diff options
author | Reid Kleckner <rnk@google.com> | 2017-10-31 16:16:08 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2017-10-31 16:16:08 +0000 |
commit | c212cc88e2b61d197d9a60acbc116c52d3555101 (patch) | |
tree | 36bb8f8ec57d2888e60a1f8d8dd81065b363f3b6 /llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp | |
parent | 68821a8b9157905ed81b540a79087396400dddb2 (diff) | |
download | bcm5719-llvm-c212cc88e2b61d197d9a60acbc116c52d3555101.tar.gz bcm5719-llvm-c212cc88e2b61d197d9a60acbc116c52d3555101.zip |
[asan] Upgrade private linkage globals to internal linkage on COFF
COFF comdats require symbol table entries, which means the comdat leader
cannot have private linkage.
llvm-svn: 317009
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp')
-rw-r--r-- | llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp index 81ad5b477e0..3d500077b7a 100644 --- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp @@ -1764,9 +1764,14 @@ void AddressSanitizerModule::SetComdatForGlobalMetadata( C = M.getOrInsertComdat(G->getName()); } - // Make this IMAGE_COMDAT_SELECT_NODUPLICATES on COFF. - if (TargetTriple.isOSBinFormatCOFF()) + // Make this IMAGE_COMDAT_SELECT_NODUPLICATES on COFF. Also upgrade private + // linkage to internal linkage so that a symbol table entry is emitted. This + // is necessary in order to create the comdat group. + if (TargetTriple.isOSBinFormatCOFF()) { C->setSelectionKind(Comdat::NoDuplicates); + if (G->hasPrivateLinkage()) + G->setLinkage(GlobalValue::InternalLinkage); + } G->setComdat(C); } |