toolchain/binutils: backport stable patches
[openwrt/staging/dangole.git] / toolchain / binutils / patches / 2.39 / 050-PowerPC64-pcrel-got-relocs-against-local-symbols.patch
1 From 4d7bba23a39fba18d6d13a2941a3c232011a7064 Mon Sep 17 00:00:00 2001
2 From: Alan Modra <amodra@gmail.com>
3 Date: Fri, 16 Sep 2022 18:08:44 +0930
4 Subject: [PATCH 050/160] PowerPC64 pcrel got relocs against local symbols
5
6 Not that anyone would want to indirect via the GOT when an address can
7 be loaded directly with pla, the following:
8
9 pld 3,x@got@pcrel
10 x:
11
12 leads to "Internal error in md_apply_fix", because the generic parts
13 of assembler fixup handling convert the fx_pcrel fixup to one without
14 a symbol. Stop that happening.
15
16 * config/tc-ppc.c (ppc_force_relocation): Add PLT_PCREL34 and
17 assorted GOT_PCREL34 relocs.
18
19 (cherry picked from commit 49c3ed081fed6b8e2b48fdc48f805f11e4589514)
20 ---
21 gas/config/tc-ppc.c | 6 ++++++
22 1 file changed, 6 insertions(+)
23
24 --- a/gas/config/tc-ppc.c
25 +++ b/gas/config/tc-ppc.c
26 @@ -6676,6 +6676,12 @@ ppc_force_relocation (fixS *fix)
27 case BFD_RELOC_PPC_BA16_BRNTAKEN:
28 case BFD_RELOC_24_PLT_PCREL:
29 case BFD_RELOC_PPC64_TOC:
30 + case BFD_RELOC_PPC64_PLT_PCREL34:
31 + case BFD_RELOC_PPC64_GOT_PCREL34:
32 + case BFD_RELOC_PPC64_GOT_TLSGD_PCREL34:
33 + case BFD_RELOC_PPC64_GOT_TLSLD_PCREL34:
34 + case BFD_RELOC_PPC64_GOT_TPREL_PCREL34:
35 + case BFD_RELOC_PPC64_GOT_DTPREL_PCREL34:
36 return 1;
37 case BFD_RELOC_PPC_B26:
38 case BFD_RELOC_PPC_BA26: