summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2012-12-05 12:49:41 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2012-12-05 12:49:41 +0000
commit474cb3b3b5e9ac5d32954e802795fc66091bebd7 (patch)
tree734341a418754fd70ace5debe82c17e21bc55318
parentc446aa039a8c73ef3d0d5b7923dc94279a986990 (diff)
downloadbcm5719-llvm-474cb3b3b5e9ac5d32954e802795fc66091bebd7.tar.gz
bcm5719-llvm-474cb3b3b5e9ac5d32954e802795fc66091bebd7.zip
[msan] Change linkage type of __msan_track_origins.
LinkOnceODRLinkage globals may be removed in GlobalOpt if not used in the current module. llvm-svn: 169377
-rw-r--r--llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp2
-rw-r--r--llvm/test/Instrumentation/MemorySanitizer/msan_basic.ll3
2 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
index 81cbb07831c..4680994c326 100644
--- a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -244,7 +244,7 @@ bool MemorySanitizer::doInitialization(Module &M) {
appendToGlobalCtors(M, cast<Function>(M.getOrInsertFunction(
"__msan_init", IRB.getVoidTy(), NULL)), 0);
- new GlobalVariable(M, IRB.getInt32Ty(), true, GlobalValue::LinkOnceODRLinkage,
+ new GlobalVariable(M, IRB.getInt32Ty(), true, GlobalValue::WeakODRLinkage,
IRB.getInt32(ClTrackOrigins), "__msan_track_origins");
// Create the callback.
diff --git a/llvm/test/Instrumentation/MemorySanitizer/msan_basic.ll b/llvm/test/Instrumentation/MemorySanitizer/msan_basic.ll
index acad4ba6bb0..05cdaa7d6f3 100644
--- a/llvm/test/Instrumentation/MemorySanitizer/msan_basic.ll
+++ b/llvm/test/Instrumentation/MemorySanitizer/msan_basic.ll
@@ -4,6 +4,9 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
; Check the presence of __msan_init
; CHECK: @llvm.global_ctors {{.*}} @__msan_init
+; Check the presence and the linkage type of __msan_track_origins
+; CHECK: @__msan_track_origins = weak_odr constant i32 0
+
; load followed by cmp: check that we load the shadow and call __msan_warning.
define void @LoadAndCmp(i32* nocapture %a) nounwind uwtable {
entry:
OpenPOWER on IntegriCloud