ExtName should not be decorated, just like Name.
This avoids double decoration on symbols in import libraries that use = for renaming functions. (Weak aliases, which use ==, worked fine with respect to decoration.)
Differential D66617
[llvm-dlltool] Make sure to strip decorations from ExtName for renamed exports mstorsjo on Aug 22 2019, 1:26 PM. Authored by
Details ExtName should not be decorated, just like Name. This avoids double decoration on symbols in import libraries that use = for renaming functions. (Weak aliases, which use ==, worked fine with respect to decoration.)
Diff Detail
Event TimelineComment Actions @hans - This is a pretty well isolated fix that might be mergeworthy if you still have the gates open, it shouldn't have any risk of regressions outside of its own scope at least :-) Comment Actions It looks like decoration is killed too aggressively now. If aliasee symbol has no decoration, aliased symbol is stripped. For example: LIBRARY test.dll EXPORTS will result with _TestForward symbol instead of _TestForward@4 Comment Actions Ah, crap. @hans - no point in backporting this, as it's a bigger mess than it seemed first. @jacek - the issue stems from how these work in msvc land. You can have /export:foo=bar where the decoration from the actual bar symbol gets transplanted on foo, see https://github.com/llvm/llvm-project/blob/master/llvm/lib/Object/COFFImportFile.cpp#L604. In this case, the original symbol has no decoration to transplant on the stripped ExtName. Comment Actions Oh, I see. FWIW, it shouldn't be too hard to work around the problem in Wine. .def file is generated automatically, so we could just skip aliases for .def file used for importlibs. It seems like it would help a hypethetical Wine MSCV port anyway and it might be better for LLVM to be MSVC compatible in this case. I will experiment with it. Comment Actions That sounds good
Well, when invoked as llvm-dlltool (or lld in mingw mode), it should definitely behave as the gnu equivalents. (Whether each bug is worth spending time on is ofc a different matter... And gnu dlltool has got an awful lot of different flags affecting how the symbol decorations are mangled.) |