Skip to content

[BOLT][AArch64] Unknown relocation type error (R_AARCH64_P32_ABS16?) during emitAndLink with jump-table-info.sΒ #143709

@whubeibei

Description

@whubeibei

Hi,

While testing PR #132114 (JumpTableReader support) on AArch64, I encountered a linker error related to unknown relocation types during the emitAndLink phase.

πŸ” Issue
The error occurs when processing a jump table in .rodata. The relocation type reported is 2, which seems to correspond to R_AARCH64_P32_ABS16.

This happens specifically when using the bolt/test/AArch64/jump-table-info.s example included in the PR.

Image

Image

πŸ’» Reproduction Steps
llvm-mc -filetype=obj -triple aarch64-unknown-unknown jump-table-info.s -o jt.o
clang jt.o jt_main.o -o jt.exe -static
clang --target=aarch64-linux-gnu -static jt.o main.o -llvm-bolt jt.exe -o /dev/null -print-jump-tables
In the final step (running BOLT), the linker reports an unknown relocation type on .rodata.

🧠 Analysis
It appears that after the jump table is recognized, BOLT emits a relocation for each entry in .rodata, which triggers the error.

I'm not familiar with how ARM relocations should be handled here β€” is this a missing relocation handler, or should the relocations not be emitted at all?

πŸ—‚οΈ Environment
Target: AArch64

Error: Unknown relocation type: 2

Possibly related relocation: R_AARCH64_P32_ABS16

PR: #132114

Any insight from ARM or BOLT maintainers would be appreciated!

Thanks,
Zichen Li

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions