]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
PR22394, hppa-linux-ld fails to emit dynamic relocations
authorAlan Modra <amodra@gmail.com>
Tue, 31 Oct 2017 07:43:03 +0000 (18:13 +1030)
committerAlan Modra <amodra@gmail.com>
Sat, 4 Nov 2017 23:07:33 +0000 (09:37 +1030)
commit127e8e9f62ed0e7145dfa1172c6253275fc150dd
treedef30853228eab94412a04c0a3a4d6182b6518b9
parentab4b1c4699fecd1f2461cecae108e7c583c15bc4
PR22394, hppa-linux-ld fails to emit dynamic relocations

gcc -mfast-indirect-calls emits a function pointer initialization
without a P% (plabel) modifier.  ld does not create the necessary
dynamic relocations for this to work.  It turns out that the problem
is caused by the non_got_ref symbol flag.  This flag is set for
non-pic by check_relocs to indicate that the symbol might need copy
relocations or dynamic relocations.  Later, the backend
adjust_dynamic_symbol clears the flag to indicate dynamic relocations
are needed, but leaves it set when copy relocations were created.  The
inversion in meaning is insane, but it's that way because the backend
adjust_dynamic_symbol function doesn't get to look at all symbols..
Anyway, the insanity works for non-function symbols.  However, the
flag is left set on any function symbol with a dynamic relocation.

This patch fixes the non_got_ref handling for function symbols, adds
-z nocopyreloc for hppa-elf, reports where textrel occurs, and expands
comments.  The check_relocs change just stops creation of dyn_relocs
we always threw away later.

PR 22394
* elf32-hppa.c (elf32_hppa_check_relocs): Don't create dyn_relocs
for plabels when non-pic.
(maybe_set_textrel): New function.
(readonly_dynrelocs): Move and rewrite.
(elf32_hppa_adjust_dynamic_symbol): Use it.  Don't create copy
relocs when def_regular or -z nocopyreloc.  Handle non_got_ref
for functions.  Expand non_got_ref comments.
(elf32_hppa_size_dynamic_sections): Use maybe_set_textrel.
bfd/ChangeLog
bfd/elf32-hppa.c