-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Driver] Add CLANG_DEFAULT_PIE_ON_LINUX to emulate GCC --enable-defau…
…lt-pie In 2015-05, GCC added the configure option `--enable-default-pie`. When enabled, * in the absence of -fno-pic/-fpie/-fpic (and their upper-case variants), -fPIE is the default. * in the absence of -no-pie/-pie/-shared/-static/-static-pie, -pie is the default. This has been adopted by all(?) major distros. I think default PIE is the majority in the Linux world, but --disable-default-pie users is not that uncommon because GCC upstream hasn't switched the default yet (https://gcc.gnu.org/PR103398). This patch add CLANG_DEFAULT_PIE_ON_LINUX which allows distros to use default PIE. The option is justified as its adoption can be very high among Linux distros to make Clang default match GCC, and is likely a future-new-default, at which point we will remove CLANG_DEFAULT_PIE_ON_LINUX. The lit feature `default-pie-on-linux` can be handy to exclude default PIE sensitive tests. Reviewed By: foutrelis, sylvestre.ledru, thesamesam Differential Revision: https://reviews.llvm.org/D113372
- Loading branch information
Showing
11 changed files
with
31 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// REQUIRES: default-pie-on-linux | ||
/// Test -DCLANG_DEFAULT_PIE_ON_LINUX=on. | ||
|
||
// RUN: %clang -### --target=aarch64-linux-gnu %s 2>&1 | FileCheck %s --check-prefix=PIE2 | ||
|
||
// PIE2: "-mrelocation-model" "pic" "-pic-level" "2" "-pic-is-pie" | ||
// PIE2: "-pie" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters