This is an archive of the discontinued LLVM Phabricator instance.

[LLD] [COFF] Don't export symbols that have corresponding __imp_ symbols
ClosedPublic

Authored by mstorsjo on Nov 28 2017, 6:04 AM.

Details

Summary

GNU ld has got an exception for such symbols, and mingw-w64 occasionally uses that exception to avoid exporting symbols in cases where they otherwise aren't caught by the other exclusion mechanisms.

Diff Detail

Event Timeline

mstorsjo created this revision.Nov 28 2017, 6:04 AM
ruiu added inline comments.Nov 28 2017, 2:01 PM
COFF/MinGW.cpp
103–109

nit: add a blank line before each comment.

105–108

Don't you have to handle the i386 name mangling which is ___imp_ (triple underscores)?

mstorsjo added inline comments.Nov 28 2017, 2:04 PM
COFF/MinGW.cpp
103–109

Ok, will do.

105–108

No, the __imp_ prefix is added before the actual symbol name. The function foo which for cdecl gets mangled into _foo has the corresponding __imp__foo (while it'd be __imp_foo for x86_64), so here it works out automatically.

ruiu accepted this revision.Nov 28 2017, 2:05 PM

LGTM

This revision is now accepted and ready to land.Nov 28 2017, 2:05 PM
This revision was automatically updated to reflect the committed changes.