]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
LoongArch: Add relaxation support for call36 that jump to PLT entry
authormengqinggang <mengqinggang@loongson.cn>
Thu, 26 Dec 2024 06:14:12 +0000 (14:14 +0800)
committercailulu <cailulu@loongson.cn>
Mon, 30 Dec 2024 01:40:14 +0000 (09:40 +0800)
Part of commit a104f0a3e620 ("LoongArch: Add more relaxation support for
call36") in master.  This part is needed for 2.43 branch to fix a link
failure of QtWebEngine-6.8.1, which can be demonstrated with a reduced
test case (with -shared):

    .text
    .zero 1 << 27   # pretending we have a lot of code in .text
    .globl f        # preemptible, thus must be called via PLT
    f:
      move $a0, $r0
      ret
    g:
      pcaddu18i $t0, %call36(f)
      jr $t0

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
bfd/elfnn-loongarch.c

index 7760b5279f8dbc08e266b37a4af5d078a62cd583..610713a9d7ebf17e6ee4070733a56c8cc1f1c836 100644 (file)
@@ -5410,6 +5410,11 @@ loongarch_elf_relax_section (bfd *abfd, asection *sec,
                    && GOT_TLS_GD_BOTH_P (tls_type))
                symval += 2 * GOT_ENTRY_SIZE;
            }
+         else if (h->plt.offset != MINUS_ONE)
+           {
+             sym_sec = htab->elf.splt ? htab->elf.splt : htab->elf.iplt;
+             symval = h->plt.offset;
+           }
          else if ((h->root.type == bfd_link_hash_defined
                  || h->root.type == bfd_link_hash_defweak)
                && h->root.u.def.section != NULL