From 43419a74ac2bd80f9b6215557f4e33bc074e3cb1 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 21 Nov 2014 12:19:01 +0000 Subject: [PATCH] clang: do not add -pie for tsan Revision 220571 removes the requirement to use -pie for tsan binaries. So remove -pie from driver. Also s/hasZeroBaseShadow/requiresPIE/ because that is what it is used for. Msan does not have zero-based shadow, but requires pie. And in general the relation between zero-based shadow and pie is unclear. http://reviews.llvm.org/D6318 llvm-svn: 222526 --- clang/include/clang/Driver/SanitizerArgs.h | 2 +- clang/lib/Driver/SanitizerArgs.cpp | 6 +++--- clang/lib/Driver/ToolChains.cpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/clang/include/clang/Driver/SanitizerArgs.h b/clang/include/clang/Driver/SanitizerArgs.h index 32b2e89..0b165b4 100644 --- a/clang/include/clang/Driver/SanitizerArgs.h +++ b/clang/include/clang/Driver/SanitizerArgs.h @@ -49,7 +49,7 @@ class SanitizerArgs { bool needsDfsanRt() const { return Sanitizers.has(SanitizerKind::DataFlow); } bool sanitizesVptr() const { return Sanitizers.has(SanitizerKind::Vptr); } - bool hasZeroBaseShadow() const; + bool requiresPIE() const; bool needsUnwindTables() const; bool linkCXXRuntimes() const { return LinkCXXRuntimes; } void addArgs(const llvm::opt::ArgList &Args, diff --git a/clang/lib/Driver/SanitizerArgs.cpp b/clang/lib/Driver/SanitizerArgs.cpp index 4460f9f..1e7487f 100644 --- a/clang/lib/Driver/SanitizerArgs.cpp +++ b/clang/lib/Driver/SanitizerArgs.cpp @@ -42,7 +42,7 @@ ID = ALIAS, ID##Group = 1 << SO_##ID##Group, #include "clang/Basic/Sanitizers.def" NeedsUbsanRt = Undefined | Integer, NotAllowedWithTrap = Vptr, - HasZeroBaseShadow = Thread | Memory | DataFlow, + RequiresPIE = Memory | DataFlow, NeedsUnwindTables = Address | Thread | Memory | DataFlow }; } @@ -140,8 +140,8 @@ bool SanitizerArgs::needsUbsanRt() const { return !UbsanTrapOnError && hasOneOf(Sanitizers, NeedsUbsanRt); } -bool SanitizerArgs::hasZeroBaseShadow() const { - return AsanZeroBaseShadow || hasOneOf(Sanitizers, HasZeroBaseShadow); +bool SanitizerArgs::requiresPIE() const { + return AsanZeroBaseShadow || hasOneOf(Sanitizers, RequiresPIE); } bool SanitizerArgs::needsUnwindTables() const { diff --git a/clang/lib/Driver/ToolChains.cpp b/clang/lib/Driver/ToolChains.cpp index 17ef107..10079cd 100644 --- a/clang/lib/Driver/ToolChains.cpp +++ b/clang/lib/Driver/ToolChains.cpp @@ -2507,7 +2507,7 @@ bool FreeBSD::HasNativeLLVMSupport() const { } bool FreeBSD::isPIEDefault() const { - return getSanitizerArgs().hasZeroBaseShadow(); + return getSanitizerArgs().requiresPIE(); } /// NetBSD - NetBSD tool chain which can call as(1) and ld(1) directly. @@ -3383,7 +3383,7 @@ void Linux::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs, } bool Linux::isPIEDefault() const { - return getSanitizerArgs().hasZeroBaseShadow(); + return getSanitizerArgs().requiresPIE(); } /// DragonFly - DragonFly tool chain which can call as(1) and ld(1) directly. -- 2.7.4