summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGObjCMac.cpp
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2016-09-18 16:12:14 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2016-09-18 16:12:14 +0000
commit3f307518f8bea834e7ba0fb522e990063d09cfb3 (patch)
tree58bb96b5a82d0dad24be2a2d7ee92939a55f4579 /clang/lib/CodeGen/CGObjCMac.cpp
parent0c54dc862e5c9dae681a43299126376757615cab (diff)
downloadbcm5719-llvm-3f307518f8bea834e7ba0fb522e990063d09cfb3.tar.gz
bcm5719-llvm-3f307518f8bea834e7ba0fb522e990063d09cfb3.zip
CodeGen: mark ObjC cstring literals as unnamed_addr
These are all emitted into a section with a cstring_literal attribute. The attribute permits the linker to coalesce the string contents. The address of the strings are not important. llvm-svn: 281855
Diffstat (limited to 'clang/lib/CodeGen/CGObjCMac.cpp')
-rw-r--r--clang/lib/CodeGen/CGObjCMac.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp
index e3320e9d9a8..1b435d33acc 100644
--- a/clang/lib/CodeGen/CGObjCMac.cpp
+++ b/clang/lib/CodeGen/CGObjCMac.cpp
@@ -3694,7 +3694,9 @@ CGObjCCommonMac::CreateCStringLiteral(StringRef Name, ObjCLabelType Type) {
new llvm::GlobalVariable(CGM.getModule(), Value->getType(),
/*isConstant=*/true,
llvm::GlobalValue::PrivateLinkage, Value, Label);
- GV->setSection(Section);
+ if (CGM.getTriple().isOSBinFormatMachO())
+ GV->setSection(Section);
+ GV->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global);
GV->setAlignment(CharUnits::One().getQuantity());
CGM.addCompilerUsedGlobal(GV);
OpenPOWER on IntegriCloud