From: mengqinggang Date: Tue, 9 Sep 2025 07:39:38 +0000 (+0800) Subject: LoongArch: Add linker relaxation support for R_LARCH_CALL30 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=da99165f7140e24be472ca92c34183e72e1090e5;p=thirdparty%2Fbinutils-gdb.git LoongArch: Add linker relaxation support for R_LARCH_CALL30 Relax call30 to bl, relax tail30 to b. --- diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c index 5e5eb237abd..62696b83397 100644 --- a/bfd/elfnn-loongarch.c +++ b/bfd/elfnn-loongarch.c @@ -6100,6 +6100,7 @@ loongarch_elf_relax_section (bfd *abfd, asection *sec, relax_func = loongarch_relax_pcala_ld; break; case R_LARCH_CALL36: + case R_LARCH_CALL30: relax_func = loongarch_relax_call36; break; case R_LARCH_TLS_LE_HI20_R: @@ -6158,7 +6159,7 @@ loongarch_elf_relax_section (bfd *abfd, asection *sec, + r_symndx; if ((ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC - && r_type != R_LARCH_CALL36) + && (r_type != R_LARCH_CALL36 || r_type != R_LARCH_CALL30)) || sym->st_shndx == SHN_ABS) continue; @@ -6195,7 +6196,7 @@ loongarch_elf_relax_section (bfd *abfd, asection *sec, is not set yet. */ if (h != NULL && ((h->type == STT_GNU_IFUNC - && r_type != R_LARCH_CALL36) + && (r_type != R_LARCH_CALL36 || r_type != R_LARCH_CALL30)) || bfd_is_abs_section (h->root.u.def.section) || h->start_stop)) continue; @@ -6223,7 +6224,7 @@ loongarch_elf_relax_section (bfd *abfd, asection *sec, Undefweak for other relocations handing in the future. */ else if (h->root.type == bfd_link_hash_undefweak && !h->root.linker_def - && r_type == R_LARCH_CALL36) + && (r_type == R_LARCH_CALL36 || r_type == R_LARCH_CALL30)) { sym_sec = sec; symval = rel->r_offset; diff --git a/gas/config/tc-loongarch.c b/gas/config/tc-loongarch.c index a3e6fcb056c..284bbdcc12a 100644 --- a/gas/config/tc-loongarch.c +++ b/gas/config/tc-loongarch.c @@ -880,7 +880,8 @@ loongarch_args_parser_can_match_arg_helper (char esc_ch1, char esc_ch2, || BFD_RELOC_LARCH_TLS_LE_LO12 == reloc_type || BFD_RELOC_LARCH_TLS_LE64_LO20 == reloc_type || BFD_RELOC_LARCH_TLS_LE64_HI12 == reloc_type - || BFD_RELOC_LARCH_CALL36 == reloc_type)) + || BFD_RELOC_LARCH_CALL36 == reloc_type + || BFD_RELOC_LARCH_CALL30 == reloc_type)) { ip->reloc_info[ip->reloc_num].type = BFD_RELOC_LARCH_RELAX; ip->reloc_info[ip->reloc_num].value = const_0;