Page MenuHomePhabricator

Support CLANG_ENABLE_DEFAULT_PIE like gcc --enable-default-pie
Needs ReviewPublic

Authored by jiangyi on Apr 3 2019, 1:47 AM.



GCC 6 added the --enable-defaut-pie flag, which would provide better security with ASLR enabled.

--enable-defaut-pie is enabled by default in many linux distros such as Alpine, Arch, Debian, Fedora, Gentoo, OpenSUSE, Ubuntu...

Add a cmake option CLANG_ENABLE_DEFAULT_PIE to support the same functionality for clang.

A pre-processor macro is placed at clang/Driver/ToolChain.h to conditionally make isPIEDefault() a non-virtual function. By doing so, future subclasses of clang::driver::ToolChain will not accidentally override isPIEDefault() while not taking into account of CLANG_ENABLE_DEFAULT_PIE.

Diff Detail

rC Clang

Event Timeline

jiangyi created this revision.Apr 3 2019, 1:47 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 3 2019, 1:47 AM
E5ten added a subscriber: E5ten.Apr 3 2019, 4:43 AM

@rsmith How do you think of this patch?