This is an archive of the discontinued LLVM Phabricator instance.

[JITLink][COFF][x86_64] Implement SECTION/SECREL relocation.
ClosedPublic

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

Details

Summary

Implements SECTION/SECREL relocation. These are used by debug info (pdb) data.

Diff Detail

Event Timeline

sunho created this revision.Jul 21 2022, 7:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 21 2022, 7:49 AM
sunho requested review of this revision.Jul 21 2022, 7:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 21 2022, 7:49 AM

What is Const16 used for?

I think we want to maintain the invariant that all edges point at symbols. We could use an absolute symbol for this if we allow for the idea that absolute symbols can be used for values other than addresses.

Alternatively, could the value be baked into the contents by the LinkGraphBuilder?

sunho updated this revision to Diff 448526.Jul 29 2022, 12:20 AM

Use absolute symbol.

lhames accepted this revision.Aug 2 2022, 10:14 PM

LGTM, other than the change to the assert condition.

Thanks @sunho!

llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
1105–1110

Why has the S == Scope::Local check been removed?

It's an odd "feature" but LinkGraph does permit duplicate names for local symbols, because they can crop up in real objects produced by ld -r and other tools.

llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp
540–542

This is a nice catch. I guess we're missing absolute symbol support test coverage.

This revision is now accepted and ready to land.Aug 2 2022, 10:14 PM
lhames added inline comments.Aug 3 2022, 10:12 AM
llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
1105–1110

/facepalm.

I read the change backwards. Thanks for adding the check. :)

This revision was landed with ongoing or failed builds.Aug 10 2022, 11:13 PM
This revision was automatically updated to reflect the committed changes.