summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/ItaniumCXXABI.cpp
diff options
context:
space:
mode:
authorDerek Schuff <dschuff@google.com>2015-05-08 16:47:21 +0000
committerDerek Schuff <dschuff@google.com>2015-05-08 16:47:21 +0000
commit2312bd38114c932374f37aa4fe6c8fefc763dbfb (patch)
treea35e7f252d2bda095536bdf987bbaadc0188809c /clang/lib/CodeGen/ItaniumCXXABI.cpp
parent049887b252f7f7cca78ade06f03075f0df8d247c (diff)
downloadbcm5719-llvm-2312bd38114c932374f37aa4fe6c8fefc763dbfb.tar.gz
bcm5719-llvm-2312bd38114c932374f37aa4fe6c8fefc763dbfb.zip
Do not emit thunks with available_externally linkage in comdats
Functions with available_externally linkage will not be emitted to object files (they will just be undefined symbols), so it does not make sense to put them in comdats. Creates a second overload of maybeSetTrivialComdat that uses the GlobalObject instead of the Decl, and uses that in several places that had the faulty logic. Differential Revision: http://reviews.llvm.org/D9580 llvm-svn: 236879
Diffstat (limited to 'clang/lib/CodeGen/ItaniumCXXABI.cpp')
-rw-r--r--clang/lib/CodeGen/ItaniumCXXABI.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/clang/lib/CodeGen/ItaniumCXXABI.cpp b/clang/lib/CodeGen/ItaniumCXXABI.cpp
index e8c28c1265d..58786fe2ce0 100644
--- a/clang/lib/CodeGen/ItaniumCXXABI.cpp
+++ b/clang/lib/CodeGen/ItaniumCXXABI.cpp
@@ -1328,8 +1328,7 @@ void ItaniumCXXABI::emitVTableDefinitions(CodeGenVTables &CGVT,
// Set the correct linkage.
VTable->setLinkage(Linkage);
- if (CGM.supportsCOMDAT() && VTable->isWeakForLinker())
- VTable->setComdat(CGM.getModule().getOrInsertComdat(VTable->getName()));
+ CGM.maybeSetTrivialComdat(*VTable);
// Set the right visibility.
CGM.setGlobalVisibility(VTable, RD);
@@ -1796,8 +1795,8 @@ void ItaniumCXXABI::EmitGuardedInit(CodeGenFunction &CGF,
if (!D.isLocalVarDecl() && C) {
guard->setComdat(C);
CGF.CurFn->setComdat(C);
- } else if (CGM.supportsCOMDAT() && guard->isWeakForLinker()) {
- guard->setComdat(CGM.getModule().getOrInsertComdat(guard->getName()));
+ } else {
+ CGM.maybeSetTrivialComdat(*guard);
}
CGM.setStaticLocalDeclGuardAddress(&D, guard);
@@ -2803,8 +2802,7 @@ llvm::Constant *ItaniumRTTIBuilder::BuildTypeInfo(QualType Ty, bool Force) {
new llvm::GlobalVariable(M, Init->getType(),
/*Constant=*/true, Linkage, Init, Name);
- if (CGM.supportsCOMDAT() && GV->isWeakForLinker())
- GV->setComdat(M.getOrInsertComdat(GV->getName()));
+ CGM.maybeSetTrivialComdat(*GV);
// If there's already an old global variable, replace it with the new one.
if (OldGV) {
@@ -3598,8 +3596,7 @@ static llvm::Constant *getClangCallTerminateFn(CodeGenModule &CGM) {
// we don't want it to turn into an exported symbol.
fn->setLinkage(llvm::Function::LinkOnceODRLinkage);
fn->setVisibility(llvm::Function::HiddenVisibility);
- if (CGM.supportsCOMDAT())
- fn->setComdat(CGM.getModule().getOrInsertComdat(fn->getName()));
+ CGM.maybeSetTrivialComdat(*fn);
// Set up the function.
llvm::BasicBlock *entry =
OpenPOWER on IntegriCloud