summaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/ItaniumCXXABI.cpp
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2016-12-15 06:59:05 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2016-12-15 06:59:05 +0000
commite13e0e403d22d8abc1105a3ae841eb64de64526e (patch)
treeafe808a9e158b75a0e90b8e15c45cdfc27778895 /lib/CodeGen/ItaniumCXXABI.cpp
parent676b68f0681fa4bc129cc6d99d09956d5189e6c1 (diff)
CodeGen: fix runtime function dll storage
Properly attribute DLL storage to runtime functions. When generating the runtime function, scan for an existing declaration which may provide an explicit declaration (local storage) or a DLL import or export storage from the user. Honour that if available. Otherwise, if building with a local visibility of the public or standard namespaces (-flto-visibility-public-std), give the symbols local storage (it indicates a /MT[d] link, so static runtime). Otherwise, assume that the link is dynamic, and give the runtime function dllimport storage. This allows for implementations to get the correct storage as long as they are properly declared, the user to override the import storage, and in case no explicit storage is given, use of the import storage. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289776 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/ItaniumCXXABI.cpp')
-rw-r--r--lib/CodeGen/ItaniumCXXABI.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/CodeGen/ItaniumCXXABI.cpp b/lib/CodeGen/ItaniumCXXABI.cpp
index 963b1403f5..26c486af12 100644
--- a/lib/CodeGen/ItaniumCXXABI.cpp
+++ b/lib/CodeGen/ItaniumCXXABI.cpp
@@ -3899,7 +3899,8 @@ static llvm::Constant *getClangCallTerminateFn(CodeGenModule &CGM) {
llvm::FunctionType *fnTy =
llvm::FunctionType::get(CGM.VoidTy, CGM.Int8PtrTy, /*IsVarArgs=*/false);
llvm::Constant *fnRef =
- CGM.CreateRuntimeFunction(fnTy, "__clang_call_terminate");
+ CGM.CreateRuntimeFunction(fnTy, "__clang_call_terminate",
+ llvm::AttributeSet(), /*Local=*/true);
llvm::Function *fn = dyn_cast<llvm::Function>(fnRef);
if (fn && fn->empty()) {