[PATCH] D49138: [LTO] Handle __imp_ (dllimport) symbols consistently with lld
Teresa Johnson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 10 08:56:30 PDT 2018
tejohnson created this revision.
tejohnson added a reviewer: pcc.
Herald added subscribers: dexonsmith, steven_wu, inglorion, mehdi_amini.
Similar to what lld already does for dllimport symbols which are
prefaced with __imp_ (see lld patch r240620), strip off the __imp_
prefix in LTO. Otherwise we can get 2 separate GlobalResolution for
a single symbol, the dllimport declaration, and the definition, which
leads to incorrect LTO handling.
Tests coming in separate tools/lld patch.
Fixes PR38105.
Repository:
rL LLVM
https://reviews.llvm.org/D49138
Files:
lib/LTO/LTO.cpp
Index: lib/LTO/LTO.cpp
===================================================================
--- lib/LTO/LTO.cpp
+++ lib/LTO/LTO.cpp
@@ -428,7 +428,10 @@
assert(ResI != ResE);
SymbolResolution Res = *ResI++;
- auto &GlobalRes = GlobalResolutions[Sym.getName()];
+ StringRef Name = Sym.getName();
+ if (Name.startswith("__imp_"))
+ Name = Name.substr(strlen("__imp_"));
+ auto &GlobalRes = GlobalResolutions[Name];
GlobalRes.UnnamedAddr &= Sym.isUnnamedAddr();
if (Res.Prevailing) {
assert(!GlobalRes.Prevailing &&
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49138.154819.patch
Type: text/x-patch
Size: 558 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180710/47696dab/attachment.bin>
More information about the llvm-commits
mailing list