summaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2021-11-10 08:49:05 +1030
committerAlan Modra <amodra@gmail.com>2021-11-15 12:20:13 +1030
commit7aba54da426b9999085d8f84e7896b8afdbb9ca6 (patch)
tree58612237fa11e0a5f5a9c001163a4c979c8482d8 /ld
parent64f5c8167b1bf098d7e054fb32a65bc252f9d18b (diff)
PowerPC64 @notoc in non-power10 code
R_PPC64_REL24_P9NOTOC is a variant of R_PPC64_REL24_NOTOC for use on @notoc cals from non-power10 code in the rare case that using such a construct is useful. R_PPC64_REL24_P9NOTOC will be emitted by gas rather than R_PPC64_REL24_NOTOC when @notoc is used in a branch instruction if power10 instructions are not enabled at that point. The new relocation tells the linker to not use power10 instructions on any stub emitted for that branch, unless overridden by --power10-stubs=yes. The current linker heuristic of only generating power10 instructions for stubs if power10-only relocations are detected, continues to be used. include/ * elf/ppc64.h (R_PPC64_REL24_P9NOTOC): Define. bfd/ * reloc.c (BFD_RELOC_PPC64_REL24_P9NOTOC): Define. * elf64-ppc.c (ppc64_elf_howto_raw): Add entry for new reloc. (ppc64_elf_reloc_type_lookup): Handle it. (enum ppc_stub_type): Delete. (enum ppc_stub_main_type, ppc_stub_sub_type): New. (struct ppc_stub_type): New. (struct ppc_stub_hash_entry): Use the above new type. (struct ppc_link_hash_table): Update stub_count. (is_branch_reloc, ppc64_elf_check_relocs), (toc_adjusting_stub_needed): Handle new reloc. (stub_hash_newfunc, select_alt_stub, ppc_merge_stub), (ppc_type_of_stub, plt_stub_size, build_plt_stub), (build_tls_get_addr_head, build_tls_get_addr_tail), (ppc_build_one_stub, ppc_size_one_stub, ppc64_elf_size_stubs), (ppc64_elf_build_stubs, ppc64_elf_relocate_section): Handle new reloc. Modify stub handling to suit new scheme. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. gas/ * config/tc-ppc.c (ppc_elf_suffix): When power10 is not enabled return BFD_RELOC_PPC64_REL24_P9NOTOC for @notoc. (fixup_size, ppc_force_relocation, ppc_fix_adjustable): Handle BFD_RELOC_PPC64_REL24_P9NOTOC. ld/ * testsuite/ld-powerpc/callstub-2.s: Add .machine power10.
Diffstat (limited to 'ld')
-rw-r--r--ld/testsuite/ld-powerpc/callstub-2.s1
1 files changed, 1 insertions, 0 deletions
diff --git a/ld/testsuite/ld-powerpc/callstub-2.s b/ld/testsuite/ld-powerpc/callstub-2.s
index f25ea0268c..1427c47e0b 100644
--- a/ld/testsuite/ld-powerpc/callstub-2.s
+++ b/ld/testsuite/ld-powerpc/callstub-2.s
@@ -1,6 +1,7 @@
#notoc call stubs, no pcrel insns
.text
.abiversion 2
+ .machine power10
_start:
bl f1
nop