Object: Prepend __imp_ when mangling a dllimport symbol in IRObjectFile.
authorPeter Collingbourne <peter@pcc.me.uk>
Thu, 11 Jun 2015 21:42:18 +0000 (21:42 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Thu, 11 Jun 2015 21:42:18 +0000 (21:42 +0000)
commit6170134a1fb0af16d0681f90b6cc4f07f979ee3c
tree26c8540c817e0801e618147131b09d2b2e561f6b
parent6f69f4074fdc5b464b32134d6be96a67a9c1376e
Object: Prepend __imp_ when mangling a dllimport symbol in IRObjectFile.

We cannot prepend __imp_ in the IR mangler because a function reference may
be emitted unmangled in a constant initializer. The linker is expected to
resolve such references to thunks. This is covered by the new test case.

Strictly speaking we ought to emit two undefined symbols, one with __imp_ and
one without, as we cannot know which symbol the final object file will refer
to. However, this would require rather intrusive changes to IRObjectFile,
and lld works fine without it for now.

This reimplements r239437, which was reverted in r239502.

Differential Revision: http://reviews.llvm.org/D10400

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239560 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Object/IRObjectFile.cpp
test/CodeGen/X86/dllimport.ll
test/Object/dllimport.ll [new file with mode: 0644]