This is an archive of the discontinued LLVM Phabricator instance.

Bug 21886 - MCJIT/ELF now support MSVC C++ mangled symbol
ClosedPublic

Authored by belleyb on Jan 6 2015, 11:25 AM.

Details

Summary

http://llvm.org/bugs/show_bug.cgi?id=21886

The ELF format is used on Windows by the MCJIT engine. Thus, on Windows, the ELFObjectWriter can encounter symbols mangled
using the MS Visual Studio C++ name mangling. Symbols mangled using the MSVC C++ name mangling can legally have "@@@" as a substring. The EFLObjectWriter should not interpret the "@@@" substring as specifying GNU-style symbol versioning. The ELFObjectWriter therefore check for the MSVC C++ name mangling prefix which is either "?", "@?", "imp_?" or "imp_?@".

Diff Detail

Event Timeline

belleyb updated this revision to Diff 17841.Jan 6 2015, 11:25 AM
belleyb retitled this revision from to Bug 21886 - MCJIT/ELF now support MSVC C++ mangled symbol.
belleyb updated this object.
belleyb edited the test plan for this revision. (Show Details)
belleyb added reviewers: lhames, Bigcheese, rafael.
belleyb set the repository for this revision to rL LLVM.
belleyb added a subscriber: Unknown Object (MLST).

Let me know if your agree with the proposed solution or if an other approach would be more appropriate. I am willing to implement any suggested changes,

rafael accepted this revision.Jan 20 2015, 2:01 PM
rafael edited edge metadata.

The ELF format itself only requires names to be null terminated.

The GNU as syntax is what gives special meaning to @@@.

The fact that both issues are mixed in ELFObjectWriter is my fault and I am sorry. This should really have been handled outside of the ELF writer.

Changing it will not be simple, so this is fine for now. Please just add a FIXME saying that all name handling should be done before we get to the writer.

This revision is now accepted and ready to land.Jan 20 2015, 2:01 PM

Do you have commit access?

belleyb updated this revision to Diff 18504.Jan 21 2015, 6:16 AM
belleyb edited edge metadata.

Added a FIXME notice as suggested by Rafael.

belleyb added a comment.EditedJan 21 2015, 6:21 AM

No, I don't have direct commit access to the llvm repository. Would "arc land" work once the revision is approved ? (I'll be watching the build bots afterward...)

Thanks for the review! :-)

If you give me a few hints regarding the proper place to put the GNU-style symbol versioning replacement, I might take a stab at it as a follow-up to this patch.

rafael closed this revision.Jan 22 2015, 6:22 AM

clang-formatted and committed as r226830.