This is an archive of the discontinued LLVM Phabricator instance.

[LLD] [COFF] Allow specifying export forwarding in a def file
ClosedPublic

Authored by mstorsjo on Apr 30 2018, 12:40 AM.

Diff Detail

Event Timeline

mstorsjo created this revision.Apr 30 2018, 12:40 AM
ruiu added a comment.May 4 2018, 3:08 PM

Is this a feature supported by the MS linker?

Is this a feature supported by the MS linker?

Yes, link.exe supports this.

ruiu added inline comments.May 5 2018, 9:56 AM
COFF/Driver.cpp
631

Can you add a comment?

mstorsjo added inline comments.May 5 2018, 10:54 AM
COFF/Driver.cpp
631

Sure - I can add one like this:

In simple cases, only Name is set. Renamed exports are parsed and set as "ExtName = Name". If Name has the form "OtherDll.Func", it shouldn't be a normal exported function but a forward to another DLL instead.

ruiu added inline comments.May 5 2018, 12:06 PM
COFF/Driver.cpp
631

Sounds good! I'd also mention that this is a MS linker feature.

mstorsjo updated this revision to Diff 145380.May 5 2018, 12:50 PM

Added the requested comment.

mstorsjo added inline comments.May 5 2018, 12:54 PM
COFF/Driver.cpp
631

It's not only a MS linker feature, GNU ld.bfd also supports the same, so I didn't add this comment.

I started poking all this when I wanted to fix the misconception as I'm fixing in D46245, which all boiled down to the comment "// GNU dlltool accepts both = and ==." The thing is that GNU tools do support both = and ==, but they're two completely different things, while the = case is the exact same as in link.exe. Due to this misunderstanding, we've been overloading the same concept with different behaviours between MinGW and MSVC cases, even though it's actually much less messy.

Ping, anything else on this one?

ruiu added inline comments.May 7 2018, 2:35 PM
COFF/Driver.cpp
631

By MS feature, I meant I'd make it clear that this is not MinGW-only feature. I'd think this is valuable information to add, as we've added a few MinGW-specific rules.

mstorsjo updated this revision to Diff 145630.May 7 2018, 9:38 PM

Extended the comment as requested, mentioning that it's supported by both MS and GNU.

ruiu accepted this revision.May 9 2018, 9:43 AM

LGTM

This revision is now accepted and ready to land.May 9 2018, 9:43 AM
This revision was automatically updated to reflect the committed changes.