diff options
author | Saleem Abdulrasool <compnerd@compnerd.org> | 2017-06-29 00:54:44 +0000 |
---|---|---|
committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2017-06-29 00:54:44 +0000 |
commit | 9f83f3b2511d6b7b396d9f98a7cda4dab4d42a34 (patch) | |
tree | c1a143fb79830cead84d2c9d62908fbc082bace5 /clang/lib/CodeGen/CGObjCMac.cpp | |
parent | 2af2fd5f76cc57ac9a42338a889d669bb67dd01c (diff) | |
download | bcm5719-llvm-9f83f3b2511d6b7b396d9f98a7cda4dab4d42a34.tar.gz bcm5719-llvm-9f83f3b2511d6b7b396d9f98a7cda4dab4d42a34.zip |
CodeGen: handle missed case of COMDAT handling
When Protocol references are constructed, we need to add the reference
symbol to a COMDAT group on non-MachO object file formats (MachO handles
this by having a coalesced attribute). This adds the missing case.
llvm-svn: 306622
Diffstat (limited to 'clang/lib/CodeGen/CGObjCMac.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGObjCMac.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp index 7976c53d9e9..224d2d6606a 100644 --- a/clang/lib/CodeGen/CGObjCMac.cpp +++ b/clang/lib/CodeGen/CGObjCMac.cpp @@ -6381,16 +6381,15 @@ llvm::Value *CGObjCNonFragileABIMac::GenerateProtocolRef(CodeGenFunction &CGF, llvm::GlobalVariable *PTGV = CGM.getModule().getGlobalVariable(ProtocolName); if (PTGV) return CGF.Builder.CreateAlignedLoad(PTGV, Align); - PTGV = new llvm::GlobalVariable( - CGM.getModule(), - Init->getType(), false, - llvm::GlobalValue::WeakAnyLinkage, - Init, - ProtocolName); + PTGV = new llvm::GlobalVariable(CGM.getModule(), Init->getType(), false, + llvm::GlobalValue::WeakAnyLinkage, Init, + ProtocolName); PTGV->setSection(GetSectionName("__objc_protorefs", "coalesced,no_dead_strip")); PTGV->setVisibility(llvm::GlobalValue::HiddenVisibility); PTGV->setAlignment(Align.getQuantity()); + if (!CGM.getTriple().isOSBinFormatMachO()) + PTGV->setComdat(CGM.getModule().getOrInsertComdat(ProtocolName)); CGM.addCompilerUsedGlobal(PTGV); return CGF.Builder.CreateAlignedLoad(PTGV, Align); } |