From: Evgeniy Stepanov Date: Wed, 21 Oct 2015 20:20:03 +0000 (+0000) Subject: MemorySanitizer does not require PIE. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b7257774a584cd48fc3fdb74617754ce1f65bf3a;p=clang MemorySanitizer does not require PIE. Since r249754 MemorySanitizer should work equally well for PIE and non-PIE executables. Beware, with this change -fsanitize=memory no longer adds implicit -fPIE -pie compiler/linker flags, unless the target defaults to PIE. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250941 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/SanitizerArgs.cpp b/lib/Driver/SanitizerArgs.cpp index 8c417ef432..e939ec3b6f 100644 --- a/lib/Driver/SanitizerArgs.cpp +++ b/lib/Driver/SanitizerArgs.cpp @@ -29,7 +29,7 @@ enum : SanitizerMask { NeedsUbsanRt = Undefined | Integer | CFI, NeedsUbsanCxxRt = Vptr | CFI, NotAllowedWithTrap = Vptr, - RequiresPIE = Memory | DataFlow, + RequiresPIE = DataFlow, NeedsUnwindTables = Address | Thread | Memory | DataFlow, SupportsCoverage = Address | Memory | Leak | Undefined | Integer | DataFlow, RecoverableByDefault = Undefined | Integer, diff --git a/test/Driver/fsanitize.c b/test/Driver/fsanitize.c index b9e525239d..606c0bd758 100644 --- a/test/Driver/fsanitize.c +++ b/test/Driver/fsanitize.c @@ -146,8 +146,9 @@ // CHECK-TSAN-NO-PIE: "-mrelocation-model" "static" // RUN: %clang -target x86_64-linux-gnu -fsanitize=memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MSAN-NO-PIE -// CHECK-MSAN-NO-PIE: "-mrelocation-model" "pic" "-pic-level" "2" "-pie-level" "2" -// CHECK-MSAN-NO-PIE: "-pie" +// CHECK-MSAN-NO-PIE-NOT: "-pie" +// CHECK-MSAN-NO-PIE: "-mrelocation-model" "static" +// CHECK-MSAN-NO-PIE-NOT: "-pie" // RUN: %clang -target arm-linux-androideabi -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ANDROID-ASAN-NO-PIE // CHECK-ANDROID-ASAN-NO-PIE: "-mrelocation-model" "pic" "-pic-level" "2" "-pie-level" "2"