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)
commit82e657b509b33611620076ab8065cb485b54c348
tree989fe170397732716a20469e7b64b2036027f1c0
parent485ad4860e7b26200a25c7fc593828d91b0520cf
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

llvm-svn: 239560
llvm/lib/Object/IRObjectFile.cpp
llvm/test/CodeGen/X86/dllimport.ll
llvm/test/Object/dllimport.ll [new file with mode: 0644]