summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGVTables.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2016-03-14 18:41:59 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2016-03-14 18:41:59 +0000
commit0446e7cfae9fb33c367dceaac17fe40391f21e7c (patch)
treecd0ca40fadb25fc5bac00fa2814314494e1ff8c0 /clang/lib/CodeGen/CGVTables.cpp
parentb7860fedd45a197215b5ce27ece92502f0fa4c98 (diff)
downloadbcm5719-llvm-0446e7cfae9fb33c367dceaac17fe40391f21e7c.tar.gz
bcm5719-llvm-0446e7cfae9fb33c367dceaac17fe40391f21e7c.zip
CodeGen: Mark functions used in vtables as unnamed_addr.
This marks virtual function declarations, as well as runtime library functions __cxa_pure_virtual, __cxa_deleted_virtual and _purecall, as unnamed_addr. This will allow us to correctly form relative references to them from vtables in the relative vtable ABI. Differential Revision: http://reviews.llvm.org/D18071 llvm-svn: 263464
Diffstat (limited to 'clang/lib/CodeGen/CGVTables.cpp')
-rw-r--r--clang/lib/CodeGen/CGVTables.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGVTables.cpp b/clang/lib/CodeGen/CGVTables.cpp
index 953053bd1c3..f139e2c8504 100644
--- a/clang/lib/CodeGen/CGVTables.cpp
+++ b/clang/lib/CodeGen/CGVTables.cpp
@@ -607,6 +607,8 @@ llvm::Constant *CodeGenVTables::CreateVTableInitializer(
llvm::FunctionType::get(CGM.VoidTy, /*isVarArg=*/false);
StringRef PureCallName = CGM.getCXXABI().GetPureVirtualCallName();
PureVirtualFn = CGM.CreateRuntimeFunction(Ty, PureCallName);
+ if (auto *F = dyn_cast<llvm::Function>(PureVirtualFn))
+ F->setUnnamedAddr(true);
PureVirtualFn = llvm::ConstantExpr::getBitCast(PureVirtualFn,
CGM.Int8PtrTy);
}
@@ -618,6 +620,8 @@ llvm::Constant *CodeGenVTables::CreateVTableInitializer(
StringRef DeletedCallName =
CGM.getCXXABI().GetDeletedVirtualCallName();
DeletedVirtualFn = CGM.CreateRuntimeFunction(Ty, DeletedCallName);
+ if (auto *F = dyn_cast<llvm::Function>(DeletedVirtualFn))
+ F->setUnnamedAddr(true);
DeletedVirtualFn = llvm::ConstantExpr::getBitCast(DeletedVirtualFn,
CGM.Int8PtrTy);
}
OpenPOWER on IntegriCloud