From be1ebb6710a8f707bd4b0eecbd00f4f4964050e5 Mon Sep 17 00:00:00 2001 From: mengqinggang Date: Sun, 25 Jun 2023 17:47:42 +0800 Subject: LoongArch: Add R_LARCH_64_PCREL relocation support Gas defaults to emit R_LARCH_ADD64/R_LARCH_SUB64 unless explcitly declared to emit R_LARCH_64_PCREL. The LoongArch ABI at here: https://github.com/loongson/la-abi-specs/blob/release/la-abi.adoc bfd/ChangeLog: * bfd-in2.h (not): Add R_LARCH_64_PCREL * elfnn-loongarch.c (perform_relocation): Likewise. * elfxx-loongarch.c: Likewise. * libbfd.h: Likewise. * reloc.c: Likewise. gas/ChangeLog: * config/tc-loongarch.c (loongarch_args_parser_can_match_arg_helper): (md_apply_fix): Add R_LARCH_64_PCREL. * testsuite/gas/loongarch/64_pcrel.d: New test. * testsuite/gas/loongarch/64_pcrel.s: New test. include/ChangeLog: * elf/loongarch.h (RELOC_NUMBER): Add R_LARCH_64_PCREL. ld/ChangeLog: * testsuite/ld-loongarch-elf/ld-loongarch-elf.exp: Add test. * testsuite/ld-loongarch-elf/64_pcrel.d: New test. * testsuite/ld-loongarch-elf/64_pcrel.s: New test. --- bfd/elfnn-loongarch.c | 1 + 1 file changed, 1 insertion(+) (limited to 'bfd/elfnn-loongarch.c') diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c index b16066c..d3d8419 100644 --- a/bfd/elfnn-loongarch.c +++ b/bfd/elfnn-loongarch.c @@ -2070,6 +2070,7 @@ perform_relocation (const Elf_Internal_Rela *rel, asection *input_section, /* For eh_frame and debug info. */ case R_LARCH_32_PCREL: + case R_LARCH_64_PCREL: { value -= sec_addr (input_section) + rel->r_offset; value += rel->r_addend; -- cgit v1.1