[llvm] [bolt][aarch64] Add R_AARCH64_P32_ABS16/32 relocations (PR #143773)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 12 02:49:17 PDT 2025


whubeibei wrote:

> Hey Alexei,
> 
> Thanks for the patch! The code itself looks okay. When trying @aaupov patch #132114 (currently marked as **draft**), I do get a failure on `AArch64/jump-table-info.s` as @whubeibei reports on issue #143709.
> 
> After cherry-picking this PR on top of Amir's draft PR I get an assertion:
> 
> ```
> BinarySection.cpp:136: void llvm::bolt::BinarySection::emitAsData(MCStreamer &, const Twine &) const
> : Assertion `SectionOffset <= SectionContents.size() && "overflow error"' failed.
> ```
> 
> Not sure if I missed something.
> 
> Regarding the relocations themselves, they appear to be part of the [ILP32](https://github.com/ARM-software/abi-aa/blob/main/aaelf64/aaelf64.rst#ilp32-beta) which is **Beta**. @yavtuk , @whubeibei could you share more details on how you get to generate those relocations in the input binary?
> 
> cc @smithp35 who can provide additional context around the status of ILP32.

Thanks for the update!

I only applied PR #132114 along with its prerequisite patch (#131997), and I haven't encountered the `emitAsData()` assertion so far.

That said, I'm still learning the internals of BOLT and AArch64 relocation handling, and I'm trying to understand the cause of this issue. I'll keep digging and follow up if I find anything useful.

> Hey Alexei,
> 
> Thanks for the patch! The code itself looks okay. When trying @aaupov patch #132114 (currently marked as **draft**), I do get a failure on `AArch64/jump-table-info.s` as @whubeibei reports on issue #143709.
> 
> After cherry-picking this PR on top of Amir's draft PR I get an assertion:
> 
> ```
> BinarySection.cpp:136: void llvm::bolt::BinarySection::emitAsData(MCStreamer &, const Twine &) const
> : Assertion `SectionOffset <= SectionContents.size() && "overflow error"' failed.
> ```
> 
> Not sure if I missed something.
> 
> Regarding the relocations themselves, they appear to be part of the [ILP32](https://github.com/ARM-software/abi-aa/blob/main/aaelf64/aaelf64.rst#ilp32-beta) which is **Beta**. @yavtuk , @whubeibei could you share more details on how you get to generate those relocations in the input binary?
> 
> cc @smithp35 who can provide additional context around the status of ILP32.

Thanks for the update!

I only applied PR #132114 along with its prerequisite patch , and I haven't encountered the `emitAsData()` assertion so far.

That said, I'm still learning the internals of BOLT and AArch64 relocation handling, and I'm trying to understand the cause of this issue. I'll keep digging and follow up if I find anything useful.

As for the relocations, I also believe—like @yavtuk mentioned—that they were generated by mistake. It seems `emitJumpTables()` and `updateOriginal()` are still using hardcoded x86 relocation types, which causes problems on AArch64. Adding proper relocation types for AArch64 in those places might be the right direction, and I'm planning to look into that.

Thanks again for all the insights and help!

https://github.com/llvm/llvm-project/pull/143773


More information about the llvm-commits mailing list