summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2019-04-29 23:05:47 +0000
committerReid Kleckner <rnk@google.com>2019-04-29 23:05:47 +0000
commit1808c02c155eb562e6cc7bcc43cb04ee225cf1d5 (patch)
treeb90f3de7d039b92c40111ada0318cab601de9189 /clang/lib/CodeGen/CodeGenModule.cpp
parent2ac6aca8af70ee4496667587df58f467f5240252 (diff)
downloadbcm5719-llvm-1808c02c155eb562e6cc7bcc43cb04ee225cf1d5.tar.gz
bcm5719-llvm-1808c02c155eb562e6cc7bcc43cb04ee225cf1d5.zip
Re-land r359250, [COFF] Statically link certain runtime library functions
Reverts the revert of r359251, this time with fixed tests. Differential Revision: https://reviews.llvm.org/D55229 llvm-svn: 359513
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index e51963aa9af..b490fa0faf2 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -3000,9 +3000,13 @@ CodeGenModule::CreateRuntimeFunction(llvm::FunctionType *FTy, StringRef Name,
if (F->empty()) {
F->setCallingConv(getRuntimeCC());
- if (!Local && getTriple().isOSBinFormatCOFF() &&
- !getCodeGenOpts().LTOVisibilityPublicStd &&
- !getTriple().isWindowsGNUEnvironment()) {
+ // In Windows Itanium environments, try to mark runtime functions
+ // dllimport. For Mingw and MSVC, don't. We don't really know if the user
+ // will link their standard library statically or dynamically. Marking
+ // functions imported when they are not imported can cause linker errors
+ // and warnings.
+ if (!Local && getTriple().isWindowsItaniumEnvironment() &&
+ !getCodeGenOpts().LTOVisibilityPublicStd) {
const FunctionDecl *FD = GetRuntimeFunctionDecl(Context, Name);
if (!FD || FD->hasAttr<DLLImportAttr>()) {
F->setDLLStorageClass(llvm::GlobalValue::DLLImportStorageClass);
OpenPOWER on IntegriCloud