llvm.org GIT mirror llvm / 3e0d3a4
This reverts commit r201625 and r201624. Since r201608 got reverted, it is not safe to use private linkage in these cases until it is committed back. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201688 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 5 years ago
3 changed file(s) with 13 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
914914 new llvm::GlobalVariable(module,
915915 stringConstant->getType(),
916916 true,
917 llvm::GlobalValue::PrivateLinkage,
917 llvm::GlobalValue::LinkerPrivateLinkage,
918918 stringConstant,
919919 "");
920920 }
958958 new llvm::GlobalVariable(module,
959959 stringConstant->getType(),
960960 true,
961 llvm::GlobalValue::PrivateLinkage,
961 llvm::GlobalValue::LinkerPrivateLinkage,
962962 stringConstant,
963963 "");
964964 }
560560 static GlobalVariable *createPrivateGlobalForString(
561561 Module &M, StringRef Str, bool AllowMerging) {
562562 Constant *StrConst = ConstantDataArray::getString(M.getContext(), Str);
563 // We use private linkage for module-local strings. If they can be merged
564 // with another one, we set the unnamed_addr attribute.
563 // For module-local strings that can be merged with another one we set the
564 // private linkage and the unnamed_addr attribute.
565 // Non-mergeable strings are made linker_private to remove them from the
566 // symbol table. "private" linkage doesn't work for Darwin, where the
567 // "L"-prefixed globals end up in __TEXT,__const section
568 // (see http://llvm.org/bugs/show_bug.cgi?id=17976 for more info).
569 GlobalValue::LinkageTypes linkage =
570 AllowMerging ? GlobalValue::PrivateLinkage
571 : GlobalValue::LinkerPrivateLinkage;
565572 GlobalVariable *GV =
566573 new GlobalVariable(M, StrConst->getType(), true,
567 GlobalValue::PrivateLinkage, StrConst, kAsanGenPrefix);
568 if (AllowMerging)
569 GV->setUnnamedAddr(true);
574 linkage, StrConst, kAsanGenPrefix);
575 if (AllowMerging) GV->setUnnamedAddr(true);
570576 GV->setAlignment(1); // Strings may not be merged w/o setting align 1.
571577 return GV;
572578 }
66 ; module ctor/dtor
77
88 ; CHECK: llvm.global_ctors
9 ; CHECK: @__asan_gen_ = private constant [8 x i8] c"\00", align 1
109 ; CHECK: llvm.global_dtors
1110
1211 ; Test that we don't instrument global arrays with static initializer