From 63c1f59d665542359de4737e3e48033c588f44dc Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Thu, 30 Nov 2017 19:46:17 +1030 Subject: 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. --- bfd/elf32-hppa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'bfd/elf32-hppa.c') diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index 3f71159..57d746e 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -2098,8 +2098,8 @@ maybe_set_textrel (struct elf_link_hash_entry *eh, void *inf) info->flags |= DF_TEXTREL; info->callbacks->minfo - (_("%B: dynamic relocation in read-only section `%A'\n"), - sec->owner, sec); + (_("%B: dynamic relocation against `%T' in read-only section `%A'\n"), + sec->owner, eh->root.root.string, sec); /* Not an error, just cut short the traversal. */ return FALSE; -- cgit v1.1