diff options
author | Saleem Abdulrasool <compnerd@compnerd.org> | 2018-01-23 19:35:51 +0000 |
---|---|---|
committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2018-01-23 19:35:51 +0000 |
commit | be2b5cbf5e9403c4d12bd768f15d14193b6530ae (patch) | |
tree | 5bb16e8ace031782aeb5aaafc73444df507ad275 /clang/lib/CodeGen/CGObjCMac.cpp | |
parent | 6719e2418c1d8fc20a6a6b6a0540281736b591d6 (diff) | |
download | bcm5719-llvm-be2b5cbf5e9403c4d12bd768f15d14193b6530ae.tar.gz bcm5719-llvm-be2b5cbf5e9403c4d12bd768f15d14193b6530ae.zip |
CodeGen: use `llvm.used` for ObjC protocols
These symbols are supposed to be preserved even by the linker. Use the
`llvm.used` to ensure that the symbols are not removed by DCE in the
linker. This should be a no-op change on MachO since the symbols are
annotated as `no_dead_strip`.
llvm-svn: 323247
Diffstat (limited to 'clang/lib/CodeGen/CGObjCMac.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGObjCMac.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp index 37ba33dfd97..4060b7196bd 100644 --- a/clang/lib/CodeGen/CGObjCMac.cpp +++ b/clang/lib/CodeGen/CGObjCMac.cpp @@ -6399,7 +6399,7 @@ llvm::Value *CGObjCNonFragileABIMac::GenerateProtocolRef(CodeGenFunction &CGF, PTGV->setAlignment(Align.getQuantity()); if (!CGM.getTriple().isOSBinFormatMachO()) PTGV->setComdat(CGM.getModule().getOrInsertComdat(ProtocolName)); - CGM.addCompilerUsedGlobal(PTGV); + CGM.addUsedGlobal(PTGV); return CGF.Builder.CreateAlignedLoad(PTGV, Align); } @@ -6843,7 +6843,7 @@ llvm::Constant *CGObjCNonFragileABIMac::GetOrEmitProtocol( Protocols[PD->getIdentifier()] = Entry; } Entry->setVisibility(llvm::GlobalValue::HiddenVisibility); - CGM.addCompilerUsedGlobal(Entry); + CGM.addUsedGlobal(Entry); // Use this protocol meta-data to build protocol list table in section // __DATA, __objc_protolist @@ -6862,7 +6862,7 @@ llvm::Constant *CGObjCNonFragileABIMac::GetOrEmitProtocol( PTGV->setSection(GetSectionName("__objc_protolist", "coalesced,no_dead_strip")); PTGV->setVisibility(llvm::GlobalValue::HiddenVisibility); - CGM.addCompilerUsedGlobal(PTGV); + CGM.addUsedGlobal(PTGV); return Entry; } |