readonly_dynrelocs
authorAlan Modra <amodra@gmail.com>
Thu, 30 Nov 2017 09:16:17 +0000 (19:46 +1030)
committerAlan Modra <amodra@gmail.com>
Fri, 1 Dec 2017 06:53:56 +0000 (17:23 +1030)
commit63c1f59d665542359de4737e3e48033c588f44dc
tree4a7cd6ca5ba13f6b413d608c5968f57eede6f0e8
parent254cefe35f012977d567af0bbad2a8091d90e22b
readonly_dynrelocs

In early October, HJ Lu added support for a number of targets to "Dump
dynamic relocation in read-only section with minfo".  This extends
that support to more targets, displays the symbol involved, and splits
the existing function that sets TEXTREL into a "readonly_dynrelocs"
and "maybe_set_textrel" function.  I'll need "readonly_dynrelocs" if I
ever get around to fixing "pr22374 function pointer initialization"
fails.

am33_2.0, arc, bfin, hppa64, mn10300, and nios2 fail to mark a binary
needing text relocations with DT_TEXTREL.  That's not good.  xtensa also
fails to do so but complains about "dangerous relocation: dynamic
relocation in read-only section" so I reckon that is fine and have
marked the test as an xfail.  The other targets need maintainer
attention.

Curiously, the map file dump wasn't added for x86, so the map test
currently fail on x86.  It also fails on alpha, am33_2.0, arc, bfin,
hppa64, ia64, m68k, mips, mn10300, nios2, score and vax.  cris
complains with "tmpdir/textrel.o, section .rodata: relocation
R_CRIS_32 should not be used in a shared object; recompile with -fPIC"
so I've marked it as an xfail.

bfd/
* elf32-hppa.c (maybe_set_textrel): Print symbol for map file output.
* elf32-ppc.c (maybe_set_textrel): Likewise.
* elf64-ppc.c (maybe_set_textrel): Likewise.
* elf32-arm.c (readonly_dynrelocs): New function.
(maybe_set_textrel): New function, replacing..
(elf32_arm_readonly_dynrelocs): ..this.
* elf32-lm32.c (readonly_dynrelocs): New function.
(maybe_set_textrel): New function, replacing old version of..
(readonly_dynrelocs): ..this.
* elf32-m32r.c (readonly_dynrelocs): New function.
(maybe_set_textrel): New function, replacing old version of..
(readonly_dynrelocs): ..this.
* elf32-metag.c (readonly_dynrelocs): New function.
(maybe_set_textrel): New function, replacing old version of..
(readonly_dynrelocs): ..this.
* elf32-nds32.c: Delete unnecessary forward declarations.
(readonly_dynrelocs): New function.
(maybe_set_textrel): New function, replacing old version of..
(readonly_dynrelocs): ..this.
* elf32-or1k.c (readonly_dynrelocs): New function.
(maybe_set_textrel): New function, replacing old version of..
(readonly_dynrelocs): ..this.
* elf32-s390.c (readonly_dynrelocs): New function.
(maybe_set_textrel): New function, replacing old version of..
(readonly_dynrelocs): ..this.
* elf32-sh.c (readonly_dynrelocs): New function.
(maybe_set_textrel): New function, replacing old version of..
(readonly_dynrelocs): ..this.
* elf32-tic6x.c (readonly_dynrelocs): New function.
(maybe_set_textrel): New function, replacing..
(elf32_tic6x_readonly_dynrelocs): ..this.
* elf32-tilepro.c (readonly_dynrelocs): New function.
(maybe_set_textrel): New function, replacing old version of..
(readonly_dynrelocs): ..this.
* elf64-s390.c (readonly_dynrelocs): New function.
(maybe_set_textrel): New function, replacing old version of..
(readonly_dynrelocs): ..this.
* elfnn-aarch64.c (readonly_dynrelocs): New function.
(maybe_set_textrel): New function, replacing..
(aarch64_readonly_readonly_dynrelocs): ..this.
* elfnn-riscv.c (readonly_dynrelocs): New function.
(maybe_set_textrel): New function, replacing old version of..
(readonly_dynrelocs): ..this.
* elfxx-sparc.c (readonly_dynrelocs): New function.
(maybe_set_textrel): New function, replacing old version of..
(readonly_dynrelocs): ..this.
* elfxx-tilegx.c (readonly_dynrelocs): New function.
(maybe_set_textrel): New function, replacing old version of..
(readonly_dynrelocs): ..this.
ld/
* testsuite/ld-elf/shared.exp: Run new textrel tests.
* testsuite/ld-elf/textrel.map: New file.
* testsuite/ld-elf/textrel.rd: New file.
* testsuite/ld-elf/textrel.s: New file.
* testsuite/ld-elf/textrel.warn: New file.
25 files changed:
bfd/ChangeLog
bfd/elf32-arm.c
bfd/elf32-hppa.c
bfd/elf32-lm32.c
bfd/elf32-m32r.c
bfd/elf32-metag.c
bfd/elf32-nds32.c
bfd/elf32-or1k.c
bfd/elf32-ppc.c
bfd/elf32-s390.c
bfd/elf32-sh.c
bfd/elf32-tic6x.c
bfd/elf32-tilepro.c
bfd/elf64-ppc.c
bfd/elf64-s390.c
bfd/elfnn-aarch64.c
bfd/elfnn-riscv.c
bfd/elfxx-sparc.c
bfd/elfxx-tilegx.c
ld/ChangeLog
ld/testsuite/ld-elf/shared.exp
ld/testsuite/ld-elf/textrel.map [new file with mode: 0644]
ld/testsuite/ld-elf/textrel.rd [new file with mode: 0644]
ld/testsuite/ld-elf/textrel.s [new file with mode: 0644]
ld/testsuite/ld-elf/textrel.warn [new file with mode: 0644]