This is an archive of the discontinued LLVM Phabricator instance.

[JITLink] Introduce target flags for Symbol and prepare ObjectLinkingLayer to account for them
ClosedPublic

Authored by sgraenitz on Mar 22 2023, 9:28 AM.

Details

Summary

AArch32 branch offsets explicitly encode the target instruction subset (Arm/Thumb) in their least significant bit. We want this bit set (or clear) in addreses we hand out, but the addresses in the LinkGraph should be the real/physical addresses.

This patch allows ELFLinkGraphBuilder's to set target-specific flags in jitlink::Symbol and prepares ObjectLinkingLayer to account for them.

Diff Detail

Event Timeline

sgraenitz created this revision.Mar 22 2023, 9:28 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 22 2023, 9:28 AM
sgraenitz requested review of this revision.Mar 22 2023, 9:28 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 22 2023, 9:28 AM

This is a rather quick sketch that aims to be as non-intrusive as possible. I will add the ThumbSymbol handling in D144083.

llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
679

Conceptually, this should be generic and allow targets to store a variety of flags, but for the time being I guess ThumbSymbol will be the only flag we have upstream.

Anyway, non of these data structures are serialized, so can change it any time. I could take one more bit away from Offset to reduce memory pressure. (Or Two?) What do you think?

lhames accepted this revision.Mar 22 2023, 10:03 AM
lhames added inline comments.
llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
679

Yep -- we're free to modify link graph internals at will. I think it's fine to steal another bit from Offset for now.

This revision is now accepted and ready to land.Mar 22 2023, 10:03 AM
sgraenitz marked an inline comment as done.

Steal one more bit from Offset

This revision was landed with ongoing or failed builds.Mar 22 2023, 12:45 PM
This revision was automatically updated to reflect the committed changes.