[LTO] Handle __imp_ (dllimport) symbols consistently with lld
authorTeresa Johnson <tejohnson@google.com>
Mon, 23 Jul 2018 22:33:57 +0000 (22:33 +0000)
committerTeresa Johnson <tejohnson@google.com>
Mon, 23 Jul 2018 22:33:57 +0000 (22:33 +0000)
commitb963c0b658cc54b370832df4f5a3d63fd69da334
treeb4d12f19720226fff7e8b17566b022470b7f7710
parentfc3d72eeea942e71a4dc5174e925a5e7d52a7e5a
[LTO] Handle __imp_ (dllimport) symbols consistently with lld

Summary:
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.

Fixes PR38105.

Reviewers: pcc

Subscribers: mehdi_amini, inglorion, steven_wu, dexonsmith, llvm-commits

Differential Revision: https://reviews.llvm.org/D49138

llvm-svn: 337762
llvm/lib/LTO/LTO.cpp
llvm/test/LTO/X86/Inputs/dllimport.ll [new file with mode: 0644]
llvm/test/LTO/X86/dllimport.ll [new file with mode: 0644]