aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMatthew Voss <matthew.voss@sony.com>2018-12-19 19:07:45 +0000
committerMatthew Voss <matthew.voss@sony.com>2018-12-19 19:07:45 +0000
commitdc8dd58c4c4701911679755721b33843142f1b63 (patch)
tree9b423da3fa09ffb85140f8835b4394ddc3f58424 /lib
parent39d65885534a298794339fb1c72b9cd082e41a6d (diff)
downloadllvm-dc8dd58c4c4701911679755721b33843142f1b63.tar.gz
[ThinLTO] Remove dllimport attribute from locally defined symbols
Summary: The LTO/ThinLTO driver currently creates invalid bitcode by setting symbols marked dllimport as dso_local. The compiler often has access to the definition (often dllexport) and the declaration (often dllimport) of an object at link-time, leading to a conflicting declaration. This patch resolves the inconsistency by removing the dllimport attribute. Reviewers: tejohnson, pcc, rnk, echristo Reviewed By: rnk Subscribers: dmikulin, wristow, mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, dang, llvm-commits Differential Revision: https://reviews.llvm.org/D55627 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349667 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/LTO/LTO.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/LTO/LTO.cpp b/lib/LTO/LTO.cpp
index 08924fb92dd..f736ef8b7f9 100644
--- a/lib/LTO/LTO.cpp
+++ b/lib/LTO/LTO.cpp
@@ -693,8 +693,12 @@ LTO::addRegularLTO(BitcodeModule BM, ArrayRef<InputFile::Symbol> Syms,
}
// Set the 'local' flag based on the linker resolution for this symbol.
- if (Res.FinalDefinitionInLinkageUnit)
+ if (Res.FinalDefinitionInLinkageUnit) {
GV->setDSOLocal(true);
+ if (GV->hasDLLImportStorageClass())
+ GV->setDLLStorageClass(GlobalValue::DLLStorageClassTypes::
+ DefaultStorageClass);
+ }
}
// Common resolution: collect the maximum size/alignment over all commons.
// We also record if we see an instance of a common as prevailing, so that