This is an archive of the discontinued LLVM Phabricator instance.

[JITLink][COFF] Implement include/alternatename linker directive.
ClosedPublic

Authored by sunho on Jul 21 2022, 7:53 AM.

Details

Summary

Implements include/alternatename linker directive. Alternatename is used by static msvc runtime library. Alias symbol is technically incorrect (we have to search for external definition) but we don't have a way to represent this in jitlink/orc yet, this is solved in the following up patch.

Inlcude linker directive is used in ucrt to forcelly lookup the static initializer symbols so that they will be emitted. It's implemented as extenral symbols with live flag on that cause the lookup of these symbols.

Diff Detail

Event Timeline

sunho created this revision.Jul 21 2022, 7:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 21 2022, 7:53 AM
sunho requested review of this revision.Jul 21 2022, 7:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 21 2022, 7:53 AM
sunho updated this revision to Diff 447155.Jul 24 2022, 5:20 PM

Add tests / handle string read after free.

sunho retitled this revision from [JITLink][COFF] Implement alternatename linker directive. to [JITLink][COFF] Implement include/alternatename linker directive..Jul 24 2022, 6:51 PM
sunho edited the summary of this revision. (Show Details)
lhames accepted this revision.Jul 25 2022, 4:34 PM

LGTM. This is really cool -- we've never had a proper way to handle COFF exports!

Speaking of which -- in the long term we may want to move the COFF options parser to libObject -- it would allow us to set the SF_Export flag correctly in that library, and JITLink could re-use the parser from there (since JITLink depends on libObject).

This revision is now accepted and ready to land.Jul 25 2022, 4:34 PM

I've filed https://github.com/llvm/llvm-project/issues/56716 to investigate moving the options parser to libObject in the future.

This revision was landed with ongoing or failed builds.Jul 29 2022, 12:48 AM
This revision was automatically updated to reflect the committed changes.
sunho updated this revision to Diff 448817.Jul 30 2022, 3:49 PM
This revision was landed with ongoing or failed builds.Jul 30 2022, 3:50 PM