diff options
| author | Reid Kleckner <rnk@google.com> | 2019-04-29 23:05:47 +0000 |
|---|---|---|
| committer | Reid Kleckner <rnk@google.com> | 2019-04-29 23:05:47 +0000 |
| commit | 1808c02c155eb562e6cc7bcc43cb04ee225cf1d5 (patch) | |
| tree | b90f3de7d039b92c40111ada0318cab601de9189 /clang/lib/CodeGen/CodeGenModule.cpp | |
| parent | 2ac6aca8af70ee4496667587df58f467f5240252 (diff) | |
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.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index e51963aa9afc..b490fa0faf2e 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); |
