summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorKarl-Johan Karlsson <karl-johan.karlsson@ericsson.com>2019-10-30 07:45:39 +0100
committerKarl-Johan Karlsson <karl-johan.karlsson@ericsson.com>2019-10-30 09:32:19 +0100
commit760ed8da98e3c4cd80e92bbdcc78c181f36f71d4 (patch)
tree56d4113da037f37fe623bcf4643689227727d7bf /llvm/lib/Transforms
parentf15cf93899df3e8863207b40c3900facb0ccc356 (diff)
downloadbcm5719-llvm-760ed8da98e3c4cd80e92bbdcc78c181f36f71d4.tar.gz
bcm5719-llvm-760ed8da98e3c4cd80e92bbdcc78c181f36f71d4.zip
[AddressSanitizer] Only instrument globals of default address space
The address sanitizer ignore memory accesses from different address spaces, however when instrumenting globals the check for different address spaces is missing. This result in assertion failure. The fault was found in an out of tree target. The patch skip all globals of non default address space. Reviewed By: leonardchan, vitalybuka Differential Revision: https://reviews.llvm.org/D68790
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
index d92ee11c2e1..554def59af1 100644
--- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -1808,6 +1808,8 @@ bool ModuleAddressSanitizer::ShouldInstrumentGlobal(GlobalVariable *G) {
if (GlobalsMD.get(G).IsBlacklisted) return false;
if (!Ty->isSized()) return false;
if (!G->hasInitializer()) return false;
+ // Only instrument globals of default address spaces
+ if (G->getAddressSpace()) return false;
if (GlobalWasGeneratedByCompiler(G)) return false; // Our own globals.
// Two problems with thread-locals:
// - The address of the main thread's copy can't be computed at link-time.
OpenPOWER on IntegriCloud