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.
please try trunk binutils, looks like fixed by the following commit already. commit 2e0488d33f8abbbc5bec214e1723d07048d7afcc Author: Jiong Wang <jiong.wang@arm.com> Date: Tue Jul 8 09:29:06 2014 +0100 Enable elf_backend_rela_normal for AArch64
Yes, you are right. Sorry for the noise.
mark as invalid.