-
Notifications
You must be signed in to change notification settings - Fork 10.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[JITLink][AArch32] Implement R_ARM_PREL31 and process .ARM.exidx sections #79044
[JITLink][AArch32] Implement R_ARM_PREL31 and process .ARM.exidx sections #79044
Conversation
✅ With the latest revision this PR passed the C/C++ code formatter. |
@@ -397,6 +397,11 @@ template <typename ELFT> Error ELFLinkGraphBuilder<ELFT>::graphifySections() { | |||
orc::ExecutorAddr(Sec.sh_addr), | |||
Sec.sh_addralign, 0); | |||
|
|||
if (Sec.sh_type == ELF::SHT_ARM_EXIDX) { | |||
// Add live symbol to avoid dead-stripping for .ARM.exidx sections | |||
G->addAnonymousSymbol(*B, orc::ExecutorAddrDiff(), orc::ExecutorAddrDiff(), false, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The compiler emits a R_ARM_NONE
relocation from an exception-handling table section to the required personality routine to indicate the dependence, but the edge alone doesn't keep the section alive in JITLink. We add the anonymous live symbol here to preserve it from dead-stripping.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's surprising -- any valid edge should keep the routine alive? Do we actually build an edge, or do we discard R_ARM_NONE
relocations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIUC the issue is that here https://github.com/llvm/llvm-project/blob/release/17.x/llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.cpp#L271 we start from a set of live symbols and then follow edges and mark their target blocks live. Blocks without any symbols and only outgoing edges will remain dead.
I implemented R_ARM_NONE
as no-op here 565470e. Not sure we could use it to mark the block live.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
R_ARM_PREL31
is a 31-bits relative data relocation where the most-significant bit is preserved. It's used primarily in.ARM.exidx
sections, which we skipped processing until now, because we didn't support the relocation type. This was implemented in RuntimeDyld with https://reviews.llvm.org/D25069 and I implemented it in a similar way in JITLink in order to reach feature parity.