This is an archive of the discontinued LLVM Phabricator instance.

[LLD] [COFF] Keep the underscore on exported decorated stdcall functions
ClosedPublic

Authored by mstorsjo on Dec 29 2017, 12:30 PM.

Details

Summary

This (together with D41631) fixes PR35733.

I'm not very fond of adding yet another flag to signal this particular case, but I'm not sure if it'd be better to overload the existing fields Name/SymbolName/ExtName with extra interpretations for this particular case (I'm afraid that would break some other case where their differences actually matter).

Diff Detail

Event Timeline

mstorsjo created this revision.Dec 29 2017, 12:30 PM
ruiu added a comment.Jan 8 2018, 5:42 PM

Hmm, if we have to do this, this patch is okay, but it feels to me we are building a complex theory to describe the behavior of the MSVC linker, but the MSVC linker is likely to follow some simple rules that we do not understand yet. Do you think we can find simpler rules to describe all these behaivors?

In D41632#970546, @ruiu wrote:

Hmm, if we have to do this, this patch is okay, but it feels to me we are building a complex theory to describe the behavior of the MSVC linker, but the MSVC linker is likely to follow some simple rules that we do not understand yet.

Yes, I have the exact same feeling.

Do you think we can find simpler rules to describe all these behaivors?

Maybe, but I think it probably would require adjusting a lot of the logic about how symbol names are decorated/undecorated throughout the linker. A couple months ago when I revisited this topic the last time, I was able to make all the other cases work pretty easily, except this one, and I had hoped nobody actually used/cared about the behaviour in this one.

ruiu added a comment.Jan 9 2018, 3:30 PM

Could you add a brief comment to describe the situation (we might not understand the underlying logic correctly, but all these struct members are required to mimic the exact behavior of the observed MSVC link.exe behavior.) It's also nice to add a comment on KeepDecoration.

mstorsjo updated this revision to Diff 129792.Jan 14 2018, 2:18 PM

I figured I could fix this in a much more straightforward fashion, instead of adding a new, very vaguely defined field to the data structures.

ruiu accepted this revision.Jan 17 2018, 3:29 PM

LGTM

This is much much better. Thank you very much for making the improvement over the original patch!

This revision is now accepted and ready to land.Jan 17 2018, 3:29 PM
This revision was automatically updated to reflect the committed changes.