This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH + test RFA] MIPS/LD: Fix crashing with a discarded dynamic relocation section
On Fri, 20 Jul 2018, H.J. Lu wrote:
> On x86-64, I got
>
> regexp_diff match failure
> regexp "^There are no dynamic relocations in this file\.$"
> line "'RELA' relocation section at offset 0x70 contains 24 bytes:"
> extra lines in tmpdir/dump.out starting with "^ Offset Info
> Type Sym. Value Sym. Name + Addend$"
> EOF from /export/gnu/import/git/sources/binutils-gdb/ld/testsuite/ld-elf/reloc-discard.d
> FAIL: Discarded dynamic relocation section
>
> [hjl@gnu-cfl-1 ld]$ cat 1
> /export/build/gnu/binutils-gold/build-x86_64-linux/ld/../gas/as-new
> --defsym ALIGN=3 -o tmpdir/reloc-discard.o
> /export/gnu/import/git/sources/binutils-gdb/ld/testsuite/ld-elf/reloc-discard.s
> ./ld-new -z norelro
> -L/export/gnu/import/git/sources/binutils-gdb/ld/testsuite/ld-elf
> -shared -T reloc-discard.ld -o tmpdir/dump tmpdir/reloc-discard.o
> /export/build/gnu/binutils-gold/build-x86_64-linux/ld/../binutils/readelf
> -r --use-dynamic tmpdir/dump
> [hjl@gnu-cfl-1 ld]$ sh 1
>
> 'RELA' relocation section at offset 0x70 contains 24 bytes:
> Offset Info Type Sym. Value Sym. Name + Addend
> 000000000088 000100000001 R_X86_64_64 0000000000000000 foo + 0
> [hjl@gnu-cfl-1 ld]$
Is that legitimate or just rubbish as with most targets? Given that
`.rela.dyn' has been discarded where does this relocation come from (if
more relocation sections need to be discarded with x86-64, then let's just
add them to the /DISCARD/ assignment; perhaps I should have used `.rel*'
as the pattern instead).
Maciej