forked from OSchip/llvm-project
[ASan] Fix the test for __asan_gen_ globals and actually fix http://llvm.org/bugs/show_bug.cgi?id=17976
by setting the correct linkage (as stated in the bug). llvm-svn: 198018
This commit is contained in:
parent
daf96ae81b
commit
4f0335f863
|
@ -1,7 +1,8 @@
|
|||
// Make sure __asan_gen_* strings do not end up in the symbol table.
|
||||
|
||||
// RUN: %clang_asan %s -o %t.exe
|
||||
// RUN: nm %t.exe | grep __asan_gen_ || exit 0
|
||||
// RUN: nm %t.exe | FileCheck %s
|
||||
|
||||
int x, y, z;
|
||||
int main() { return 0; }
|
||||
// CHECK-NOT: __asan_gen_
|
||||
|
|
|
@ -562,13 +562,13 @@ static GlobalVariable *createPrivateGlobalForString(
|
|||
Module &M, StringRef Str, bool AllowMerging) {
|
||||
Constant *StrConst = ConstantDataArray::getString(M.getContext(), Str);
|
||||
// For module-local strings that can be merged with another one we set the
|
||||
// internal linkage and the unnamed_addr attribute.
|
||||
// private linkage and the unnamed_addr attribute.
|
||||
// Non-mergeable strings are made linker_private to remove them from the
|
||||
// symbol table. "private" linkage doesn't work for Darwin, where the
|
||||
// "L"-prefixed globals end up in __TEXT,__const section
|
||||
// (see http://llvm.org/bugs/show_bug.cgi?id=17976 for more info).
|
||||
GlobalValue::LinkageTypes linkage =
|
||||
AllowMerging ? GlobalValue::InternalLinkage
|
||||
AllowMerging ? GlobalValue::PrivateLinkage
|
||||
: GlobalValue::LinkerPrivateLinkage;
|
||||
GlobalVariable *GV =
|
||||
new GlobalVariable(M, StrConst->getType(), true,
|
||||
|
|
Loading…
Reference in New Issue