https://sourceware.org/bugzilla/show_bug.cgi?id=18692
Bug ID: 18692 Summary: AArch64: ld --emit-relocs corrupts section relative relocations Product: binutils Version: 2.24 Status: NEW Severity: normal Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: ard.biesheuvel at linaro dot org Target Milestone: --- When merging ELF sections together, section relative relocations emitted using --emit-relocs do not have their addends recalculated, leading to corrupt relocation data. For instance, after assembling the following code: .text .skip 0x20 .quad sym1 .section ".rodata" sym1: .skip 0x38 .word 0x0 using "aarch64-linux-gnu-as -o /tmp/rela.o /tmp/rela.s", the resulting rela.text section contains: Relocation section '.rela.text' at offset 0x3f0 contains 1 entries: Offset Info Type Sym. Value Sym. Name + Addend 000000000020 000600000101 R_AARCH64_ABS64 0000000000000000 .rodata + 38 However, after linking it using the following script: SECTIONS { .text : { *(.text .rodata) } } using "aarch64-linux-gnu-ld -e 0x0 -o /tmp/rela /tmp/rela.o --emit-relocs -T /tmp/rela.lds", the resulting rela.text section contains the following relocation: Relocation section '.rela.text' at offset 0x10298 contains 1 entries: Offset Info Type Sym. Value Sym. Name + Addend 000000000020 000100000101 R_AARCH64_ABS64 0000000000000000 .text + 38 Here, the RELA addend is unchanged, even though the original .rodata is placed 0x28 bytes into .text. -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils