diff options
author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2017-05-09 21:57:43 +0000 |
---|---|---|
committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2017-05-09 21:57:43 +0000 |
commit | d991cdd50bea4bca96336303a68348332b50b39d (patch) | |
tree | 43571c2a525b83c344973ac5dace8679a7d34bd8 /clang/lib/CodeGen/BackendUtil.cpp | |
parent | b86ca11b577e813032747147f1975448bc440ec1 (diff) | |
download | llvm-d991cdd50bea4bca96336303a68348332b50b39d.zip llvm-d991cdd50bea4bca96336303a68348332b50b39d.tar.gz llvm-d991cdd50bea4bca96336303a68348332b50b39d.tar.bz2 |
[asan] A clang flag to enable ELF globals-gc.
This feature is subtly broken when the linker is gold 2.26 or
earlier. See the following bug for details:
https://sourceware.org/bugzilla/show_bug.cgi?id=19002
Since the decision needs to be made at compilation time, we can not
test the linker version. The flag is off by default on ELF targets,
and on otherwise.
llvm-svn: 302591
Diffstat (limited to 'clang/lib/CodeGen/BackendUtil.cpp')
-rw-r--r-- | clang/lib/CodeGen/BackendUtil.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp index 0d96f2e..51c21c9 100644 --- a/clang/lib/CodeGen/BackendUtil.cpp +++ b/clang/lib/CodeGen/BackendUtil.cpp @@ -194,6 +194,8 @@ static void addSanitizerCoveragePass(const PassManagerBuilder &Builder, // where this is not a factor). Also, on ELF this feature requires an assembler // extension that only works with -integrated-as at the moment. static bool asanUseGlobalsGC(const Triple &T, const CodeGenOptions &CGOpts) { + if (!CGOpts.SanitizeAddressGlobalsDeadStripping) + return false; switch (T.getObjectFormat()) { case Triple::MachO: case Triple::COFF: |