From 7aba54da426b9999085d8f84e7896b8afdbb9ca6 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 10 Nov 2021 08:49:05 +1030 Subject: 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. --- include/elf/ppc64.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/elf/ppc64.h b/include/elf/ppc64.h index e9f72b0..2d503c1 100644 --- a/include/elf/ppc64.h +++ b/include/elf/ppc64.h @@ -162,6 +162,7 @@ START_RELOC_NUMBERS (elf_ppc64_reloc_type) RELOC_NUMBER (R_PPC64_PLTSEQ_NOTOC, 121) RELOC_NUMBER (R_PPC64_PLTCALL_NOTOC, 122) RELOC_NUMBER (R_PPC64_PCREL_OPT, 123) + RELOC_NUMBER (R_PPC64_REL24_P9NOTOC, 124) RELOC_NUMBER (R_PPC64_D34, 128) RELOC_NUMBER (R_PPC64_D34_LO, 129) -- cgit v1.1