This is an archive of the discontinued LLVM Phabricator instance.

[JITLink][COFF] Implement dllimport stubs.
ClosedPublic

Authored by sunho on Jul 20 2022, 7:45 AM.

Details

Summary

Implements dllimport stubs using GOT table manager. Benefit of using GOT table manager is that we can just reuse jitlink-check architecture.

Diff Detail

Event Timeline

sunho created this revision.Jul 20 2022, 7:45 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 20 2022, 7:45 AM
sunho requested review of this revision.Jul 20 2022, 7:45 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 20 2022, 7:45 AM
lhames accepted this revision.Jul 25 2022, 4:05 PM

Otherwise LGTM.

llvm/lib/ExecutionEngine/JITLink/COFFLinkGraphBuilder.cpp
145–151

What prompted this change?

I assume IMAGE_SCN_MEM_READ is specified on most sections, or you'd have seen this blow up already. Should we turn Read on by default for all sections, or only for some subset?

225–248

This might be worth lifting out into its own method.

This revision is now accepted and ready to land.Jul 25 2022, 4:05 PM
sunho added inline comments.Jul 25 2022, 8:36 PM
llvm/lib/ExecutionEngine/JITLink/COFFLinkGraphBuilder.cpp
145–151

I was getting "Illegal memory protection flag specified" error in getWindowsProtectionFlags. I thought it was None flag just supplied as it is but it might be with some interesting combination like W + X. I'll check again.

225–248

I reallized the same when I was writing SECREL patch and splitted off into additional method in that patch.

sunho added inline comments.Jul 25 2022, 9:03 PM
llvm/lib/ExecutionEngine/JITLink/COFFLinkGraphBuilder.cpp
225–248

I meant directive parser patch

This revision was landed with ongoing or failed builds.Jul 29 2022, 12:30 AM
This revision was automatically updated to reflect the committed changes.