This is an archive of the discontinued LLVM Phabricator instance.

Object: Prepend __imp_ when mangling a dllimport symbol in IRObjectFile.
ClosedPublic

Authored by pcc on Jun 11 2015, 1:29 PM.

Details

Summary

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.

Diff Detail

Repository
rL LLVM

Event Timeline

pcc updated this revision to Diff 27540.Jun 11 2015, 1:29 PM
pcc retitled this revision from to Object: Prepend __imp_ when mangling a dllimport symbol in IRObjectFile..
pcc updated this object.
pcc edited the test plan for this revision. (Show Details)
pcc added a reviewer: rnk.
pcc added subscribers: rafael, Unknown Object (MLST).
rnk accepted this revision.Jun 11 2015, 2:34 PM
rnk edited edge metadata.

lgtm

This revision is now accepted and ready to land.Jun 11 2015, 2:34 PM
This revision was automatically updated to reflect the committed changes.