diff --git a/0025-LoongArch-add-new-relocations-and-fix-bugs-from-upst.patch b/0025-LoongArch-add-new-relocations-and-fix-bugs-from-upst.patch new file mode 100644 index 0000000000000000000000000000000000000000..ce6d767cc754e42e9e9990b6376b70a4dda343e0 --- /dev/null +++ b/0025-LoongArch-add-new-relocations-and-fix-bugs-from-upst.patch @@ -0,0 +1,12925 @@ +From 1b76c523348dc623386cb7dd0a732cf4265243c6 Mon Sep 17 00:00:00 2001 +From: Peng Fan +Date: Tue, 18 Jul 2023 14:55:16 +0800 +Subject: [PATCH] LoongArch: add new relocations and fix bugs from upstream. + +Signed-off-by: Peng Fan +--- + bfd/.gitignore | 1 + + bfd/Makefile.am | 9 +- + bfd/Makefile.in | 11 +- + bfd/bfd-in2.h | 37 + + bfd/bfd.c | 1 + + bfd/coff-loongarch64.c | 169 ++ + bfd/coffcode.h | 19 +- + bfd/config.bfd | 2 +- + bfd/configure | 1 + + bfd/configure.ac | 1 + + bfd/elfnn-loongarch.c | 1588 ++++++++++++----- + bfd/elfxx-loongarch.c | 1371 ++++++++++---- + bfd/elfxx-loongarch.h | 4 + + bfd/libbfd.h | 37 + + bfd/libpei.h | 36 + + bfd/peXXigen.c | 49 +- + bfd/pei-loongarch64.c | 75 + + bfd/peicode.h | 21 +- + bfd/reloc.c | 82 + + bfd/targets.c | 2 + + binutils/readelf.c | 12 +- + .../binutils-all/loongarch64/loongarch64.exp | 30 + + .../loongarch64/pei-loongarch64.d | 15 + + .../loongarch64/pei-loongarch64.s | 33 + + gas/config/loongarch-lex-wrapper.c | 2 +- + gas/config/loongarch-lex.h | 3 + + gas/config/loongarch-parse.y | 92 +- + gas/config/tc-loongarch.c | 244 ++- + gas/config/tc-loongarch.h | 9 +- + gas/testsuite/gas/all/gas.exp | 4 +- + gas/testsuite/gas/loongarch/bfd_reloc_8.s | 16 + + gas/testsuite/gas/loongarch/imm_ins.d | 80 + + gas/testsuite/gas/loongarch/imm_ins.s | 83 + + gas/testsuite/gas/loongarch/imm_ins_32.d | 57 + + gas/testsuite/gas/loongarch/imm_ins_32.s | 60 + + .../gas/loongarch/imm_ins_label-fail.d | 3 + + .../gas/loongarch/imm_ins_label-fail.l | 3 + + .../gas/loongarch/imm_ins_label-fail.s | 3 + + gas/testsuite/gas/loongarch/jmp_op.d | 83 +- + gas/testsuite/gas/loongarch/jmp_op.s | 39 +- + gas/testsuite/gas/loongarch/li.d | 21 + + gas/testsuite/gas/loongarch/li.s | 22 + + gas/testsuite/gas/loongarch/loongarch.exp | 1 + + gas/testsuite/gas/loongarch/macro_op.d | 778 +------- + gas/testsuite/gas/loongarch/macro_op.s | 44 +- + gas/testsuite/gas/loongarch/macro_op_32.d | 55 + + gas/testsuite/gas/loongarch/macro_op_32.s | 16 + + .../gas/loongarch/macro_op_large_abs.d | 77 + + .../gas/loongarch/macro_op_large_abs.s | 9 + + .../gas/loongarch/macro_op_large_pc.d | 77 + + .../gas/loongarch/macro_op_large_pc.s | 9 + + gas/testsuite/gas/loongarch/reloc.d | 167 ++ + gas/testsuite/gas/loongarch/reloc.s | 144 ++ + include/coff/loongarch64.h | 61 + + include/coff/pe.h | 1 + + include/elf/loongarch.h | 183 +- + ld/testsuite/ld-elf/eh5.d | 2 +- + ld/testsuite/ld-elf/elf.exp | 1 + + ld/testsuite/ld-elf/pr26936.d | 2 +- + ld/testsuite/ld-elf/shared.exp | 9 +- + ld/testsuite/ld-loongarch-elf/attr-ifunc-4.c | 23 + + .../ld-loongarch-elf/attr-ifunc-4.out | 1 + + .../ld-loongarch-elf/cmodel-libjirl.dd | 4 + + ld/testsuite/ld-loongarch-elf/cmodel.exp | 40 + + ld/testsuite/ld-loongarch-elf/disas-jirl-32.d | 18 +- + ld/testsuite/ld-loongarch-elf/disas-jirl.d | 19 +- + ld/testsuite/ld-loongarch-elf/ifunc.exp | 34 + + ld/testsuite/ld-loongarch-elf/jmp_op.d | 85 +- + ld/testsuite/ld-loongarch-elf/jmp_op.s | 43 +- + .../ld-loongarch-elf/ld-loongarch-elf.exp | 1 + + ld/testsuite/ld-loongarch-elf/libjirl.s | 2 + + .../ld-loongarch-elf/libnopic-global.s | 113 ++ + .../ld-loongarch-elf/local-ifunc-reloc.d | 10 + + .../ld-loongarch-elf/local-ifunc-reloc.s | 28 + + ld/testsuite/ld-loongarch-elf/macro_op.d | 883 ++------- + ld/testsuite/ld-loongarch-elf/macro_op.s | 57 +- + ld/testsuite/ld-loongarch-elf/macro_op_32.d | 768 +------- + ld/testsuite/ld-loongarch-elf/macro_op_32.s | 43 +- + .../ld-loongarch-elf/nopic-global-so.rd | 5 + + .../ld-loongarch-elf/nopic-global-so.sd | 10 + + .../ld-loongarch-elf/nopic-global.out | 1 + + ld/testsuite/ld-loongarch-elf/nopic-global.s | 373 ++++ + ld/testsuite/ld-loongarch-elf/nopic-global.sd | 5 + + ld/testsuite/ld-loongarch-elf/nopic-global.xd | 3 + + ld/testsuite/ld-loongarch-elf/nopic-local.out | 1 + + ld/testsuite/ld-loongarch-elf/nopic-local.rd | 0 + ld/testsuite/ld-loongarch-elf/nopic-local.s | 383 ++++ + ld/testsuite/ld-loongarch-elf/nopic-local.sd | 5 + + ld/testsuite/ld-loongarch-elf/nopic-local.xd | 3 + + .../ld-loongarch-elf/nopic-weak-global-so.rd | 5 + + .../ld-loongarch-elf/nopic-weak-global-so.sd | 10 + + .../ld-loongarch-elf/nopic-weak-global.out | 1 + + .../ld-loongarch-elf/nopic-weak-global.s | 374 ++++ + .../ld-loongarch-elf/nopic-weak-global.sd | 5 + + .../ld-loongarch-elf/nopic-weak-global.xd | 3 + + .../ld-loongarch-elf/nopic-weak-local.out | 1 + + .../ld-loongarch-elf/nopic-weak-local.rd | 0 + .../ld-loongarch-elf/nopic-weak-local.s | 383 ++++ + .../ld-loongarch-elf/nopic-weak-local.sd | 5 + + .../ld-loongarch-elf/nopic-weak-local.xd | 3 + + ld/testsuite/ld-loongarch-elf/pic.exp | 202 +++ + ld/testsuite/ld-loongarch-elf/pic.ld | 18 + + opcodes/loongarch-opc.c | 426 +++-- + 103 files changed, 6869 insertions(+), 3594 deletions(-) + create mode 100644 bfd/coff-loongarch64.c + create mode 100644 bfd/pei-loongarch64.c + create mode 100644 binutils/testsuite/binutils-all/loongarch64/loongarch64.exp + create mode 100644 binutils/testsuite/binutils-all/loongarch64/pei-loongarch64.d + create mode 100644 binutils/testsuite/binutils-all/loongarch64/pei-loongarch64.s + create mode 100644 gas/testsuite/gas/loongarch/bfd_reloc_8.s + create mode 100644 gas/testsuite/gas/loongarch/imm_ins.d + create mode 100644 gas/testsuite/gas/loongarch/imm_ins.s + create mode 100644 gas/testsuite/gas/loongarch/imm_ins_32.d + create mode 100644 gas/testsuite/gas/loongarch/imm_ins_32.s + create mode 100644 gas/testsuite/gas/loongarch/imm_ins_label-fail.d + create mode 100644 gas/testsuite/gas/loongarch/imm_ins_label-fail.l + create mode 100644 gas/testsuite/gas/loongarch/imm_ins_label-fail.s + create mode 100644 gas/testsuite/gas/loongarch/li.d + create mode 100644 gas/testsuite/gas/loongarch/li.s + create mode 100644 gas/testsuite/gas/loongarch/macro_op_32.d + create mode 100644 gas/testsuite/gas/loongarch/macro_op_32.s + create mode 100644 gas/testsuite/gas/loongarch/macro_op_large_abs.d + create mode 100644 gas/testsuite/gas/loongarch/macro_op_large_abs.s + create mode 100644 gas/testsuite/gas/loongarch/macro_op_large_pc.d + create mode 100644 gas/testsuite/gas/loongarch/macro_op_large_pc.s + create mode 100644 gas/testsuite/gas/loongarch/reloc.d + create mode 100644 gas/testsuite/gas/loongarch/reloc.s + create mode 100644 include/coff/loongarch64.h + create mode 100644 ld/testsuite/ld-loongarch-elf/attr-ifunc-4.c + create mode 100644 ld/testsuite/ld-loongarch-elf/attr-ifunc-4.out + create mode 100644 ld/testsuite/ld-loongarch-elf/cmodel-libjirl.dd + create mode 100644 ld/testsuite/ld-loongarch-elf/cmodel.exp + create mode 100644 ld/testsuite/ld-loongarch-elf/ifunc.exp + create mode 100644 ld/testsuite/ld-loongarch-elf/libjirl.s + create mode 100644 ld/testsuite/ld-loongarch-elf/libnopic-global.s + create mode 100644 ld/testsuite/ld-loongarch-elf/local-ifunc-reloc.d + create mode 100644 ld/testsuite/ld-loongarch-elf/local-ifunc-reloc.s + create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-global-so.rd + create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-global-so.sd + create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-global.out + create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-global.s + create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-global.sd + create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-global.xd + create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-local.out + create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-local.rd + create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-local.s + create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-local.sd + create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-local.xd + create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-weak-global-so.rd + create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-weak-global-so.sd + create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-weak-global.out + create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-weak-global.s + create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-weak-global.sd + create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-weak-global.xd + create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-weak-local.out + create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-weak-local.rd + create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-weak-local.s + create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-weak-local.sd + create mode 100644 ld/testsuite/ld-loongarch-elf/nopic-weak-local.xd + create mode 100644 ld/testsuite/ld-loongarch-elf/pic.exp + create mode 100644 ld/testsuite/ld-loongarch-elf/pic.ld + +diff --git a/bfd/.gitignore b/bfd/.gitignore +index 065ed99f..e93eb658 100644 +--- a/bfd/.gitignore ++++ b/bfd/.gitignore +@@ -11,6 +11,7 @@ + /pepigen.c + /pex64igen.c + /pe-aarch64igen.c ++/pe-loongarch64igen.c + /stmp-bfd-h + /targmatch.h + +diff --git a/bfd/Makefile.am b/bfd/Makefile.am +index 2d1c6ac8..1f47e799 100644 +--- a/bfd/Makefile.am ++++ b/bfd/Makefile.am +@@ -573,9 +573,11 @@ BFD64_BACKENDS = \ + mach-o-x86-64.lo \ + mmo.lo \ + pe-aarch64igen.lo \ ++ pe-loongarch64igen.lo \ + pe-x86_64.lo \ + pei-aarch64.lo \ + pei-ia64.lo \ ++ pei-loongarch64.lo \ + pei-x86_64.lo \ + pepigen.lo \ + pex64igen.lo \ +@@ -618,6 +620,7 @@ BFD64_BACKENDS_CFILES = \ + pe-x86_64.c \ + pei-aarch64.c \ + pei-ia64.c \ ++ pei-loongarch64.c \ + pei-x86_64.c \ + vms-alpha.c + +@@ -677,7 +680,7 @@ BUILD_CFILES = \ + elf32-ia64.c elf64-ia64.c \ + elf32-loongarch.c elf64-loongarch.c \ + elf32-riscv.c elf64-riscv.c \ +- peigen.c pepigen.c pex64igen.c pe-aarch64igen.c ++ peigen.c pepigen.c pex64igen.c pe-aarch64igen.c pe-loongarch64igen.c + + CFILES = $(SOURCE_CFILES) $(BUILD_CFILES) + +@@ -894,6 +897,10 @@ pe-aarch64igen.c: peXXigen.c + $(AM_V_at)echo "#line 1 \"peXXigen.c\"" > $@ + $(AM_V_GEN)$(SED) -e s/XX/peAArch64/g < $< >> $@ + ++pe-loongarch64igen.c: peXXigen.c ++ $(AM_V_at)echo "#line 1 \"peXXigen.c\"" > $@ ++ $(AM_V_GEN)$(SED) -e s/XX/peLoongArch64/g < $< >> $@ ++ + host-aout.lo: Makefile + + # The following program can be used to generate a simple config file +diff --git a/bfd/Makefile.in b/bfd/Makefile.in +index daf11aae..02134615 100644 +--- a/bfd/Makefile.in ++++ b/bfd/Makefile.in +@@ -1037,9 +1037,11 @@ BFD64_BACKENDS = \ + mach-o-x86-64.lo \ + mmo.lo \ + pe-aarch64igen.lo \ ++ pe-loongarch64igen.lo \ + pe-x86_64.lo \ + pei-aarch64.lo \ + pei-ia64.lo \ ++ pei-loongarch64.lo \ + pei-x86_64.lo \ + pepigen.lo \ + pex64igen.lo \ +@@ -1082,6 +1084,7 @@ BFD64_BACKENDS_CFILES = \ + pe-x86_64.c \ + pei-aarch64.c \ + pei-ia64.c \ ++ pei-loongarch64.c \ + pei-x86_64.c \ + vms-alpha.c + +@@ -1140,7 +1143,7 @@ BUILD_CFILES = \ + elf32-ia64.c elf64-ia64.c \ + elf32-loongarch.c elf64-loongarch.c \ + elf32-riscv.c elf64-riscv.c \ +- peigen.c pepigen.c pex64igen.c pe-aarch64igen.c ++ peigen.c pepigen.c pex64igen.c pe-aarch64igen.c pe-loongarch64igen.c + + CFILES = $(SOURCE_CFILES) $(BUILD_CFILES) + SOURCE_HFILES = \ +@@ -1691,6 +1694,7 @@ distclean-compile: + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pe-arm-wince.Plo@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pe-arm.Plo@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pe-i386.Plo@am__quote@ ++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pe-loongarch64igen.Plo@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pe-mcore.Plo@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pe-sh.Plo@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pe-x86_64.Plo@am__quote@ +@@ -1700,6 +1704,7 @@ distclean-compile: + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pei-arm.Plo@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pei-i386.Plo@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pei-ia64.Plo@am__quote@ ++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pei-loongarch64.Plo@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pei-mcore.Plo@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pei-sh.Plo@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pei-x86_64.Plo@am__quote@ +@@ -2402,6 +2407,10 @@ pe-aarch64igen.c: peXXigen.c + $(AM_V_at)echo "#line 1 \"peXXigen.c\"" > $@ + $(AM_V_GEN)$(SED) -e s/XX/peAArch64/g < $< >> $@ + ++pe-loongarch64igen.c: peXXigen.c ++ $(AM_V_at)echo "#line 1 \"peXXigen.c\"" > $@ ++ $(AM_V_GEN)$(SED) -e s/XX/peLoongArch64/g < $< >> $@ ++ + host-aout.lo: Makefile + + # The following program can be used to generate a simple config file +diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h +index d7ea196f..b87d4942 100644 +--- a/bfd/bfd-in2.h ++++ b/bfd/bfd-in2.h +@@ -6259,6 +6259,43 @@ assembler and not (currently) written to any object files. */ + BFD_RELOC_LARCH_SUB24, + BFD_RELOC_LARCH_SUB32, + BFD_RELOC_LARCH_SUB64, ++ BFD_RELOC_LARCH_B16, ++ BFD_RELOC_LARCH_B21, ++ BFD_RELOC_LARCH_B26, ++ BFD_RELOC_LARCH_ABS_HI20, ++ BFD_RELOC_LARCH_ABS_LO12, ++ BFD_RELOC_LARCH_ABS64_LO20, ++ BFD_RELOC_LARCH_ABS64_HI12, ++ BFD_RELOC_LARCH_PCALA_HI20, ++ BFD_RELOC_LARCH_PCALA_LO12, ++ BFD_RELOC_LARCH_PCALA64_LO20, ++ BFD_RELOC_LARCH_PCALA64_HI12, ++ BFD_RELOC_LARCH_GOT_PC_HI20, ++ BFD_RELOC_LARCH_GOT_PC_LO12, ++ BFD_RELOC_LARCH_GOT64_PC_LO20, ++ BFD_RELOC_LARCH_GOT64_PC_HI12, ++ BFD_RELOC_LARCH_GOT_HI20, ++ BFD_RELOC_LARCH_GOT_LO12, ++ BFD_RELOC_LARCH_GOT64_LO20, ++ BFD_RELOC_LARCH_GOT64_HI12, ++ BFD_RELOC_LARCH_TLS_LE_HI20, ++ BFD_RELOC_LARCH_TLS_LE_LO12, ++ BFD_RELOC_LARCH_TLS_LE64_LO20, ++ BFD_RELOC_LARCH_TLS_LE64_HI12, ++ BFD_RELOC_LARCH_TLS_IE_PC_HI20, ++ BFD_RELOC_LARCH_TLS_IE_PC_LO12, ++ BFD_RELOC_LARCH_TLS_IE64_PC_LO20, ++ BFD_RELOC_LARCH_TLS_IE64_PC_HI12, ++ BFD_RELOC_LARCH_TLS_IE_HI20, ++ BFD_RELOC_LARCH_TLS_IE_LO12, ++ BFD_RELOC_LARCH_TLS_IE64_LO20, ++ BFD_RELOC_LARCH_TLS_IE64_HI12, ++ BFD_RELOC_LARCH_TLS_LD_PC_HI20, ++ BFD_RELOC_LARCH_TLS_LD_HI20, ++ BFD_RELOC_LARCH_TLS_GD_PC_HI20, ++ BFD_RELOC_LARCH_TLS_GD_HI20, ++ BFD_RELOC_LARCH_32_PCREL, ++ BFD_RELOC_LARCH_RELAX, + BFD_RELOC_UNUSED }; + + typedef enum bfd_reloc_code_real bfd_reloc_code_real_type; +diff --git a/bfd/bfd.c b/bfd/bfd.c +index 913ce2d6..f250f734 100644 +--- a/bfd/bfd.c ++++ b/bfd/bfd.c +@@ -1741,6 +1741,7 @@ bfd_get_sign_extend_vma (bfd *abfd) + || strcmp (name, "pei-aarch64-little") == 0 + || strcmp (name, "pe-arm-wince-little") == 0 + || strcmp (name, "pei-arm-wince-little") == 0 ++ || strcmp (name, "pei-loongarch64") == 0 + || strcmp (name, "aixcoff-rs6000") == 0 + || strcmp (name, "aix5coff64-rs6000") == 0) + return 1; +diff --git a/bfd/coff-loongarch64.c b/bfd/coff-loongarch64.c +new file mode 100644 +index 00000000..f752efbb +--- /dev/null ++++ b/bfd/coff-loongarch64.c +@@ -0,0 +1,169 @@ ++/* BFD back-end for LoongArch64 COFF files. ++ Copyright (C) 2022 Free Software Foundation, Inc. ++ ++ This file is part of BFD, the Binary File Descriptor library. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software ++ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, ++ MA 02110-1301, USA. */ ++ ++ ++#ifndef COFF_WITH_peLoongArch64 ++#define COFF_WITH_peLoongArch64 ++#endif ++ ++/* Note we have to make sure not to include headers twice. ++ Not all headers are wrapped in #ifdef guards, so we define ++ PEI_HEADERS to prevent double including here. */ ++#ifndef PEI_HEADERS ++#include "sysdep.h" ++#include "bfd.h" ++#include "libbfd.h" ++#include "coff/loongarch64.h" ++#include "coff/internal.h" ++#include "coff/pe.h" ++#include "libcoff.h" ++#include "libiberty.h" ++#endif ++ ++#include "libcoff.h" ++ ++/* The page size is a guess based on ELF. */ ++ ++#define COFF_PAGE_SIZE 0x4000 ++ ++/* All users of this file have bfd_octets_per_byte (abfd, sec) == 1. */ ++#define OCTETS_PER_BYTE(ABFD, SEC) 1 ++ ++#ifndef PCRELOFFSET ++#define PCRELOFFSET true ++#endif ++ ++/* Currently we don't handle any relocations. */ ++static reloc_howto_type pe_loongarch64_std_reloc_howto[] = ++ { ++ ++ }; ++ ++#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER 2 ++ ++#ifndef NUM_ELEM ++#define NUM_ELEM(a) ((sizeof (a)) / sizeof ((a)[0])) ++#endif ++ ++#define NUM_RELOCS NUM_ELEM (pe_loongarch64_std_reloc_howto) ++ ++#define RTYPE2HOWTO(cache_ptr, dst) \ ++ (cache_ptr)->howto = NULL ++ ++#ifndef bfd_pe_print_pdata ++#define bfd_pe_print_pdata NULL ++#endif ++ ++/* Handle include/coff/loongarch64.h external_reloc. */ ++#define SWAP_IN_RELOC_OFFSET H_GET_32 ++#define SWAP_OUT_RELOC_OFFSET H_PUT_32 ++ ++/* Return TRUE if this relocation should ++ appear in the output .reloc section. */ ++ ++static bool ++in_reloc_p (bfd * abfd ATTRIBUTE_UNUSED, ++ reloc_howto_type * howto) ++{ ++ return !howto->pc_relative; ++} ++ ++#include "coffcode.h" ++ ++/* Target vectors. */ ++const bfd_target ++#ifdef TARGET_SYM ++ TARGET_SYM = ++#else ++ loongarch64_pei_vec = ++#endif ++{ ++#ifdef TARGET_NAME ++ TARGET_NAME, ++#else ++ "pei-loongarch64", /* Name. */ ++#endif ++ bfd_target_coff_flavour, ++ BFD_ENDIAN_LITTLE, /* Data byte order is little. */ ++ BFD_ENDIAN_LITTLE, /* Header byte order is little. */ ++ ++ (HAS_RELOC | EXEC_P /* Object flags. */ ++ | HAS_LINENO | HAS_DEBUG ++ | HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED | BFD_COMPRESS | BFD_DECOMPRESS), ++ ++ (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* Section flags. */ ++#if defined(COFF_WITH_PE) ++ | SEC_LINK_ONCE | SEC_LINK_DUPLICATES | SEC_READONLY | SEC_DEBUGGING ++#endif ++ | SEC_CODE | SEC_DATA | SEC_EXCLUDE ), ++ ++#ifdef TARGET_UNDERSCORE ++ TARGET_UNDERSCORE, /* Leading underscore. */ ++#else ++ 0, /* Leading underscore. */ ++#endif ++ '/', /* Ar_pad_char. */ ++ 15, /* Ar_max_namelen. */ ++ 0, /* match priority. */ ++ TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols. */ ++ ++ /* Data conversion functions. */ ++ bfd_getl64, bfd_getl_signed_64, bfd_putl64, ++ bfd_getl32, bfd_getl_signed_32, bfd_putl32, ++ bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Data. */ ++ /* Header conversion functions. */ ++ bfd_getl64, bfd_getl_signed_64, bfd_putl64, ++ bfd_getl32, bfd_getl_signed_32, bfd_putl32, ++ bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Hdrs. */ ++ ++ /* Note that we allow an object file to be treated as a core file as well. */ ++ { /* bfd_check_format. */ ++ _bfd_dummy_target, ++ coff_object_p, ++ bfd_generic_archive_p, ++ coff_object_p ++ }, ++ { /* bfd_set_format. */ ++ _bfd_bool_bfd_false_error, ++ coff_mkobject, ++ _bfd_generic_mkarchive, ++ _bfd_bool_bfd_false_error ++ }, ++ { /* bfd_write_contents. */ ++ _bfd_bool_bfd_false_error, ++ coff_write_object_contents, ++ _bfd_write_archive_contents, ++ _bfd_bool_bfd_false_error ++ }, ++ ++ BFD_JUMP_TABLE_GENERIC (coff), ++ BFD_JUMP_TABLE_COPY (coff), ++ BFD_JUMP_TABLE_CORE (_bfd_nocore), ++ BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), ++ BFD_JUMP_TABLE_SYMBOLS (coff), ++ BFD_JUMP_TABLE_RELOCS (coff), ++ BFD_JUMP_TABLE_WRITE (coff), ++ BFD_JUMP_TABLE_LINK (coff), ++ BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), ++ ++ NULL, ++ ++ COFF_SWAP_TABLE ++}; +diff --git a/bfd/coffcode.h b/bfd/coffcode.h +index 6de6ecde..081fc170 100644 +--- a/bfd/coffcode.h ++++ b/bfd/coffcode.h +@@ -2231,6 +2231,12 @@ coff_set_arch_mach_hook (bfd *abfd, void * filehdr) + machine = internal_f->f_flags & F_AARCH64_ARCHITECTURE_MASK; + break; + #endif ++#ifdef LOONGARCH64MAGIC ++ case LOONGARCH64MAGIC: ++ arch = bfd_arch_loongarch; ++ machine = internal_f->f_flags & F_LOONGARCH64_ARCHITECTURE_MASK; ++ break; ++#endif + #ifdef Z80MAGIC + case Z80MAGIC: + arch = bfd_arch_z80; +@@ -2795,6 +2801,12 @@ coff_set_flags (bfd * abfd, + return true; + #endif + ++#ifdef LOONGARCH64MAGIC ++ case bfd_arch_loongarch: ++ * magicp = LOONGARCH64MAGIC; ++ return true; ++#endif ++ + #ifdef ARMMAGIC + case bfd_arch_arm: + #ifdef ARM_WINCE +@@ -3889,7 +3901,7 @@ coff_write_object_contents (bfd * abfd) + internal_f.f_flags |= IMAGE_FILE_LARGE_ADDRESS_AWARE; + #endif + +-#if !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64) ++#if !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64) && !defined(COFF_WITH_peLoongArch64) + #ifdef COFF_WITH_PE + internal_f.f_flags |= IMAGE_FILE_32BIT_MACHINE; + #else +@@ -3943,6 +3955,11 @@ coff_write_object_contents (bfd * abfd) + internal_a.magic = ZMAGIC; + #endif + ++#if defined(LOONGARCH64) ++#define __A_MAGIC_SET__ ++ internal_a.magic = ZMAGIC; ++#endif ++ + #if defined MCORE_PE + #define __A_MAGIC_SET__ + internal_a.magic = IMAGE_NT_OPTIONAL_HDR_MAGIC; +diff --git a/bfd/config.bfd b/bfd/config.bfd +index b59b6487..385944ec 100644 +--- a/bfd/config.bfd ++++ b/bfd/config.bfd +@@ -1465,7 +1465,7 @@ case "${targ}" in + + loongarch64-*) + targ_defvec=loongarch_elf64_vec +- targ_selvecs="loongarch_elf32_vec loongarch_elf64_vec" ++ targ_selvecs="loongarch_elf32_vec loongarch_elf64_vec loongarch64_pei_vec" + want64=true + ;; + #endif +diff --git a/bfd/configure b/bfd/configure +index d72288f4..d5c6ddd5 100755 +--- a/bfd/configure ++++ b/bfd/configure +@@ -13473,6 +13473,7 @@ do + lm32_elf32_fdpic_vec) tb="$tb elf32-lm32.lo elf32.lo $elf" ;; + loongarch_elf32_vec) tb="$tb elf32-loongarch.lo elfxx-loongarch.lo elf32.lo elf-ifunc.lo $elf" ;; + loongarch_elf64_vec) tb="$tb elf64-loongarch.lo elf64.lo elfxx-loongarch.lo elf32.lo elf-ifunc.lo $elf"; target_size=64 ;; ++ loongarch64_pei_vec) tb="$tb pei-loongarch64.lo pe-loongarch64igen.lo $coff"; target_size=64 ;; + m32c_elf32_vec) tb="$tb elf32-m32c.lo elf32.lo $elf" ;; + m32r_elf32_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;; + m32r_elf32_le_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;; +diff --git a/bfd/configure.ac b/bfd/configure.ac +index 9839a974..3f45174f 100644 +--- a/bfd/configure.ac ++++ b/bfd/configure.ac +@@ -506,6 +506,7 @@ do + lm32_elf32_fdpic_vec) tb="$tb elf32-lm32.lo elf32.lo $elf" ;; + loongarch_elf32_vec) tb="$tb elf32-loongarch.lo elfxx-loongarch.lo elf32.lo elf-ifunc.lo $elf" ;; + loongarch_elf64_vec) tb="$tb elf64-loongarch.lo elf64.lo elfxx-loongarch.lo elf32.lo elf-ifunc.lo $elf"; target_size=64 ;; ++ loongarch64_pei_vec) tb="$tb pei-loongarch64.lo pe-loongarch64igen.lo $coff"; target_size=64 ;; + m32c_elf32_vec) tb="$tb elf32-m32c.lo elf32.lo $elf" ;; + m32r_elf32_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;; + m32r_elf32_le_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;; +diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c +index 5b44901b..8a9c40af 100644 +--- a/bfd/elfnn-loongarch.c ++++ b/bfd/elfnn-loongarch.c +@@ -122,14 +122,17 @@ struct loongarch_elf_link_hash_table + + #define elf_backend_plt_readonly 1 + +-#define elf_backend_want_plt_sym 0 ++#define elf_backend_want_plt_sym 1 + #define elf_backend_plt_alignment 4 + #define elf_backend_can_gc_sections 1 ++#define elf_backend_can_refcount 1 + #define elf_backend_want_got_sym 1 + + #define elf_backend_got_header_size (GOT_ENTRY_SIZE * 1) + + #define elf_backend_want_dynrelro 1 ++#define elf_backend_rela_normal 1 ++#define elf_backend_default_execstack 0 + + /* Generate a PLT header. */ + +@@ -413,8 +416,22 @@ elfNN_loongarch_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info) + elf_elfheader (obfd)->e_flags = in_flags; + return true; + } ++ else if (out_flags != in_flags) ++ { ++ if ((EF_LOONGARCH_IS_OBJ_V0 (out_flags) ++ && EF_LOONGARCH_IS_OBJ_V1 (in_flags)) ++ || (EF_LOONGARCH_IS_OBJ_V0 (in_flags) ++ && EF_LOONGARCH_IS_OBJ_V1 (out_flags))) ++ { ++ elf_elfheader (obfd)->e_flags |= EF_LOONGARCH_OBJABI_V1; ++ out_flags = elf_elfheader (obfd)->e_flags; ++ in_flags = out_flags; ++ } ++ } + + /* Disallow linking different ABIs. */ ++ /* Only check relocation version. ++ The obj_v0 is compatible with obj_v1. */ + if (EF_LOONGARCH_ABI(out_flags ^ in_flags) & EF_LOONGARCH_ABI_MASK) + { + _bfd_error_handler (_("%pB: can't link different ABI object."), ibfd); +@@ -607,9 +624,6 @@ loongarch_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, + struct elf_link_hash_entry *h; + Elf_Internal_Sym *isym = NULL; + +- int need_dynreloc; +- int only_need_pcrel; +- + r_symndx = ELFNN_R_SYM (rel->r_info); + r_type = ELFNN_R_TYPE (rel->r_info); + +@@ -622,7 +636,7 @@ loongarch_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, + if (r_symndx < symtab_hdr->sh_info) + { + /* A local symbol. */ +- isym = bfd_sym_from_r_symndx (&htab->sym_cache, abfd, r_symndx); ++ isym = bfd_sym_from_r_symndx (&htab->elf.sym_cache, abfd, r_symndx); + if (isym == NULL) + return false; + +@@ -655,17 +669,20 @@ loongarch_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, + if (htab->elf.dynobj == NULL) + htab->elf.dynobj = abfd; + ++ /* Create 'irelifunc' in PIC object. */ ++ if (bfd_link_pic (info) ++ && !_bfd_elf_create_ifunc_sections (htab->elf.dynobj, info)) ++ return false; ++ /* If '.plt' not represent, create '.iplt' to deal with ifunc. */ ++ else if (!htab->elf.splt ++ && !_bfd_elf_create_ifunc_sections (htab->elf.dynobj, info)) ++ return false; + /* Create the ifunc sections, iplt and ipltgot, for static + executables. */ + if ((r_type == R_LARCH_64 || r_type == R_LARCH_32) + && !_bfd_elf_create_ifunc_sections (htab->elf.dynobj, info)) + return false; + +- if (!htab->elf.splt +- && !_bfd_elf_create_ifunc_sections (htab->elf.dynobj, info)) +- /* If '.plt' not represent, create '.iplt' to deal with ifunc. */ +- return false; +- + if (h->plt.refcount < 0) + h->plt.refcount = 0; + h->plt.refcount++; +@@ -674,17 +691,27 @@ loongarch_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, + elf_tdata (info->output_bfd)->has_gnu_osabi |= elf_gnu_osabi_ifunc; + } + +- need_dynreloc = 0; +- only_need_pcrel = 0; ++ int need_dynreloc = 0; ++ int only_need_pcrel = 0; ++ + switch (r_type) + { ++ case R_LARCH_GOT_PC_HI20: ++ case R_LARCH_GOT_HI20: + case R_LARCH_SOP_PUSH_GPREL: ++ /* For la.global. */ ++ if (h) ++ h->pointer_equality_needed = 1; + if (!loongarch_elf_record_tls_and_got_reference (abfd, info, h, + r_symndx, + GOT_NORMAL)) + return false; + break; + ++ case R_LARCH_TLS_LD_PC_HI20: ++ case R_LARCH_TLS_LD_HI20: ++ case R_LARCH_TLS_GD_PC_HI20: ++ case R_LARCH_TLS_GD_HI20: + case R_LARCH_SOP_PUSH_TLS_GD: + if (!loongarch_elf_record_tls_and_got_reference (abfd, info, h, + r_symndx, +@@ -692,6 +719,8 @@ loongarch_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, + return false; + break; + ++ case R_LARCH_TLS_IE_PC_HI20: ++ case R_LARCH_TLS_IE_HI20: + case R_LARCH_SOP_PUSH_TLS_GOT: + if (bfd_link_pic (info)) + /* May fail for lazy-bind. */ +@@ -703,6 +732,7 @@ loongarch_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, + return false; + break; + ++ case R_LARCH_TLS_LE_HI20: + case R_LARCH_SOP_PUSH_TLS_TPREL: + if (!bfd_link_executable (info)) + return false; +@@ -715,6 +745,7 @@ loongarch_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, + return false; + break; + ++ case R_LARCH_ABS_HI20: + case R_LARCH_SOP_PUSH_ABSOLUTE: + if (h != NULL) + /* If this reloc is in a read-only section, we might +@@ -726,16 +757,51 @@ loongarch_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, + h->non_got_ref = 1; + break; + +- case R_LARCH_SOP_PUSH_PCREL: ++ case R_LARCH_PCALA_HI20: + if (h != NULL) + { ++ /* For pcalau12i + jirl. */ ++ h->needs_plt = 1; ++ if (h->plt.refcount < 0) ++ h->plt.refcount = 0; ++ h->plt.refcount++; ++ + h->non_got_ref = 1; ++ h->pointer_equality_needed = 1; ++ } ++ ++ break; ++ ++ case R_LARCH_B21: ++ case R_LARCH_B16: ++ case R_LARCH_B26: ++ if (h != NULL) ++ { ++ h->needs_plt = 1; ++ if (!bfd_link_pic (info)) ++ h->non_got_ref = 1; ++ ++ /* We try to create PLT stub for all non-local function. */ ++ if (h->plt.refcount < 0) ++ h->plt.refcount = 0; ++ h->plt.refcount++; ++ } ++ ++ break; ++ ++ case R_LARCH_SOP_PUSH_PCREL: ++ if (h != NULL) ++ { ++ if (!bfd_link_pic (info)) ++ h->non_got_ref = 1; + + /* We try to create PLT stub for all non-local function. */ + if (h->plt.refcount < 0) + h->plt.refcount = 0; + h->plt.refcount++; ++ h->pointer_equality_needed = 1; + } ++ + break; + + case R_LARCH_SOP_PUSH_PLT_PCREL: +@@ -762,6 +828,7 @@ loongarch_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, + case R_LARCH_JUMP_SLOT: + case R_LARCH_32: + case R_LARCH_64: ++ + need_dynreloc = 1; + + /* If resolved symbol is defined in this object, +@@ -774,9 +841,6 @@ loongarch_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, + Thus, only under pde, it needs pcrel only. We discard it. */ + only_need_pcrel = bfd_link_pde (info); + +- if (h != NULL) +- h->non_got_ref = 1; +- + if (h != NULL + && (!bfd_link_pic (info) + || h->type == STT_GNU_IFUNC)) +@@ -899,9 +963,7 @@ loongarch_elf_adjust_dynamic_symbol (struct bfd_link_info *info, + struct elf_link_hash_entry *h) + { + struct loongarch_elf_link_hash_table *htab; +- struct loongarch_elf_link_hash_entry *eh; + bfd *dynobj; +- asection *s, *srel; + + htab = loongarch_elf_hash_table (info); + BFD_ASSERT (htab != NULL); +@@ -918,7 +980,7 @@ loongarch_elf_adjust_dynamic_symbol (struct bfd_link_info *info, + (although we could actually do it here). */ + if (h->type == STT_FUNC || h->type == STT_GNU_IFUNC || h->needs_plt) + { +- if (h->plt.refcount < 0 ++ if (h->plt.refcount <= 0 + || (h->type != STT_GNU_IFUNC + && (SYMBOL_REFERENCES_LOCAL (info, h) + || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT +@@ -931,8 +993,6 @@ loongarch_elf_adjust_dynamic_symbol (struct bfd_link_info *info, + h->plt.offset = MINUS_ONE; + h->needs_plt = 0; + } +- else +- h->needs_plt = 1; + + return true; + } +@@ -951,73 +1011,9 @@ loongarch_elf_adjust_dynamic_symbol (struct bfd_link_info *info, + return true; + } + +- /* This is a reference to a symbol defined by a dynamic object which +- is not a function. */ +- +- /* If we are creating a shared library, we must presume that the +- only references to the symbol are via the global offset table. +- For such cases we need not do anything here; the relocations will +- be handled correctly by relocate_section. */ +- if (bfd_link_dll (info)) +- return true; +- +- /* If there are no references to this symbol that do not use the +- GOT, we don't need to generate a copy reloc. */ +- if (!h->non_got_ref) +- return true; +- +- /* If -z nocopyreloc was given, we won't generate them either. */ +- if (info->nocopyreloc) +- { +- h->non_got_ref = 0; +- return true; +- } +- +- /* If we don't find any dynamic relocs in read-only sections, then +- we'll be keeping the dynamic relocs and avoiding the copy reloc. */ +- if (!readonly_dynrelocs (h)) +- { +- h->non_got_ref = 0; +- return true; +- } +- +- /* We must allocate the symbol in our .dynbss section, which will +- become part of the .bss section of the executable. There will be +- an entry for this symbol in the .dynsym section. The dynamic +- object will contain position independent code, so all references +- from the dynamic object to this symbol will go through the global +- offset table. The dynamic linker will use the .dynsym entry to +- determine the address it must put in the global offset table, so +- both the dynamic object and the regular object will refer to the +- same memory location for the variable. */ +- +- /* We must generate a R_LARCH_COPY reloc to tell the dynamic linker +- to copy the initial value out of the dynamic object and into the +- runtime process image. We need to remember the offset into the +- .rel.bss section we are going to use. */ +- eh = (struct loongarch_elf_link_hash_entry *) h; +- if (eh->tls_type & ~GOT_NORMAL) +- { +- s = htab->sdyntdata; +- srel = htab->elf.srelbss; +- } +- else if ((h->root.u.def.section->flags & SEC_READONLY) != 0) +- { +- s = htab->elf.sdynrelro; +- srel = htab->elf.sreldynrelro; +- } +- else +- { +- s = htab->elf.sdynbss; +- srel = htab->elf.srelbss; +- } +- if ((h->root.u.def.section->flags & SEC_ALLOC) != 0 && h->size != 0) +- { +- srel->size += sizeof (ElfNN_External_Rela); +- h->needs_copy = 1; +- } +- +- return _bfd_elf_adjust_dynamic_copy (info, h, s); ++ /* R_LARCH_COPY is not adept glibc, not to generate. */ ++ /* Can not print anything, because make check ld. */ ++ return true; + } + + /* Allocate space in .plt, .got and associated reloc sections for +@@ -1039,6 +1035,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) + + info = (struct bfd_link_info *) inf; + htab = loongarch_elf_hash_table (info); ++ bool dyn = htab->elf.dynamic_sections_created; + BFD_ASSERT (htab != NULL); + + do +@@ -1052,9 +1049,12 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) + + if (htab->elf.splt) + { +- if (h->dynindx == -1 && !h->forced_local +- && !bfd_elf_link_record_dynamic_symbol (info, h)) +- return false; ++ if (h->dynindx == -1 && !h->forced_local && dyn ++ && h->root.type == bfd_link_hash_undefweak) ++ { ++ if (!bfd_elf_link_record_dynamic_symbol (info, h)) ++ return false; ++ } + + if (!WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, bfd_link_pic (info), h) + && h->type != STT_GNU_IFUNC) +@@ -1090,7 +1090,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) + location in the .plt. This is required to make function + pointers compare as equal between the normal executable and + the shared library. */ +- if (!bfd_link_pic(info) ++ if (!bfd_link_pic (info) + && !h->def_regular) + { + h->root.u.def.section = plt; +@@ -1107,51 +1107,68 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) + if (0 < h->got.refcount) + { + asection *s; +- bool dyn; + int tls_type = loongarch_elf_hash_entry (h)->tls_type; + + /* Make sure this symbol is output as a dynamic symbol. + Undefined weak syms won't yet be marked as dynamic. */ +- if (h->dynindx == -1 && !h->forced_local) ++ if (h->dynindx == -1 && !h->forced_local && dyn ++ && h->root.type == bfd_link_hash_undefweak) + { +- if (SYMBOL_REFERENCES_LOCAL (info, h) +- && (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT) +- && h->start_stop) +- { +- /* The pr21964-4. do nothing. */ +- } +- else +- { +- if( !bfd_elf_link_record_dynamic_symbol (info, h)) +- return false; +- } ++ if (!bfd_elf_link_record_dynamic_symbol (info, h)) ++ return false; + } + + s = htab->elf.sgot; + h->got.offset = s->size; +- dyn = htab->elf.dynamic_sections_created; + if (tls_type & (GOT_TLS_GD | GOT_TLS_IE)) + { + /* TLS_GD needs two dynamic relocs and two GOT slots. */ + if (tls_type & GOT_TLS_GD) + { + s->size += 2 * GOT_ENTRY_SIZE; +- htab->elf.srelgot->size += 2 * sizeof (ElfNN_External_Rela); ++ if (bfd_link_executable (info)) ++ { ++ /* Link exe and not defined local. */ ++ if (!SYMBOL_REFERENCES_LOCAL (info, h)) ++ htab->elf.srelgot->size += 2 * sizeof (ElfNN_External_Rela); ++ } ++ else ++ { ++ if (SYMBOL_REFERENCES_LOCAL (info, h)) ++ htab->elf.srelgot->size += sizeof (ElfNN_External_Rela); ++ else ++ htab->elf.srelgot->size += 2 * sizeof (ElfNN_External_Rela); ++ } + } + + /* TLS_IE needs one dynamic reloc and one GOT slot. */ + if (tls_type & GOT_TLS_IE) + { + s->size += GOT_ENTRY_SIZE; +- htab->elf.srelgot->size += sizeof (ElfNN_External_Rela); ++ ++ if (bfd_link_executable (info)) ++ { ++ /* Link exe and not defined local. */ ++ if (!SYMBOL_REFERENCES_LOCAL (info, h)) ++ htab->elf.srelgot->size += sizeof (ElfNN_External_Rela); ++ } ++ else ++ { ++ htab->elf.srelgot->size += sizeof (ElfNN_External_Rela); ++ } + } + } + else + { + s->size += GOT_ENTRY_SIZE; +- if ((WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, bfd_link_pic (info), h) +- && !UNDEFWEAK_NO_DYNAMIC_RELOC (info, h)) +- || h->type == STT_GNU_IFUNC) ++ if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT ++ || h->root.type != bfd_link_hash_undefweak) ++ && (bfd_link_pic (info) ++ || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, bfd_link_pic (info), ++ h)) ++ && !UNDEFWEAK_NO_DYNAMIC_RELOC (info, h)) ++ /* Undefined weak symbol in static PIE resolves to 0 without ++ any dynamic relocations. */ + htab->elf.srelgot->size += sizeof (ElfNN_External_Rela); + } + } +@@ -1161,7 +1178,13 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) + if (h->dyn_relocs == NULL) + return true; + +- if (SYMBOL_REFERENCES_LOCAL (info, h)) ++ /* Extra dynamic relocate, ++ * R_LARCH_64 ++ * R_LARCH_TLS_DTPRELNN ++ * R_LARCH_JUMP_SLOT ++ * R_LARCH_NN. */ ++ ++ if (SYMBOL_CALLS_LOCAL (info, h)) + { + struct elf_dyn_relocs **pp; + +@@ -1178,13 +1201,20 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) + + if (h->root.type == bfd_link_hash_undefweak) + { +- if (UNDEFWEAK_NO_DYNAMIC_RELOC (info, h)) ++ if (UNDEFWEAK_NO_DYNAMIC_RELOC (info, h) ++ || ELF_ST_VISIBILITY (h->other) != STV_DEFAULT ++ || (!bfd_link_pic (info) && h->non_got_ref)) + h->dyn_relocs = NULL; +- else if (h->dynindx == -1 && !h->forced_local +- /* Make sure this symbol is output as a dynamic symbol. +- Undefined weak syms won't yet be marked as dynamic. */ +- && !bfd_elf_link_record_dynamic_symbol (info, h)) +- return false; ++ else if (h->dynindx == -1 && !h->forced_local) ++ { ++ /* Make sure this symbol is output as a dynamic symbol. ++ Undefined weak syms won't yet be marked as dynamic. */ ++ if (!bfd_elf_link_record_dynamic_symbol (info, h)) ++ return false; ++ ++ if (h->dynindx == -1) ++ h->dyn_relocs = NULL; ++ } + } + + for (p = h->dyn_relocs; p != NULL; p = p->next) +@@ -1196,12 +1226,264 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) + return true; + } + ++/* A modified version of _bfd_elf_allocate_ifunc_dyn_relocs. ++ For local def and ref ifunc, ++ dynamic relocations are stored in ++ 1. rela.srelgot section in dynamic object (dll or exec). ++ 2. rela.irelplt section in static executable. ++ Unlike _bfd_elf_allocate_ifunc_dyn_relocs, rela.srelgot is used ++ instead of rela.srelplt. Glibc ELF loader will not support ++ R_LARCH_IRELATIVE relocation in rela.plt. */ ++ ++static bool ++local_allocate_ifunc_dyn_relocs (struct bfd_link_info *info, ++ struct elf_link_hash_entry *h, ++ struct elf_dyn_relocs **head, ++ unsigned int plt_entry_size, ++ unsigned int plt_header_size, ++ unsigned int got_entry_size, ++ bool avoid_plt) ++{ ++ asection *plt, *gotplt, *relplt; ++ struct elf_dyn_relocs *p; ++ unsigned int sizeof_reloc; ++ const struct elf_backend_data *bed; ++ struct elf_link_hash_table *htab; ++ /* If AVOID_PLT is TRUE, don't use PLT if possible. */ ++ bool use_plt = !avoid_plt || h->plt.refcount > 0; ++ bool need_dynreloc = !use_plt || bfd_link_pic (info); ++ ++ /* When a PIC object references a STT_GNU_IFUNC symbol defined ++ in executable or it isn't referenced via PLT, the address of ++ the resolved function may be used. But in non-PIC executable, ++ the address of its plt slot may be used. Pointer equality may ++ not work correctly. PIE or non-PLT reference should be used if ++ pointer equality is required here. ++ ++ If STT_GNU_IFUNC symbol is defined in position-dependent executable, ++ backend should change it to the normal function and set its address ++ to its PLT entry which should be resolved by R_*_IRELATIVE at ++ run-time. All external references should be resolved to its PLT in ++ executable. */ ++ if (!need_dynreloc ++ && !(bfd_link_pde (info) && h->def_regular) ++ && (h->dynindx != -1 ++ || info->export_dynamic) ++ && h->pointer_equality_needed) ++ { ++ info->callbacks->einfo ++ /* xgettext:c-format. */ ++ (_("%F%P: dynamic STT_GNU_IFUNC symbol `%s' with pointer " ++ "equality in `%pB' can not be used when making an " ++ "executable; recompile with -fPIE and relink with -pie\n"), ++ h->root.root.string, ++ h->root.u.def.section->owner); ++ bfd_set_error (bfd_error_bad_value); ++ return false; ++ } ++ ++ htab = elf_hash_table (info); ++ ++ /* When the symbol is marked with regular reference, if PLT isn't used ++ or we are building a PIC object, we must keep dynamic relocation ++ if there is non-GOT reference and use PLT if there is PC-relative ++ reference. */ ++ if (need_dynreloc && h->ref_regular) ++ { ++ bool keep = false; ++ for (p = *head; p != NULL; p = p->next) ++ if (p->count) ++ { ++ h->non_got_ref = 1; ++ /* Need dynamic relocations for non-GOT reference. */ ++ keep = true; ++ if (p->pc_count) ++ { ++ /* Must use PLT for PC-relative reference. */ ++ use_plt = true; ++ need_dynreloc = bfd_link_pic (info); ++ break; ++ } ++ } ++ if (keep) ++ goto keep; ++ } ++ ++ /* Support garbage collection against STT_GNU_IFUNC symbols. */ ++ if (h->plt.refcount <= 0 && h->got.refcount <= 0) ++ { ++ h->got = htab->init_got_offset; ++ h->plt = htab->init_plt_offset; ++ *head = NULL; ++ return true; ++ } ++ ++ /* Return and discard space for dynamic relocations against it if ++ it is never referenced. */ ++ if (!h->ref_regular) ++ { ++ if (h->plt.refcount > 0 ++ || h->got.refcount > 0) ++ abort (); ++ h->got = htab->init_got_offset; ++ h->plt = htab->init_plt_offset; ++ *head = NULL; ++ return true; ++ } ++ ++ keep: ++ bed = get_elf_backend_data (info->output_bfd); ++ if (bed->rela_plts_and_copies_p) ++ sizeof_reloc = bed->s->sizeof_rela; ++ else ++ sizeof_reloc = bed->s->sizeof_rel; ++ ++ /* When building a static executable, use iplt, igot.plt and ++ rela.iplt sections for STT_GNU_IFUNC symbols. */ ++ if (htab->splt != NULL) ++ { ++ plt = htab->splt; ++ gotplt = htab->sgotplt; ++ /* Change dynamic info of ifunc gotplt from srelplt to srelgot. */ ++ relplt = htab->srelgot; ++ ++ /* If this is the first plt entry and PLT is used, make room for ++ the special first entry. */ ++ if (plt->size == 0 && use_plt) ++ plt->size += plt_header_size; ++ } ++ else ++ { ++ plt = htab->iplt; ++ gotplt = htab->igotplt; ++ relplt = htab->irelplt; ++ } ++ ++ if (use_plt) ++ { ++ /* Don't update value of STT_GNU_IFUNC symbol to PLT. We need ++ the original value for R_*_IRELATIVE. */ ++ h->plt.offset = plt->size; ++ ++ /* Make room for this entry in the plt/iplt section. */ ++ plt->size += plt_entry_size; ++ ++ /* We also need to make an entry in the got.plt/got.iplt section, ++ which will be placed in the got section by the linker script. */ ++ gotplt->size += got_entry_size; ++ } ++ ++ /* We also need to make an entry in the rela.plt/.rela.iplt ++ section for GOTPLT relocation if PLT is used. */ ++ if (use_plt) ++ { ++ relplt->size += sizeof_reloc; ++ relplt->reloc_count++; ++ } ++ ++ /* We need dynamic relocation for STT_GNU_IFUNC symbol only when ++ there is a non-GOT reference in a PIC object or PLT isn't used. */ ++ if (!need_dynreloc || !h->non_got_ref) ++ *head = NULL; ++ ++ /* Finally, allocate space. */ ++ p = *head; ++ if (p != NULL) ++ { ++ bfd_size_type count = 0; ++ do ++ { ++ count += p->count; ++ p = p->next; ++ } ++ while (p != NULL); ++ ++ htab->ifunc_resolvers = count != 0; ++ ++ /* Dynamic relocations are stored in ++ 1. rela.srelgot section in PIC object. ++ 2. rela.srelgot section in dynamic executable. ++ 3. rela.irelplt section in static executable. */ ++ if (htab->splt != NULL) ++ htab->srelgot->size += count * sizeof_reloc; ++ else ++ { ++ relplt->size += count * sizeof_reloc; ++ relplt->reloc_count += count; ++ } ++ } ++ ++ /* For STT_GNU_IFUNC symbol, got.plt has the real function address ++ and got has the PLT entry adddress. We will load the GOT entry ++ with the PLT entry in finish_dynamic_symbol if it is used. For ++ branch, it uses got.plt. For symbol value, if PLT is used, ++ 1. Use got.plt in a PIC object if it is forced local or not ++ dynamic. ++ 2. Use got.plt in a non-PIC object if pointer equality isn't ++ needed. ++ 3. Use got.plt in PIE. ++ 4. Use got.plt if got isn't used. ++ 5. Otherwise use got so that it can be shared among different ++ objects at run-time. ++ If PLT isn't used, always use got for symbol value. ++ We only need to relocate got entry in PIC object or in dynamic ++ executable without PLT. */ ++ if (use_plt ++ && (h->got.refcount <= 0 ++ || (bfd_link_pic (info) ++ && (h->dynindx == -1 ++ || h->forced_local)) ++ || ( ++ !h->pointer_equality_needed) ++ || htab->sgot == NULL)) ++ { ++ /* Use got.plt. */ ++ h->got.offset = (bfd_vma) -1; ++ } ++ else ++ { ++ if (!use_plt) ++ { ++ /* PLT isn't used. */ ++ h->plt.offset = (bfd_vma) -1; ++ } ++ if (h->got.refcount <= 0) ++ { ++ /* GOT isn't need when there are only relocations for static ++ pointers. */ ++ h->got.offset = (bfd_vma) -1; ++ } ++ else ++ { ++ h->got.offset = htab->sgot->size; ++ htab->sgot->size += got_entry_size; ++ /* Need to relocate the GOT entry in a PIC object or PLT isn't ++ used. Otherwise, the GOT entry will be filled with the PLT ++ entry and dynamic GOT relocation isn't needed. */ ++ if (need_dynreloc) ++ { ++ /* For non-static executable, dynamic GOT relocation is in ++ rela.got section, but for static executable, it is ++ in rela.iplt section. */ ++ if (htab->splt != NULL) ++ htab->srelgot->size += sizeof_reloc; ++ else ++ { ++ relplt->size += sizeof_reloc; ++ relplt->reloc_count++; ++ } ++ } ++ } ++ } ++ ++ return true; ++} ++ + /* Allocate space in .plt, .got and associated reloc sections for + ifunc dynamic relocs. */ + + static bool +-elfNN_loongarch_allocate_ifunc_dynrelocs (struct elf_link_hash_entry *h, +- void *inf) ++elfNN_allocate_ifunc_dynrelocs (struct elf_link_hash_entry *h, void *inf) + { + struct bfd_link_info *info; + /* An example of a bfd_link_hash_indirect symbol is versioned +@@ -1223,14 +1505,24 @@ elfNN_loongarch_allocate_ifunc_dynrelocs (struct elf_link_hash_entry *h, + + /* Since STT_GNU_IFUNC symbol must go through PLT, we handle it + here if it is defined and referenced in a non-shared object. */ +- if (h->type == STT_GNU_IFUNC +- && h->def_regular) +- return _bfd_elf_allocate_ifunc_dyn_relocs (info, h, +- &h->dyn_relocs, +- PLT_ENTRY_SIZE, +- PLT_HEADER_SIZE, +- GOT_ENTRY_SIZE, +- false); ++ if (h->type == STT_GNU_IFUNC && h->def_regular) ++ { ++ if (SYMBOL_REFERENCES_LOCAL (info, h)) ++ return local_allocate_ifunc_dyn_relocs (info, h, ++ &h->dyn_relocs, ++ PLT_ENTRY_SIZE, ++ PLT_HEADER_SIZE, ++ GOT_ENTRY_SIZE, ++ false); ++ else ++ return _bfd_elf_allocate_ifunc_dyn_relocs (info, h, ++ &h->dyn_relocs, ++ PLT_ENTRY_SIZE, ++ PLT_HEADER_SIZE, ++ GOT_ENTRY_SIZE, ++ false); ++ } ++ + return true; + } + +@@ -1238,7 +1530,7 @@ elfNN_loongarch_allocate_ifunc_dynrelocs (struct elf_link_hash_entry *h, + ifunc dynamic relocs. */ + + static bool +-elfNN_loongarch_allocate_local_dynrelocs (void **slot, void *inf) ++elfNN_allocate_local_ifunc_dynrelocs (void **slot, void *inf) + { + struct elf_link_hash_entry *h = (struct elf_link_hash_entry *) *slot; + +@@ -1249,7 +1541,7 @@ elfNN_loongarch_allocate_local_dynrelocs (void **slot, void *inf) + || h->root.type != bfd_link_hash_defined) + abort (); + +- return elfNN_loongarch_allocate_ifunc_dynrelocs (h, inf); ++ return elfNN_allocate_ifunc_dynrelocs (h, inf); + } + + /* Set DF_TEXTREL if we find any dynamic relocs that apply to +@@ -1299,15 +1591,16 @@ loongarch_elf_size_dynamic_sections (bfd *output_bfd, + if (bfd_link_executable (info) && !info->nointerp) + { + const char *interpreter; +- flagword flags = elf_elfheader (output_bfd)->e_flags; + s = bfd_get_linker_section (dynobj, ".interp"); + BFD_ASSERT (s != NULL); +- if (EF_LOONGARCH_IS_ILP32 (flags)) ++ ++ if (elf_elfheader (output_bfd)->e_ident[EI_CLASS] == ELFCLASS32) + interpreter = "/lib32/ld.so.1"; +- else if (EF_LOONGARCH_IS_LP64 (flags)) ++ else if (elf_elfheader (output_bfd)->e_ident[EI_CLASS] == ELFCLASS64) + interpreter = "/lib64/ld.so.1"; + else + interpreter = "/lib/ld.so.1"; ++ + s->contents = (unsigned char *) interpreter; + s->size = strlen (interpreter) + 1; + } +@@ -1367,16 +1660,21 @@ loongarch_elf_size_dynamic_sections (bfd *output_bfd, + if (0 < *local_got) + { + *local_got = s->size; +- s->size += GOT_ENTRY_SIZE; + ++ /* TLS gd use two got. */ + if (*local_tls_type & GOT_TLS_GD) ++ s->size += GOT_ENTRY_SIZE * 2; ++ else ++ /* Normal got, tls ie/ld use one got. */ + s->size += GOT_ENTRY_SIZE; + +- /* If R_LARCH_RELATIVE. */ +- if (bfd_link_pic (info) +- /* Or R_LARCH_TLS_DTPRELNN or R_LARCH_TLS_TPRELNN. */ +- || (*local_tls_type & (GOT_TLS_GD | GOT_TLS_IE))) +- srel->size += sizeof (ElfNN_External_Rela); ++ if (bfd_link_executable (info) ++ && (*local_tls_type & (GOT_TLS_GD| GOT_TLS_IE))) ++ ;/* Do nothing. */ ++ else ++ { ++ srel->size += sizeof (ElfNN_External_Rela); ++ } + } + else + *local_got = MINUS_ONE; +@@ -1389,11 +1687,11 @@ loongarch_elf_size_dynamic_sections (bfd *output_bfd, + + /* Allocate global ifunc sym .plt and .got entries, and space for global + ifunc sym dynamic relocs. */ +- elf_link_hash_traverse (&htab->elf, elfNN_loongarch_allocate_ifunc_dynrelocs, info); ++ elf_link_hash_traverse (&htab->elf, elfNN_allocate_ifunc_dynrelocs, info); + + /* Allocate .plt and .got entries, and space for local ifunc symbols. */ + htab_traverse (htab->loc_hash_table, +- (void *) elfNN_loongarch_allocate_local_dynrelocs, info); ++ (void *) elfNN_allocate_local_ifunc_dynrelocs, info); + + /* Don't allocate .got.plt section if there are no PLT. */ + if (htab->elf.sgotplt && htab->elf.sgotplt->size == GOTPLT_HEADER_SIZE +@@ -1542,10 +1840,13 @@ loongarch_top (int64_t *val) + static void + loongarch_elf_append_rela (bfd *abfd, asection *s, Elf_Internal_Rela *rel) + { ++ BFD_ASSERT (s && s->contents); + const struct elf_backend_data *bed; + bfd_byte *loc; + + bed = get_elf_backend_data (abfd); ++ if (!(s->size > s->reloc_count * bed->s->sizeof_rela)) ++ BFD_ASSERT (s->size > s->reloc_count * bed->s->sizeof_rela); + loc = s->contents + (s->reloc_count++ * bed->s->sizeof_rela); + bed->s->swap_reloca_out (abfd, rel, loc); + } +@@ -1594,19 +1895,15 @@ loongarch_reloc_rewrite_imm_insn (const Elf_Internal_Rela *rel, + return bfd_reloc_ok; + } + +-/* Emplace a static relocation. */ +- + static bfd_reloc_status_type + perform_relocation (const Elf_Internal_Rela *rel, asection *input_section, + reloc_howto_type *howto, bfd_vma value, + bfd *input_bfd, bfd_byte *contents) + { +- uint32_t insn1; + int64_t opr1, opr2, opr3; + bfd_reloc_status_type r = bfd_reloc_ok; + int bits = bfd_get_reloc_size (howto) * 8; + +- + switch (ELFNN_R_TYPE (rel->r_info)) + { + case R_LARCH_SOP_PUSH_PCREL: +@@ -1679,6 +1976,8 @@ perform_relocation (const Elf_Internal_Rela *rel, asection *input_section, + case R_LARCH_SOP_POP_32_S_10_12: + case R_LARCH_SOP_POP_32_S_10_16: + case R_LARCH_SOP_POP_32_S_10_16_S2: ++ case R_LARCH_SOP_POP_32_S_0_5_10_16_S2: ++ case R_LARCH_SOP_POP_32_S_0_10_10_16_S2: + case R_LARCH_SOP_POP_32_S_5_20: + case R_LARCH_SOP_POP_32_U_10_12: + case R_LARCH_SOP_POP_32_U: +@@ -1694,67 +1993,6 @@ perform_relocation (const Elf_Internal_Rela *rel, asection *input_section, + contents, (bfd_vma)opr1); + break; + +- case R_LARCH_SOP_POP_32_S_0_5_10_16_S2: +- { +- r = loongarch_pop (&opr1); +- if (r != bfd_reloc_ok) +- break; +- +- if ((opr1 & 0x3) != 0) +- { +- r = bfd_reloc_overflow; +- break; +- } +- +- uint32_t imm = opr1 >> howto->rightshift; +- if ((imm & (~0xfffffU)) && ((imm & (~0xfffffU)) != (~0xfffffU))) +- { +- r = bfd_reloc_overflow; +- break; +- } +- r = loongarch_check_offset (rel, input_section); +- if (r != bfd_reloc_ok) +- break; +- +- insn1 = bfd_get (bits, input_bfd, contents + rel->r_offset); +- insn1 = (insn1 & howto->src_mask) +- | ((imm & 0xffffU) << 10) +- | ((imm & 0x1f0000U) >> 16); +- bfd_put (bits, input_bfd, insn1, contents + rel->r_offset); +- break; +- } +- +- case R_LARCH_SOP_POP_32_S_0_10_10_16_S2: +- { +- r = loongarch_pop (&opr1); +- if (r != bfd_reloc_ok) +- break; +- +- if ((opr1 & 0x3) != 0) +- { +- r = bfd_reloc_overflow; +- break; +- } +- +- uint32_t imm = opr1 >> howto->rightshift; +- if ((imm & (~0x1ffffffU)) && (imm & (~0x1ffffffU)) != (~0x1ffffffU)) +- { +- r = bfd_reloc_overflow; +- break; +- } +- +- r = loongarch_check_offset (rel, input_section); +- if (r != bfd_reloc_ok) +- break; +- +- insn1 = bfd_get (bits, input_bfd, contents + rel->r_offset); +- insn1 = ((insn1 & howto->src_mask) +- | ((imm & 0xffffU) << 10) +- | ((imm & 0x3ff0000U) >> 16)); +- bfd_put (bits, input_bfd, insn1, contents + rel->r_offset); +- break; +- } +- + case R_LARCH_TLS_DTPREL32: + case R_LARCH_32: + case R_LARCH_TLS_DTPREL64: +@@ -1792,6 +2030,66 @@ perform_relocation (const Elf_Internal_Rela *rel, asection *input_section, + bfd_put (bits, input_bfd, opr1 - value, contents + rel->r_offset); + break; + ++ /* For eh_frame and debug info. */ ++ case R_LARCH_32_PCREL: ++ value -= sec_addr (input_section) + rel->r_offset; ++ value += rel->r_addend; ++ bfd_vma word = bfd_get (howto->bitsize, input_bfd, ++ contents + rel->r_offset); ++ word = (word & ~howto->dst_mask) | (value & howto->dst_mask); ++ bfd_put (howto->bitsize, input_bfd, word, contents + rel->r_offset); ++ r = bfd_reloc_ok; ++ break; ++ ++ /* New reloc type. ++ R_LARCH_B16 ~ R_LARCH_TLS_GD_HI20. */ ++ case R_LARCH_B16: ++ case R_LARCH_B21: ++ case R_LARCH_B26: ++ case R_LARCH_ABS_HI20: ++ case R_LARCH_ABS_LO12: ++ case R_LARCH_ABS64_LO20: ++ case R_LARCH_ABS64_HI12: ++ case R_LARCH_PCALA_HI20: ++ case R_LARCH_PCALA_LO12: ++ case R_LARCH_PCALA64_LO20: ++ case R_LARCH_PCALA64_HI12: ++ case R_LARCH_GOT_PC_HI20: ++ case R_LARCH_GOT_PC_LO12: ++ case R_LARCH_GOT64_PC_LO20: ++ case R_LARCH_GOT64_PC_HI12: ++ case R_LARCH_GOT_HI20: ++ case R_LARCH_GOT_LO12: ++ case R_LARCH_GOT64_LO20: ++ case R_LARCH_GOT64_HI12: ++ case R_LARCH_TLS_LE_HI20: ++ case R_LARCH_TLS_LE_LO12: ++ case R_LARCH_TLS_LE64_LO20: ++ case R_LARCH_TLS_LE64_HI12: ++ case R_LARCH_TLS_IE_PC_HI20: ++ case R_LARCH_TLS_IE_PC_LO12: ++ case R_LARCH_TLS_IE64_PC_LO20: ++ case R_LARCH_TLS_IE64_PC_HI12: ++ case R_LARCH_TLS_IE_HI20: ++ case R_LARCH_TLS_IE_LO12: ++ case R_LARCH_TLS_IE64_LO20: ++ case R_LARCH_TLS_IE64_HI12: ++ case R_LARCH_TLS_LD_PC_HI20: ++ case R_LARCH_TLS_LD_HI20: ++ case R_LARCH_TLS_GD_PC_HI20: ++ case R_LARCH_TLS_GD_HI20: ++ r = loongarch_check_offset (rel, input_section); ++ if (r != bfd_reloc_ok) ++ break; ++ ++ r = loongarch_reloc_rewrite_imm_insn (rel, input_section, ++ howto, input_bfd, ++ contents, value); ++ break; ++ ++ case R_LARCH_RELAX: ++ break; ++ + default: + r = bfd_reloc_notsupported; + } +@@ -1900,7 +2198,6 @@ loongarch_dump_reloc_record (void (*p) (const char *fmt, ...)) + "-- Record dump end --\n\n"); + } + +- + static bool + loongarch_reloc_is_fatal (struct bfd_link_info *info, + bfd *input_bfd, +@@ -1945,8 +2242,27 @@ loongarch_reloc_is_fatal (struct bfd_link_info *info, + return fatal; + } + +- +- ++#define RELOCATE_CALC_PC32_HI20(relocation, pc) \ ++ ({ \ ++ bfd_vma lo = (relocation) & ((bfd_vma)0xfff); \ ++ pc = pc & (~(bfd_vma)0xfff); \ ++ if (lo > 0x7ff) \ ++ { \ ++ relocation += 0x1000; \ ++ } \ ++ relocation &= ~(bfd_vma)0xfff; \ ++ relocation -= pc; \ ++ }) ++ ++#define RELOCATE_CALC_PC64_HI32(relocation, pc) \ ++ ({ \ ++ bfd_vma lo = (relocation) & ((bfd_vma)0xfff); \ ++ if (lo > 0x7ff) \ ++ { \ ++ relocation -= 0x100000000; \ ++ } \ ++ relocation -= (pc & ~(bfd_vma)0xffffffff); \ ++ }) + + static int + loongarch_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, +@@ -1983,8 +2299,7 @@ loongarch_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, + bool is_ie, is_undefweak, unresolved_reloc, defined_local; + bool resolved_local, resolved_dynly, resolved_to_const; + char tls_type; +- bfd_vma relocation; +- bfd_vma off, ie_off; ++ bfd_vma relocation, off, ie_off; + int i, j; + + howto = loongarch_elf_rtype_to_howto (input_bfd, r_type); +@@ -2018,9 +2333,12 @@ loongarch_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, + resolved_local = true; + resolved_dynly = false; + resolved_to_const = false; ++ ++ /* Calc in funtion elf_link_input_bfd, ++ * if #define elf_backend_rela_normal to 1. */ + if (bfd_link_relocatable (info) + && ELF_ST_TYPE (sym->st_info) == STT_SECTION) +- rel->r_addend += sec->output_offset; ++ continue; + } + else + { +@@ -2092,7 +2410,7 @@ loongarch_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, + resolved_to_const = true; + } + +- /* The ifunc without reference does not generate plt. */ ++ /* The ifunc reference generate plt. */ + if (h && h->type == STT_GNU_IFUNC && h->plt.offset != MINUS_ONE) + { + defined_local = true; +@@ -2138,32 +2456,55 @@ loongarch_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, + + outrel.r_offset += sec_addr (input_section); + +- /* A pointer point to a local ifunc symbol. */ +- if(h +- && h->type == STT_GNU_IFUNC +- && (h->dynindx == -1 +- || h->forced_local +- || bfd_link_executable(info))) ++ /* A pointer point to a ifunc symbol. */ ++ if (h && h->type == STT_GNU_IFUNC) + { +- outrel.r_info = ELFNN_R_INFO (0, R_LARCH_IRELATIVE); +- outrel.r_addend = (h->root.u.def.value +- + h->root.u.def.section->output_section->vma +- + h->root.u.def.section->output_offset); +- +- /* Dynamic relocations are stored in +- 1. .rela.ifunc section in PIC object. +- 2. .rela.got section in dynamic executable. +- 3. .rela.iplt section in static executable. */ +- if (bfd_link_pic (info)) +- sreloc = htab->elf.irelifunc; +- else if (htab->elf.splt != NULL) +- sreloc = htab->elf.srelgot; ++ if (h->dynindx == -1) ++ { ++ outrel.r_info = ELFNN_R_INFO (0, R_LARCH_IRELATIVE); ++ outrel.r_addend = (h->root.u.def.value ++ + h->root.u.def.section->output_section->vma ++ + h->root.u.def.section->output_offset); ++ } ++ else ++ { ++ outrel.r_info = ELFNN_R_INFO (h->dynindx, R_LARCH_NN); ++ outrel.r_addend = 0; ++ } ++ ++ if (SYMBOL_REFERENCES_LOCAL (info, h)) ++ { ++ ++ if (htab->elf.splt != NULL) ++ sreloc = htab->elf.srelgot; ++ else ++ sreloc = htab->elf.irelplt; ++ } + else +- sreloc = htab->elf.irelplt; ++ { ++ ++ if (bfd_link_pic (info)) ++ sreloc = htab->elf.irelifunc; ++ else if (htab->elf.splt != NULL) ++ sreloc = htab->elf.srelgot; ++ else ++ sreloc = htab->elf.irelplt; ++ } + } + else if (resolved_dynly) + { +- outrel.r_info = ELFNN_R_INFO (h->dynindx, r_type); ++ if (h->dynindx == -1) ++ { ++ if (h->root.type == bfd_link_hash_undefined) ++ (*info->callbacks->undefined_symbol) ++ (info, name, input_bfd, input_section, ++ rel->r_offset, true); ++ ++ outrel.r_info = ELFNN_R_INFO (0, r_type); ++ } ++ else ++ outrel.r_info = ELFNN_R_INFO (h->dynindx, r_type); ++ + outrel.r_addend = rel->r_addend; + } + else +@@ -2172,7 +2513,9 @@ loongarch_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, + outrel.r_addend = relocation + rel->r_addend; + } + +- if (unresolved_reloc) ++ /* No alloc space of func allocate_dynrelocs. */ ++ if (unresolved_reloc ++ && !(h && (h->is_weakalias || !h->dyn_relocs))) + loongarch_elf_append_rela (output_bfd, sreloc, &outrel); + } + +@@ -2341,12 +2684,7 @@ loongarch_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, + case R_LARCH_SOP_PUSH_PLT_PCREL: + unresolved_reloc = false; + +- if (resolved_to_const) +- { +- relocation += rel->r_addend; +- break; +- } +- else if (is_undefweak) ++ if (is_undefweak) + { + i = 0, j = 0; + relocation = 0; +@@ -2427,10 +2765,9 @@ loongarch_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, + + if (h != NULL) + { +- off = h->got.offset; ++ off = h->got.offset & (~1); + +- if (off == MINUS_ONE +- && h->type != STT_GNU_IFUNC) ++ if (h->got.offset == MINUS_ONE && h->type != STT_GNU_IFUNC) + { + fatal = (loongarch_reloc_is_fatal + (info, input_bfd, input_section, rel, howto, +@@ -2441,8 +2778,7 @@ loongarch_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, + + /* Hidden symbol not has .got entry, only .got.plt entry + so gprel is (plt - got). */ +- if (off == MINUS_ONE +- && h->type == STT_GNU_IFUNC) ++ if (h->got.offset == MINUS_ONE && h->type == STT_GNU_IFUNC) + { + if (h->plt.offset == (bfd_vma) -1) + { +@@ -2455,79 +2791,76 @@ loongarch_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, + if (htab->elf.splt != NULL) + { + /* Section .plt header is 2 times of plt entry. */ +- off = sec_addr(htab->elf.sgotplt) + off +- - sec_addr(htab->elf.sgot); ++ off = sec_addr (htab->elf.sgotplt) + off ++ - sec_addr (htab->elf.sgot); + } + else + { + /* Section iplt not has plt header. */ +- off = sec_addr(htab->elf.igotplt) + off +- - sec_addr(htab->elf.sgot); ++ off = sec_addr (htab->elf.igotplt) + off ++ - sec_addr (htab->elf.sgot); + } + } + +- if (!WILL_CALL_FINISH_DYNAMIC_SYMBOL (is_dyn, is_pic, h) +- || (is_pic && SYMBOL_REFERENCES_LOCAL (info, h))) ++ if ((h->got.offset & 1) == 0) + { +- /* This is actually a static link, or it is a +- -Bsymbolic link and the symbol is defined +- locally, or the symbol was forced to be local +- because of a version file. We must initialize +- this entry in the global offset table. Since the +- offset must always be a multiple of the word size, +- we use the least significant bit to record whether +- we have initialized it already. +- +- When doing a dynamic link, we create a .rela.got +- relocation entry to initialize the value. This +- is done in the finish_dynamic_symbol routine. */ +- +- if (resolved_dynly) ++ if (!WILL_CALL_FINISH_DYNAMIC_SYMBOL (is_dyn, ++ bfd_link_pic (info), h) ++ && ((bfd_link_pic (info) ++ && SYMBOL_REFERENCES_LOCAL (info, h)))) + { +- fatal = (loongarch_reloc_is_fatal +- (info, input_bfd, input_section, rel, howto, +- bfd_reloc_dangerous, is_undefweak, name, +- "Internal: here shouldn't dynamic.")); +- } ++ /* This is actually a static link, or it is a ++ -Bsymbolic link and the symbol is defined ++ locally, or the symbol was forced to be local ++ because of a version file. We must initialize ++ this entry in the global offset table. Since the ++ offset must always be a multiple of the word size, ++ we use the least significant bit to record whether ++ we have initialized it already. ++ ++ When doing a dynamic link, we create a rela.got ++ relocation entry to initialize the value. This ++ is done in the finish_dynamic_symbol routine. */ ++ ++ if (resolved_dynly) ++ { ++ fatal = (loongarch_reloc_is_fatal ++ (info, input_bfd, input_section, rel, howto, ++ bfd_reloc_dangerous, is_undefweak, name, ++ "Internal: here shouldn't dynamic.")); ++ } + +- if (!(defined_local || resolved_to_const)) +- { +- fatal = (loongarch_reloc_is_fatal +- (info, input_bfd, input_section, rel, howto, +- bfd_reloc_undefined, is_undefweak, name, +- "Internal: ")); +- break; +- } ++ if (!(defined_local || resolved_to_const)) ++ { ++ fatal = (loongarch_reloc_is_fatal ++ (info, input_bfd, input_section, rel, howto, ++ bfd_reloc_undefined, is_undefweak, name, ++ "Internal: ")); ++ break; ++ } + +- if ((off & 1) != 0) +- off &= ~1; +- else +- { +- /* The pr21964-4. Create relocate entry. */ +- if (is_pic && h->start_stop) ++ asection *s; ++ Elf_Internal_Rela outrel; ++ /* We need to generate a R_LARCH_RELATIVE reloc ++ for the dynamic linker. */ ++ s = htab->elf.srelgot; ++ if (!s) + { +- asection *s; +- Elf_Internal_Rela outrel; +- /* We need to generate a R_LARCH_RELATIVE reloc +- for the dynamic linker. */ +- s = htab->elf.srelgot; +- if (!s) +- { +- fatal = loongarch_reloc_is_fatal (info, input_bfd, +- input_section, rel, howto, +- bfd_reloc_notsupported, is_undefweak, name, +- "Internal: '.rel.got' not represent"); +- break; +- } +- +- outrel.r_offset = sec_addr (got) + off; +- outrel.r_info = ELFNN_R_INFO (0, R_LARCH_RELATIVE); +- outrel.r_addend = relocation; /* Link-time addr. */ +- loongarch_elf_append_rela (output_bfd, s, &outrel); ++ fatal = loongarch_reloc_is_fatal ++ (info, input_bfd, ++ input_section, rel, howto, ++ bfd_reloc_notsupported, is_undefweak, name, ++ "Internal: '.rel.got' not represent"); ++ break; + } +- bfd_put_NN (output_bfd, relocation, got->contents + off); +- h->got.offset |= 1; ++ ++ outrel.r_offset = sec_addr (got) + off; ++ outrel.r_info = ELFNN_R_INFO (0, R_LARCH_RELATIVE); ++ outrel.r_addend = relocation; /* Link-time addr. */ ++ loongarch_elf_append_rela (output_bfd, s, &outrel); + } ++ bfd_put_NN (output_bfd, relocation, got->contents + off); ++ h->got.offset |= 1; + } + } + else +@@ -2541,9 +2874,9 @@ loongarch_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, + break; + } + +- off = local_got_offsets[r_symndx]; ++ off = local_got_offsets[r_symndx] & (~1); + +- if (off == MINUS_ONE) ++ if (local_got_offsets[r_symndx] == MINUS_ONE) + { + fatal = (loongarch_reloc_is_fatal + (info, input_bfd, input_section, rel, howto, +@@ -2555,9 +2888,7 @@ loongarch_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, + /* The offset must always be a multiple of the word size. + So, we can use the least significant bit to record + whether we have already processed this entry. */ +- if ((off & 1) != 0) +- off &= ~1; +- else ++ if ((local_got_offsets[r_symndx] & 1) == 0) + { + if (is_pic) + { +@@ -2586,160 +2917,515 @@ loongarch_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, + } + } + relocation = off; ++ + break; + + case R_LARCH_SOP_PUSH_TLS_GOT: + case R_LARCH_SOP_PUSH_TLS_GD: +- if (r_type == R_LARCH_SOP_PUSH_TLS_GOT) +- is_ie = true; ++ { ++ unresolved_reloc = false; ++ if (r_type == R_LARCH_SOP_PUSH_TLS_GOT) ++ is_ie = true; ++ ++ bfd_vma got_off = 0; ++ if (h != NULL) ++ { ++ got_off = h->got.offset; ++ h->got.offset |= 1; ++ } ++ else ++ { ++ got_off = local_got_offsets[r_symndx]; ++ local_got_offsets[r_symndx] |= 1; ++ } ++ ++ BFD_ASSERT (got_off != MINUS_ONE); ++ ++ ie_off = 0; ++ tls_type = _bfd_loongarch_elf_tls_type (input_bfd, h, r_symndx); ++ if ((tls_type & GOT_TLS_GD) && (tls_type & GOT_TLS_IE)) ++ ie_off = 2 * GOT_ENTRY_SIZE; ++ ++ if ((got_off & 1) == 0) ++ { ++ Elf_Internal_Rela rela; ++ asection *srel = htab->elf.srelgot; ++ bfd_vma tls_block_off = 0; ++ ++ if (SYMBOL_REFERENCES_LOCAL (info, h)) ++ { ++ BFD_ASSERT (elf_hash_table (info)->tls_sec); ++ tls_block_off = relocation ++ - elf_hash_table (info)->tls_sec->vma; ++ } ++ ++ if (tls_type & GOT_TLS_GD) ++ { ++ rela.r_offset = sec_addr (got) + got_off; ++ rela.r_addend = 0; ++ if (SYMBOL_REFERENCES_LOCAL (info, h)) ++ { ++ /* Local sym, used in exec, set module id 1. */ ++ if (bfd_link_executable (info)) ++ bfd_put_NN (output_bfd, 1, got->contents + got_off); ++ else ++ { ++ rela.r_info = ELFNN_R_INFO (0, ++ R_LARCH_TLS_DTPMODNN); ++ loongarch_elf_append_rela (output_bfd, srel, &rela); ++ } ++ ++ bfd_put_NN (output_bfd, tls_block_off, ++ got->contents + got_off + GOT_ENTRY_SIZE); ++ } ++ /* Dynamic resolved. */ ++ else ++ { ++ /* Dynamic relocate module id. */ ++ rela.r_info = ELFNN_R_INFO (h->dynindx, ++ R_LARCH_TLS_DTPMODNN); ++ loongarch_elf_append_rela (output_bfd, srel, &rela); ++ ++ /* Dynamic relocate offset of block. */ ++ rela.r_offset += GOT_ENTRY_SIZE; ++ rela.r_info = ELFNN_R_INFO (h->dynindx, ++ R_LARCH_TLS_DTPRELNN); ++ loongarch_elf_append_rela (output_bfd, srel, &rela); ++ } ++ } ++ if (tls_type & GOT_TLS_IE) ++ { ++ rela.r_offset = sec_addr (got) + got_off + ie_off; ++ if (SYMBOL_REFERENCES_LOCAL (info, h)) ++ { ++ /* Local sym, used in exec, set module id 1. */ ++ if (!bfd_link_executable (info)) ++ { ++ rela.r_info = ELFNN_R_INFO (0, R_LARCH_TLS_TPRELNN); ++ rela.r_addend = tls_block_off; ++ loongarch_elf_append_rela (output_bfd, srel, &rela); ++ } ++ ++ bfd_put_NN (output_bfd, tls_block_off, ++ got->contents + got_off + ie_off); ++ } ++ /* Dynamic resolved. */ ++ else ++ { ++ /* Dynamic relocate offset of block. */ ++ rela.r_info = ELFNN_R_INFO (h->dynindx, ++ R_LARCH_TLS_TPRELNN); ++ rela.r_addend = 0; ++ loongarch_elf_append_rela (output_bfd, srel, &rela); ++ } ++ } ++ } ++ ++ relocation = (got_off & (~(bfd_vma)1)) + (is_ie ? ie_off : 0); ++ } ++ break; ++ ++ /* New reloc types. */ ++ case R_LARCH_B21: ++ case R_LARCH_B26: ++ case R_LARCH_B16: + unresolved_reloc = false; ++ if (is_undefweak) ++ { ++ relocation = 0; ++ } + +- if (rel->r_addend != 0) ++ if (resolved_local) + { +- fatal = (loongarch_reloc_is_fatal +- (info, input_bfd, input_section, rel, howto, +- bfd_reloc_notsupported, is_undefweak, name, +- "Shouldn't be with r_addend.")); ++ relocation -= pc; ++ relocation += rel->r_addend; ++ } ++ else if (resolved_dynly) ++ { ++ BFD_ASSERT (h ++ && (h->plt.offset != MINUS_ONE ++ || ELF_ST_VISIBILITY (h->other) != STV_DEFAULT) ++ && rel->r_addend == 0); ++ if (h && h->plt.offset == MINUS_ONE ++ && ELF_ST_VISIBILITY (h->other) != STV_DEFAULT) ++ { ++ relocation -= pc; ++ relocation += rel->r_addend; ++ } ++ else ++ relocation = sec_addr (plt) + h->plt.offset - pc; ++ } ++ ++ break; ++ ++ case R_LARCH_ABS_HI20: ++ case R_LARCH_ABS_LO12: ++ case R_LARCH_ABS64_LO20: ++ case R_LARCH_ABS64_HI12: ++ BFD_ASSERT (!is_pic); ++ ++ if (is_undefweak) ++ { ++ BFD_ASSERT (resolved_dynly); ++ relocation = 0; + break; + } ++ else if (resolved_to_const || resolved_local) ++ { ++ relocation += rel->r_addend; ++ } ++ else if (resolved_dynly) ++ { ++ unresolved_reloc = false; ++ BFD_ASSERT ((plt && h && h->plt.offset != MINUS_ONE) ++ && rel->r_addend == 0); ++ relocation = sec_addr (plt) + h->plt.offset; ++ } ++ ++ break; ++ ++ case R_LARCH_PCALA_HI20: ++ unresolved_reloc = false; ++ if (h && h->plt.offset != MINUS_ONE) ++ relocation = sec_addr (plt) + h->plt.offset; ++ else ++ relocation += rel->r_addend; ++ ++ RELOCATE_CALC_PC32_HI20 (relocation, pc); + ++ break; + +- if (resolved_to_const && is_undefweak && h->dynindx != -1) ++ case R_LARCH_PCALA_LO12: ++ /* Not support if sym_addr in 2k page edge. ++ pcalau12i pc_hi20 (sym_addr) ++ ld.w/d pc_lo12 (sym_addr) ++ ld.w/d pc_lo12 (sym_addr + x) ++ ... ++ can not calc correct address ++ if sym_addr < 0x800 && sym_addr + x >= 0x800. */ ++ ++ if (h && h->plt.offset != MINUS_ONE) ++ relocation = sec_addr (plt) + h->plt.offset; ++ else ++ relocation += rel->r_addend; ++ ++ relocation &= 0xfff; ++ /* Signed extend. */ ++ relocation = (relocation ^ 0x800) - 0x800; ++ ++ /* For 2G jump, generate pcalau12i, jirl. */ ++ /* If use jirl, turns to R_LARCH_B16. */ ++ uint32_t insn = bfd_get (32, input_bfd, contents + rel->r_offset); ++ if ((insn & 0x4c000000) == 0x4c000000) + { +- /* What if undefweak? Let rtld make a decision. */ +- resolved_to_const = resolved_local = false; +- resolved_dynly = true; ++ rel->r_info = ELFNN_R_INFO (r_symndx, R_LARCH_B16); ++ howto = loongarch_elf_rtype_to_howto (input_bfd, R_LARCH_B16); + } ++ break; + +- if (resolved_to_const) ++ case R_LARCH_PCALA64_LO20: ++ case R_LARCH_PCALA64_HI12: ++ if (h && h->plt.offset != MINUS_ONE) ++ relocation = sec_addr (plt) + h->plt.offset; ++ else ++ relocation += rel->r_addend; ++ ++ RELOCATE_CALC_PC64_HI32 (relocation, pc); ++ ++ break; ++ ++ case R_LARCH_GOT_PC_HI20: ++ case R_LARCH_GOT_HI20: ++ /* Calc got offset. */ + { +- fatal = (loongarch_reloc_is_fatal +- (info, input_bfd, input_section, rel, howto, +- bfd_reloc_notsupported, is_undefweak, name, +- "Internal: Shouldn't be resolved to const.")); +- break; ++ unresolved_reloc = false; ++ BFD_ASSERT (rel->r_addend == 0); ++ ++ bfd_vma got_off = 0; ++ if (h != NULL) ++ { ++ /* GOT ref or ifunc. */ ++ BFD_ASSERT (h->got.offset != MINUS_ONE ++ || h->type == STT_GNU_IFUNC); ++ ++ got_off = h->got.offset & (~(bfd_vma)1); ++ /* Hidden symbol not has got entry, ++ * only got.plt entry so it is (plt - got). */ ++ if (h->got.offset == MINUS_ONE && h->type == STT_GNU_IFUNC) ++ { ++ bfd_vma idx; ++ if (htab->elf.splt != NULL) ++ { ++ idx = (h->plt.offset - PLT_HEADER_SIZE) ++ / PLT_ENTRY_SIZE; ++ got_off = sec_addr (htab->elf.sgotplt) ++ + GOTPLT_HEADER_SIZE ++ + (idx * GOT_ENTRY_SIZE) ++ - sec_addr (htab->elf.sgot); ++ } ++ else ++ { ++ idx = h->plt.offset / PLT_ENTRY_SIZE; ++ got_off = sec_addr (htab->elf.sgotplt) ++ + (idx * GOT_ENTRY_SIZE) ++ - sec_addr (htab->elf.sgot); ++ } ++ } ++ ++ if ((h->got.offset & 1) == 0) ++ { ++ /* We need to generate a R_LARCH_RELATIVE reloc once ++ * in loongarch_elf_finish_dynamic_symbol or now, ++ * call finish_dyn && nopic ++ * or !call finish_dyn && pic. */ ++ if (!WILL_CALL_FINISH_DYNAMIC_SYMBOL (is_dyn, ++ bfd_link_pic (info), ++ h) ++ && bfd_link_pic (info) ++ && SYMBOL_REFERENCES_LOCAL (info, h)) ++ { ++ Elf_Internal_Rela rela; ++ rela.r_offset = sec_addr (got) + got_off; ++ rela.r_info = ELFNN_R_INFO (0, R_LARCH_RELATIVE); ++ rela.r_addend = relocation; ++ loongarch_elf_append_rela (output_bfd, ++ htab->elf.srelgot, &rela); ++ } ++ h->got.offset |= 1; ++ bfd_put_NN (output_bfd, relocation, ++ got->contents + got_off); ++ } ++ } ++ else ++ { ++ BFD_ASSERT (local_got_offsets ++ && local_got_offsets[r_symndx] != MINUS_ONE); ++ ++ got_off = local_got_offsets[r_symndx] & (~(bfd_vma)1); ++ if ((local_got_offsets[r_symndx] & 1) == 0) ++ { ++ if (bfd_link_pic (info)) ++ { ++ Elf_Internal_Rela rela; ++ rela.r_offset = sec_addr (got) + got_off; ++ rela.r_info = ELFNN_R_INFO (0, R_LARCH_RELATIVE); ++ rela.r_addend = relocation; ++ loongarch_elf_append_rela (output_bfd, ++ htab->elf.srelgot, &rela); ++ } ++ local_got_offsets[r_symndx] |= 1; ++ } ++ bfd_put_NN (output_bfd, relocation, got->contents + got_off); ++ } ++ ++ relocation = got_off + sec_addr (got); ++ } ++ ++ if (r_type == R_LARCH_GOT_PC_HI20) ++ RELOCATE_CALC_PC32_HI20 (relocation, pc); ++ ++ break; ++ ++ case R_LARCH_GOT_PC_LO12: ++ case R_LARCH_GOT64_PC_LO20: ++ case R_LARCH_GOT64_PC_HI12: ++ case R_LARCH_GOT_LO12: ++ case R_LARCH_GOT64_LO20: ++ case R_LARCH_GOT64_HI12: ++ { ++ unresolved_reloc = false; ++ bfd_vma got_off; ++ if (h) ++ got_off = h->got.offset & (~(bfd_vma)1); ++ else ++ got_off = local_got_offsets[r_symndx] & (~(bfd_vma)1); ++ ++ if (h && h->got.offset == MINUS_ONE && h->type == STT_GNU_IFUNC) ++ { ++ bfd_vma idx; ++ if (htab->elf.splt != NULL) ++ idx = (h->plt.offset - PLT_HEADER_SIZE) / PLT_ENTRY_SIZE; ++ else ++ idx = h->plt.offset / PLT_ENTRY_SIZE; ++ ++ got_off = sec_addr (htab->elf.sgotplt) ++ + GOTPLT_HEADER_SIZE ++ + (idx * GOT_ENTRY_SIZE) ++ - sec_addr (htab->elf.sgot); ++ } ++ relocation = got_off + sec_addr (got); + } + ++ if (r_type == R_LARCH_GOT_PC_LO12) ++ relocation &= (bfd_vma)0xfff; ++ else if (r_type == R_LARCH_GOT64_PC_LO20 ++ || r_type == R_LARCH_GOT64_PC_HI12) ++ RELOCATE_CALC_PC64_HI32 (relocation, pc); ++ ++ break; ++ ++ case R_LARCH_TLS_LE_HI20: ++ case R_LARCH_TLS_LE_LO12: ++ case R_LARCH_TLS_LE64_LO20: ++ case R_LARCH_TLS_LE64_HI12: ++ BFD_ASSERT (resolved_local && elf_hash_table (info)->tls_sec); ++ ++ relocation -= elf_hash_table (info)->tls_sec->vma; ++ break; ++ ++ /* TLS IE LD/GD process separately is troublesome. ++ When a symbol is both ie and LD/GD, h->got.off |= 1 ++ make only one type be relocated. We must use ++ h->got.offset |= 1 and h->got.offset |= 2 ++ diff IE and LD/GD. And all (got_off & (~(bfd_vma)1)) ++ (IE LD/GD and reusable GOT reloc) must change to ++ (got_off & (~(bfd_vma)3)), beause we use lowest 2 bits ++ as a tag. ++ Now, LD and GD is both GOT_TLS_GD type, LD seems to ++ can be omitted. */ ++ case R_LARCH_TLS_IE_PC_HI20: ++ case R_LARCH_TLS_IE_HI20: ++ case R_LARCH_TLS_LD_PC_HI20: ++ case R_LARCH_TLS_LD_HI20: ++ case R_LARCH_TLS_GD_PC_HI20: ++ case R_LARCH_TLS_GD_HI20: ++ BFD_ASSERT (rel->r_addend == 0); ++ unresolved_reloc = false; ++ ++ if (r_type == R_LARCH_TLS_IE_PC_HI20 ++ || r_type == R_LARCH_TLS_IE_HI20) ++ is_ie = true; ++ ++ bfd_vma got_off = 0; + if (h != NULL) + { +- off = h->got.offset; ++ got_off = h->got.offset; + h->got.offset |= 1; + } + else + { +- off = local_got_offsets[r_symndx]; ++ got_off = local_got_offsets[r_symndx]; + local_got_offsets[r_symndx] |= 1; + } + +- if (off == MINUS_ONE) +- { +- fatal = (loongarch_reloc_is_fatal +- (info, input_bfd, input_section, rel, howto, +- bfd_reloc_notsupported, is_undefweak, name, +- "Internal: TLS GOT entry doesn't represent.")); +- break; +- } +- +- tls_type = _bfd_loongarch_elf_tls_type (input_bfd, h, r_symndx); ++ BFD_ASSERT (got_off != MINUS_ONE); + +- /* If this symbol is referenced by both GD and IE TLS, the IE +- reference's GOT slot follows the GD reference's slots. */ + ie_off = 0; ++ tls_type = _bfd_loongarch_elf_tls_type (input_bfd, h, r_symndx); + if ((tls_type & GOT_TLS_GD) && (tls_type & GOT_TLS_IE)) + ie_off = 2 * GOT_ENTRY_SIZE; + +- if ((off & 1) != 0) +- off &= ~1; +- else ++ if ((got_off & 1) == 0) + { ++ Elf_Internal_Rela rela; ++ asection *relgot = htab->elf.srelgot; + bfd_vma tls_block_off = 0; +- Elf_Internal_Rela outrel; + +- if (resolved_local) ++ if (SYMBOL_REFERENCES_LOCAL (info, h)) + { +- if (!elf_hash_table (info)->tls_sec) +- { +- fatal = (loongarch_reloc_is_fatal +- (info, input_bfd, input_section, rel, howto, +- bfd_reloc_notsupported, is_undefweak, name, +- "Internal: TLS sec not represent.")); +- break; +- } +- tls_block_off = +- relocation - elf_hash_table (info)->tls_sec->vma; ++ BFD_ASSERT (elf_hash_table (info)->tls_sec); ++ tls_block_off = relocation ++ - elf_hash_table (info)->tls_sec->vma; + } + + if (tls_type & GOT_TLS_GD) + { +- outrel.r_offset = sec_addr (got) + off; +- outrel.r_addend = 0; +- bfd_put_NN (output_bfd, 0, got->contents + off); +- if (resolved_local && bfd_link_executable (info)) +- bfd_put_NN (output_bfd, 1, got->contents + off); +- else if (resolved_local /* && !bfd_link_executable (info) */) +- { +- outrel.r_info = ELFNN_R_INFO (0, R_LARCH_TLS_DTPMODNN); +- loongarch_elf_append_rela (output_bfd, htab->elf.srelgot, +- &outrel); +- } +- else /* if (resolved_dynly) */ ++ rela.r_offset = sec_addr (got) + got_off; ++ rela.r_addend = 0; ++ if (SYMBOL_REFERENCES_LOCAL (info, h)) + { +- outrel.r_info = +- ELFNN_R_INFO (h->dynindx, R_LARCH_TLS_DTPMODNN); +- loongarch_elf_append_rela (output_bfd, htab->elf.srelgot, +- &outrel); +- } ++ /* Local sym, used in exec, set module id 1. */ ++ if (bfd_link_executable (info)) ++ bfd_put_NN (output_bfd, 1, got->contents + got_off); ++ else ++ { ++ rela.r_info = ELFNN_R_INFO (0, R_LARCH_TLS_DTPMODNN); ++ loongarch_elf_append_rela (output_bfd, relgot, &rela); ++ } + +- outrel.r_offset += GOT_ENTRY_SIZE; +- bfd_put_NN (output_bfd, tls_block_off, +- got->contents + off + GOT_ENTRY_SIZE); +- if (resolved_local) +- /* DTPREL known. */; +- else /* if (resolved_dynly) */ ++ bfd_put_NN (output_bfd, tls_block_off, ++ got->contents + got_off + GOT_ENTRY_SIZE); ++ } ++ /* Dynamic resolved. */ ++ else + { +- outrel.r_info = +- ELFNN_R_INFO (h->dynindx, R_LARCH_TLS_DTPRELNN); +- loongarch_elf_append_rela (output_bfd, htab->elf.srelgot, +- &outrel); ++ /* Dynamic relocate module id. */ ++ rela.r_info = ELFNN_R_INFO (h->dynindx, ++ R_LARCH_TLS_DTPMODNN); ++ loongarch_elf_append_rela (output_bfd, relgot, &rela); ++ ++ /* Dynamic relocate offset of block. */ ++ rela.r_offset += GOT_ENTRY_SIZE; ++ rela.r_info = ELFNN_R_INFO (h->dynindx, ++ R_LARCH_TLS_DTPRELNN); ++ loongarch_elf_append_rela (output_bfd, relgot, &rela); + } + } +- + if (tls_type & GOT_TLS_IE) + { +- outrel.r_offset = sec_addr (got) + off + ie_off; +- bfd_put_NN (output_bfd, tls_block_off, +- got->contents + off + ie_off); +- if (resolved_local && bfd_link_executable (info)) +- /* TPREL known. */; +- else if (resolved_local /* && !bfd_link_executable (info) */) +- { +- outrel.r_info = ELFNN_R_INFO (0, R_LARCH_TLS_TPRELNN); +- outrel.r_addend = tls_block_off; +- loongarch_elf_append_rela (output_bfd, htab->elf.srelgot, +- &outrel); +- } +- else /* if (resolved_dynly) */ ++ rela.r_offset = sec_addr (got) + got_off + ie_off; ++ if (SYMBOL_REFERENCES_LOCAL (info, h)) + { +- /* Static linking has no .dynsym table. */ +- if (!htab->elf.dynamic_sections_created) +- { +- outrel.r_info = +- ELFNN_R_INFO (0, R_LARCH_TLS_TPRELNN); +- outrel.r_addend = 0; +- } +- else ++ /* Local sym, used in exec, set module id 1. */ ++ if (!bfd_link_executable (info)) + { +- outrel.r_info = +- ELFNN_R_INFO (h->dynindx, R_LARCH_TLS_TPRELNN); +- outrel.r_addend = 0; ++ rela.r_info = ELFNN_R_INFO (0, R_LARCH_TLS_TPRELNN); ++ rela.r_addend = tls_block_off; ++ loongarch_elf_append_rela (output_bfd, relgot, &rela); + } +- loongarch_elf_append_rela (output_bfd, htab->elf.srelgot, +- &outrel); ++ ++ bfd_put_NN (output_bfd, tls_block_off, ++ got->contents + got_off + ie_off); ++ } ++ /* Dynamic resolved. */ ++ else ++ { ++ /* Dynamic relocate offset of block. */ ++ rela.r_info = ELFNN_R_INFO (h->dynindx, ++ R_LARCH_TLS_TPRELNN); ++ rela.r_addend = 0; ++ loongarch_elf_append_rela (output_bfd, relgot, &rela); + } + } + } ++ relocation = (got_off & (~(bfd_vma)1)) + sec_addr (got) ++ + (is_ie ? ie_off : 0); ++ ++ if (r_type == R_LARCH_TLS_LD_PC_HI20 ++ || r_type == R_LARCH_TLS_GD_PC_HI20 ++ || r_type == R_LARCH_TLS_IE_PC_HI20) ++ RELOCATE_CALC_PC32_HI20 (relocation, pc); ++ ++ break; ++ ++ case R_LARCH_TLS_IE_PC_LO12: ++ case R_LARCH_TLS_IE64_PC_LO20: ++ case R_LARCH_TLS_IE64_PC_HI12: ++ case R_LARCH_TLS_IE_LO12: ++ case R_LARCH_TLS_IE64_LO20: ++ case R_LARCH_TLS_IE64_HI12: ++ unresolved_reloc = false; + +- relocation = off + (is_ie ? ie_off : 0); ++ if (h) ++ relocation = sec_addr (got) + (h->got.offset & (~(bfd_vma)3)); ++ else ++ relocation = sec_addr (got) ++ + (local_got_offsets[r_symndx] & (~(bfd_vma)3)); ++ ++ tls_type = _bfd_loongarch_elf_tls_type (input_bfd, h, r_symndx); ++ /* Use both TLS_GD and TLS_IE. */ ++ if ((tls_type & GOT_TLS_GD) && (tls_type & GOT_TLS_IE)) ++ relocation += 2 * GOT_ENTRY_SIZE; ++ ++ if (r_type == R_LARCH_TLS_IE_PC_LO12) ++ relocation &= (bfd_vma)0xfff; ++ else if (r_type == R_LARCH_TLS_IE64_PC_LO20 ++ || r_type == R_LARCH_TLS_IE64_PC_HI12) ++ RELOCATE_CALC_PC64_HI32 (relocation, pc); ++ ++ break; ++ ++ case R_LARCH_RELAX: + break; + + default: +@@ -2759,7 +3445,7 @@ loongarch_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, + if (_bfd_elf_section_offset (output_bfd, info, input_section, + rel->r_offset) == MINUS_ONE) + /* WHY? May because it's invalid so skip checking. +- But why dynamic reloc a invalid section? */ ++ But why dynamic reloc a invalid section? */ + break; + + if (input_section->output_section->flags & SEC_DEBUGGING) +@@ -2825,7 +3511,6 @@ loongarch_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, + } + + fatal = true; +- break; + } + + return !fatal; +@@ -2842,6 +3527,12 @@ loongarch_elf_finish_dynamic_symbol (bfd *output_bfd, + { + struct loongarch_elf_link_hash_table *htab = loongarch_elf_hash_table (info); + const struct elf_backend_data *bed = get_elf_backend_data (output_bfd); ++ asection *rela_dyn = bfd_get_section_by_name (output_bfd, ".rela.dyn"); ++ struct bfd_link_order *lo = NULL; ++ Elf_Internal_Rela *slot = NULL, *last_slot = NULL; ++ ++ if (rela_dyn) ++ lo = rela_dyn->map_head.link_order; + + if (h->plt.offset != MINUS_ONE) + { +@@ -2851,6 +3542,7 @@ loongarch_elf_finish_dynamic_symbol (bfd *output_bfd, + uint32_t plt_entry[PLT_ENTRY_INSNS]; + bfd_byte *loc; + Elf_Internal_Rela rela; ++ asection *rela_sec = NULL; + + if (htab->elf.splt) + { +@@ -2860,7 +3552,10 @@ loongarch_elf_finish_dynamic_symbol (bfd *output_bfd, + + plt = htab->elf.splt; + gotplt = htab->elf.sgotplt; +- relplt = htab->elf.srelplt; ++ if (h->type == STT_GNU_IFUNC && SYMBOL_REFERENCES_LOCAL (info, h)) ++ relplt = htab->elf.srelgot; ++ else ++ relplt = htab->elf.srelplt; + plt_idx = (h->plt.offset - PLT_HEADER_SIZE) / PLT_ENTRY_SIZE; + got_address = + sec_addr (gotplt) + GOTPLT_HEADER_SIZE + plt_idx * GOT_ENTRY_SIZE; +@@ -2889,30 +3584,52 @@ loongarch_elf_finish_dynamic_symbol (bfd *output_bfd, + for (i = 0; i < PLT_ENTRY_INSNS; i++) + bfd_put_32 (output_bfd, plt_entry[i], loc + 4 * i); + +- /* Fill in the initial value of the .got.plt entry. */ ++ /* Fill in the initial value of the got.plt entry. */ + loc = gotplt->contents + (got_address - sec_addr (gotplt)); + bfd_put_NN (output_bfd, sec_addr (plt), loc); + + rela.r_offset = got_address; + + /* TRUE if this is a PLT reference to a local IFUNC. */ +- if (PLT_LOCAL_IFUNC_P(info, h)) ++ if (PLT_LOCAL_IFUNC_P (info, h) ++ && (relplt == htab->elf.srelgot ++ || relplt == htab->elf.irelplt)) + { + rela.r_info = ELFNN_R_INFO (0, R_LARCH_IRELATIVE); + rela.r_addend = (h->root.u.def.value +- + h->root.u.def.section->output_section->vma +- + h->root.u.def.section->output_offset); ++ + h->root.u.def.section->output_section->vma ++ + h->root.u.def.section->output_offset); ++ ++ /* Find the space after dyn sort. */ ++ while (slot == last_slot || slot->r_offset != 0) ++ { ++ if (slot != last_slot) ++ { ++ slot++; ++ continue; ++ } ++ ++ BFD_ASSERT (lo != NULL); ++ rela_sec = lo->u.indirect.section; ++ lo = lo->next; ++ ++ slot = (Elf_Internal_Rela *)rela_sec->contents; ++ last_slot = (Elf_Internal_Rela *)(rela_sec->contents + ++ rela_sec->size); ++ } ++ ++ bed->s->swap_reloca_out (output_bfd, &rela, (bfd_byte *)slot); ++ rela_sec->reloc_count++; + } + else + { +- /* Fill in the entry in the .rela.plt section. */ ++ /* Fill in the entry in the rela.plt section. */ + rela.r_info = ELFNN_R_INFO (h->dynindx, R_LARCH_JUMP_SLOT); + rela.r_addend = 0; ++ loc = relplt->contents + plt_idx * sizeof (ElfNN_External_Rela); ++ bed->s->swap_reloca_out (output_bfd, &rela, loc); + } + +- loc = relplt->contents + plt_idx * sizeof (ElfNN_External_Rela); +- bed->s->swap_reloca_out (output_bfd, &rela, loc); +- + if (!h->def_regular) + { + /* Mark the symbol as undefined, rather than as defined in +@@ -2930,15 +3647,14 @@ loongarch_elf_finish_dynamic_symbol (bfd *output_bfd, + if (h->got.offset != MINUS_ONE + /* TLS got entry have been handled in elf_relocate_section. */ + && !(loongarch_elf_hash_entry (h)->tls_type & (GOT_TLS_GD | GOT_TLS_IE)) +- /* have allocated got entry but not allocated rela before. */ ++ /* Have allocated got entry but not allocated rela before. */ + && !UNDEFWEAK_NO_DYNAMIC_RELOC (info, h)) + { + asection *sgot, *srela; + Elf_Internal_Rela rela; +- bfd_vma off = h->got.offset & ~(bfd_vma) 1; ++ bfd_vma off = h->got.offset & ~(bfd_vma)1; + + /* This symbol has an entry in the GOT. Set it up. */ +- + sgot = htab->elf.sgot; + srela = htab->elf.srelgot; + BFD_ASSERT (sgot && srela); +@@ -2963,7 +3679,6 @@ loongarch_elf_finish_dynamic_symbol (bfd *output_bfd, + } + else + { +- BFD_ASSERT ((h->got.offset & 1) == 0); + BFD_ASSERT (h->dynindx != -1); + rela.r_info = ELFNN_R_INFO (h->dynindx, R_LARCH_NN); + rela.r_addend = 0; +@@ -2993,7 +3708,6 @@ loongarch_elf_finish_dynamic_symbol (bfd *output_bfd, + } + else if (bfd_link_pic (info) && SYMBOL_REFERENCES_LOCAL (info, h)) + { +- BFD_ASSERT (h->got.offset & 1 /* Has been filled in addr. */); + asection *sec = h->root.u.def.section; + rela.r_info = ELFNN_R_INFO (0, R_LARCH_RELATIVE); + rela.r_addend = (h->root.u.def.value + sec->output_section->vma +@@ -3001,7 +3715,6 @@ loongarch_elf_finish_dynamic_symbol (bfd *output_bfd, + } + else + { +- BFD_ASSERT ((h->got.offset & 1) == 0); + BFD_ASSERT (h->dynindx != -1); + rela.r_info = ELFNN_R_INFO (h->dynindx, R_LARCH_NN); + rela.r_addend = 0; +@@ -3010,24 +3723,6 @@ loongarch_elf_finish_dynamic_symbol (bfd *output_bfd, + loongarch_elf_append_rela (output_bfd, srela, &rela); + } + +- if (h->needs_copy) +- { +- Elf_Internal_Rela rela; +- asection *s; +- +- /* This symbols needs a copy reloc. Set it up. */ +- BFD_ASSERT (h->dynindx != -1); +- +- rela.r_offset = sec_addr (h->root.u.def.section) + h->root.u.def.value; +- rela.r_info = ELFNN_R_INFO (h->dynindx, R_LARCH_COPY); +- rela.r_addend = 0; +- if (h->root.u.def.section == htab->elf.sdynrelro) +- s = htab->elf.sreldynrelro; +- else +- s = htab->elf.srelbss; +- loongarch_elf_append_rela (output_bfd, s, &rela); +- } +- + /* Mark some specially defined symbols as absolute. */ + if (h == htab->elf.hdynamic || h == htab->elf.hgot || h == htab->elf.hplt) + sym->st_shndx = SHN_ABS; +@@ -3337,7 +4032,6 @@ loongarch_elf_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) + #define PRPSINFO_OFFSET_PR_PS_ARGS 0x38 + #define PRPSINFO_SIZEOF_PR_PS_ARGS 0x50 + +- + static bool + loongarch_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) + { +diff --git a/bfd/elfxx-loongarch.c b/bfd/elfxx-loongarch.c +index 4424969e..0b00df55 100644 +--- a/bfd/elfxx-loongarch.c ++++ b/bfd/elfxx-loongarch.c +@@ -35,27 +35,30 @@ typedef struct loongarch_reloc_howto_type_struct + reloc_howto_type howto; + bfd_reloc_code_real_type bfd_type; + bool (*adjust_reloc_bits)(reloc_howto_type *, bfd_vma *); +-}loongarch_reloc_howto_type; ++ const char *larch_reloc_type_name; ++} loongarch_reloc_howto_type; + + #define LOONGARCH_DEFAULT_HOWTO(r_name) \ + { HOWTO (R_LARCH_##r_name, 0, 4, 32, false, 0, complain_overflow_signed, \ + bfd_elf_generic_reloc, "R_LARCH_" #r_name, false, 0, ALL_ONES, \ +- false), BFD_RELOC_LARCH_##r_name, NULL } ++ false), BFD_RELOC_LARCH_##r_name, NULL, NULL } + + #define LOONGARCH_HOWTO(type, right, size, bits, pcrel, left, ovf, func, \ +- name, inplace, src_mask, dst_mask, pcrel_off, btype, afunc) \ ++ name, inplace, src_mask, dst_mask, pcrel_off, btype, afunc,lname) \ + { HOWTO(type, right, size, bits, pcrel, left, ovf, func, name, \ +- inplace, src_mask, dst_mask, pcrel_off), btype, afunc } ++ inplace, src_mask, dst_mask, pcrel_off), btype, afunc, lname } + + #define LOONGARCH_EMPTY_HOWTO(C) \ +- { EMPTY_HOWTO(C), BFD_RELOC_NONE, NULL } +- +-bool loongarch_gen_adjust_reloc_bits (reloc_howto_type *howto, bfd_vma *val); +-bool loongarch_adjust_reloc_bits_l16_xx5_h5 (reloc_howto_type *howto, +- bfd_vma *fix_val); +-bool loongarch_adjust_reloc_bits_l16_h10 (reloc_howto_type *howto, +- bfd_vma *val); ++ { EMPTY_HOWTO (C), BFD_RELOC_NONE, NULL, NULL } + ++static bool ++reloc_bits (reloc_howto_type *howto, bfd_vma *val); ++static bool ++reloc_bits_b16 (reloc_howto_type *howto, bfd_vma *fix_val); ++static bool ++reloc_bits_b21 (reloc_howto_type *howto, bfd_vma *fix_val); ++static bool ++reloc_bits_b26 (reloc_howto_type *howto, bfd_vma *val); + + /* This does not include any relocation information, but should be + good enough for GDB or objdump to read the file. */ +@@ -76,7 +79,8 @@ static loongarch_reloc_howto_type loongarch_howto_table[] = + 0, /* dst_mask */ + false, /* pcrel_offset */ + BFD_RELOC_NONE, /* bfd_reloc_code_real_type */ +- NULL), /* adjust_reloc_bits */ ++ NULL, /* adjust_reloc_bits */ ++ NULL), /* larch_reloc_type_name */ + + /* 32 bit relocation. */ + LOONGARCH_HOWTO (R_LARCH_32, /* type (1). */ +@@ -93,7 +97,8 @@ static loongarch_reloc_howto_type loongarch_howto_table[] = + ALL_ONES, /* dst_mask */ + false, /* pcrel_offset */ + BFD_RELOC_32, /* bfd_reloc_code_real_type */ +- NULL), /* adjust_reloc_bits */ ++ NULL, /* adjust_reloc_bits */ ++ NULL), /* larch_reloc_type_name */ + + /* 64 bit relocation. */ + LOONGARCH_HOWTO (R_LARCH_64, /* type (2). */ +@@ -110,7 +115,8 @@ static loongarch_reloc_howto_type loongarch_howto_table[] = + ALL_ONES, /* dst_mask */ + false, /* pcrel_offset */ + BFD_RELOC_64, /* bfd_reloc_code_real_type */ +- NULL), /* adjust_reloc_bits */ ++ NULL, /* adjust_reloc_bits */ ++ NULL), /* larch_reloc_type_name */ + + LOONGARCH_HOWTO (R_LARCH_RELATIVE, /* type (3). */ + 0, /* rightshift */ +@@ -126,7 +132,8 @@ static loongarch_reloc_howto_type loongarch_howto_table[] = + ALL_ONES, /* dst_mask */ + false, /* pcrel_offset */ + BFD_RELOC_NONE, /* undefined? */ +- NULL), /* adjust_reloc_bits */ ++ NULL, /* adjust_reloc_bits */ ++ NULL), /* larch_reloc_type_name */ + + LOONGARCH_HOWTO (R_LARCH_COPY, /* type (4). */ + 0, /* rightshift */ +@@ -141,8 +148,9 @@ static loongarch_reloc_howto_type loongarch_howto_table[] = + 0, /* src_mask */ + 0, /* dst_mask */ + false, /* pcrel_offset */ +- BFD_RELOC_NONE, /* undefined? */ +- NULL), /* adjust_reloc_bits */ ++ BFD_RELOC_NONE, /* undefined? */ ++ NULL, /* adjust_reloc_bits */ ++ NULL), /* larch_reloc_type_name */ + + LOONGARCH_HOWTO (R_LARCH_JUMP_SLOT, /* type (5). */ + 0, /* rightshift */ +@@ -157,8 +165,9 @@ static loongarch_reloc_howto_type loongarch_howto_table[] = + 0, /* src_mask */ + 0, /* dst_mask */ + false, /* pcrel_offset */ +- BFD_RELOC_NONE, /* undefined? */ +- NULL), /* adjust_reloc_bits */ ++ BFD_RELOC_NONE, /* undefined? */ ++ NULL, /* adjust_reloc_bits */ ++ NULL), /* larch_reloc_type_name */ + + /* Dynamic TLS relocations. */ + LOONGARCH_HOWTO (R_LARCH_TLS_DTPMOD32, /* type (6). */ +@@ -175,7 +184,8 @@ static loongarch_reloc_howto_type loongarch_howto_table[] = + ALL_ONES, /* dst_mask */ + false, /* pcrel_offset */ + BFD_RELOC_LARCH_TLS_DTPMOD32, /* bfd_reloc_code_real_type */ +- NULL), /* adjust_reloc_bits */ ++ NULL, /* adjust_reloc_bits */ ++ NULL), /* larch_reloc_type_name */ + + LOONGARCH_HOWTO (R_LARCH_TLS_DTPMOD64, /* type (7). */ + 0, /* rightshift */ +@@ -191,7 +201,8 @@ static loongarch_reloc_howto_type loongarch_howto_table[] = + ALL_ONES, /* dst_mask */ + false, /* pcrel_offset */ + BFD_RELOC_LARCH_TLS_DTPMOD64, /* bfd_reloc_code_real_type */ +- NULL), /* adjust_reloc_bits */ ++ NULL, /* adjust_reloc_bits */ ++ NULL), /* larch_reloc_type_name */ + + LOONGARCH_HOWTO (R_LARCH_TLS_DTPREL32, /* type (8). */ + 0, /* rightshift */ +@@ -207,7 +218,8 @@ static loongarch_reloc_howto_type loongarch_howto_table[] = + ALL_ONES, /* dst_mask */ + false, /* pcrel_offset */ + BFD_RELOC_LARCH_TLS_DTPREL32, /* bfd_reloc_code_real_type */ +- NULL), /* adjust_reloc_bits */ ++ NULL, /* adjust_reloc_bits */ ++ NULL), /* larch_reloc_type_name */ + + LOONGARCH_HOWTO (R_LARCH_TLS_DTPREL64, /* type (9). */ + 0, /* rightshift */ +@@ -223,7 +235,8 @@ static loongarch_reloc_howto_type loongarch_howto_table[] = + ALL_ONES, /* dst_mask */ + false, /* pcrel_offset */ + BFD_RELOC_LARCH_TLS_DTPREL64, /* bfd_reloc_code_real_type */ +- NULL), /* adjust_reloc_bits */ ++ NULL, /* adjust_reloc_bits */ ++ NULL), /* larch_reloc_type_name */ + + LOONGARCH_HOWTO (R_LARCH_TLS_TPREL32, /* type (10). */ + 0, /* rightshift */ +@@ -239,7 +252,8 @@ static loongarch_reloc_howto_type loongarch_howto_table[] = + ALL_ONES, /* dst_mask */ + false, /* pcrel_offset */ + BFD_RELOC_LARCH_TLS_TPREL32, /* bfd_reloc_code_real_type */ +- NULL), /* adjust_reloc_bits */ ++ NULL, /* adjust_reloc_bits */ ++ NULL), /* larch_reloc_type_name */ + + LOONGARCH_HOWTO (R_LARCH_TLS_TPREL64, /* type (11). */ + 0, /* rightshift */ +@@ -255,7 +269,8 @@ static loongarch_reloc_howto_type loongarch_howto_table[] = + ALL_ONES, /* dst_mask */ + false, /* pcrel_offset */ + BFD_RELOC_LARCH_TLS_TPREL64, /* bfd_reloc_code_real_type */ +- NULL), /* adjust_reloc_bits */ ++ NULL, /* adjust_reloc_bits */ ++ NULL), /* larch_reloc_type_name */ + + LOONGARCH_HOWTO (R_LARCH_IRELATIVE, /* type (12). */ + 0, /* rightshift */ +@@ -271,63 +286,67 @@ static loongarch_reloc_howto_type loongarch_howto_table[] = + ALL_ONES, /* dst_mask */ + false, /* pcrel_offset */ + BFD_RELOC_NONE, /* undefined? */ +- NULL), /* adjust_reloc_bits */ ++ NULL, /* adjust_reloc_bits */ ++ NULL), /* larch_reloc_type_name */ + +- LOONGARCH_EMPTY_HOWTO(13), +- LOONGARCH_EMPTY_HOWTO(14), +- LOONGARCH_EMPTY_HOWTO(15), +- LOONGARCH_EMPTY_HOWTO(16), +- LOONGARCH_EMPTY_HOWTO(17), +- LOONGARCH_EMPTY_HOWTO(18), +- LOONGARCH_EMPTY_HOWTO(19), ++ LOONGARCH_EMPTY_HOWTO (13), ++ LOONGARCH_EMPTY_HOWTO (14), ++ LOONGARCH_EMPTY_HOWTO (15), ++ LOONGARCH_EMPTY_HOWTO (16), ++ LOONGARCH_EMPTY_HOWTO (17), ++ LOONGARCH_EMPTY_HOWTO (18), ++ LOONGARCH_EMPTY_HOWTO (19), + + LOONGARCH_HOWTO (R_LARCH_MARK_LA, /* type (20). */ +- 0, /* rightshift. */ +- 0, /* size. */ +- 0, /* bitsize. */ ++ 0, /* rightshift. */ ++ 0, /* size. */ ++ 0, /* bitsize. */ + false, /* pc_relative. */ +- 0, /* bitpos. */ +- complain_overflow_signed, /* complain_on_overflow. */ +- bfd_elf_generic_reloc, /* special_function. */ ++ 0, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ + "R_LARCH_MARK_LA", /* name. */ +- false, /* partial_inplace. */ ++ false, /* partial_inplace. */ + 0, /* src_mask. */ + 0, /* dst_mask. */ + false, /* pcrel_offset */ + BFD_RELOC_LARCH_MARK_LA, /* bfd_reloc_code_real_type */ +- NULL), /* adjust_reloc_bits */ ++ NULL, /* adjust_reloc_bits */ ++ NULL), /* larch_reloc_type_name */ + + LOONGARCH_HOWTO (R_LARCH_MARK_PCREL, /* type (21). */ +- 0, /* rightshift. */ +- 0, /* size. */ +- 0, /* bitsize. */ ++ 0, /* rightshift. */ ++ 0, /* size. */ ++ 0, /* bitsize. */ + false, /* pc_relative. */ +- 0, /* bitpos. */ +- complain_overflow_signed, /* complain_on_overflow. */ +- bfd_elf_generic_reloc, /* special_function. */ ++ 0, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ + "R_LARCH_MARK_PCREL", /* name. */ +- false, /* partial_inplace. */ ++ false, /* partial_inplace. */ + 0, /* src_mask. */ + 0, /* dst_mask. */ + false, /* pcrel_offset */ + BFD_RELOC_LARCH_MARK_PCREL, /* bfd_reloc_code_real_type */ +- NULL), /* adjust_reloc_bits */ ++ NULL, /* adjust_reloc_bits */ ++ NULL), /* larch_reloc_type_name */ + + LOONGARCH_HOWTO (R_LARCH_SOP_PUSH_PCREL, /* type (22). */ +- 2, /* rightshift. */ +- 4, /* size. */ +- 32, /* bitsize. */ ++ 2, /* rightshift. */ ++ 4, /* size. */ ++ 32, /* bitsize. */ + true /* FIXME: somewhat use this. */, /* pc_relative. */ +- 0, /* bitpos. */ +- complain_overflow_signed, /* complain_on_overflow. */ +- bfd_elf_generic_reloc, /* special_function. */ +- "R_LARCH_SOP_PUSH_PCREL", /* name. */ +- false, /* partial_inplace. */ ++ 0, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_SOP_PUSH_PCREL", /* name. */ ++ false, /* partial_inplace. */ + 0x03ffffff, /* src_mask. */ + 0x03ffffff, /* dst_mask. */ + false, /* pcrel_offset */ + BFD_RELOC_LARCH_SOP_PUSH_PCREL, /* bfd_reloc_code_real_type */ +- NULL), /* adjust_reloc_bits */ ++ NULL, /* adjust_reloc_bits */ ++ NULL), /* larch_reloc_type_name */ + + /* type 23-37. */ + LOONGARCH_DEFAULT_HOWTO (SOP_PUSH_ABSOLUTE), +@@ -347,343 +366,1001 @@ static loongarch_reloc_howto_type loongarch_howto_table[] = + LOONGARCH_DEFAULT_HOWTO (SOP_IF_ELSE), + + LOONGARCH_HOWTO (R_LARCH_SOP_POP_32_S_10_5, /* type (38). */ +- 0, /* rightshift. */ +- 4, /* size. */ +- 5, /* bitsize. */ ++ 0, /* rightshift. */ ++ 4, /* size. */ ++ 5, /* bitsize. */ + false, /* pc_relative. */ +- 10, /* bitpos. */ +- complain_overflow_signed, /* complain_on_overflow. */ +- bfd_elf_generic_reloc, /* special_function. */ +- "R_LARCH_SOP_POP_32_S_10_5", /* name. */ +- false, /* partial_inplace. */ ++ 10, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_SOP_POP_32_S_10_5", /* name. */ ++ false, /* partial_inplace. */ + 0, /* src_mask */ + 0x7c00, /* dst_mask */ + false, /* pcrel_offset */ + BFD_RELOC_LARCH_SOP_POP_32_S_10_5, /* bfd_reloc_code_real_type */ +- loongarch_gen_adjust_reloc_bits), /* adjust_reloc_bits */ ++ reloc_bits, /* adjust_reloc_bits */ ++ NULL), /* larch_reloc_type_name */ + + LOONGARCH_HOWTO (R_LARCH_SOP_POP_32_U_10_12, /* type (39). */ +- 0, /* rightshift. */ +- 4, /* size. */ +- 12, /* bitsize. */ ++ 0, /* rightshift. */ ++ 4, /* size. */ ++ 12, /* bitsize. */ + false, /* pc_relative. */ +- 10, /* bitpos. */ +- complain_overflow_unsigned, /* complain_on_overflow. */ +- bfd_elf_generic_reloc, /* special_function. */ +- "R_LARCH_SOP_POP_32_U_10_12", /* name. */ +- false, /* partial_inplace. */ ++ 10, /* bitpos. */ ++ complain_overflow_unsigned, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_SOP_POP_32_U_10_12", /* name. */ ++ false, /* partial_inplace. */ + 0, /* src_mask */ + 0x3ffc00, /* dst_mask */ + false, /* pcrel_offset */ + BFD_RELOC_LARCH_SOP_POP_32_U_10_12, /* bfd_reloc_code_real_type */ +- loongarch_gen_adjust_reloc_bits), /* adjust_reloc_bits */ ++ reloc_bits, /* adjust_reloc_bits */ ++ NULL), /* larch_reloc_type_name */ + + LOONGARCH_HOWTO (R_LARCH_SOP_POP_32_S_10_12, /* type (40). */ +- 0, /* rightshift. */ +- 4, /* size. */ +- 12, /* bitsize. */ ++ 0, /* rightshift. */ ++ 4, /* size. */ ++ 12, /* bitsize. */ + false, /* pc_relative. */ +- 10, /* bitpos. */ +- complain_overflow_signed, /* complain_on_overflow. */ +- bfd_elf_generic_reloc, /* special_function. */ +- "R_LARCH_SOP_POP_32_S_10_12", /* name. */ +- false, /* partial_inplace. */ ++ 10, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_SOP_POP_32_S_10_12", /* name. */ ++ false, /* partial_inplace. */ + 0, /* src_mask */ + 0x3ffc00, /* dst_mask */ + false, /* pcrel_offset */ + BFD_RELOC_LARCH_SOP_POP_32_S_10_12, /* bfd_reloc_code_real_type */ +- loongarch_gen_adjust_reloc_bits), /* adjust_reloc_bits */ ++ reloc_bits, /* adjust_reloc_bits */ ++ NULL), /* larch_reloc_type_name */ + + LOONGARCH_HOWTO (R_LARCH_SOP_POP_32_S_10_16, /* type (41). */ +- 0, /* rightshift. */ +- 4, /* size. */ +- 16, /* bitsize. */ ++ 0, /* rightshift. */ ++ 4, /* size. */ ++ 16, /* bitsize. */ + false, /* pc_relative. */ +- 10, /* bitpos. */ +- complain_overflow_signed, /* complain_on_overflow. */ +- bfd_elf_generic_reloc, /* special_function. */ +- "R_LARCH_SOP_POP_32_S_10_16", /* name. */ +- false, /* partial_inplace. */ ++ 10, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_SOP_POP_32_S_10_16", /* name. */ ++ false, /* partial_inplace. */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + false, /* pcrel_offset */ + BFD_RELOC_LARCH_SOP_POP_32_S_10_16, /* bfd_reloc_code_real_type */ +- loongarch_gen_adjust_reloc_bits), /* adjust_reloc_bits */ ++ reloc_bits, /* adjust_reloc_bits */ ++ NULL), /* larch_reloc_type_name */ + + LOONGARCH_HOWTO (R_LARCH_SOP_POP_32_S_10_16_S2, /* type (42). */ + 2, /* rightshift. */ +- 4, /* size. */ +- 16, /* bitsize. */ ++ 4, /* size. */ ++ 16, /* bitsize. */ + false, /* pc_relative. */ +- 10, /* bitpos. */ +- complain_overflow_signed, /* complain_on_overflow. */ +- bfd_elf_generic_reloc, /* special_function. */ +- "R_LARCH_SOP_POP_32_S_10_16_S2", /* name. */ +- false, /* partial_inplace. */ ++ 10, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_SOP_POP_32_S_10_16_S2", /* name. */ ++ false, /* partial_inplace. */ + 0, /* src_mask */ + 0x3fffc00, /* dst_mask */ + false, /* pcrel_offset */ + BFD_RELOC_LARCH_SOP_POP_32_S_10_16_S2, /* bfd_reloc_code_real_type */ +- loongarch_gen_adjust_reloc_bits), /* adjust_reloc_bits */ ++ reloc_bits_b16, /* adjust_reloc_bits */ ++ NULL), /* larch_reloc_type_name */ + + LOONGARCH_HOWTO (R_LARCH_SOP_POP_32_S_5_20, /* type (43). */ +- 0, /* rightshift. */ +- 4, /* size. */ +- 20, /* bitsize. */ ++ 0, /* rightshift. */ ++ 4, /* size. */ ++ 20, /* bitsize. */ + false, /* pc_relative. */ +- 5, /* bitpos. */ +- complain_overflow_signed, /* complain_on_overflow. */ +- bfd_elf_generic_reloc, /* special_function. */ +- "R_LARCH_SOP_POP_32_S_5_20", /* name. */ +- false, /* partial_inplace. */ ++ 5, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_SOP_POP_32_S_5_20", /* name. */ ++ false, /* partial_inplace. */ + 0, /* src_mask */ + 0x1ffffe0, /* dst_mask */ + false, /* pcrel_offset */ + BFD_RELOC_LARCH_SOP_POP_32_S_5_20, /* bfd_reloc_code_real_type */ +- loongarch_gen_adjust_reloc_bits), /* adjust_reloc_bits */ ++ reloc_bits, /* adjust_reloc_bits */ ++ NULL), /* larch_reloc_type_name */ + + LOONGARCH_HOWTO (R_LARCH_SOP_POP_32_S_0_5_10_16_S2, + /* type (44). */ + 2, /* rightshift. */ + 4, /* size. */ +- 21, /* bitsize. */ ++ 21, /* bitsize. */ + false, /* pc_relative. */ +- 0, /* bitpos. */ +- complain_overflow_signed, /* complain_on_overflow. */ +- bfd_elf_generic_reloc, /* special_function. */ +- "R_LARCH_SOP_POP_32_S_0_5_10_16_S2", /* name. */ +- false, /* partial_inplace. */ ++ 0, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_SOP_POP_32_S_0_5_10_16_S2", /* name. */ ++ false, /* partial_inplace. */ + 0xfc0003e0, /* src_mask */ + 0xfc0003e0, /* dst_mask */ + false, /* pcrel_offset */ + BFD_RELOC_LARCH_SOP_POP_32_S_0_5_10_16_S2, + /* bfd_reloc_code_real_type */ +- loongarch_adjust_reloc_bits_l16_xx5_h5), /* adjust_reloc_bits */ ++ reloc_bits_b21, /* adjust_reloc_bits */ ++ NULL), /* larch_reloc_type_name */ + + LOONGARCH_HOWTO (R_LARCH_SOP_POP_32_S_0_10_10_16_S2, /* type (45). */ +- 2, /* rightshift. */ +- 4, /* size. */ +- 26, /* bitsize. */ +- false, /* pc_relative. */ +- 0, /* bitpos. */ +- complain_overflow_signed, /* complain_on_overflow. */ +- bfd_elf_generic_reloc, /* special_function. */ +- "R_LARCH_SOP_POP_32_S_0_10_10_16_S2", /* name. */ +- false, /* partial_inplace. */ +- 0xfc000000, /* src_mask */ +- 0xfc000000, /* dst_mask */ ++ 2, /* rightshift. */ ++ 4, /* size. */ ++ 26, /* bitsize. */ ++ false, /* pc_relative. */ ++ 0, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_SOP_POP_32_S_0_10_10_16_S2", /* name. */ ++ false, /* partial_inplace. */ ++ 0, /* src_mask */ ++ 0x03ffffff, /* dst_mask */ + false, /* pcrel_offset */ + BFD_RELOC_LARCH_SOP_POP_32_S_0_10_10_16_S2, + /* bfd_reloc_code_real_type */ +- loongarch_adjust_reloc_bits_l16_h10), /* adjust_reloc_bits */ ++ reloc_bits_b26, /* adjust_reloc_bits */ ++ NULL), /* larch_reloc_type_name */ + + LOONGARCH_HOWTO (R_LARCH_SOP_POP_32_U, /* type (46). */ +- 0, /* rightshift. */ +- 4, /* size. */ +- 32, /* bitsize. */ +- false, /* pc_relative. */ +- 0, /* bitpos. */ +- complain_overflow_unsigned, /* complain_on_overflow. */ +- bfd_elf_generic_reloc, /* special_function. */ +- "R_LARCH_SOP_POP_32_S_U", /* name. */ +- false, /* partial_inplace. */ ++ 0, /* rightshift. */ ++ 4, /* size. */ ++ 32, /* bitsize. */ ++ false, /* pc_relative. */ ++ 0, /* bitpos. */ ++ complain_overflow_unsigned, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_SOP_POP_32_S_U", /* name. */ ++ false, /* partial_inplace. */ + 0xffffffff00000000, /* src_mask */ + 0x00000000ffffffff, /* dst_mask */ + false, /* pcrel_offset */ + BFD_RELOC_LARCH_SOP_POP_32_U, /* bfd_reloc_code_real_type */ +- loongarch_gen_adjust_reloc_bits), /* adjust_reloc_bits */ ++ reloc_bits, /* adjust_reloc_bits */ ++ NULL), /* larch_reloc_type_name */ + +- LOONGARCH_HOWTO (R_LARCH_ADD8, /* type (47). */ +- 0, /* rightshift. */ +- 4, /* size. */ +- 8, /* bitsize. */ ++ LOONGARCH_HOWTO (R_LARCH_ADD8, /* type (47). */ ++ 0, /* rightshift. */ ++ 4, /* size. */ ++ 8, /* bitsize. */ + false, /* pc_relative. */ +- 0, /* bitpos. */ +- complain_overflow_signed, /* complain_on_overflow. */ +- bfd_elf_generic_reloc, /* special_function. */ +- "R_LARCH_ADD8", /* name. */ +- false, /* partial_inplace. */ ++ 0, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_ADD8", /* name. */ ++ false, /* partial_inplace. */ + 0, /* src_mask */ + ALL_ONES, /* dst_mask */ + false, /* pcrel_offset */ + BFD_RELOC_LARCH_ADD8, /* bfd_reloc_code_real_type */ +- NULL), /* adjust_reloc_bits */ ++ NULL, /* adjust_reloc_bits */ ++ NULL), /* larch_reloc_type_name */ + +- LOONGARCH_HOWTO (R_LARCH_ADD16, /* type (48). */ +- 0, /* rightshift. */ +- 4, /* size. */ +- 16, /* bitsize. */ ++ LOONGARCH_HOWTO (R_LARCH_ADD16, /* type (48). */ ++ 0, /* rightshift. */ ++ 4, /* size. */ ++ 16, /* bitsize. */ + false, /* pc_relative. */ +- 0, /* bitpos. */ +- complain_overflow_signed, /* complain_on_overflow. */ +- bfd_elf_generic_reloc, /* special_function. */ +- "R_LARCH_ADD16", /* name. */ +- false, /* partial_inplace. */ ++ 0, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_ADD16", /* name. */ ++ false, /* partial_inplace. */ + 0, /* src_mask */ + ALL_ONES, /* dst_mask */ + false, /* pcrel_offset */ + BFD_RELOC_LARCH_ADD16, /* bfd_reloc_code_real_type */ +- NULL), /* adjust_reloc_bits */ ++ NULL, /* adjust_reloc_bits */ ++ NULL), /* larch_reloc_type_name */ + +- LOONGARCH_HOWTO (R_LARCH_ADD24, /* type (49). */ +- 0, /* rightshift. */ +- 4, /* size. */ +- 24, /* bitsize. */ ++ LOONGARCH_HOWTO (R_LARCH_ADD24, /* type (49). */ ++ 0, /* rightshift. */ ++ 4, /* size. */ ++ 24, /* bitsize. */ + false, /* pc_relative. */ +- 0, /* bitpos. */ +- complain_overflow_signed, /* complain_on_overflow. */ +- bfd_elf_generic_reloc, /* special_function. */ +- "R_LARCH_ADD24", /* name. */ +- false, /* partial_inplace. */ ++ 0, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_ADD24", /* name. */ ++ false, /* partial_inplace. */ + 0, /* src_mask */ + ALL_ONES, /* dst_mask */ + false, /* pcrel_offset */ + BFD_RELOC_LARCH_ADD24, /* bfd_reloc_code_real_type */ +- NULL), /* adjust_reloc_bits */ ++ NULL, /* adjust_reloc_bits */ ++ NULL), /* larch_reloc_type_name */ + +- LOONGARCH_HOWTO (R_LARCH_ADD32, /* type (50). */ +- 0, /* rightshift. */ +- 4, /* size. */ +- 32, /* bitsize. */ ++ LOONGARCH_HOWTO (R_LARCH_ADD32, /* type (50). */ ++ 0, /* rightshift. */ ++ 4, /* size. */ ++ 32, /* bitsize. */ + false, /* pc_relative. */ +- 0, /* bitpos. */ +- complain_overflow_signed, /* complain_on_overflow. */ +- bfd_elf_generic_reloc, /* special_function. */ +- "R_LARCH_ADD32", /* name. */ +- false, /* partial_inplace. */ ++ 0, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_ADD32", /* name. */ ++ false, /* partial_inplace. */ + 0, /* src_mask */ + ALL_ONES, /* dst_mask */ + false, /* pcrel_offset */ + BFD_RELOC_LARCH_ADD32, /* bfd_reloc_code_real_type */ +- NULL), /* adjust_reloc_bits */ ++ NULL, /* adjust_reloc_bits */ ++ NULL), /* larch_reloc_type_name */ + +- LOONGARCH_HOWTO (R_LARCH_ADD64, /* type (51). */ +- 0, /* rightshift. */ +- 8, /* size. */ +- 64, /* bitsize. */ ++ LOONGARCH_HOWTO (R_LARCH_ADD64, /* type (51). */ ++ 0, /* rightshift. */ ++ 8, /* size. */ ++ 64, /* bitsize. */ + false, /* pc_relative. */ +- 0, /* bitpos. */ +- complain_overflow_signed, /* complain_on_overflow. */ +- bfd_elf_generic_reloc, /* special_function. */ +- "R_LARCH_ADD64", /* name. */ +- false, /* partial_inplace. */ ++ 0, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_ADD64", /* name. */ ++ false, /* partial_inplace. */ + 0, /* src_mask */ + ALL_ONES, /* dst_mask */ + false, /* pcrel_offset */ + BFD_RELOC_LARCH_ADD64, /* bfd_reloc_code_real_type */ +- NULL), /* adjust_reloc_bits */ ++ NULL, /* adjust_reloc_bits */ ++ NULL), /* larch_reloc_type_name */ + +- LOONGARCH_HOWTO (R_LARCH_SUB8, /* type (52). */ +- 0, /* rightshift. */ +- 4, /* size. */ +- 8, /* bitsize. */ ++ LOONGARCH_HOWTO (R_LARCH_SUB8, /* type (52). */ ++ 0, /* rightshift. */ ++ 4, /* size. */ ++ 8, /* bitsize. */ + false, /* pc_relative. */ +- 0, /* bitpos. */ +- complain_overflow_signed, /* complain_on_overflow. */ +- bfd_elf_generic_reloc, /* special_function. */ +- "R_LARCH_SUB8", /* name. */ +- false, /* partial_inplace. */ ++ 0, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_SUB8", /* name. */ ++ false, /* partial_inplace. */ + 0, /* src_mask */ + ALL_ONES, /* dst_mask */ + false, /* pcrel_offset */ + BFD_RELOC_LARCH_SUB8, /* bfd_reloc_code_real_type */ +- NULL), /* adjust_reloc_bits */ ++ NULL, /* adjust_reloc_bits */ ++ NULL), /* larch_reloc_type_name */ + +- LOONGARCH_HOWTO (R_LARCH_SUB16, /* type (53). */ +- 0, /* rightshift. */ +- 4, /* size. */ +- 16, /* bitsize. */ ++ LOONGARCH_HOWTO (R_LARCH_SUB16, /* type (53). */ ++ 0, /* rightshift. */ ++ 4, /* size. */ ++ 16, /* bitsize. */ + false, /* pc_relative. */ +- 0, /* bitpos. */ +- complain_overflow_signed, /* complain_on_overflow. */ +- bfd_elf_generic_reloc, /* special_function. */ +- "R_LARCH_SUB16", /* name. */ +- false, /* partial_inplace. */ ++ 0, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_SUB16", /* name. */ ++ false, /* partial_inplace. */ + 0, /* src_mask */ + ALL_ONES, /* dst_mask */ + false, /* pcrel_offset */ + BFD_RELOC_LARCH_SUB16, /* bfd_reloc_code_real_type */ +- NULL), /* adjust_reloc_bits */ ++ NULL, /* adjust_reloc_bits */ ++ NULL), /* larch_reloc_type_name */ + +- LOONGARCH_HOWTO (R_LARCH_SUB24, /* type (54). */ +- 0, /* rightshift. */ +- 4, /* size. */ +- 24, /* bitsize. */ ++ LOONGARCH_HOWTO (R_LARCH_SUB24, /* type (54). */ ++ 0, /* rightshift. */ ++ 4, /* size. */ ++ 24, /* bitsize. */ + false, /* pc_relative. */ +- 0, /* bitpos. */ +- complain_overflow_signed, /* complain_on_overflow. */ +- bfd_elf_generic_reloc, /* special_function. */ +- "R_LARCH_SUB24", /* name. */ +- false, /* partial_inplace. */ ++ 0, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_SUB24", /* name. */ ++ false, /* partial_inplace. */ + 0, /* src_mask */ + ALL_ONES, /* dst_mask */ + false, /* pcrel_offset */ + BFD_RELOC_LARCH_SUB24, /* bfd_reloc_code_real_type */ +- NULL), /* adjust_reloc_bits */ ++ NULL, /* adjust_reloc_bits */ ++ NULL), /* larch_reloc_type_name */ + +- LOONGARCH_HOWTO (R_LARCH_SUB32, /* type (55). */ +- 0, /* rightshift. */ +- 4, /* size. */ +- 32, /* bitsize. */ ++ LOONGARCH_HOWTO (R_LARCH_SUB32, /* type (55). */ ++ 0, /* rightshift. */ ++ 4, /* size. */ ++ 32, /* bitsize. */ + false, /* pc_relative. */ +- 0, /* bitpos. */ +- complain_overflow_signed, /* complain_on_overflow. */ +- bfd_elf_generic_reloc, /* special_function. */ +- "R_LARCH_SUB32", /* name. */ +- false, /* partial_inplace. */ ++ 0, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_SUB32", /* name. */ ++ false, /* partial_inplace. */ + 0, /* src_mask */ + ALL_ONES, /* dst_mask */ + false, /* pcrel_offset */ + BFD_RELOC_LARCH_SUB32, /* bfd_reloc_code_real_type */ +- NULL), /* adjust_reloc_bits */ ++ NULL, /* adjust_reloc_bits */ ++ NULL), /* larch_reloc_type_name */ + +- LOONGARCH_HOWTO (R_LARCH_SUB64, /* type (56). */ +- 0, /* rightshift. */ +- 8, /* size. */ +- 64, /* bitsize. */ ++ LOONGARCH_HOWTO (R_LARCH_SUB64, /* type (56). */ ++ 0, /* rightshift. */ ++ 8, /* size. */ ++ 64, /* bitsize. */ + false, /* pc_relative. */ +- 0, /* bitpos. */ +- complain_overflow_signed, /* complain_on_overflow. */ +- bfd_elf_generic_reloc, /* special_function. */ +- "R_LARCH_SUB64", /* name. */ +- false, /* partial_inplace. */ ++ 0, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_SUB64", /* name. */ ++ false, /* partial_inplace. */ + 0, /* src_mask */ + ALL_ONES, /* dst_mask */ + false, /* pcrel_offset */ + BFD_RELOC_LARCH_SUB64, /* bfd_reloc_code_real_type */ +- NULL), /* adjust_reloc_bits */ ++ NULL, /* adjust_reloc_bits */ ++ NULL), /* larch_reloc_type_name */ + +- LOONGARCH_HOWTO (R_LARCH_GNU_VTINHERIT, /* type (57). */ +- 0, /* rightshift. */ +- 0, /* size. */ +- 0, /* bitsize. */ ++ LOONGARCH_HOWTO (R_LARCH_GNU_VTINHERIT, /* type (57). */ ++ 0, /* rightshift. */ ++ 0, /* size. */ ++ 0, /* bitsize. */ + false, /* pc_relative. */ +- 0, /* bitpos. */ +- complain_overflow_signed, /* complain_on_overflow. */ +- bfd_elf_generic_reloc, /* special_function. */ +- "R_LARCH_GNU_VTINHERIT", /* name. */ +- false, /* partial_inplace. */ ++ 0, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_GNU_VTINHERIT", /* name. */ ++ false, /* partial_inplace. */ + 0, /* src_mask */ + 0, /* dst_mask */ + false, /* pcrel_offset */ + BFD_RELOC_NONE, /* bfd_reloc_code_real_type */ +- NULL), /* adjust_reloc_bits */ ++ NULL, /* adjust_reloc_bits */ ++ NULL), /* larch_reloc_type_name */ + +- LOONGARCH_HOWTO (R_LARCH_GNU_VTENTRY, /* type (58). */ +- 0, /* rightshift. */ +- 0, /* size. */ +- 0, /* bitsize. */ ++ LOONGARCH_HOWTO (R_LARCH_GNU_VTENTRY, /* type (58). */ ++ 0, /* rightshift. */ ++ 0, /* size. */ ++ 0, /* bitsize. */ + false, /* pc_relative. */ +- 0, /* bitpos. */ +- complain_overflow_signed, /* complain_on_overflow. */ ++ 0, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ + NULL, /* special_function. */ +- "R_LARCH_GNU_VTENTRY", /* name. */ +- false, /* partial_inplace. */ ++ "R_LARCH_GNU_VTENTRY", /* name. */ ++ false, /* partial_inplace. */ + 0, /* src_mask */ + 0, /* dst_mask */ + false, /* pcrel_offset */ + BFD_RELOC_NONE, /* bfd_reloc_code_real_type */ +- NULL), /* adjust_reloc_bits */ ++ NULL, /* adjust_reloc_bits */ ++ NULL), /* larch_reloc_type_name */ ++ ++ LOONGARCH_EMPTY_HOWTO (59), ++ LOONGARCH_EMPTY_HOWTO (60), ++ LOONGARCH_EMPTY_HOWTO (61), ++ LOONGARCH_EMPTY_HOWTO (62), ++ LOONGARCH_EMPTY_HOWTO (63), ++ ++ /* New reloc types. */ ++ LOONGARCH_HOWTO (R_LARCH_B16, /* type (64). */ ++ 2, /* rightshift. */ ++ 4, /* size. */ ++ 16, /* bitsize. */ ++ false, /* pc_relative. */ ++ 10, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_B16", /* name. */ ++ false, /* partial_inplace. */ ++ 0x3fffc00, /* src_mask */ ++ 0x3fffc00, /* dst_mask */ ++ false, /* pcrel_offset */ ++ BFD_RELOC_LARCH_B16, /* bfd_reloc_code_real_type */ ++ reloc_bits_b16, /* adjust_reloc_bits */ ++ "b16"), /* larch_reloc_type_name */ ++ ++ LOONGARCH_HOWTO (R_LARCH_B21, /* type (65). */ ++ 2, /* rightshift. */ ++ 4, /* size. */ ++ 21, /* bitsize. */ ++ false, /* pc_relative. */ ++ 0, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_B21", /* name. */ ++ false, /* partial_inplace. */ ++ 0xfc0003e0, /* src_mask */ ++ 0xfc0003e0, /* dst_mask */ ++ false, /* pcrel_offset */ ++ BFD_RELOC_LARCH_B21, /* bfd_reloc_code_real_type */ ++ reloc_bits_b21, /* adjust_reloc_bits */ ++ "b21"), /* larch_reloc_type_name */ ++ ++ LOONGARCH_HOWTO (R_LARCH_B26, /* type (66). */ ++ 2, /* rightshift. */ ++ 4, /* size. */ ++ 26, /* bitsize. */ ++ false, /* pc_relative. */ ++ 0, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_B26", /* name. */ ++ false, /* partial_inplace. */ ++ 0, /* src_mask */ ++ 0x03ffffff, /* dst_mask */ ++ false, /* pcrel_offset */ ++ BFD_RELOC_LARCH_B26, /* bfd_reloc_code_real_type */ ++ reloc_bits_b26, /* adjust_reloc_bits */ ++ "b26"), /* larch_reloc_type_name */ ++ ++ LOONGARCH_HOWTO (R_LARCH_ABS_HI20, /* type (67). */ ++ 12, /* rightshift. */ ++ 4, /* size. */ ++ 20, /* bitsize. */ ++ false, /* pc_relative. */ ++ 5, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_ABS_HI20", /* name. */ ++ false, /* partial_inplace. */ ++ 0, /* src_mask */ ++ 0x1ffffe0, /* dst_mask */ ++ false, /* pcrel_offset */ ++ BFD_RELOC_LARCH_ABS_HI20, /* bfd_reloc_code_real_type */ ++ reloc_bits, /* adjust_reloc_bits */ ++ "abs_hi20"), /* larch_reloc_type_name */ ++ ++ LOONGARCH_HOWTO (R_LARCH_ABS_LO12, /* type (68). */ ++ 0, /* rightshift. */ ++ 4, /* size. */ ++ 12, /* bitsize. */ ++ false, /* pc_relative. */ ++ 10, /* bitpos. */ ++ complain_overflow_unsigned, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_ABS_LO12", /* name. */ ++ false, /* partial_inplace. */ ++ 0, /* src_mask */ ++ 0x3ffc00, /* dst_mask */ ++ false, /* pcrel_offset */ ++ BFD_RELOC_LARCH_ABS_LO12, /* bfd_reloc_code_real_type */ ++ reloc_bits, /* adjust_reloc_bits */ ++ "abs_lo12"), /* larch_reloc_type_name */ ++ ++ LOONGARCH_HOWTO (R_LARCH_ABS64_LO20, /* type (69). */ ++ 32, /* rightshift. */ ++ 4, /* size. */ ++ 20, /* bitsize. */ ++ false, /* pc_relative. */ ++ 5, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_ABS64_LO20", /* name. */ ++ false, /* partial_inplace. */ ++ 0, /* src_mask */ ++ 0x1ffffe0, /* dst_mask */ ++ false, /* pcrel_offset */ ++ BFD_RELOC_LARCH_ABS64_LO20, /* bfd_reloc_code_real_type */ ++ reloc_bits, /* adjust_reloc_bits */ ++ "abs64_lo20"), /* larch_reloc_type_name */ ++ ++ LOONGARCH_HOWTO (R_LARCH_ABS64_HI12, /* type (70). */ ++ 52, /* rightshift. */ ++ 4, /* size. */ ++ 12, /* bitsize. */ ++ false, /* pc_relative. */ ++ 10, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_ABS64_HI12", /* name. */ ++ false, /* partial_inplace. */ ++ 0, /* src_mask */ ++ 0x3ffc00, /* dst_mask */ ++ false, /* pcrel_offset */ ++ BFD_RELOC_LARCH_ABS64_HI12, /* bfd_reloc_code_real_type */ ++ reloc_bits, /* adjust_reloc_bits */ ++ "abs64_hi12"), /* larch_reloc_type_name */ ++ ++ LOONGARCH_HOWTO (R_LARCH_PCALA_HI20, /* type (71). */ ++ 12, /* rightshift. */ ++ 4, /* size. */ ++ 20, /* bitsize. */ ++ false, /* pc_relative. */ ++ 5, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_PCALA_HI20", /* name. */ ++ false, /* partial_inplace. */ ++ 0, /* src_mask */ ++ 0x1ffffe0, /* dst_mask */ ++ false, /* pcrel_offset */ ++ BFD_RELOC_LARCH_PCALA_HI20, /* bfd_reloc_code_real_type */ ++ reloc_bits, /* adjust_reloc_bits */ ++ "pc_hi20"), /* larch_reloc_type_name */ ++ ++ LOONGARCH_HOWTO (R_LARCH_PCALA_LO12, /* type (72). */ ++ 0, /* rightshift. */ ++ 4, /* size. */ ++ 12, /* bitsize. */ ++ false, /* pc_relative. */ ++ 10, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_PCALA_LO12", /* name. */ ++ false, /* partial_inplace. */ ++ 0, /* src_mask */ ++ 0x3ffc00, /* dst_mask */ ++ false, /* pcrel_offset */ ++ BFD_RELOC_LARCH_PCALA_LO12, /* bfd_reloc_code_real_type */ ++ reloc_bits, /* adjust_reloc_bits */ ++ "pc_lo12"), /* larch_reloc_type_name */ ++ ++ LOONGARCH_HOWTO (R_LARCH_PCALA64_LO20, /* type (73). */ ++ 32, /* rightshift. */ ++ 4, /* size. */ ++ 20, /* bitsize. */ ++ false, /* pc_relative. */ ++ 5, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_PCALA64_LO20", /* name. */ ++ false, /* partial_inplace. */ ++ 0, /* src_mask */ ++ 0x1ffffe0, /* dst_mask */ ++ false, /* pcrel_offset */ ++ BFD_RELOC_LARCH_PCALA64_LO20, /* bfd_reloc_code_real_type */ ++ reloc_bits, /* adjust_reloc_bits */ ++ "pc64_lo20"), /* larch_reloc_type_name */ ++ ++ LOONGARCH_HOWTO (R_LARCH_PCALA64_HI12, /* type (74). */ ++ 52, /* rightshift. */ ++ 4, /* size. */ ++ 12, /* bitsize. */ ++ false, /* pc_relative. */ ++ 10, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_PCALA64_HI12", /* name. */ ++ false, /* partial_inplace. */ ++ 0, /* src_mask */ ++ 0x3ffc00, /* dst_mask */ ++ false, /* pcrel_offset */ ++ BFD_RELOC_LARCH_PCALA64_HI12, /* bfd_reloc_code_real_type */ ++ reloc_bits, /* adjust_reloc_bits */ ++ "pc64_hi12"), /* larch_reloc_type_name */ ++ ++ LOONGARCH_HOWTO (R_LARCH_GOT_PC_HI20, /* type (75). */ ++ 12, /* rightshift. */ ++ 4, /* size. */ ++ 20, /* bitsize. */ ++ false, /* pc_relative. */ ++ 5, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_GOT_PC_HI20", /* name. */ ++ false, /* partial_inplace. */ ++ 0, /* src_mask */ ++ 0x1ffffe0, /* dst_mask */ ++ false, /* pcrel_offset */ ++ BFD_RELOC_LARCH_GOT_PC_HI20, /* bfd_reloc_code_real_type */ ++ reloc_bits, /* adjust_reloc_bits */ ++ "got_pc_hi20"), /* larch_reloc_type_name */ ++ ++ LOONGARCH_HOWTO (R_LARCH_GOT_PC_LO12, /* type (76). */ ++ 0, /* rightshift. */ ++ 4, /* size. */ ++ 12, /* bitsize. */ ++ false, /* pc_relative. */ ++ 10, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_GOT_PC_LO12", /* name. */ ++ false, /* partial_inplace. */ ++ 0, /* src_mask */ ++ 0x3ffc00, /* dst_mask */ ++ false, /* pcrel_offset */ ++ BFD_RELOC_LARCH_GOT_PC_LO12, /* bfd_reloc_code_real_type */ ++ reloc_bits, /* adjust_reloc_bits */ ++ "got_pc_lo12"), /* larch_reloc_type_name */ ++ ++ LOONGARCH_HOWTO (R_LARCH_GOT64_PC_LO20, /* type (77). */ ++ 32, /* rightshift. */ ++ 4, /* size. */ ++ 20, /* bitsize. */ ++ false, /* pc_relative. */ ++ 5, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_GOT64_PC_LO20", /* name. */ ++ false, /* partial_inplace. */ ++ 0, /* src_mask */ ++ 0x1ffffe0, /* dst_mask */ ++ false, /* pcrel_offset */ ++ BFD_RELOC_LARCH_GOT64_PC_LO20, /* bfd_reloc_code_real_type */ ++ reloc_bits, /* adjust_reloc_bits */ ++ "got64_pc_lo20"), /* larch_reloc_type_name */ ++ ++ LOONGARCH_HOWTO (R_LARCH_GOT64_PC_HI12, /* type (78). */ ++ 52, /* rightshift. */ ++ 4, /* size. */ ++ 12, /* bitsize. */ ++ false, /* pc_relative. */ ++ 10, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_GOT64_PC_HI12", /* name. */ ++ false, /* partial_inplace. */ ++ 0, /* src_mask */ ++ 0x3ffc00, /* dst_mask */ ++ false, /* pcrel_offset */ ++ BFD_RELOC_LARCH_GOT64_PC_HI12, /* bfd_reloc_code_real_type */ ++ reloc_bits, /* adjust_reloc_bits */ ++ "got64_pc_hi12"), /* larch_reloc_type_name */ ++ ++ LOONGARCH_HOWTO (R_LARCH_GOT_HI20, /* type (79). */ ++ 12, /* rightshift. */ ++ 4, /* size. */ ++ 20, /* bitsize. */ ++ false, /* pc_relative. */ ++ 5, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_GOT_HI20", /* name. */ ++ false, /* partial_inplace. */ ++ 0, /* src_mask */ ++ 0x1ffffe0, /* dst_mask */ ++ false, /* pcrel_offset */ ++ BFD_RELOC_LARCH_GOT_HI20, /* bfd_reloc_code_real_type */ ++ reloc_bits, /* adjust_reloc_bits */ ++ "got_hi20"), /* larch_reloc_type_name */ ++ ++ LOONGARCH_HOWTO (R_LARCH_GOT_LO12, /* type (80). */ ++ 0, /* rightshift. */ ++ 4, /* size. */ ++ 12, /* bitsize. */ ++ false, /* pc_relative. */ ++ 10, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_GOT_LO12", /* name. */ ++ false, /* partial_inplace. */ ++ 0, /* src_mask */ ++ 0x3ffc00, /* dst_mask */ ++ false, /* pcrel_offset */ ++ BFD_RELOC_LARCH_GOT_LO12, /* bfd_reloc_code_real_type */ ++ reloc_bits, /* adjust_reloc_bits */ ++ "got_lo12"), /* larch_reloc_type_name */ ++ ++ LOONGARCH_HOWTO (R_LARCH_GOT64_LO20, /* type (81). */ ++ 32, /* rightshift. */ ++ 4, /* size. */ ++ 20, /* bitsize. */ ++ false, /* pc_relative. */ ++ 5, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_GOT64_LO20", /* name. */ ++ false, /* partial_inplace. */ ++ 0, /* src_mask */ ++ 0x1ffffe0, /* dst_mask */ ++ false, /* pcrel_offset */ ++ BFD_RELOC_LARCH_GOT64_LO20, /* bfd_reloc_code_real_type */ ++ reloc_bits, /* adjust_reloc_bits */ ++ "got64_lo20"), /* larch_reloc_type_name */ ++ ++ LOONGARCH_HOWTO (R_LARCH_GOT64_HI12, /* type (82). */ ++ 52, /* rightshift. */ ++ 4, /* size. */ ++ 12, /* bitsize. */ ++ false, /* pc_relative. */ ++ 10, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_GOT64_HI12", /* name. */ ++ false, /* partial_inplace. */ ++ 0, /* src_mask */ ++ 0x3ffc00, /* dst_mask */ ++ false, /* pcrel_offset */ ++ BFD_RELOC_LARCH_GOT64_HI12, /* bfd_reloc_code_real_type */ ++ reloc_bits, /* adjust_reloc_bits */ ++ "got64_hi12"), /* larch_reloc_type_name */ ++ ++ LOONGARCH_HOWTO (R_LARCH_TLS_LE_HI20, /* type (83). */ ++ 12, /* rightshift. */ ++ 4, /* size. */ ++ 20, /* bitsize. */ ++ false, /* pc_relative. */ ++ 5, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_TLS_LE_HI20", /* name. */ ++ false, /* partial_inplace. */ ++ 0, /* src_mask */ ++ 0x1ffffe0, /* dst_mask */ ++ false, /* pcrel_offset */ ++ BFD_RELOC_LARCH_TLS_LE_HI20, /* bfd_reloc_code_real_type */ ++ reloc_bits, /* adjust_reloc_bits */ ++ "le_hi20"), /* larch_reloc_type_name */ ++ ++ LOONGARCH_HOWTO (R_LARCH_TLS_LE_LO12, /* type (84). */ ++ 0, /* rightshift. */ ++ 4, /* size. */ ++ 12, /* bitsize. */ ++ false, /* pc_relative. */ ++ 10, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_TLS_LE_LO12", /* name. */ ++ false, /* partial_inplace. */ ++ 0, /* src_mask */ ++ 0x3ffc00, /* dst_mask */ ++ false, /* pcrel_offset */ ++ BFD_RELOC_LARCH_TLS_LE_LO12, /* bfd_reloc_code_real_type */ ++ reloc_bits, /* adjust_reloc_bits */ ++ "le_lo12"), /* larch_reloc_type_name */ ++ ++ LOONGARCH_HOWTO (R_LARCH_TLS_LE64_LO20, /* type (85). */ ++ 32, /* rightshift. */ ++ 4, /* size. */ ++ 20, /* bitsize. */ ++ false, /* pc_relative. */ ++ 5, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_TLS_LE64_LO20", /* name. */ ++ false, /* partial_inplace. */ ++ 0, /* src_mask */ ++ 0x1ffffe0, /* dst_mask */ ++ false, /* pcrel_offset */ ++ BFD_RELOC_LARCH_TLS_LE64_LO20, /* bfd_reloc_code_real_type */ ++ reloc_bits, /* adjust_reloc_bits */ ++ "le64_lo20"), /* larch_reloc_type_name */ ++ ++ LOONGARCH_HOWTO (R_LARCH_TLS_LE64_HI12, /* type (86). */ ++ 52, /* rightshift. */ ++ 4, /* size. */ ++ 12, /* bitsize. */ ++ false, /* pc_relative. */ ++ 10, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_TLS_LE64_HI12", /* name. */ ++ false, /* partial_inplace. */ ++ 0, /* src_mask */ ++ 0x3ffc00, /* dst_mask */ ++ false, /* pcrel_offset */ ++ BFD_RELOC_LARCH_TLS_LE64_HI12, /* bfd_reloc_code_real_type */ ++ reloc_bits, /* adjust_reloc_bits */ ++ "le64_hi12"), /* larch_reloc_type_name */ ++ ++ LOONGARCH_HOWTO (R_LARCH_TLS_IE_PC_HI20, /* type (87). */ ++ 12, /* rightshift. */ ++ 4, /* size. */ ++ 20, /* bitsize. */ ++ false, /* pc_relative. */ ++ 5, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_TLS_IE_PC_HI20", /* name. */ ++ false, /* partial_inplace. */ ++ 0, /* src_mask */ ++ 0x1ffffe0, /* dst_mask */ ++ false, /* pcrel_offset */ ++ BFD_RELOC_LARCH_TLS_IE_PC_HI20, /* bfd_reloc_code_real_type */ ++ reloc_bits, /* adjust_reloc_bits */ ++ "ie_pc_hi20"), /* larch_reloc_type_name */ ++ ++ LOONGARCH_HOWTO (R_LARCH_TLS_IE_PC_LO12, /* type (88). */ ++ 0, /* rightshift. */ ++ 4, /* size. */ ++ 12, /* bitsize. */ ++ false, /* pc_relative. */ ++ 10, /* bitpos. */ ++ complain_overflow_unsigned, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_TLS_IE_PC_LO12", /* name. */ ++ false, /* partial_inplace. */ ++ 0, /* src_mask */ ++ 0x3ffc00, /* dst_mask */ ++ false, /* pcrel_offset */ ++ BFD_RELOC_LARCH_TLS_IE_PC_LO12, /* bfd_reloc_code_real_type */ ++ reloc_bits, /* adjust_reloc_bits */ ++ "ie_pc_lo12"), /* larch_reloc_type_name */ ++ ++ LOONGARCH_HOWTO (R_LARCH_TLS_IE64_PC_LO20, /* type (89). */ ++ 32, /* rightshift. */ ++ 4, /* size. */ ++ 20, /* bitsize. */ ++ false, /* pc_relative. */ ++ 5, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_TLS_IE64_PC_LO20", /* name. */ ++ false, /* partial_inplace. */ ++ 0, /* src_mask */ ++ 0x1ffffe0, /* dst_mask */ ++ false, /* pcrel_offset */ ++ BFD_RELOC_LARCH_TLS_IE64_PC_LO20, /* bfd_reloc_code_real_type */ ++ reloc_bits, /* adjust_reloc_bits */ ++ "ie64_pc_lo20"), /* larch_reloc_type_name */ ++ ++ LOONGARCH_HOWTO (R_LARCH_TLS_IE64_PC_HI12, /* type (90). */ ++ 52, /* rightshift. */ ++ 4, /* size. */ ++ 12, /* bitsize. */ ++ false, /* pc_relative. */ ++ 10, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_TLS_IE64_PC_HI12", /* name. */ ++ false, /* partial_inplace. */ ++ 0, /* src_mask */ ++ 0x3ffc00, /* dst_mask */ ++ false, /* pcrel_offset */ ++ BFD_RELOC_LARCH_TLS_IE64_PC_HI12, /* bfd_reloc_code_real_type */ ++ reloc_bits, /* adjust_reloc_bits */ ++ "ie64_pc_hi12"), /* larch_reloc_type_name */ ++ ++ LOONGARCH_HOWTO (R_LARCH_TLS_IE_HI20, /* type (91). */ ++ 12, /* rightshift. */ ++ 4, /* size. */ ++ 20, /* bitsize. */ ++ false, /* pc_relative. */ ++ 5, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_TLS_IE_HI20", /* name. */ ++ false, /* partial_inplace. */ ++ 0, /* src_mask */ ++ 0x1ffffe0, /* dst_mask */ ++ false, /* pcrel_offset */ ++ BFD_RELOC_LARCH_TLS_IE_HI20, /* bfd_reloc_code_real_type */ ++ reloc_bits, /* adjust_reloc_bits */ ++ "ie_hi20"), /* larch_reloc_type_name */ ++ ++ LOONGARCH_HOWTO (R_LARCH_TLS_IE_LO12, /* type (92). */ ++ 0, /* rightshift. */ ++ 4, /* size. */ ++ 12, /* bitsize. */ ++ false, /* pc_relative. */ ++ 10, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_TLS_IE_LO12", /* name. */ ++ false, /* partial_inplace. */ ++ 0, /* src_mask */ ++ 0x3ffc00, /* dst_mask */ ++ false, /* pcrel_offset */ ++ BFD_RELOC_LARCH_TLS_IE_LO12, /* bfd_reloc_code_real_type */ ++ reloc_bits, /* adjust_reloc_bits */ ++ "ie_lo12"), /* larch_reloc_type_name */ ++ ++ LOONGARCH_HOWTO (R_LARCH_TLS_IE64_LO20, /* type (93). */ ++ 32, /* rightshift. */ ++ 4, /* size. */ ++ 20, /* bitsize. */ ++ false, /* pc_relative. */ ++ 5, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_TLS_IE64_LO20", /* name. */ ++ false, /* partial_inplace. */ ++ 0, /* src_mask */ ++ 0x1ffffe0, /* dst_mask */ ++ false, /* pcrel_offset */ ++ BFD_RELOC_LARCH_TLS_IE64_LO20, /* bfd_reloc_code_real_type */ ++ reloc_bits, /* adjust_reloc_bits */ ++ "ie64_lo20"), /* larch_reloc_type_name */ ++ ++ LOONGARCH_HOWTO (R_LARCH_TLS_IE64_HI12, /* type (94). */ ++ 52, /* rightshift. */ ++ 4, /* size. */ ++ 12, /* bitsize. */ ++ false, /* pc_relative. */ ++ 10, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_TLS_IE64_HI12", /* name. */ ++ false, /* partial_inplace. */ ++ 0, /* src_mask */ ++ 0x3ffc00, /* dst_mask */ ++ false, /* pcrel_offset */ ++ BFD_RELOC_LARCH_TLS_IE64_HI12, /* bfd_reloc_code_real_type */ ++ reloc_bits, /* adjust_reloc_bits */ ++ "ie64_hi12"), /* larch_reloc_type_name */ ++ ++ LOONGARCH_HOWTO (R_LARCH_TLS_LD_PC_HI20, /* type (95). */ ++ 12, /* rightshift. */ ++ 4, /* size. */ ++ 20, /* bitsize. */ ++ false, /* pc_relative. */ ++ 5, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_TLS_LD_PC_HI20", /* name. */ ++ false, /* partial_inplace. */ ++ 0, /* src_mask */ ++ 0x1ffffe0, /* dst_mask */ ++ false, /* pcrel_offset */ ++ BFD_RELOC_LARCH_TLS_LD_PC_HI20, /* bfd_reloc_code_real_type */ ++ reloc_bits, /* adjust_reloc_bits */ ++ "ld_pc_hi20"), /* larch_reloc_type_name */ ++ ++ LOONGARCH_HOWTO (R_LARCH_TLS_LD_HI20, /* type (96). */ ++ 12, /* rightshift. */ ++ 4, /* size. */ ++ 20, /* bitsize. */ ++ false, /* pc_relative. */ ++ 5, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_TLS_LD_HI20", /* name. */ ++ false, /* partial_inplace. */ ++ 0, /* src_mask */ ++ 0x1ffffe0, /* dst_mask */ ++ false, /* pcrel_offset */ ++ BFD_RELOC_LARCH_TLS_LD_HI20, /* bfd_reloc_code_real_type */ ++ reloc_bits, /* adjust_reloc_bits */ ++ "ld_hi20"), /* larch_reloc_type_name */ ++ ++ LOONGARCH_HOWTO (R_LARCH_TLS_GD_PC_HI20, /* type (97). */ ++ 12, /* rightshift. */ ++ 4, /* size. */ ++ 20, /* bitsize. */ ++ false, /* pc_relative. */ ++ 5, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_TLS_GD_PC_HI20", /* name. */ ++ false, /* partial_inplace. */ ++ 0, /* src_mask */ ++ 0x1ffffe0, /* dst_mask */ ++ false, /* pcrel_offset */ ++ BFD_RELOC_LARCH_TLS_GD_PC_HI20, /* bfd_reloc_code_real_type */ ++ reloc_bits, /* adjust_reloc_bits */ ++ "gd_pc_hi20"), /* larch_reloc_type_name */ ++ ++ LOONGARCH_HOWTO (R_LARCH_TLS_GD_HI20, /* type (98). */ ++ 12, /* rightshift. */ ++ 4, /* size. */ ++ 20, /* bitsize. */ ++ false, /* pc_relative. */ ++ 5, /* bitpos. */ ++ complain_overflow_signed, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_TLS_GD_HI20", /* name. */ ++ false, /* partial_inplace. */ ++ 0, /* src_mask */ ++ 0x1ffffe0, /* dst_mask */ ++ false, /* pcrel_offset */ ++ BFD_RELOC_LARCH_TLS_GD_HI20, /* bfd_reloc_code_real_type */ ++ reloc_bits, /* adjust_reloc_bits */ ++ "gd_hi20"), /* larch_reloc_type_name */ ++ ++ LOONGARCH_HOWTO (R_LARCH_32_PCREL, /* type (99). */ ++ 0, /* rightshift. */ ++ 4, /* size. */ ++ 32, /* bitsize. */ ++ true, /* pc_relative. */ ++ 0, /* bitpos. */ ++ complain_overflow_dont, /* complain_on_overflow. */ ++ bfd_elf_generic_reloc, /* special_function. */ ++ "R_LARCH_32_PCREL", /* name. */ ++ false, /* partial_inplace. */ ++ 0, /* src_mask */ ++ 0xffffffff, /* dst_mask */ ++ false, /* pcrel_offset */ ++ BFD_RELOC_LARCH_32_PCREL, /* bfd_reloc_code_real_type */ ++ NULL, /* adjust_reloc_bits */ ++ NULL), /* larch_reloc_type_name */ ++ ++ LOONGARCH_HOWTO (R_LARCH_RELAX, /* type (100). */ ++ 0, /* rightshift */ ++ 1, /* size */ ++ 0, /* bitsize */ ++ false, /* pc_relative */ ++ 0, /* bitpos */ ++ complain_overflow_dont, /* complain_on_overflow */ ++ bfd_elf_generic_reloc, /* special_function */ ++ "R_LARCH_RELAX", /* name */ ++ false, /* partial_inplace */ ++ 0, /* src_mask */ ++ 0, /* dst_mask */ ++ false, /* pcrel_offset */ ++ BFD_RELOC_LARCH_RELAX, /* bfd_reloc_code_real_type */ ++ NULL, /* adjust_reloc_bits */ ++ NULL), /* larch_reloc_type_name */ ++ + }; + + reloc_howto_type * +@@ -697,8 +1374,6 @@ loongarch_elf_rtype_to_howto (bfd *abfd, unsigned int r_type) + if (loongarch_howto_table[r_type].howto.type == r_type) + return (reloc_howto_type *)&loongarch_howto_table[r_type]; + +- BFD_ASSERT (loongarch_howto_table[r_type].howto.type == r_type); +- + for (size_t i = 0; i < ARRAY_SIZE (loongarch_howto_table); i++) + if (loongarch_howto_table[i].howto.type == r_type) + return (reloc_howto_type *)&loongarch_howto_table[i]; +@@ -734,6 +1409,17 @@ loongarch_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, + { + BFD_ASSERT (ARRAY_SIZE (loongarch_howto_table) == R_LARCH_count); + ++ /* Fast search for new reloc types. */ ++ if (BFD_RELOC_LARCH_B16 <= code && code < BFD_RELOC_LARCH_RELAX) ++ { ++ BFD_ASSERT (BFD_RELOC_LARCH_RELAX - BFD_RELOC_LARCH_B16 ++ == R_LARCH_RELAX - R_LARCH_B16); ++ loongarch_reloc_howto_type *ht = NULL; ++ ht = &loongarch_howto_table[code - BFD_RELOC_LARCH_B16 + R_LARCH_B16]; ++ BFD_ASSERT (ht->bfd_type == code); ++ return (reloc_howto_type *)ht; ++ } ++ + for (size_t i = 0; i < ARRAY_SIZE (loongarch_howto_table); i++) + if (loongarch_howto_table[i].bfd_type == code) + return (reloc_howto_type *)&loongarch_howto_table[i]; +@@ -745,56 +1431,89 @@ loongarch_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, + return NULL; + } + ++bfd_reloc_code_real_type ++loongarch_larch_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, ++ const char *l_r_name) ++{ ++ for (size_t i = 0; i < ARRAY_SIZE (loongarch_howto_table); i++) ++ { ++ loongarch_reloc_howto_type *lht = &loongarch_howto_table[i]; ++ if ((NULL != lht->larch_reloc_type_name) ++ && (0 == strcmp (lht->larch_reloc_type_name, l_r_name))) ++ return lht->bfd_type; ++ } ++ ++ (*_bfd_error_handler) (_("%pB: unsupported relocation type name %s"), ++ abfd, l_r_name); ++ bfd_set_error (bfd_error_bad_value); ++ return BFD_RELOC_NONE; ++} ++ ++ ++/* Functions for reloc bits field. ++ 1. Signed extend *fix_val. ++ 2. Return false if overflow. */ ++ + #define LARCH_RELOC_BFD_VMA_BIT_MASK(bitsize) \ + (~((((bfd_vma)0x1) << (bitsize)) - 1)) + + /* Adjust val to perform insn +- * BFD_RELOC_LARCH_SOP_POP_32_S_10_5 +- * BFD_RELOC_LARCH_SOP_POP_32_S_10_12 +- * BFD_RELOC_LARCH_SOP_POP_32_U_10_12 +- * BFD_RELOC_LARCH_SOP_POP_32_S_10_16 +- * BFD_RELOC_LARCH_SOP_POP_32_S_10_16_S2 +- * BFD_RELOC_LARCH_SOP_POP_32_S_5_20 +- * BFD_RELOC_LARCH_SOP_POP_32_U. +-*/ +- +-bool loongarch_gen_adjust_reloc_bits (reloc_howto_type *howto, bfd_vma *fix_val) ++ BFD_RELOC_LARCH_SOP_POP_32_S_10_5 ++ BFD_RELOC_LARCH_SOP_POP_32_S_10_12 ++ BFD_RELOC_LARCH_SOP_POP_32_U_10_12 ++ BFD_RELOC_LARCH_SOP_POP_32_S_10_16 ++ BFD_RELOC_LARCH_SOP_POP_32_S_5_20 ++ BFD_RELOC_LARCH_SOP_POP_32_U. */ ++static bool ++reloc_bits (reloc_howto_type *howto, bfd_vma *fix_val) + { +- bfd_vma val = *fix_val; +- /* Check val low bits if rightshift != 0, before rightshift */ +- if (howto->rightshift +- && (((0x1UL << howto->rightshift) - 1) & val)) ++ bfd_signed_vma val = ((bfd_signed_vma)(*fix_val)) >> howto->rightshift; ++ ++ /* Perform insn bits field. */ ++ val = val & (((bfd_vma)0x1 << howto->bitsize) - 1); ++ val <<= howto->bitpos; ++ ++ *fix_val = (bfd_vma)val; ++ ++ return true; ++} ++ ++/* Adjust val to perform insn ++ R_LARCH_SOP_POP_32_S_10_16_S2 ++ R_LARCH_B16. */ ++static bool ++reloc_bits_b16 (reloc_howto_type *howto, bfd_vma *fix_val) ++{ ++ if (howto->complain_on_overflow != complain_overflow_signed) ++ return false; ++ ++ bfd_signed_vma val = *fix_val; ++ ++ /* Judge whether 4 bytes align. */ ++ if (val & ((0x1UL << howto->rightshift) - 1)) + return false; + + int bitsize = howto->bitsize + howto->rightshift; ++ bfd_signed_vma sig_bit = (val >> (bitsize - 1)) & 0x1; + +- /* Return false if overflow. */ +- if (howto->complain_on_overflow == complain_overflow_signed) ++ /* If val < 0, sign bit is 1. */ ++ if (sig_bit) + { +- bfd_vma sig_bit = (val >> (bitsize - 1)) & 0x1; +- /* If val < 0. */ +- if (sig_bit) +- { +- if ((LARCH_RELOC_BFD_VMA_BIT_MASK (bitsize - 1) & val) +- != LARCH_RELOC_BFD_VMA_BIT_MASK (bitsize - 1)) +- return false; +- } +- else +- { +- if (LARCH_RELOC_BFD_VMA_BIT_MASK (bitsize - 1) & val) +- return false; +- } ++ /* Signed bits is 1. */ ++ if ((LARCH_RELOC_BFD_VMA_BIT_MASK (bitsize - 1) & val) ++ != LARCH_RELOC_BFD_VMA_BIT_MASK (bitsize - 1)) ++ return false; + } +- else if (howto->complain_on_overflow == complain_overflow_unsigned) ++ else + { ++ /* Signed bits is 0. */ + if (LARCH_RELOC_BFD_VMA_BIT_MASK (bitsize) & val) + return false; + } +- else +- return false; + + /* Perform insn bits field. */ +- val = (val & ((0x1U << bitsize) - 1)) >> howto->rightshift; ++ val >>= howto->rightshift; ++ val = val & (((bfd_vma)0x1 << howto->bitsize) - 1); + val <<= howto->bitpos; + + *fix_val = val; +@@ -802,22 +1521,24 @@ bool loongarch_gen_adjust_reloc_bits (reloc_howto_type *howto, bfd_vma *fix_val) + return true; + } + +-/* Reloc type R_LARCH_SOP_POP_32_S_0_5_10_16_S2. */ +-bool loongarch_adjust_reloc_bits_l16_xx5_h5 (reloc_howto_type *howto, +- bfd_vma *fix_val) ++/* Reloc type : ++ R_LARCH_SOP_POP_32_S_0_5_10_16_S2 ++ R_LARCH_B21. */ ++static bool ++reloc_bits_b21 (reloc_howto_type *howto, ++ bfd_vma *fix_val) + { +- bfd_vma val = *fix_val; +- /* Check val low bits if rightshift != 0, before rightshift */ +- if (howto->rightshift +- && (((0x1UL << howto->rightshift) - 1) & val)) ++ if (howto->complain_on_overflow != complain_overflow_signed) + return false; + +- /* Return false if overflow. */ +- if (howto->complain_on_overflow != complain_overflow_signed) ++ bfd_signed_vma val = *fix_val; ++ ++ if (val & ((0x1UL << howto->rightshift) - 1)) + return false; + + int bitsize = howto->bitsize + howto->rightshift; +- bfd_vma sig_bit = (val >> (bitsize - 1)) & 0x1; ++ bfd_signed_vma sig_bit = (val >> (bitsize - 1)) & 0x1; ++ + /* If val < 0. */ + if (sig_bit) + { +@@ -827,14 +1548,15 @@ bool loongarch_adjust_reloc_bits_l16_xx5_h5 (reloc_howto_type *howto, + } + else + { +- if (LARCH_RELOC_BFD_VMA_BIT_MASK (bitsize - 1) & val) ++ if (LARCH_RELOC_BFD_VMA_BIT_MASK (bitsize) & val) + return false; + } + + /* Perform insn bits field. */ +- val = (val & ((0x1U << bitsize) - 1)) >> howto->rightshift; ++ val >>= howto->rightshift; ++ val = val & (((bfd_vma)0x1 << howto->bitsize) - 1); + +- /* Perform insn bits field. 20:16>>16, 15:0<<10 */ ++ /* Perform insn bits field. 15:0<<10, 20:16>>16. */ + val = ((val & 0xffff) << 10) | ((val >> 16) & 0x1f); + + *fix_val = val; +@@ -842,22 +1564,25 @@ bool loongarch_adjust_reloc_bits_l16_xx5_h5 (reloc_howto_type *howto, + return true; + } + +-/* Reloc type R_LARCH_SOP_POP_32_S_0_10_10_16_S2. */ +-bool loongarch_adjust_reloc_bits_l16_h10 (reloc_howto_type *howto, +- bfd_vma *fix_val) ++/* Reloc type: ++ R_LARCH_SOP_POP_32_S_0_10_10_16_S2 ++ R_LARCH_B26. */ ++static bool ++reloc_bits_b26 (reloc_howto_type *howto, ++ bfd_vma *fix_val) + { +- bfd_vma val = *fix_val; +- /* Check val low bits if rightshift != 0, before rightshift */ +- if (howto->rightshift +- && (((0x1UL << howto->rightshift) - 1) & val)) +- return false; +- + /* Return false if overflow. */ + if (howto->complain_on_overflow != complain_overflow_signed) + return false; + ++ bfd_signed_vma val = *fix_val; ++ ++ if (val & ((0x1UL << howto->rightshift) - 1)) ++ return false; ++ + int bitsize = howto->bitsize + howto->rightshift; +- bfd_vma sig_bit = (val >> (bitsize - 1)) & 0x1; ++ bfd_signed_vma sig_bit = (val >> (bitsize - 1)) & 0x1; ++ + /* If val < 0. */ + if (sig_bit) + { +@@ -867,14 +1592,15 @@ bool loongarch_adjust_reloc_bits_l16_h10 (reloc_howto_type *howto, + } + else + { +- if (LARCH_RELOC_BFD_VMA_BIT_MASK (bitsize - 1) & val) ++ if (LARCH_RELOC_BFD_VMA_BIT_MASK (bitsize) & val) + return false; + } + + /* Perform insn bits field. */ +- val = (val & ((0x1U << bitsize) - 1)) >> howto->rightshift; ++ val >>= howto->rightshift; ++ val = val & (((bfd_vma)0x1 << howto->bitsize) - 1); + +- /* Perform insn bits field. 25:16>>16, 15:0<<10 */ ++ /* Perform insn bits field. 25:16>>16, 15:0<<10. */ + val = ((val & 0xffff) << 10) | ((val >> 16) & 0x3ff); + + *fix_val = val; +@@ -882,8 +1608,9 @@ bool loongarch_adjust_reloc_bits_l16_h10 (reloc_howto_type *howto, + return true; + } + +-bool loongarch_adjust_reloc_bitsfield (reloc_howto_type *howto, +- bfd_vma *fix_val) ++bool ++loongarch_adjust_reloc_bitsfield (reloc_howto_type *howto, ++ bfd_vma *fix_val) + { + BFD_ASSERT (((loongarch_reloc_howto_type *)howto)->adjust_reloc_bits); + return ((loongarch_reloc_howto_type *) +diff --git a/bfd/elfxx-loongarch.h b/bfd/elfxx-loongarch.h +index 8ea63d03..7b8a7213 100644 +--- a/bfd/elfxx-loongarch.h ++++ b/bfd/elfxx-loongarch.h +@@ -30,6 +30,10 @@ loongarch_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code); + extern reloc_howto_type * + loongarch_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, const char *r_name); + ++extern bfd_reloc_code_real_type ++loongarch_larch_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, ++ const char *l_r_name); ++ + bool loongarch_adjust_reloc_bitsfield (reloc_howto_type *howto, bfd_vma *fix_val); + + /* TRUE if this is a PLT reference to a local IFUNC. */ +diff --git a/bfd/libbfd.h b/bfd/libbfd.h +index 29e8187f..c766722e 100644 +--- a/bfd/libbfd.h ++++ b/bfd/libbfd.h +@@ -3457,6 +3457,43 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", + "BFD_RELOC_LARCH_SUB24", + "BFD_RELOC_LARCH_SUB32", + "BFD_RELOC_LARCH_SUB64", ++ "BFD_RELOC_LARCH_B16", ++ "BFD_RELOC_LARCH_B21", ++ "BFD_RELOC_LARCH_B26", ++ "BFD_RELOC_LARCH_ABS_HI20", ++ "BFD_RELOC_LARCH_ABS_LO12", ++ "BFD_RELOC_LARCH_ABS64_LO20", ++ "BFD_RELOC_LARCH_ABS64_HI12", ++ "BFD_RELOC_LARCH_PCALA_HI20", ++ "BFD_RELOC_LARCH_PCALA_LO12", ++ "BFD_RELOC_LARCH_PCALA64_LO20", ++ "BFD_RELOC_LARCH_PCALA64_HI12", ++ "BFD_RELOC_LARCH_GOT_PC_HI20", ++ "BFD_RELOC_LARCH_GOT_PC_LO12", ++ "BFD_RELOC_LARCH_GOT64_PC_LO20", ++ "BFD_RELOC_LARCH_GOT64_PC_HI12", ++ "BFD_RELOC_LARCH_GOT_HI20", ++ "BFD_RELOC_LARCH_GOT_LO12", ++ "BFD_RELOC_LARCH_GOT64_LO20", ++ "BFD_RELOC_LARCH_GOT64_HI12", ++ "BFD_RELOC_LARCH_TLS_LE_HI20", ++ "BFD_RELOC_LARCH_TLS_LE_LO12", ++ "BFD_RELOC_LARCH_TLS_LE64_LO20", ++ "BFD_RELOC_LARCH_TLS_LE64_HI12", ++ "BFD_RELOC_LARCH_TLS_IE_PC_HI20", ++ "BFD_RELOC_LARCH_TLS_IE_PC_LO12", ++ "BFD_RELOC_LARCH_TLS_IE64_PC_LO20", ++ "BFD_RELOC_LARCH_TLS_IE64_PC_HI12", ++ "BFD_RELOC_LARCH_TLS_IE_HI20", ++ "BFD_RELOC_LARCH_TLS_IE_LO12", ++ "BFD_RELOC_LARCH_TLS_IE64_LO20", ++ "BFD_RELOC_LARCH_TLS_IE64_HI12", ++ "BFD_RELOC_LARCH_TLS_LD_PC_HI20", ++ "BFD_RELOC_LARCH_TLS_LD_HI20", ++ "BFD_RELOC_LARCH_TLS_GD_PC_HI20", ++ "BFD_RELOC_LARCH_TLS_GD_HI20", ++ "BFD_RELOC_LARCH_32_PCREL", ++ "BFD_RELOC_LARCH_RELAX", + "@@overflow: BFD_RELOC_UNUSED@@", + }; + #endif +diff --git a/bfd/libpei.h b/bfd/libpei.h +index 4aca0241..dcf42f93 100644 +--- a/bfd/libpei.h ++++ b/bfd/libpei.h +@@ -310,6 +310,41 @@ + #define _bfd_XXi_write_codeview_record _bfd_peAArch64i_write_codeview_record + #define _bfd_XXi_slurp_codeview_record _bfd_peAArch64i_slurp_codeview_record + ++#elif defined COFF_WITH_peLoongArch64 ++ ++#define GET_OPTHDR_IMAGE_BASE H_GET_64 ++#define PUT_OPTHDR_IMAGE_BASE H_PUT_64 ++#define GET_OPTHDR_SIZE_OF_STACK_RESERVE H_GET_64 ++#define PUT_OPTHDR_SIZE_OF_STACK_RESERVE H_PUT_64 ++#define GET_OPTHDR_SIZE_OF_STACK_COMMIT H_GET_64 ++#define PUT_OPTHDR_SIZE_OF_STACK_COMMIT H_PUT_64 ++#define GET_OPTHDR_SIZE_OF_HEAP_RESERVE H_GET_64 ++#define PUT_OPTHDR_SIZE_OF_HEAP_RESERVE H_PUT_64 ++#define GET_OPTHDR_SIZE_OF_HEAP_COMMIT H_GET_64 ++#define PUT_OPTHDR_SIZE_OF_HEAP_COMMIT H_PUT_64 ++#define GET_PDATA_ENTRY bfd_get_32 ++ ++#define _bfd_XX_bfd_copy_private_bfd_data_common _bfd_peLoongArch64_bfd_copy_private_bfd_data_common ++#define _bfd_XX_bfd_copy_private_section_data _bfd_peLoongArch64_bfd_copy_private_section_data ++#define _bfd_XX_get_symbol_info _bfd_peLoongArch64_get_symbol_info ++#define _bfd_XX_only_swap_filehdr_out _bfd_peLoongArch64_only_swap_filehdr_out ++#define _bfd_XX_print_private_bfd_data_common _bfd_peLoongArch64_print_private_bfd_data_common ++#define _bfd_XXi_final_link_postscript _bfd_peLoongArch64i_final_link_postscript ++#define _bfd_XXi_only_swap_filehdr_out _bfd_peLoongArch64i_only_swap_filehdr_out ++#define _bfd_XXi_swap_aouthdr_in _bfd_peLoongArch64i_swap_aouthdr_in ++#define _bfd_XXi_swap_aouthdr_out _bfd_peLoongArch64i_swap_aouthdr_out ++#define _bfd_XXi_swap_aux_in _bfd_peLoongArch64i_swap_aux_in ++#define _bfd_XXi_swap_aux_out _bfd_peLoongArch64i_swap_aux_out ++#define _bfd_XXi_swap_lineno_in _bfd_peLoongArch64i_swap_lineno_in ++#define _bfd_XXi_swap_lineno_out _bfd_peLoongArch64i_swap_lineno_out ++#define _bfd_XXi_swap_scnhdr_out _bfd_peLoongArch64i_swap_scnhdr_out ++#define _bfd_XXi_swap_sym_in _bfd_peLoongArch64i_swap_sym_in ++#define _bfd_XXi_swap_sym_out _bfd_peLoongArch64i_swap_sym_out ++#define _bfd_XXi_swap_debugdir_in _bfd_peLoongArch64i_swap_debugdir_in ++#define _bfd_XXi_swap_debugdir_out _bfd_peLoongArch64i_swap_debugdir_out ++#define _bfd_XXi_write_codeview_record _bfd_peLoongArch64i_write_codeview_record ++#define _bfd_XXi_slurp_codeview_record _bfd_peLoongArch64i_slurp_codeview_record ++ + #else /* !COFF_WITH_pep */ + + #define GET_OPTHDR_IMAGE_BASE H_GET_32 +@@ -405,5 +440,6 @@ bool _bfd_pe_print_ce_compressed_pdata (bfd *, void *); + bool _bfd_pe64_print_ce_compressed_pdata (bfd *, void *); + bool _bfd_pex64_print_ce_compressed_pdata (bfd *, void *); + bool _bfd_peAArch64_print_ce_compressed_pdata (bfd *, void *); ++bool _bfd_peLoongArch64_print_ce_compressed_pdata (bfd *, void *); + bool _bfd_pep_print_ce_compressed_pdata (bfd *, void *); + +diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c +index 5ab09387..a7b85713 100644 +--- a/bfd/peXXigen.c ++++ b/bfd/peXXigen.c +@@ -60,9 +60,9 @@ + on this code has a chance of getting something accomplished without + wasting too much time. */ + +-/* This expands into COFF_WITH_pe, COFF_WITH_pep, COFF_WITH_pex64 or +- COFF_WITH_peAArch64 depending on whether we're compiling for straight +- PE or PE+. */ ++/* This expands into COFF_WITH_pe, COFF_WITH_pep, COFF_WITH_pex64, ++ COFF_WITH_peAArch64 or COFF_WITH_peLoongArch64 depending on whether we're ++ compiling for straight PE or PE+. */ + #define COFF_WITH_XX + + #include "sysdep.h" +@@ -86,6 +86,8 @@ + # include "coff/ia64.h" + #elif defined COFF_WITH_peAArch64 + # include "coff/aarch64.h" ++#elif defined COFF_WITH_peLoongArch64 ++# include "coff/loongarch64.h" + #else + # include "coff/i386.h" + #endif +@@ -95,7 +97,7 @@ + #include "libpei.h" + #include "safe-ctype.h" + +-#if defined COFF_WITH_pep || defined COFF_WITH_pex64 || defined COFF_WITH_peAArch64 ++#if defined COFF_WITH_pep || defined COFF_WITH_pex64 || defined COFF_WITH_peAArch64 || defined COFF_WITH_peLoongArch64 + # undef AOUTSZ + # define AOUTSZ PEPAOUTSZ + # define PEAOUTHDR PEPAOUTHDR +@@ -472,7 +474,7 @@ _bfd_XXi_swap_aouthdr_in (bfd * abfd, + aouthdr_int->text_start = + GET_AOUTHDR_TEXT_START (abfd, aouthdr_ext->text_start); + +-#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64) ++#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64) && !defined(COFF_WITH_peLoongArch64) + /* PE32+ does not have data_start member! */ + aouthdr_int->data_start = + GET_AOUTHDR_DATA_START (abfd, aouthdr_ext->data_start); +@@ -558,7 +560,7 @@ _bfd_XXi_swap_aouthdr_in (bfd * abfd, + if (aouthdr_int->entry) + { + aouthdr_int->entry += a->ImageBase; +-#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64) ++#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64) && !defined(COFF_WITH_peLoongArch64) + aouthdr_int->entry &= 0xffffffff; + #endif + } +@@ -566,12 +568,12 @@ _bfd_XXi_swap_aouthdr_in (bfd * abfd, + if (aouthdr_int->tsize) + { + aouthdr_int->text_start += a->ImageBase; +-#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64) ++#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64) && !defined(COFF_WITH_peLoongArch64) + aouthdr_int->text_start &= 0xffffffff; + #endif + } + +-#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64) ++#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64) && !defined(COFF_WITH_peLoongArch64) + /* PE32+ does not have data_start member! */ + if (aouthdr_int->dsize) + { +@@ -631,7 +633,7 @@ _bfd_XXi_swap_aouthdr_out (bfd * abfd, void * in, void * out) + if (aouthdr_in->tsize) + { + aouthdr_in->text_start -= ib; +-#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64) ++#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64) && !defined(COFF_WITH_peLoongArch64) + aouthdr_in->text_start &= 0xffffffff; + #endif + } +@@ -639,7 +641,7 @@ _bfd_XXi_swap_aouthdr_out (bfd * abfd, void * in, void * out) + if (aouthdr_in->dsize) + { + aouthdr_in->data_start -= ib; +-#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64) ++#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64) && !defined(COFF_WITH_peLoongArch64) + aouthdr_in->data_start &= 0xffffffff; + #endif + } +@@ -647,7 +649,7 @@ _bfd_XXi_swap_aouthdr_out (bfd * abfd, void * in, void * out) + if (aouthdr_in->entry) + { + aouthdr_in->entry -= ib; +-#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64) ++#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64) && !defined(COFF_WITH_peLoongArch64) + aouthdr_in->entry &= 0xffffffff; + #endif + } +@@ -761,7 +763,7 @@ _bfd_XXi_swap_aouthdr_out (bfd * abfd, void * in, void * out) + PUT_AOUTHDR_TEXT_START (abfd, aouthdr_in->text_start, + aouthdr_out->standard.text_start); + +-#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64) ++#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64) && !defined(COFF_WITH_peLoongArch64) + /* PE32+ does not have data_start member! */ + PUT_AOUTHDR_DATA_START (abfd, aouthdr_in->data_start, + aouthdr_out->standard.data_start); +@@ -946,9 +948,14 @@ _bfd_XXi_swap_scnhdr_out (bfd * abfd, void * in, void * out) + if (scnhdr_int->s_vaddr < pe_data (abfd)->pe_opthdr.ImageBase) + _bfd_error_handler (_("%pB:%.8s: section below image base"), + abfd, scnhdr_int->s_name); ++ /* Do not compare lower 32-bits for 64-bit vma. */ ++#if !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64) && !defined(COFF_WITH_peLoongArch64) + else if(ss != (ss & 0xffffffff)) + _bfd_error_handler (_("%pB:%.8s: RVA truncated"), abfd, scnhdr_int->s_name); + PUT_SCNHDR_VADDR (abfd, ss & 0xffffffff, scnhdr_ext->s_vaddr); ++#else ++ PUT_SCNHDR_VADDR (abfd, ss, scnhdr_ext->s_vaddr); ++#endif + + /* NT wants the size data to be rounded up to the next + NT_FILE_ALIGNMENT, but zero if it has no content (as in .bss, +@@ -1813,7 +1820,7 @@ pe_print_edata (bfd * abfd, void * vfile) + static bool + pe_print_pdata (bfd * abfd, void * vfile) + { +-#if defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64) ++#if defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64) && !defined(COFF_WITH_peLoongArch64) + # define PDATA_ROW_SIZE (3 * 8) + #else + # define PDATA_ROW_SIZE (5 * 4) +@@ -1840,7 +1847,7 @@ pe_print_pdata (bfd * abfd, void * vfile) + + fprintf (file, + _("\nThe Function Table (interpreted .pdata section contents)\n")); +-#if defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64) ++#if defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64) && !defined(COFF_WITH_peLoongArch64) + fprintf (file, + _(" vma:\t\t\tBegin Address End Address Unwind Info\n")); + #else +@@ -1877,7 +1884,7 @@ pe_print_pdata (bfd * abfd, void * vfile) + bfd_vma eh_handler; + bfd_vma eh_data; + bfd_vma prolog_end_addr; +-#if !defined(COFF_WITH_pep) || defined(COFF_WITH_pex64) || defined(COFF_WITH_peAArch64) ++#if !defined(COFF_WITH_pep) || defined(COFF_WITH_pex64) || defined(COFF_WITH_peAArch64) || defined(COFF_WITH_peLoongArch64) + int em_data; + #endif + +@@ -1895,7 +1902,7 @@ pe_print_pdata (bfd * abfd, void * vfile) + /* We are probably into the padding of the section now. */ + break; + +-#if !defined(COFF_WITH_pep) || defined(COFF_WITH_pex64) || defined(COFF_WITH_peAArch64) ++#if !defined(COFF_WITH_pep) || defined(COFF_WITH_pex64) || defined(COFF_WITH_peAArch64) || defined(COFF_WITH_peLoongArch64) + em_data = ((eh_handler & 0x1) << 2) | (prolog_end_addr & 0x3); + #endif + eh_handler &= ~(bfd_vma) 0x3; +@@ -1906,7 +1913,7 @@ pe_print_pdata (bfd * abfd, void * vfile) + bfd_fprintf_vma (abfd, file, begin_addr); fputc (' ', file); + bfd_fprintf_vma (abfd, file, end_addr); fputc (' ', file); + bfd_fprintf_vma (abfd, file, eh_handler); +-#if !defined(COFF_WITH_pep) || defined(COFF_WITH_pex64) || defined(COFF_WITH_peAArch64) ++#if !defined(COFF_WITH_pep) || defined(COFF_WITH_pex64) || defined(COFF_WITH_peAArch64) || defined(COFF_WITH_peLoongArch64) + fputc (' ', file); + bfd_fprintf_vma (abfd, file, eh_data); fputc (' ', file); + bfd_fprintf_vma (abfd, file, prolog_end_addr); +@@ -2797,7 +2804,7 @@ _bfd_XX_print_private_bfd_data_common (bfd * abfd, void * vfile) + bfd_fprintf_vma (abfd, file, i->AddressOfEntryPoint); + fprintf (file, "\nBaseOfCode\t\t"); + bfd_fprintf_vma (abfd, file, i->BaseOfCode); +-#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64) ++#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64) && !defined(COFF_WITH_peLoongArch64) + /* PE32+ does not have BaseOfData member! */ + fprintf (file, "\nBaseOfData\t\t"); + bfd_fprintf_vma (abfd, file, i->BaseOfData); +@@ -3112,7 +3119,7 @@ _bfd_XX_get_symbol_info (bfd * abfd, asymbol *symbol, symbol_info *ret) + coff_get_symbol_info (abfd, symbol, ret); + } + +-#if !defined(COFF_WITH_pep) && (defined(COFF_WITH_pex64) || defined(COFF_WITH_peAArch64)) ++#if !defined(COFF_WITH_pep) && (defined(COFF_WITH_pex64) || defined(COFF_WITH_peAArch64) || defined(COFF_WITH_peLoongArch64)) + static int + sort_x64_pdata (const void *l, const void *r) + { +@@ -4531,7 +4538,7 @@ _bfd_XXi_final_link_postscript (bfd * abfd, struct coff_final_link_info *pfinfo) + the TLS data directory consists of 4 pointers, followed + by two 4-byte integer. This implies that the total size + is different for 32-bit and 64-bit executables. */ +-#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64) ++#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64) && !defined(COFF_WITH_peLoongArch64) + pe_data (abfd)->pe_opthdr.DataDirectory[PE_TLS_TABLE].Size = 0x18; + #else + pe_data (abfd)->pe_opthdr.DataDirectory[PE_TLS_TABLE].Size = 0x28; +@@ -4540,7 +4547,7 @@ _bfd_XXi_final_link_postscript (bfd * abfd, struct coff_final_link_info *pfinfo) + + /* If there is a .pdata section and we have linked pdata finally, we + need to sort the entries ascending. */ +-#if !defined(COFF_WITH_pep) && (defined(COFF_WITH_pex64) || defined(COFF_WITH_peAArch64)) ++#if !defined(COFF_WITH_pep) && (defined(COFF_WITH_pex64) || defined(COFF_WITH_peAArch64) || defined(COFF_WITH_peLoongArch64)) + { + asection *sec = bfd_get_section_by_name (abfd, ".pdata"); + +diff --git a/bfd/pei-loongarch64.c b/bfd/pei-loongarch64.c +new file mode 100644 +index 00000000..7221fe66 +--- /dev/null ++++ b/bfd/pei-loongarch64.c +@@ -0,0 +1,75 @@ ++/* BFD back-end for LoongArch64 PE IMAGE COFF files. ++ Copyright (C) 2022 Free Software Foundation, Inc. ++ ++ This file is part of BFD, the Binary File Descriptor library. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software ++ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, ++ MA 02110-1301, USA. */ ++ ++#include "sysdep.h" ++#include "bfd.h" ++ ++#define TARGET_SYM loongarch64_pei_vec ++#define TARGET_NAME "pei-loongarch64" ++#define TARGET_ARCHITECTURE bfd_arch_loongarch ++#define TARGET_PAGESIZE 0x4000 ++#define TARGET_BIG_ENDIAN 0 ++#define TARGET_ARCHIVE 0 ++#define TARGET_PRIORITY 0 ++ ++#define COFF_IMAGE_WITH_PE ++/* Rename the above into... */ ++#define COFF_WITH_peLoongArch64 ++#define COFF_WITH_PE ++#define PCRELOFFSET true ++ ++/* Long section names not allowed in executable images, only object files. */ ++#define COFF_LONG_SECTION_NAMES 0 ++ ++#define COFF_SECTION_ALIGNMENT_ENTRIES \ ++{ COFF_SECTION_NAME_EXACT_MATCH (".bss"), \ ++ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \ ++{ COFF_SECTION_NAME_EXACT_MATCH (".data"), \ ++ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \ ++{ COFF_SECTION_NAME_EXACT_MATCH (".rdata"), \ ++ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \ ++{ COFF_SECTION_NAME_EXACT_MATCH (".text"), \ ++ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \ ++{ COFF_SECTION_NAME_PARTIAL_MATCH (".idata"), \ ++ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \ ++{ COFF_SECTION_NAME_EXACT_MATCH (".pdata"), \ ++ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \ ++{ COFF_SECTION_NAME_PARTIAL_MATCH (".debug"), \ ++ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 }, \ ++{ COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.wi."), \ ++ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 } ++ ++#define PEI_HEADERS ++#include "sysdep.h" ++#include "bfd.h" ++#include "libbfd.h" ++#include "coff/loongarch64.h" ++#include "coff/internal.h" ++#include "coff/pe.h" ++#include "libcoff.h" ++#include "libpei.h" ++#include "libiberty.h" ++ ++/* Make sure we're setting a 64-bit format. */ ++#undef AOUTSZ ++#define AOUTSZ PEPAOUTSZ ++#define PEAOUTHDR PEPAOUTHDR ++ ++#include "coff-loongarch64.c" +diff --git a/bfd/peicode.h b/bfd/peicode.h +index 02573c84..54a159f0 100644 +--- a/bfd/peicode.h ++++ b/bfd/peicode.h +@@ -231,7 +231,7 @@ coff_swap_scnhdr_in (bfd * abfd, void * ext, void * in) + { + scnhdr_int->s_vaddr += pe_data (abfd)->pe_opthdr.ImageBase; + /* Do not cut upper 32-bits for 64-bit vma. */ +-#if !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64) ++#if !defined(COFF_WITH_pex64) && !defined(COFF_WITH_peAArch64) && !defined(COFF_WITH_peLoongArch64) + scnhdr_int->s_vaddr &= 0xffffffff; + #endif + } +@@ -763,6 +763,17 @@ static const jump_table jtab[] = + 16, 12 + }, + #endif ++ ++#ifdef LOONGARCH64MAGIC ++/* We don't currently support jumping to DLLs, so if ++ someone does try emit a runtime trap. Through BREAK 0. */ ++ { LOONGARCH64MAGIC, ++ { 0x00, 0x00, 0x2a, 0x00 }, ++ 4, 0 ++ }, ++ ++#endif ++ + { 0, { 0 }, 0, 0 } + }; + +@@ -920,7 +931,7 @@ pe_ILF_build_a_bfd (bfd * abfd, + /* See PR 20907 for a reproducer. */ + goto error_return; + +-#if defined(COFF_WITH_pex64) || defined(COFF_WITH_peAArch64) ++#if defined(COFF_WITH_pex64) || defined(COFF_WITH_peAArch64) || defined(COFF_WITH_peLoongArch64) + ((unsigned int *) id4->contents)[0] = ordinal; + ((unsigned int *) id4->contents)[1] = 0x80000000; + ((unsigned int *) id5->contents)[0] = ordinal; +@@ -1222,6 +1233,12 @@ pe_ILF_object_p (bfd * abfd) + #endif + break; + ++ case IMAGE_FILE_MACHINE_LOONGARCH64: ++#ifdef LOONGARCH64MAGIC ++ magic = LOONGARCH64MAGIC; ++#endif ++ break; ++ + case IMAGE_FILE_MACHINE_THUMB: + #ifdef THUMBPEMAGIC + { +diff --git a/bfd/reloc.c b/bfd/reloc.c +index 36999fe9..268e4b13 100644 +--- a/bfd/reloc.c ++++ b/bfd/reloc.c +@@ -8228,6 +8228,88 @@ ENUMX + BFD_RELOC_LARCH_SUB32 + ENUMX + BFD_RELOC_LARCH_SUB64 ++ ++ENUMX ++ BFD_RELOC_LARCH_B16 ++ENUMX ++ BFD_RELOC_LARCH_B21 ++ENUMX ++ BFD_RELOC_LARCH_B26 ++ ++ENUMX ++ BFD_RELOC_LARCH_ABS_HI20 ++ENUMX ++ BFD_RELOC_LARCH_ABS_LO12 ++ENUMX ++ BFD_RELOC_LARCH_ABS64_LO20 ++ENUMX ++ BFD_RELOC_LARCH_ABS64_HI12 ++ ++ENUMX ++ BFD_RELOC_LARCH_PCALA_HI20 ++ENUMX ++ BFD_RELOC_LARCH_PCALA_LO12 ++ENUMX ++ BFD_RELOC_LARCH_PCALA64_LO20 ++ENUMX ++ BFD_RELOC_LARCH_PCALA64_HI12 ++ ++ENUMX ++ BFD_RELOC_LARCH_GOT_PC_HI20 ++ENUMX ++ BFD_RELOC_LARCH_GOT_PC_LO12 ++ENUMX ++ BFD_RELOC_LARCH_GOT64_PC_LO20 ++ENUMX ++ BFD_RELOC_LARCH_GOT64_PC_HI12 ++ENUMX ++ BFD_RELOC_LARCH_GOT_HI20 ++ENUMX ++ BFD_RELOC_LARCH_GOT_LO12 ++ENUMX ++ BFD_RELOC_LARCH_GOT64_LO20 ++ENUMX ++ BFD_RELOC_LARCH_GOT64_HI12 ++ ++ENUMX ++ BFD_RELOC_LARCH_TLS_LE_HI20 ++ENUMX ++ BFD_RELOC_LARCH_TLS_LE_LO12 ++ENUMX ++ BFD_RELOC_LARCH_TLS_LE64_LO20 ++ENUMX ++ BFD_RELOC_LARCH_TLS_LE64_HI12 ++ENUMX ++ BFD_RELOC_LARCH_TLS_IE_PC_HI20 ++ENUMX ++ BFD_RELOC_LARCH_TLS_IE_PC_LO12 ++ENUMX ++ BFD_RELOC_LARCH_TLS_IE64_PC_LO20 ++ENUMX ++ BFD_RELOC_LARCH_TLS_IE64_PC_HI12 ++ENUMX ++ BFD_RELOC_LARCH_TLS_IE_HI20 ++ENUMX ++ BFD_RELOC_LARCH_TLS_IE_LO12 ++ENUMX ++ BFD_RELOC_LARCH_TLS_IE64_LO20 ++ENUMX ++ BFD_RELOC_LARCH_TLS_IE64_HI12 ++ENUMX ++ BFD_RELOC_LARCH_TLS_LD_PC_HI20 ++ENUMX ++ BFD_RELOC_LARCH_TLS_LD_HI20 ++ENUMX ++ BFD_RELOC_LARCH_TLS_GD_PC_HI20 ++ENUMX ++ BFD_RELOC_LARCH_TLS_GD_HI20 ++ ++ENUMX ++ BFD_RELOC_LARCH_32_PCREL ++ ++ENUMX ++ BFD_RELOC_LARCH_RELAX ++ + ENUMDOC + LARCH relocations. + +diff --git a/bfd/targets.c b/bfd/targets.c +index 3284bb88..8ad3ef36 100644 +--- a/bfd/targets.c ++++ b/bfd/targets.c +@@ -768,6 +768,7 @@ extern const bfd_target lm32_elf32_vec; + extern const bfd_target lm32_elf32_fdpic_vec; + extern const bfd_target loongarch_elf64_vec; + extern const bfd_target loongarch_elf32_vec; ++extern const bfd_target loongarch64_pei_vec; + extern const bfd_target m32c_elf32_vec; + extern const bfd_target m32r_elf32_vec; + extern const bfd_target m32r_elf32_le_vec; +@@ -1358,6 +1359,7 @@ static const bfd_target * const _bfd_target_vector[] = + #ifdef BFD64 + &loongarch_elf32_vec, + &loongarch_elf64_vec, ++ &loongarch64_pei_vec, + #endif + + #endif /* not SELECT_VECS */ +diff --git a/binutils/readelf.c b/binutils/readelf.c +index c74352f7..2a2e355b 100644 +--- a/binutils/readelf.c ++++ b/binutils/readelf.c +@@ -4390,11 +4390,6 @@ get_machine_flags (Filedata * filedata, unsigned e_flags, unsigned e_machine) + } + break; + case EM_LOONGARCH: +- if (EF_LOONGARCH_IS_LP64 (e_flags)) +- strcat (buf, ", LP64"); +- else if (EF_LOONGARCH_IS_ILP32 (e_flags)) +- strcat (buf, ", ILP32"); +- + if (EF_LOONGARCH_IS_SOFT_FLOAT (e_flags)) + strcat (buf, ", SOFT-FLOAT"); + else if (EF_LOONGARCH_IS_SINGLE_FLOAT (e_flags)) +@@ -4402,6 +4397,11 @@ get_machine_flags (Filedata * filedata, unsigned e_flags, unsigned e_machine) + else if (EF_LOONGARCH_IS_DOUBLE_FLOAT (e_flags)) + strcat (buf, ", DOUBLE-FLOAT"); + ++ if (EF_LOONGARCH_IS_OBJ_V0 (e_flags)) ++ strcat (buf, ", OBJ-v0"); ++ else if (EF_LOONGARCH_IS_OBJ_V1 (e_flags)) ++ strcat (buf, ", OBJ-v1"); ++ + break; + } + } +@@ -14413,6 +14413,8 @@ is_32bit_pcrel_reloc (Filedata * filedata, unsigned int reloc_type) + case EM_AVR_OLD: + case EM_AVR: + return reloc_type == 36; /* R_AVR_32_PCREL. */ ++ case EM_LOONGARCH: ++ return reloc_type == 99; /* R_LARCH_32_PCREL. */ + case EM_MICROBLAZE: + return reloc_type == 2; /* R_MICROBLAZE_32_PCREL. */ + case EM_OR1K: +diff --git a/binutils/testsuite/binutils-all/loongarch64/loongarch64.exp b/binutils/testsuite/binutils-all/loongarch64/loongarch64.exp +new file mode 100644 +index 00000000..bd1d5eba +--- /dev/null ++++ b/binutils/testsuite/binutils-all/loongarch64/loongarch64.exp +@@ -0,0 +1,30 @@ ++# Copyright (C) 2022 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. ++ ++if {![istarget "loongarch64*-*-*"] ++ || ![is_elf_format]} then { ++ return ++} ++ ++set tempfile tmpdir/loongarch64temp.o ++set copyfile tmpdir/loongarch64copy ++ ++set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]] ++foreach t $test_list { ++ # We need to strip the ".d", but can leave the dirname. ++ verbose [file rootname $t] ++ run_dump_test [file rootname $t] ++} +diff --git a/binutils/testsuite/binutils-all/loongarch64/pei-loongarch64.d b/binutils/testsuite/binutils-all/loongarch64/pei-loongarch64.d +new file mode 100644 +index 00000000..574b3e54 +--- /dev/null ++++ b/binutils/testsuite/binutils-all/loongarch64/pei-loongarch64.d +@@ -0,0 +1,15 @@ ++#ld: -e0 ++#PROG: objcopy ++#objcopy: -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel -j .rela -j .rel.* -j .rela.* -j .rel* -j .rela* -j .reloc --target=pei-loongarch64 ++#objdump: -h -f ++#name: Check if efi app format is recognized ++ ++.*: file format pei-loongarch64 ++architecture: Loongarch64, flags 0x00000132: ++EXEC_P, HAS_SYMS, HAS_LOCALS, D_PAGED ++start address 0x0000000000000000 ++ ++Sections: ++Idx Name Size VMA LMA File off Algn ++ 0 \.text 0000003c 0[^ ]+ 0[^ ]+ 0[^ ]+ 2\*\*2 ++ CONTENTS, ALLOC, LOAD, READONLY, CODE +diff --git a/binutils/testsuite/binutils-all/loongarch64/pei-loongarch64.s b/binutils/testsuite/binutils-all/loongarch64/pei-loongarch64.s +new file mode 100644 +index 00000000..1e6710ac +--- /dev/null ++++ b/binutils/testsuite/binutils-all/loongarch64/pei-loongarch64.s +@@ -0,0 +1,33 @@ ++ .file "test_pei.c" ++ .text ++ .align 2 ++ .globl main ++ .type main, @function ++main: ++.LFB0 = . ++ .cfi_startproc ++ addi.d $r3,$r3,-32 ++ .cfi_def_cfa_offset 32 ++ st.d $r22,$r3,24 ++ .cfi_offset 22, -8 ++ addi.d $r22,$r3,32 ++ .cfi_def_cfa 22, 0 ++ addi.w $r12,$r0,1 # 0x1 ++ st.w $r12,$r22,-20 ++ addi.w $r12,$r0,2 # 0x2 ++ st.w $r12,$r22,-24 ++ ld.w $r13,$r22,-20 ++ ld.w $r12,$r22,-24 ++ mul.w $r12,$r13,$r12 ++ slli.w $r12,$r12,0 ++ or $r4,$r12,$r0 ++ ld.d $r22,$r3,24 ++ .cfi_restore 22 ++ addi.d $r3,$r3,32 ++ .cfi_def_cfa_register 3 ++ jr $r1 ++ .cfi_endproc ++.LFE0: ++ .size main, .-main ++ .ident "GCC: (GNU) 12.1.0" ++ .section .note.GNU-stack,"",@progbits +diff --git a/gas/config/loongarch-lex-wrapper.c b/gas/config/loongarch-lex-wrapper.c +index 3bb0b14c..4ddeeb73 100644 +--- a/gas/config/loongarch-lex-wrapper.c ++++ b/gas/config/loongarch-lex-wrapper.c +@@ -16,5 +16,5 @@ + along with this program; see the file COPYING3. If not, + see . */ + +-#include "sysdep.h" ++#include "config.h" + #include "config/loongarch-lex.c" +diff --git a/gas/config/loongarch-lex.h b/gas/config/loongarch-lex.h +index 59212442..35d22dbd 100644 +--- a/gas/config/loongarch-lex.h ++++ b/gas/config/loongarch-lex.h +@@ -32,3 +32,6 @@ loongarch_parse_expr (const char *expr, + size_t max_reloc_num, + size_t *reloc_num, + offsetT *imm); ++bfd_reloc_code_real_type ++loongarch_larch_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, ++ const char *l_r_name); +diff --git a/gas/config/loongarch-parse.y b/gas/config/loongarch-parse.y +index 710f854c..87046877 100644 +--- a/gas/config/loongarch-parse.y ++++ b/gas/config/loongarch-parse.y +@@ -83,11 +83,11 @@ static const char * + my_getExpression (expressionS *ep, const char *str) + { + char *save_in, *ret; ++ + if (*str == ':') + { + unsigned long j; + char *str_1 = (char *) str; +- str_1++; + j = strtol (str_1, &str_1, 10); + get_internal_label (ep, j, *str_1 == 'f'); + return NULL; +@@ -100,69 +100,54 @@ my_getExpression (expressionS *ep, const char *str) + return ret; + } + ++static void ++emit_const_var (const char *op) ++{ ++ expressionS ep; ++ ++ if (end <= top) ++ as_fatal (_("expr too huge")); ++ ++ my_getExpression (&ep, op); ++ ++ if (ep.X_op != O_constant) ++ as_bad ("illegal operand: %s", op); ++ ++ top->value.X_op = O_constant; ++ top->value.X_add_number = ep.X_add_number; ++ top->type = BFD_RELOC_LARCH_SOP_PUSH_ABSOLUTE; ++ top++; ++} ++ + static void + reloc (const char *op_c_str, const char *id_c_str, offsetT addend) + { + expressionS id_sym_expr; ++ bfd_reloc_code_real_type btype; + + if (end <= top) + as_fatal (_("expr too huge")); + +- if (id_c_str) +- { +- my_getExpression (&id_sym_expr, id_c_str); +- id_sym_expr.X_add_number += addend; +- } ++ /* For compatible old asm code. */ ++ if (0 == strcmp (op_c_str, "plt")) ++ btype = BFD_RELOC_LARCH_B26; + else +- { +- id_sym_expr.X_op = O_constant; +- id_sym_expr.X_add_number = addend; +- } ++ btype = loongarch_larch_reloc_name_lookup (NULL, op_c_str); + +- if (strcmp (op_c_str, "abs") == 0) +- { +- top->value = id_sym_expr; +- top->type = BFD_RELOC_LARCH_SOP_PUSH_ABSOLUTE; +- top++; +- } +- else if (strcmp (op_c_str, "pcrel") == 0) +- { +- top->value = id_sym_expr; +- top->type = BFD_RELOC_LARCH_SOP_PUSH_PCREL; +- top++; +- } +- else if (strcmp (op_c_str, "gprel") == 0) +- { +- top->value = id_sym_expr; +- top->type = BFD_RELOC_LARCH_SOP_PUSH_GPREL; +- top++; +- } +- else if (strcmp (op_c_str, "tprel") == 0) +- { +- top->value = id_sym_expr; +- top->type = BFD_RELOC_LARCH_SOP_PUSH_TLS_TPREL; +- top++; +- } +- else if (strcmp (op_c_str, "tlsgot") == 0) +- { +- top->value = id_sym_expr; +- top->type = BFD_RELOC_LARCH_SOP_PUSH_TLS_GOT; +- top++; +- } +- else if (strcmp (op_c_str, "tlsgd") == 0) +- { +- top->value = id_sym_expr; +- top->type = BFD_RELOC_LARCH_SOP_PUSH_TLS_GD; +- top++; +- } +- else if (strcmp (op_c_str, "plt") == 0) +- { +- top->value = id_sym_expr; +- top->type = BFD_RELOC_LARCH_SOP_PUSH_PLT_PCREL; +- top++; +- } ++ if (id_c_str) ++ { ++ my_getExpression (&id_sym_expr, id_c_str); ++ id_sym_expr.X_add_number += addend; ++ } + else +- as_fatal (_("unknown reloc hint: %s"), op_c_str); ++ { ++ id_sym_expr.X_op = O_constant; ++ id_sym_expr.X_add_number = addend; ++ } ++ ++ top->value = id_sym_expr; ++ top->type = btype; ++ top++; + } + + static void +@@ -352,6 +337,7 @@ offsetT imm; + + primary_expression + : INTEGER {emit_const ($1);} ++ | IDENTIFIER {emit_const_var ($1);} + | '(' expression ')' + | '%' IDENTIFIER '(' IDENTIFIER addend ')' {reloc ($2, $4, $5); free ($2); free ($4);} + | '%' IDENTIFIER '(' INTEGER addend ')' {reloc ($2, NULL, $4 + $5); free ($2);} +diff --git a/gas/config/tc-loongarch.c b/gas/config/tc-loongarch.c +index 08203d29..218e9c3a 100644 +--- a/gas/config/tc-loongarch.c ++++ b/gas/config/tc-loongarch.c +@@ -143,13 +143,13 @@ md_parse_option (int c, const char *arg) + char ilp32[256] = ""; + unsigned char *suf = (unsigned char *)arg; + +- lp64['s'] = lp64['S'] = EF_LOONGARCH_ABI_LP64_SOFT_FLOAT; +- lp64['f'] = lp64['F'] = EF_LOONGARCH_ABI_LP64_SINGLE_FLOAT; +- lp64['d'] = lp64['D'] = EF_LOONGARCH_ABI_LP64_DOUBLE_FLOAT; ++ lp64['s'] = lp64['S'] = EF_LOONGARCH_ABI_SOFT_FLOAT; ++ lp64['f'] = lp64['F'] = EF_LOONGARCH_ABI_SINGLE_FLOAT; ++ lp64['d'] = lp64['D'] = EF_LOONGARCH_ABI_DOUBLE_FLOAT; + +- ilp32['s'] = ilp32['S'] = EF_LOONGARCH_ABI_ILP32_SOFT_FLOAT; +- ilp32['f'] = ilp32['F'] = EF_LOONGARCH_ABI_ILP32_SINGLE_FLOAT; +- ilp32['d'] = ilp32['D'] = EF_LOONGARCH_ABI_ILP32_DOUBLE_FLOAT; ++ ilp32['s'] = ilp32['S'] = EF_LOONGARCH_ABI_SOFT_FLOAT; ++ ilp32['f'] = ilp32['F'] = EF_LOONGARCH_ABI_SINGLE_FLOAT; ++ ilp32['d'] = ilp32['D'] = EF_LOONGARCH_ABI_DOUBLE_FLOAT; + + switch (c) + { +@@ -216,24 +216,24 @@ void + loongarch_after_parse_args () + { + /* Set default ABI/ISA LP64D. */ +- if (!EF_LOONGARCH_IS_LP64(LARCH_opts.ase_abi) +- && !EF_LOONGARCH_IS_ILP32(LARCH_opts.ase_abi)) ++ if (!LARCH_opts.ase_ilp32) + { + if (strcmp (default_arch, "loongarch64") == 0) + { +- LARCH_opts.ase_abi = EF_LOONGARCH_ABI_LP64_DOUBLE_FLOAT; ++ LARCH_opts.ase_abi = EF_LOONGARCH_ABI_DOUBLE_FLOAT; + LARCH_opts.ase_ilp32 = 1; + LARCH_opts.ase_lp64 = 1; + } + else if (strcmp (default_arch, "loongarch32") == 0) + { +- LARCH_opts.ase_abi = EF_LOONGARCH_ABI_ILP32_DOUBLE_FLOAT; ++ LARCH_opts.ase_abi = EF_LOONGARCH_ABI_DOUBLE_FLOAT; + LARCH_opts.ase_ilp32 = 1; + } + else + as_bad ("unknown default architecture `%s'", default_arch); + } + ++ LARCH_opts.ase_abi |= EF_LOONGARCH_OBJABI_V1; + /* Set default ISA double-float. */ + if (!LARCH_opts.ase_nf + && !LARCH_opts.ase_sf +@@ -362,18 +362,6 @@ loongarch_mach (void) + + static const expressionS const_0 = { .X_op = O_constant, .X_add_number = 0 }; + +-static const char * +-my_getExpression (expressionS *ep, const char *str) +-{ +- char *save_in, *ret; +- save_in = input_line_pointer; +- input_line_pointer = (char *) str; +- expression (ep); +- ret = input_line_pointer; +- input_line_pointer = save_in; +- return ret; +-} +- + static void + s_loongarch_align (int arg) + { +@@ -480,11 +468,6 @@ get_internal_label (expressionS *label_expr, unsigned long label, + label_expr->X_add_number = 0; + } + +-extern int loongarch_parse_expr (const char *expr, +- struct reloc_info *reloc_stack_top, +- size_t max_reloc_num, size_t *reloc_num, +- offsetT *imm_if_no_reloc); +- + static int + is_internal_label (const char *c_str) + { +@@ -599,24 +582,6 @@ loongarch_args_parser_can_match_arg_helper (char esc_ch1, char esc_ch2, + if (!ip->match_now) + break; + +- if (esc_ch1 == 's') +- switch (esc_ch2) +- { +- case 'c': +- ip->match_now = reloc_num == 0; +- break; +- } +- else +- switch (esc_ch2) +- { +- case 'c': +- ip->match_now = reloc_num == 0 && 0 <= imm; +- break; +- } +- +- if (!ip->match_now) +- break; +- + ret = imm; + if (reloc_num) + { +@@ -652,6 +617,15 @@ loongarch_args_parser_can_match_arg_helper (char esc_ch1, char esc_ch2, + as_fatal ( + _("not support reloc bit-field\nfmt: %c%c %s\nargs: %s"), + esc_ch1, esc_ch2, bit_field, arg); ++ if (ip->reloc_info[0].type >= BFD_RELOC_LARCH_B16 ++ && ip->reloc_info[0].type < BFD_RELOC_LARCH_RELAX) ++ { ++ /* As we compact stack-relocs, it is no need for pop operation. ++ But break out until here in order to check the imm field. ++ May be reloc_num > 1 if implement relax? */ ++ ip->reloc_num += reloc_num; ++ break; ++ } + reloc_num++; + ip->reloc_num += reloc_num; + ip->reloc_info[ip->reloc_num - 1].type = reloc_type; +@@ -767,7 +741,12 @@ get_loongarch_opcode (struct loongarch_cl_insn *insn) + { + ase->name_hash_entry = str_htab_create (); + for (it = ase->opcodes; it->name; it++) +- str_hash_insert (ase->name_hash_entry, it->name, (void *) it, 0); ++ { ++ if ((!it->include || (it->include && *it->include)) ++ && (!it->exclude || (it->exclude && !(*it->exclude)))) ++ str_hash_insert (ase->name_hash_entry, it->name, ++ (void *) it, 0); ++ } + } + + if ((it = str_hash_find (ase->name_hash_entry, insn->name)) == NULL) +@@ -800,10 +779,11 @@ static int + check_this_insn_before_appending (struct loongarch_cl_insn *ip) + { + int ret = 0; +- if (strcmp (ip->name, "la.abs") == 0) ++ ++ if (strncmp (ip->name, "la.abs", 6) == 0) + { + ip->reloc_info[ip->reloc_num].type = BFD_RELOC_LARCH_MARK_LA; +- my_getExpression (&ip->reloc_info[ip->reloc_num].value, ip->arg_strs[1]); ++ ip->reloc_info[ip->reloc_num].value = const_0; + ip->reloc_num++; + } + else if (ip->insn->mask == 0xffff8000 +@@ -980,6 +960,7 @@ assember_macro_helper (const char *const args[], void *context_ptr) + ret = loongarch_expand_macro (insns_buf, arg_strs, NULL, NULL, + sizeof (args_buf)); + } ++ + return ret; + } + +@@ -1096,6 +1077,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) + static int64_t stack_top; + static int last_reloc_is_sop_push_pcrel_1 = 0; + int last_reloc_is_sop_push_pcrel = last_reloc_is_sop_push_pcrel_1; ++ segT sub_segment; + last_reloc_is_sop_push_pcrel_1 = 0; + + char *buf = fixP->fx_frag->fr_literal + fixP->fx_where; +@@ -1104,26 +1086,40 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) + case BFD_RELOC_LARCH_SOP_PUSH_TLS_TPREL: + case BFD_RELOC_LARCH_SOP_PUSH_TLS_GD: + case BFD_RELOC_LARCH_SOP_PUSH_TLS_GOT: +- case BFD_RELOC_LARCH_SOP_PUSH_PCREL: +- case BFD_RELOC_LARCH_SOP_PUSH_PLT_PCREL: ++ case BFD_RELOC_LARCH_TLS_LE_HI20: ++ case BFD_RELOC_LARCH_TLS_LE_LO12: ++ case BFD_RELOC_LARCH_TLS_LE64_LO20: ++ case BFD_RELOC_LARCH_TLS_LE64_HI12: ++ case BFD_RELOC_LARCH_TLS_IE_PC_HI20: ++ case BFD_RELOC_LARCH_TLS_IE_PC_LO12: ++ case BFD_RELOC_LARCH_TLS_IE64_PC_LO20: ++ case BFD_RELOC_LARCH_TLS_IE64_PC_HI12: ++ case BFD_RELOC_LARCH_TLS_IE_HI20: ++ case BFD_RELOC_LARCH_TLS_IE_LO12: ++ case BFD_RELOC_LARCH_TLS_IE64_LO20: ++ case BFD_RELOC_LARCH_TLS_IE64_HI12: ++ case BFD_RELOC_LARCH_TLS_LD_PC_HI20: ++ case BFD_RELOC_LARCH_TLS_LD_HI20: ++ case BFD_RELOC_LARCH_TLS_GD_PC_HI20: ++ case BFD_RELOC_LARCH_TLS_GD_HI20: ++ /* Add tls lo (got_lo reloc type). */ + if (fixP->fx_addsy == NULL) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("Relocation against a constant")); ++ S_SET_THREAD_LOCAL (fixP->fx_addsy); ++ break; + +- if (fixP->fx_r_type == BFD_RELOC_LARCH_SOP_PUSH_TLS_TPREL +- || fixP->fx_r_type == BFD_RELOC_LARCH_SOP_PUSH_TLS_GD +- || fixP->fx_r_type == BFD_RELOC_LARCH_SOP_PUSH_TLS_GOT) +- S_SET_THREAD_LOCAL (fixP->fx_addsy); ++ case BFD_RELOC_LARCH_SOP_PUSH_PCREL: ++ if (fixP->fx_addsy == NULL) ++ as_bad_where (fixP->fx_file, fixP->fx_line, ++ _("Relocation against a constant")); + +- if (fixP->fx_r_type == BFD_RELOC_LARCH_SOP_PUSH_PCREL) +- { +- last_reloc_is_sop_push_pcrel_1 = 1; +- if (S_GET_SEGMENT (fixP->fx_addsy) == seg) +- stack_top = (S_GET_VALUE (fixP->fx_addsy) + fixP->fx_offset +- - (fixP->fx_where + fixP->fx_frag->fr_address)); +- else +- stack_top = 0; +- } ++ last_reloc_is_sop_push_pcrel_1 = 1; ++ if (S_GET_SEGMENT (fixP->fx_addsy) == seg) ++ stack_top = (S_GET_VALUE (fixP->fx_addsy) + fixP->fx_offset ++ - (fixP->fx_where + fixP->fx_frag->fr_address)); ++ else ++ stack_top = 0; + break; + + case BFD_RELOC_LARCH_SOP_POP_32_S_10_5: +@@ -1143,11 +1139,20 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) + + case BFD_RELOC_64: + case BFD_RELOC_32: ++ if (fixP->fx_r_type == BFD_RELOC_32 ++ && fixP->fx_addsy && fixP->fx_subsy ++ && (sub_segment = S_GET_SEGMENT (fixP->fx_subsy)) ++ && strcmp (sub_segment->name, ".eh_frame") == 0 ++ && S_GET_VALUE (fixP->fx_subsy) ++ == fixP->fx_frag->fr_address + fixP->fx_where) ++ { ++ fixP->fx_r_type = BFD_RELOC_LARCH_32_PCREL; ++ fixP->fx_subsy = NULL; ++ break; ++ } ++ + if (fixP->fx_subsy) + { +- case BFD_RELOC_24: +- case BFD_RELOC_16: +- case BFD_RELOC_8: + fixP->fx_next = xmemdup (fixP, sizeof (*fixP), sizeof (*fixP)); + fixP->fx_next->fx_addsy = fixP->fx_subsy; + fixP->fx_next->fx_subsy = NULL; +@@ -1164,25 +1169,13 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) + fixP->fx_r_type = BFD_RELOC_LARCH_ADD32; + fixP->fx_next->fx_r_type = BFD_RELOC_LARCH_SUB32; + break; +- case BFD_RELOC_24: +- fixP->fx_r_type = BFD_RELOC_LARCH_ADD24; +- fixP->fx_next->fx_r_type = BFD_RELOC_LARCH_SUB24; +- break; +- case BFD_RELOC_16: +- fixP->fx_r_type = BFD_RELOC_LARCH_ADD16; +- fixP->fx_next->fx_r_type = BFD_RELOC_LARCH_SUB16; +- break; +- case BFD_RELOC_8: +- fixP->fx_r_type = BFD_RELOC_LARCH_ADD8; +- fixP->fx_next->fx_r_type = BFD_RELOC_LARCH_SUB8; +- break; + default: + break; + } ++ + md_number_to_chars (buf, 0, fixP->fx_size); +- if (fixP->fx_next->fx_addsy == NULL) +- fixP->fx_next->fx_done = 1; + } ++ + if (fixP->fx_addsy == NULL) + { + fixP->fx_done = 1; +@@ -1190,6 +1183,64 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) + } + break; + ++ case BFD_RELOC_24: ++ case BFD_RELOC_16: ++ case BFD_RELOC_8: ++ fixP->fx_next = xmemdup (fixP, sizeof (*fixP), sizeof (*fixP)); ++ fixP->fx_next->fx_addsy = fixP->fx_subsy; ++ fixP->fx_next->fx_subsy = NULL; ++ fixP->fx_next->fx_offset = 0; ++ fixP->fx_subsy = NULL; ++ ++ switch (fixP->fx_r_type) ++ { ++ case BFD_RELOC_24: ++ fixP->fx_r_type = BFD_RELOC_LARCH_ADD24; ++ fixP->fx_next->fx_r_type = BFD_RELOC_LARCH_SUB24; ++ break; ++ case BFD_RELOC_16: ++ fixP->fx_r_type = BFD_RELOC_LARCH_ADD16; ++ fixP->fx_next->fx_r_type = BFD_RELOC_LARCH_SUB16; ++ break; ++ case BFD_RELOC_8: ++ fixP->fx_r_type = BFD_RELOC_LARCH_ADD8; ++ fixP->fx_next->fx_r_type = BFD_RELOC_LARCH_SUB8; ++ break; ++ default: ++ break; ++ } ++ ++ md_number_to_chars (buf, 0, fixP->fx_size); ++ ++ if (fixP->fx_next->fx_addsy == NULL) ++ fixP->fx_next->fx_done = 1; ++ ++ if (fixP->fx_addsy == NULL) ++ { ++ fixP->fx_done = 1; ++ md_number_to_chars (buf, *valP, fixP->fx_size); ++ } ++ break; ++ ++ case BFD_RELOC_LARCH_B16: ++ case BFD_RELOC_LARCH_B21: ++ case BFD_RELOC_LARCH_B26: ++ if (fixP->fx_addsy == NULL) ++ { ++ as_bad_where (fixP->fx_file, fixP->fx_line, ++ _ ("Relocation against a constant.")); ++ } ++ if (S_GET_SEGMENT (fixP->fx_addsy) == seg ++ && !S_FORCE_RELOC (fixP->fx_addsy, 1)) ++ { ++ int64_t sym_addend = S_GET_VALUE (fixP->fx_addsy) + fixP->fx_offset; ++ int64_t pc = fixP->fx_where + fixP->fx_frag->fr_address; ++ fix_reloc_insn (fixP, sym_addend - pc, buf); ++ fixP->fx_done = 1; ++ } ++ ++ break; ++ + default: + break; + } +@@ -1210,6 +1261,33 @@ md_estimate_size_before_relax (fragS *fragp ATTRIBUTE_UNUSED, + return 0; + } + ++int ++loongarch_fix_adjustable (fixS *fix) ++{ ++ /* Prevent all adjustments to global symbols. */ ++ if (S_IS_EXTERNAL (fix->fx_addsy) ++ || S_IS_WEAK (fix->fx_addsy) ++ || S_FORCE_RELOC (fix->fx_addsy, true)) ++ return 0; ++ ++ /* Loongarch loads extern symbols by GOT, and if there are embedded ++ asm(".local S"), gcc just output ".local S" to assembly file. ++ For a local symbol with GOT relocations, this adjustments will make ++ GOT relocation's addend not equal to zero. So this adjustments is ++ forbidden for got relocs. */ ++ if(fix->fx_r_type == BFD_RELOC_LARCH_GOT_PC_HI20 ++ || fix->fx_r_type == BFD_RELOC_LARCH_GOT_PC_LO12 ++ || fix->fx_r_type == BFD_RELOC_LARCH_GOT64_PC_LO20 ++ || fix->fx_r_type == BFD_RELOC_LARCH_GOT64_PC_HI12 ++ || fix->fx_r_type == BFD_RELOC_LARCH_GOT_HI20 ++ || fix->fx_r_type == BFD_RELOC_LARCH_GOT_LO12 ++ || fix->fx_r_type == BFD_RELOC_LARCH_GOT64_LO20 ++ || fix->fx_r_type == BFD_RELOC_LARCH_GOT64_HI12) ++ return 0; ++ ++ return 1; ++} ++ + /* Translate internal representation of relocation info to BFD target + format. */ + arelent * +@@ -1249,12 +1327,6 @@ loongarch_cfi_frame_initial_instructions (void) + cfi_add_CFA_def_cfa_register (3 /* $sp */); + } + +-int +-loongarch_dwarf2_addr_size (void) +-{ +- return LARCH_opts.ase_lp64 ? 8 : 4; +-} +- + void + tc_loongarch_parse_to_dw2regnum (expressionS *exp) + { +diff --git a/gas/config/tc-loongarch.h b/gas/config/tc-loongarch.h +index 2664da59..7d416b0c 100644 +--- a/gas/config/tc-loongarch.h ++++ b/gas/config/tc-loongarch.h +@@ -49,7 +49,8 @@ extern int loongarch_relax_frag (asection *, struct frag *, long); + + /* This is called to see whether a reloc against a defined symbol + should be converted into a reloc against a section. */ +-#define tc_fix_adjustable(fixp) 0 ++extern int loongarch_fix_adjustable (struct fix *fix); ++#define tc_fix_adjustable(fixp) loongarch_fix_adjustable(fixp) + + /* Values passed to md_apply_fix don't include symbol values. */ + #define TC_FORCE_RELOCATION_SUB_LOCAL(FIX, SEG) 1 +@@ -59,10 +60,6 @@ extern int loongarch_relax_frag (asection *, struct frag *, long); + #define TARGET_USE_CFIPOP 1 + #define DWARF2_DEFAULT_RETURN_COLUMN 1 /* $ra. */ + #define DWARF2_CIE_DATA_ALIGNMENT -4 +-extern int loongarch_dwarf2_addr_size (void); +-#define DWARF2_FDE_RELOC_SIZE loongarch_dwarf2_addr_size () +-#define DWARF2_ADDR_SIZE(bfd) loongarch_dwarf2_addr_size () +-#define CFI_DIFF_EXPR_OK 0 + + #define tc_cfi_frame_initial_instructions \ + loongarch_cfi_frame_initial_instructions +@@ -76,6 +73,8 @@ extern void tc_loongarch_parse_to_dw2regnum (expressionS *); + Here is the type 0, will fill andi insn later. */ + #define NOP_OPCODE (0x00) + ++#define SUB_SEGMENT_ALIGN(SEG, FRCHAIN) 0 ++ + #define HANDLE_ALIGN(fragp) loongarch_handle_align (fragp) + extern void loongarch_handle_align (struct frag *); + #define MAX_MEM_FOR_RS_ALIGN_CODE (3 + 4) +diff --git a/gas/testsuite/gas/all/gas.exp b/gas/testsuite/gas/all/gas.exp +index 279d9b3d..28570c53 100644 +--- a/gas/testsuite/gas/all/gas.exp ++++ b/gas/testsuite/gas/all/gas.exp +@@ -166,11 +166,11 @@ switch -glob $target_triplet { + # symbols on relocs. + setup_xfail "m68hc1*-*-*" "m6811-*-*" "m6812-*-*" "rl78-*-*" + setup_xfail "riscv*-*-*" "rx-*-*" "vax*-*-*" "xgate*-*-*" "z8k-*-*" +- setup_xfail "loongarch*-*-*" "avr-*-*" ++ setup_xfail "avr-*-*" + run_dump_test redef2 + setup_xfail "m68hc1*-*-*" "m6811-*-*" "m6812-*-*" "rl78-*-*" + setup_xfail "riscv*-*-*" "rx-*-*" "vax*-*-*" "xgate*-*-*" "z8k-*-*" +- setup_xfail "loongarch*-*-*" "avr-*-*" ++ setup_xfail "avr-*-*" + # rs6000-aix disallows redefinition via .comm. + if [is_xcoff_format] { + setup_xfail *-*-* +diff --git a/gas/testsuite/gas/loongarch/bfd_reloc_8.s b/gas/testsuite/gas/loongarch/bfd_reloc_8.s +new file mode 100644 +index 00000000..27388a58 +--- /dev/null ++++ b/gas/testsuite/gas/loongarch/bfd_reloc_8.s +@@ -0,0 +1,16 @@ ++# from linux kernel entry.s ++# test line 10 ".byte \type", BFD_RELOC_8 -> BFD_RELOC_RLARCH_ADD8 -> R_LARCH_ADD8 ++ ++.macro UNWIND_HINT type:req sp_reg=0 sp_offset=0 end=0 ++.Lunwind_hint_ip_\@: ++ .pushsection .discard.unwind_hints ++ .long .Lunwind_hint_ip_\@ - . ++ .short \sp_offset ++ .byte \sp_reg ++ .byte \type ++ .byte \end ++ .balign 4 ++ .popsection ++.endm ++ ++UNWIND_HINT type=ORC_TYPE_CALL sp_reg=2 +diff --git a/gas/testsuite/gas/loongarch/imm_ins.d b/gas/testsuite/gas/loongarch/imm_ins.d +new file mode 100644 +index 00000000..0ceaead3 +--- /dev/null ++++ b/gas/testsuite/gas/loongar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8a[ ]+fld.d[ ]+\$ft2,[ ]+\$t0,[ ]+291\(0x123\) ++[ ]+114:[ ]+2bc48d8a[ ]+fst.d[ ]+\$ft2,[ ]+\$t0,[ ]+291\(0x123\) +diff --git a/gas/testsuite/gas/loongarch/imm_ins.s b/gas/testsuite/gas/loongarch/imm_ins.s +new file mode 100644 +index 00000000..f6a4e745 +--- /dev/null ++++ b/gas/testsuite/gas/loongarch/imm_ins.s +@@ -0,0 +1,83 @@ ++.equ a, 0x123 ++.equ b, 0xfffff00000 ++.equ c, 0xfffffffffff ++.equ d, 2 ++.equ e,0x100 ++ ++li.w $r12, a ++li.d $r13, b ++li.d $r14, c ++ ++alsl.w $r11,$r12,$r13,d ++alsl.wu $r11,$r12,$r13,d ++bytepick.w $r11,$r12,$r13,d ++bytepick.d $r11,$r12,$r13,d ++ ++break d ++dbcl d ++syscall d ++ ++alsl.d $r11,$r12, $r13,d ++slli.w $r11,$r12,d ++slli.d $r11,$r12,d ++srli.w $r11,$r12,d ++srli.d $r12,$r13,d ++srai.w $r12,$r13,d ++srai.d $r12,$r13,d ++ ++bstrins.w $r12,$r13,d,d ++bstrins.d $r12,$r13,d,d ++bstrpick.d $r12,$r13,d,d ++bstrpick.d $r12,$r13,d,d ++ ++slti $r12,$r13,a ++sltui $r12,$r13,a ++addi.w $r12,$r13,a ++addi.d $r12,$r13,a ++lu52i.d $r12,$r13,a ++andi $r12,$r13,d ++ori $r12,$r13,d ++xori $r12,$r13,d ++addu16i.d $r12,$r13,d ++lu12i.w $r12,a ++lu32i.d $r12,a ++pcaddi $r12,a ++pcalau12i $r12,a ++pcaddu12i $r12,a ++pcaddu18i $r12,a ++ ++csrrd $r12,a ++csrwr $r12,a ++csrxchg $r12,$r13,d ++cacop d,$r13,d ++lddir $r12,$r13,d ++ldpte $r12,d ++ ++invtlb d,$r13,$r14 ++ ++ll.w $r12,$r13,e ++sc.w $r12,$r13,e ++ll.d $r12,$r13,e ++sc.d $r12,$r13,e ++ldptr.w $r12,$r13,e ++stptr.w $r12,$r13,e ++ldptr.d $r12,$r13,e ++stptr.d $r12,$r13,e ++ld.b $r12,$r13,e ++ld.h $r12,$r13,e ++ld.w $r12,$r13,e ++ld.d $r12,$r13,e ++st.b $r12,$r13,e ++st.h $r12,$r13,e ++st.w $r12,$r13,e ++st.d $r12,$r13,e ++ld.bu $r12,$r13,e ++ld.hu $r12,$r13,e ++ld.wu $r12,$r13,e ++preld d,$r13,e ++preldx d,$r13,$r14 ++ ++fld.s $f10,$r12,a ++fst.s $f10,$r12,a ++fld.d $f10,$r12,a ++fst.d $f10,$r12,a +diff --git a/gas/testsuite/gas/loongarch/imm_ins_32.d b/gas/testsuite/gas/loongarch/imm_ins_32.d +new file mode 100644 +index 00000000..0a826bfb +--- /dev/null ++++ b/gas/testsuite/gas/loongarch/imm_ins_32.d +@@ -0,0 +1,57 @@ ++#as: ++#objdump: -dr ++#skip: loongarch64-*-* ++ ++.*:[ ]+file format .* ++ ++ ++Disassembly of section .text: ++ ++00000000.* <.text>: ++[ ]+0:[ ]+03848c0c[ ]+ori[ ]+\$t0,[ ]+\$zero,[ ]+0x123 ++[ ]+4:[ ]+0004b58b[ ]+alsl.w[ ]+\$a7,[ ]+\$t0,[ ]+\$t1,[ ]+0x2 ++[ ]+8:[ ]+0006b58b[ ]+alsl.wu[ ]+\$a7,[ ]+\$t0,[ ]+\$t1,[ ]+0x2 ++[ ]+c:[ ]+0009358b[ ]+bytepick.w[ ]+\$a7,[ ]+\$t0,[ ]+\$t1,[ ]+0x2 ++[ ]+10:[ ]+002a0002[ ]+break[ ]+0x2 ++[ ]+14:[ ]+002a8002[ ]+dbcl[ ]+0x2 ++[ ]+18:[ ]+002b0002[ ]+syscall[ ]+0x2 ++[ ]+1c:[ ]+0040898b[ ]+slli.w[ ]+\$a7,[ ]+\$t0,[ ]+0x2 ++[ ]+20:[ ]+0044898b[ ]+srli.w[ ]+\$a7,[ ]+\$t0,[ ]+0x2 ++[ ]+24:[ ]+004889ac[ ]+sr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++[ ]+b4:[ ]+2b048d8a[ ]+fld.s[ ]+\$ft2,[ ]+\$t0,[ ]+291\(0x123\) ++[ ]+b8:[ ]+2b448d8a[ ]+fst.s[ ]+\$ft2,[ ]+\$t0,[ ]+291\(0x123\) +diff --git a/gas/testsuite/gas/loongarch/imm_ins_32.s b/gas/testsuite/gas/loongarch/imm_ins_32.s +new file mode 100644 +index 00000000..e105548e +--- /dev/null ++++ b/gas/testsuite/gas/loongarch/imm_ins_32.s +@@ -0,0 +1,60 @@ ++.equ a, 0x123 ++.equ d, 2 ++.equ e,0x100 ++ ++li.w $r12, a ++ ++alsl.w $r11,$r12,$r13,d ++alsl.wu $r11,$r12,$r13,d ++bytepick.w $r11,$r12,$r13,d ++ ++break d ++dbcl d ++syscall d ++ ++slli.w $r11,$r12,d ++srli.w $r11,$r12,d ++srai.w $r12,$r13,d ++ ++bstrins.w $r12,$r13,d,d ++ ++slti $r12,$r13,a ++sltui $r12,$r13,a ++addi.w $r12,$r13,a ++andi $r12,$r13,d ++ori $r12,$r13,d ++xori $r12,$r13,d ++lu12i.w $r12,a ++pcaddi $r12,a ++pcalau12i $r12,a ++pcaddu12i $r12,a ++pcaddu18i $r12,a ++ ++csrrd $r12,a ++csrwr $r12,a ++csrxchg $r12,$r13,d ++cacop d,$r13,d ++lddir $r12,$r13,d ++ldpte $r12,d ++ ++invtlb d,$r13,$r14 ++ ++ll.w $r12,$r13,e ++sc.w $r12,$r13,e ++ll.d $r12,$r13,e ++sc.d $r12,$r13,e ++ldptr.w $r12,$r13,e ++stptr.w $r12,$r13,e ++ld.h $r12,$r13,e ++ld.w $r12,$r13,e ++st.b $r12,$r13,e ++st.h $r12,$r13,e ++st.w $r12,$r13,e ++ld.bu $r12,$r13,e ++ld.hu $r12,$r13,e ++ld.wu $r12,$r13,e ++preld d,$r13,e ++preldx d,$r13,$r14 ++ ++fld.s $f10,$r12,a ++fst.s $f10,$r12,a +diff --git a/gas/testsuite/gas/loongarch/imm_ins_label-fail.d b/gas/testsuite/gas/loongarch/imm_ins_label-fail.d +new file mode 100644 +index 00000000..4301a007 +--- /dev/null ++++ b/gas/testsuite/gas/loongarch/imm_ins_label-fail.d +@@ -0,0 +1,3 @@ ++#as: ++#source: imm_ins_label-fail.s ++#error_output: imm_ins_label-fail.l +diff --git a/gas/testsuite/gas/loongarch/imm_ins_label-fail.l b/gas/testsuite/gas/loongarch/imm_ins_label-fail.l +new file mode 100644 +index 00000000..e0fec2fe +--- /dev/null ++++ b/gas/testsuite/gas/loongarch/imm_ins_label-fail.l +@@ -0,0 +1,3 @@ ++.*Assembler messages: ++.*Error: illegal operand: Label ++.*Error: illegal operand: Label +diff --git a/gas/testsuite/gas/loongarch/imm_ins_label-fail.s b/gas/testsuite/gas/loongarch/imm_ins_label-fail.s +new file mode 100644 +index 00000000..84b2d192 +--- /dev/null ++++ b/gas/testsuite/gas/loongarch/imm_ins_label-fail.s +@@ -0,0 +1,3 @@ ++Label: ++ li.w $r12, Label ++ addi.w $r12, $r13, Label +diff --git a/gas/testsuite/gas/loongarch/jmp_op.d b/gas/testsuite/gas/loongarch/jmp_op.d +index caa61951..218c13f9 100644 +--- a/gas/testsuite/gas/loongarch/jmp_op.d ++++ b/gas/testsuite/gas/loongarch/jmp_op.d +@@ -1,68 +1,31 @@ + #as: + #objdump: -dr + +-.*:[ ]+file format .* ++.*:[ ]+file format .* + + + Disassembly of section .text: + + 00000000.* <.text>: +-[ ]+0:[ ]+03400000 [ ]+andi[ ]+[ ]+\$zero, \$zero, 0x0 +-[ ]+4:[ ]+60000004 [ ]+bgtz[ ]+[ ]+\$a0, 0[ ]+# 0x4 +-[ ]+[ ]+[ ]+4: R_LARCH_SOP_PUSH_PCREL[ ]+L1 +-[ ]+[ ]+[ ]+4: R_LARCH_SOP_POP_32_S_10_16_S2[ ]+\*ABS\* +-[ ]+8:[ ]+64000080 [ ]+bgez[ ]+[ ]+\$a0, 0[ ]+# 0x8 +-[ ]+[ ]+[ ]+8: R_LARCH_SOP_PUSH_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(0x3ffb8\)[ ]+# 0x0 ++[ ]+4c:[ ]+6fffb485[ ]+[ ]+bgeu[ ]+\$a0, \$a1, -76\(0x3ffb4\)[ ]+# 0x0 ++[ ]+50:[ ]+6fffb0a4[ ]+[ ]+bgeu[ ]+\$a1, \$a0, -80\(0x3ffb0\)[ ]+# 0x0 ++[ ]+54:[ ]+4c000020[ ]+[ ]+jirl[ ]+\$zero, \$ra, 0 +diff --git a/gas/testsuite/gas/loongarch/jmp_op.s b/gas/testsuite/gas/loongarch/jmp_op.s +index 2ec20ed8..56f98678 100644 +--- a/gas/testsuite/gas/loongarch/jmp_op.s ++++ b/gas/testsuite/gas/loongarch/jmp_op.s +@@ -1,22 +1,23 @@ + .L1: + nop +-bgtz $r4,L1 +-bgez $r4,L1 +-blez $r4,L1 +-beqz $r4,L1 +-bnez $r4,L1 +-bceqz $fcc0,L1 +-bcnez $fcc0,L1 ++bgtz $r4,.L1 ++bgez $r4,.L1 ++blez $r4,.L1 ++beqz $r4,.L1 ++bnez $r4,.L1 ++bceqz $fcc0,.L1 ++bcnez $fcc0,.L1 + jr $r4 +-b L1 +-bl L1 +-beq $r4,$r5,L1 +-bne $r4,$r5,L1 +-blt $r4,$r5,L1 +-bgt $r4,$r5,L1 +-bge $r4,$r5,L1 +-ble $r4,$r5,L1 +-bltu $r4,$r5,L1 +-bgtu $r4,$r5,L1 +-bgeu $r4,$r5,L1 +-bleu $r4,$r5,L1 ++b .L1 ++bl .L1 ++beq $r4,$r5,.L1 ++bne $r4,$r5,.L1 ++blt $r4,$r5,.L1 ++bgt $r4,$r5,.L1 ++bge $r4,$r5,.L1 ++ble $r4,$r5,.L1 ++bltu $r4,$r5,.L1 ++bgtu $r4,$r5,.L1 ++bgeu $r4,$r5,.L1 ++bleu $r4,$r5,.L1 ++ret +diff --git a/gas/testsuite/gas/loongarch/li.d b/gas/testsuite/gas/loongarch/li.d +new file mode 100644 +index 00000000..850a3f48 +--- /dev/null ++++ b/gas/testsuite/gas/loongarch/li.d +@@ -0,0 +1,21 @@ ++#as: ++#objdump: -dr ++#skip: loongarch32-*-* ++ ++.*:[ ]+file format .* ++ ++ ++Disassembly of section .text: ++ ++00000000.* <_start>: ++[ ]+0:[ ]+03803c06[ ]+ori[ ]+\$a2,[ ]+\$zero,[ ]+0xf ++[ ]+4:[ ]+1a000005[ ]+pcalau12i[ ]+\$a1,[ ]+0 ++[ ]+4:[ ]+R_LARCH_PCALA_HI20[ ]+.rodata ++[ ]+8:[ ]+02c000a5[ ]+addi.d[ ]+\$a1,[ ]+\$a1,[ ]+0 ++[ ]+8:[ ]+R_LARCH_PCALA_LO12[ ]+.rodata ++[ ]+c:[ ]+03800404[ ]+ori[ ]+\$a0,[ ]+\$zero,[ ]+0x1 ++[ ]+10:[ ]+0381000b[ ]+ori[ ]+\$a7,[ ]+\$zero,[ ]+0x40 ++[ ]+14:[ ]+002b0000[ ]+syscall[ ]+0x0 ++[ ]+18:[ ]+00150004[ ]+move[ ]+\$a0,[ ]+\$zero ++[ ]+1c:[ ]+0381740b[ ]+ori[ ]+\$a7,[ ]+\$zero,[ ]+0x5d ++[ ]+20:[ ]+002b0000[ ]+syscall[ ]+0x0 +diff --git a/gas/testsuite/gas/loongarch/li.s b/gas/testsuite/gas/loongarch/li.s +new file mode 100644 +index 00000000..e95a527f +--- /dev/null ++++ b/gas/testsuite/gas/loongarch/li.s +@@ -0,0 +1,22 @@ ++.equ EXIT_SUCCESS, 0 ++.equ STDOUT, 1 ++.equ SYS_exit, 93 ++.equ SYS_write, 64 ++ ++.section .rodata ++msg: ++ .string "hello, world!\n" ++ len = . - msg ++ ++.text ++ .globl _start ++_start: ++ li.w $a2, len ++ la.local $a1, msg ++ li.w $a0, STDOUT ++ li.w $a7, SYS_write ++ syscall 0x0 ++ ++ li.w $a0, EXIT_SUCCESS ++ li.w $a7, SYS_exit ++ syscall 0x0 +diff --git a/gas/testsuite/gas/loongarch/loongarch.exp b/gas/testsuite/gas/loongarch/loongarch.exp +index 34a2f78c..b8ee4b25 100644 +--- a/gas/testsuite/gas/loongarch/loongarch.exp ++++ b/gas/testsuite/gas/loongarch/loongarch.exp +@@ -20,4 +20,5 @@ + + if [istarget loongarch*-*-*] { + run_dump_tests [lsort [glob -nocomplain $srcdir/$subdir/*.d]] ++ gas_test_old bfd_reloc_8.s "" "bfd_reloc_8" + } +diff --git a/gas/testsuite/gas/loongarch/macro_op.d b/gas/testsuite/gas/loongarch/macro_op.d +index fabd006b..d264c4f2 100644 +--- a/gas/testsuite/gas/loongarch/macro_op.d ++++ b/gas/testsuite/gas/loongarch/macro_op.d +@@ -1,733 +1,59 @@ + #as: + #objdump: -dr +-#skip: loongarch32*-*-* ++#skip: loongarch32-*-* + +-.*:[ ]+file format .* ++.*:[ ]+file format .* + + + Disassembly of section .text: + +-0000000000000000 <.text>: +-[ ]+0:[ ]+00150004 [ ]+move[ ]+[ ]+\$a0, \$zero +-[ ]+4:[ ]+02bffc04 [ ]+addi.w[ ]+[ ]+\$a0, \$zero, -1\(0xfff\) +-[ ]+8:[ ]+00150004 [ ]+move[ ]+[ ]+\$a0, \$zero +-[ ]+c:[ ]+02bffc04 [ ]+addi.w[ ]+[ ]+\$a0, \$zero, -1\(0xfff\) +-[ ]+10:[ ]+1c000004 [ ]+pcaddu12i[ ]+[ ]+\$a0, 0 +-[ ]+[ ]+[ ]+10: R_LARCH_SOP_PUSH_PCREL[ ]+_GLOBAL_OFFSET_TABLE_\+0x800 +-[ ]+[ ]+[ ]+10: R_LARCH_SOP_PUSH_GPREL[ ]+L1 +-[ ]+[ ]+[ ]+10: R_LARCH_SOP_ADD[ ]+\*ABS\* +-[ ]+[ ]+[ ]+10: R_LARCH_SOP_PUSH_ABSOLUTE[ ]+\*ABS\*\+0xc +-[ ]+[ ]+[ ]+10: R_LARCH_SOP_SR[ ]+\*ABS\* +-[ ]+[ ]+[ ]+10: R_LARCH_SOP_POP_32_S_5_20[ ]+\*ABS\* +-[ ]+14:[ ]+28c00084 [ ]+ld.d[ ]+[ ]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[ ]+.L1 ++[ ]+48:[ ]+14000004[ ]+lu12i.w[ ]+\$a0,[ ]+0 ++[ ]+48:[ ]+R_LARCH_TLS_LE_HI20[ ]+TLS1 ++[ ]+4c:[ ]+03800084[ ]+ori[ ]+\$a0,[ ]+\$a0,[ ]+0x0 ++[ ]+4c:[ ]+R_LARCH_TLS_LE_LO12[ ]+TLS1 ++[ ]+50:[ ]+1a000004[ ]+pcalau12i[ ]+\$a0,[ ]+0 ++[ ]+50:[ ]+R_LARCH_TLS_IE_PC_HI20[ ]+TLS1 ++[ ]+54:[ ]+28c00084[ ]+ld.d[ ]+\$a0,[ ]+\$a0,[ ]+0 ++[ ]+54:[ ]+R_LARCH_TLS_IE_PC_LO12[ ]+TLS1 ++[ ]+58:[ ]+1a000004[ ]+pcalau12i[ ]+\$a0,[ ]+0 ++[ ]+58:[ ]+R_LARCH_TLS_LD_PC_HI20[ ]+TLS1 ++[ ]+5c:[ ]+02c00084[ ]+addi.d[ ]+\$a0,[ ]+\$a0,[ ]+0 ++[ ]+5c:[ ]+R_LARCH_GOT_PC_LO12[ ]+TLS1 ++[ ]+60:[ ]+1a000004[ ]+pcalau12i[ ]+\$a0,[ ]+0 ++[ ]+60:[ ]+R_LARCH_TLS_GD_PC_HI20[ ]+TLS1 ++[ ]+64:[ ]+02c00084[ ]+addi.d[ ]+\$a0,[ ]+\$a0,[ ]+0 ++[ ]+64:[ ]+R_LARCH_GOT_PC_LO12[ ]+TLS1 +diff --git a/gas/testsuite/gas/loongarch/macro_op.s b/gas/testsuite/gas/loongarch/macro_op.s +index d83261f5..0c333141 100644 +--- a/gas/testsuite/gas/loongarch/macro_op.s ++++ b/gas/testsuite/gas/loongarch/macro_op.s +@@ -1,29 +1,15 @@ +-.L1: +-li.w $r4,0 +-li.w $r4,0xffffffff +-li.d $r4,0 +-li.d $r4,0xffffffffffffffff +-la $r4,L1 +-la.global $r4,L1 +-la.global $r4,$r5,L1 +-la.global $r4,L1 +-la.global $r4,$r5,L1 +-la.global $r4,L1 +-la.global $r4,$r5,L1 +-la.local $r4,L1 +-la.local $r4,$r5,L1 +-la.local $r4,L1 +-la.local $r4,$r5,L1 +-la.abs $r4,L1 +-la.pcrel $r4,L1 +-la.pcrel $r4,L1 +-la.pcrel $r4,$r5,L1 +-la.got $r4,L1 +-la.got $r4,$r5,L1 +-la.tls.le $r4,L1 +-la.tls.ie $r4,L1 +-la.tls.ie $r4,$r5,L1 +-la.tls.ld $r4,L1 +-la.tls.ld $r4,$r5,L1 +-la.tls.gd $r4,L1 +-la.tls.gd $r4,$r5,L1 ++li.w $r4, 0 ++li.w $r4, 0xffffffff ++li.d $r4, 0 ++li.d $r4, 0xffffffffffffffff ++la $r4, .L1 ++la.global $r4, .L1 ++la.local $r4, .L1 ++la.abs $r4, .L1 ++la.pcrel $r4, .L1 ++la.got $r4, .L1 ++ ++la.tls.le $r4, TLS1 ++la.tls.ie $r4, TLS1 ++la.tls.ld $r4, TLS1 ++la.tls.gd $r4, TLS1 +diff --git a/gas/testsuite/gas/loongarch/macro_op_32.d b/gas/testsuite/gas/loongarch/macro_op_32.d +new file mode 100644 +index 00000000..a78c4579 +--- /dev/null ++++ b/gas/testsuite/gas/loongarch/macro_op_32.d +@@ -0,0 +1,55 @@ ++#as: ++#objdump: -dr ++#skip: loongarch64-*-* ++ ++.*:[ ]+file format .* ++ ++ ++Disassembly of section .text: ++ ++00000000.* <.L1>: ++[ ]+0:[ ]+00150004[ ]+move[ ]+\$a0,[ ]+\$zero ++[ ]+4:[ ]+02bffc04[ ]+addi.w[ ]+\$a0,[ ]+\$zero,[ ]+-1\(0xfff\) ++[ ]+8:[ ]+00150004[ ]+move[ ]+\$a0,[ ]+\$zero ++[ ]+c:[ ]+02bffc04[ ]+addi.w[ ]+\$a0,[ ]+\$zero,[ ]+-1\(0xfff\) ++[ ]+10:[ ]+1a000004[ ]+pcalau12i[ ]+\$a0,[ ]+0 ++[ ]+10:[ ]+R_LARCH_GOT_PC_HI20[ ]+.L1 ++[ ]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12i.w[ ]+\$a0,[ ]+0 ++[ ]+40:[ ]+R_LARCH_TLS_LE_HI20[ ]+TLS1 ++[ ]+44:[ ]+03800084[ ]+ori[ ]+\$a0,[ ]+\$a0,[ ]+0x0 ++[ ]+44:[ ]+R_LARCH_TLS_LE_LO12[ ]+TLS1 ++[ ]+48:[ ]+1a000004[ ]+pcalau12i[ ]+\$a0,[ ]+0 ++[ ]+48:[ ]+R_LARCH_TLS_IE_PC_HI20[ ]+TLS1 ++[ ]+4c:[ ]+28800084[ ]+ld.w[ ]+\$a0,[ ]+\$a0,[ ]+0 ++[ ]+4c:[ ]+R_LARCH_TLS_IE_PC_LO12[ ]+TLS1 ++[ ]+50:[ ]+1a000004[ ]+pcalau12i[ ]+\$a0,[ ]+0 ++[ ]+50:[ ]+R_LARCH_TLS_LD_PC_HI20[ ]+TLS1 ++[ ]+54:[ ]+02800084[ ]+addi.w[ ]+\$a0,[ ]+\$a0,[ ]+0 ++[ ]+54:[ ]+R_LARCH_GOT_PC_LO12[ ]+TLS1 ++[ ]+58:[ ]+1a000004[ ]+pcalau12i[ ]+\$a0,[ ]+0 ++[ ]+58:[ ]+R_LARCH_TLS_GD_PC_HI20[ ]+TLS1 ++[ ]+5c:[ ]+02800084[ ]+addi.w[ ]+\$a0,[ ]+\$a0,[ ]+0 ++[ ]+5c:[ ]+R_LARCH_GOT_PC_LO12[ ]+TLS1 +diff --git a/gas/testsuite/gas/loongarch/macro_op_32.s b/gas/testsuite/gas/loongarch/macro_op_32.s +new file mode 100644 +index 00000000..7f19565e +--- /dev/null ++++ b/gas/testsuite/gas/loongarch/macro_op_32.s +@@ -0,0 +1,16 @@ ++.L1: ++ li.w $r4, 0 ++ li.w $r4, 0xffffffff ++ li.w $r4, 0 ++ li.w $r4, 0xffffffff ++ la $r4, .L1 ++ la.global $r4, .L1 ++ la.local $r4, .L1 ++ la.abs $r4, .L1 ++ la.pcrel $r4, .L1 ++ la.got $r4, .L1 ++ ++ la.tls.le $r4, TLS1 ++ la.tls.ie $r4, TLS1 ++ la.tls.ld $r4, TLS1 ++ la.tls.gd $r4, TLS1 +diff --git a/gas/testsuite/gas/loongarch/macro_op_large_abs.d b/gas/testsuite/gas/loongarch/macro_op_large_abs.d +new file mode 100644 +index 00000000..c0b98dbb +--- /dev/null ++++ b/gas/testsuite/gas/loongarch/macro_op_large_abs.d +@@ -0,0 +1,77 @@ ++#as: -mla-global-with-abs ++#objdump: -dr ++#skip: loongarch32-*-* ++ ++.*:[ ]+file format .* ++ ++ ++Disassembly of section .text: ++ ++00000000.* <.L1>: ++[ ]+0:[ ]+1a000004[ ]+pcalau12i[ ]+\$a0,[ ]+0 ++[ ]+0:[ ]+R_LARCH_PCALA_HI20[ ]+.text ++[ ]+4:[ ]+02c00005[ ]+addi.d[ ]+\$a1,[ ]+\$zero,[ ]+0 ++[ ]+4:[ ]+R_LARCH_PCALA_LO12[ ]+.text ++[ ]+8:[ ]+16000005[ ]+lu32i.d[ ]+\$a1,[ ]+0 ++[ ]+8:[ ]+R_LARCH_PCALA64_LO20[ ]+.text ++[ ]+c:[ ]+030000a5[ ]+lu52i.d[ ]+\$a1,[ ]+\$a1,[ ]+0 ++[ ]+c:[ ]+R_LARCH_PCALA64_HI12[ ]+.text ++[ ]+10:[ ]+00109484[ ]+add.d[ ]+\$a0,[ ]+\$a0,[ ]+\$a1 ++[ ]+14:[ ]+14000004[ ]+lu12i.w[ ]+\$a0,[ ]+0 ++[ ]+14:[ ]+R_LARCH_MARK_LA[ ]+\*ABS\* ++[ ]+14:[ ]+R_LARCH_ABS_HI20[ ]+.text ++[ ]+18:[ ]+03800084[ ]+ori[ ]+\$a0,[ ]+\$a0,[ ]+0x0 ++[ ]+18:[ ]+R_LARCH_ABS_LO12[ ]+.text ++[ ]+1c:[ ]+16000004[ ]+lu32i.d[ ]+\$a0,[ ]+0 ++[ ]+1c:[ ]+R_LARCH_ABS64_LO20[ ]+.text ++[ ]+20:[ ]+03000084[ ]+lu52i.d[ ]+\$a0,[ ]+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$a1,[ ]+\$zero,[ ]+0 ++[ ]+80:[ ]+R_LARCH_GOT_PC_LO12[ ]+TLS1 ++[ ]+84:[ ]+16000005[ ]+lu32i.d[ ]+\$a1,[ ]+0 ++[ ]+84:[ ]+R_LARCH_GOT64_PC_LO20[ ]+TLS1 ++[ ]+88:[ ]+030000a5[ ]+lu52i.d[ ]+\$a1,[ ]+\$a1,[ ]+0 ++[ ]+88:[ ]+R_LARCH_GOT64_PC_HI12[ ]+TLS1 ++[ ]+8c:[ ]+00109484[ ]+add.d[ ]+\$a0,[ ]+\$a0,[ ]+\$a1 +diff --git a/gas/testsuite/gas/loongarch/macro_op_large_abs.s b/gas/testsuite/gas/loongarch/macro_op_large_abs.s +new file mode 100644 +index 00000000..fd76391d +--- /dev/null ++++ b/gas/testsuite/gas/loongarch/macro_op_large_abs.s +@@ -0,0 +1,9 @@ ++.L1: ++la.local $r4, $r5, .L1 ++la.global $r4, $r5, .L1 ++la.pcrel $r4, $r5, .L1 ++la.got $r4, $r5, .L1 ++la.tls.le $r4, TLS1 ++la.tls.ie $r4, $r5, TLS1 ++la.tls.ld $r4, $r5, TLS1 ++la.tls.gd $r4, $r5, TLS1 +diff --git a/gas/testsuite/gas/loongarch/macro_op_large_pc.d b/gas/testsuite/gas/loongarch/macro_op_large_pc.d +new file mode 100644 +index 00000000..3b532755 +--- /dev/null ++++ b/gas/testsuite/gas/loongarch/macro_op_large_pc.d +@@ -0,0 +1,77 @@ ++#as: ++#objdump: -dr ++#skip: loongarch32-*-* ++ ++.*:[ ]+file format .* ++ ++ ++Disassembly of section .text: ++ ++00000000.* <.L1>: ++[ ]+0:[ ]+1a000004[ ]+pcalau12i[ ]+\$a0,[ ]+0 ++[ ]+0:[ ]+R_LARCH_PCALA_HI20[ ]+.text ++[ ]+4:[ ]+02c00005[ ]+addi.d[ ]+\$a1,[ ]+\$zero,[ ]+0 ++[ ]+4:[ ]+R_LARCH_PCALA_LO12[ ]+.text ++[ ]+8:[ ]+16000005[ ]+lu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]+\$a0,[ ]+\$a0,[ ]+\$a1 ++[ ]+6c:[ ]+1a000004[ ]+pcalau12i[ ]+\$a0,[ ]+0 ++[ ]+6c:[ ]+R_LARCH_TLS_LD_PC_HI20[ ]+TLS1 ++[ ]+70:[ ]+02c00005[ ]+addi.d[ ]+\$a1,[ ]+\$zero,[ ]+0 ++[ ]+70:[ ]+R_LARCH_GOT_PC_LO12[ ]+TLS1 ++[ ]+74:[ ]+16000005[ ]+lu32i.d[ ]+\$a1,[ ]+0 ++[ ]+74:[ ]+R_LARCH_GOT64_PC_LO20[ ]+TLS1 ++[ ]+78:[ ]+030000a5[ ]+lu52i.d[ ]+\$a1,[ ]+\$a1,[ ]+0 ++[ ]+78:[ ]+R_LARCH_GOT64_PC_HI12[ ]+TLS1 ++[ ]+7c:[ ]+00109484[ ]+add.d[ ]+\$a0,[ ]+\$a0,[ ]+\$a1 ++[ ]+80:[ ]+1a000004[ ]+pcalau12i[ ]+\$a0,[ ]+0 ++[ ]+80:[ ]+R_LARCH_TLS_GD_PC_HI20[ ]+TLS1 ++[ ]+84:[ ]+02c00005[ ]+addi.d[ ]+\$a1,[ ]+\$zero,[ ]+0 ++[ ]+84:[ ]+R_LARCH_GOT_PC_LO12[ ]+TLS1 ++[ ]+88:[ ]+16000005[ ]+lu32i.d[ ]+\$a1,[ ]+0 ++[ ]+88:[ ]+R_LARCH_GOT64_PC_LO20[ ]+TLS1 ++[ ]+8c:[ ]+030000a5[ ]+lu52i.d[ ]+\$a1,[ ]+\$a1,[ ]+0 ++[ ]+8c:[ ]+R_LARCH_GOT64_PC_HI12[ ]+TLS1 ++[ ]+90:[ ]+00109484[ ]+add.d[ ]+\$a0,[ ]+\$a0,[ ]+\$a1 +diff --git a/gas/testsuite/gas/loongarch/macro_op_large_pc.s b/gas/testsuite/gas/loongarch/macro_op_large_pc.s +new file mode 100644 +index 00000000..fd76391d +--- /dev/null ++++ b/gas/testsuite/gas/loongarch/macro_op_large_pc.s +@@ -0,0 +1,9 @@ ++.L1: ++la.local $r4, $r5, .L1 ++la.global $r4, $r5, .L1 ++la.pcrel $r4, $r5, .L1 ++la.got $r4, $r5, .L1 ++la.tls.le $r4, TLS1 ++la.tls.ie $r4, $r5, TLS1 ++la.tls.ld $r4, $r5, TLS1 ++la.tls.gd $r4, $r5, TLS1 +diff --git a/gas/testsuite/gas/loongarch/reloc.d b/gas/testsuite/gas/loongarch/reloc.d +new file mode 100644 +index 00000000..6f5f110b +--- /dev/null ++++ b/gas/testsuite/gas/loongarch/reloc.d +@@ -0,0 +1,167 @@ ++#as: ++#objdump: -dr ++#skip: loongarch32-*-* ++ ++.*:[ ]+file format .* ++ ++ ++Disassembly of section .text: ++ ++00000000.* <.text>: ++[ ]+0:[ ]+03400000[ ]+andi[ ]+\$zero,[ ]+\$zero,[ ]+0x0 ++[ ]+4:[ ]+58000085[ ]+beq[ ]+\$a0,[ ]+\$a1,[ ]+0[ ]+#[ ]+0x4 ++[ ]+4:[ ]+R_LARCH_B16[ ]+.L1 ++[ ]+8:[ ]+5c000085[ ]+bne[ ]+\$a0,[ ]+\$a1,[ ]+0[ ]+#[ ]+0x8 ++[ ]+8:[ ]+R_LARCH_B16[ ]+.L1 ++[ ]+c:[ ]+60000085[ ]+blt[ ]+\$a0,[ ]+\$a1,[ ]+0[ ]+#[ ]+0xc ++[ ]+c:[ ]+R_LARCH_B16[ ]+.L1 ++[ ]+10:[ ]+64000085[ ]+bge[ ]+\$a0,[ ]+\$a1,[ ]+0[ ]+#[ ]+0x10 ++[ ]+10:[ ]+R_LARCH_B16[ ]+.L1 ++[ ]+14:[ ]+68000085[ ]+bltu[ ]+\$a0,[ ]+\$a1,[ ]+0[ ]+#[ ]+0x14 ++[ ]+14:[ ]+R_LARCH_B16[ ]+.L1 ++[ ]+18:[ ]+6c000085[ ]+bgeu[ ]+\$a0,[ ]+\$a1,[ ]+0[ ]+#[ ]+0x18 ++[ ]+18:[ ]+R_LARCH_B16[ ]+.L1 ++[ ]+1c:[ ]+4c0000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+0 ++[ ]+124:[ ]+R_LARCH_GOT64_LO20[ ]+.L1\+0x8 ++[ ]+128:[ ]+03000085[ ]+lu52i.d[ ]+\$a1,[ ]+\$a0,[ ]+0 ++[ ]+128:[ ]+R_LARCH_GOT64_HI12[ ]+.L1\+0x8 ++[ ]+12c:[ ]+14000004[ ]+lu12i.w[ ]+\$a0,[ ]+0 ++[ ]+12c:[ ]+R_LARCH_TLS_LE_HI20[ ]+TLSL1\+0x8 ++[ ]+130:[ ]+03800085[ ]+ori[ ]+\$a1,[ ]+\$a0,[ ]+0x0 ++[ ]+130:[ ]+R_LARCH_TLS_LE_LO12[ ]+TLSL1\+0x8 ++[ ]+134:[ ]+16000004[ ]+lu32i.d[ ]+\$a0,[ ]+0 ++[ ]+134:[ ]+R_LARCH_TLS_LE64_LO20[ ]+TLSL1\+0x8 ++[ ]+138:[ ]+03000085[ ]+lu52i.d[ ]+\$a1,[ ]+\$a0,[ ]+0 ++[ ]+138:[ ]+R_LARCH_TLS_LE64_HI12[ ]+TLSL1\+0x8 +diff --git a/gas/testsuite/gas/loongarch/reloc.s b/gas/testsuite/gas/loongarch/reloc.s +new file mode 100644 +index 00000000..a67fecd9 +--- /dev/null ++++ b/gas/testsuite/gas/loongarch/reloc.s +@@ -0,0 +1,144 @@ ++/* Test insn relocs. */ ++.text ++nop ++ ++/* Jump Insns. */ ++/* b16. */ ++beq $r4,$r5,%b16(.L1) ++bne $r4,$r5,%b16(.L1) ++blt $r4,$r5,%b16(.L1) ++bge $r4,$r5,%b16(.L1) ++bltu $r4,$r5,%b16(.L1) ++bgeu $r4,$r5,%b16(.L1) ++jirl $r4,$r5,%b16(.L1) ++ ++/* b21. */ ++beqz $r4,%b21(.L1) ++bnez $r4,%b21(.L1) ++ ++/* b26. */ ++b %b26(.L1) ++bl %b26(.L1) ++ ++ ++/* ABS Insns. */ ++/* lu12i.w. */ ++lu12i.w $r4,%abs_hi20(.L1) ++ ++/* ori */ ++ori $r4,$r5,%abs_lo12(.L1) ++ ++/* lu32i.d. */ ++lu32i.d $r4,%abs64_lo20(.L1) ++ ++/* lu52i.d. */ ++lu52i.d $r5,$r4,%abs64_hi12(.L1) ++ ++ ++/* Pcala Insns. */ ++/* pcalau12i. */ ++pcalau12i $r4,%pc_hi20(.L1) ++pcalau12i $r4,%got_pc_hi20(.L1) ++pcalau12i $r4,%got_pc_lo12(.L1) ++pcalau12i $r4,%ie_pc_hi20(TLSL1) ++pcalau12i $r4,%ld_pc_hi20(TLSL1) ++pcalau12i $r4,%gd_pc_hi20(TLSL1) ++ ++/* addi.w/d ld.b/h/w/d. */ ++addi.w $r5,$r4,%pc_lo12(.L1) ++addi.d $r5,$r4,%pc_lo12(.L1) ++ld.b $r5,$r4,%pc_lo12(.L1) ++ld.h $r5,$r4,%pc_lo12(.L1) ++ld.w $r5,$r4,%pc_lo12(.L1) ++ld.d $r5,$r4,%pc_lo12(.L1) ++lu32i.d $r4,%pc64_lo20(.L1) ++lu52i.d $r5,$r4,%pc64_lo20(.L1) ++lu32i.d $r4,%got64_pc_lo20(.L1) ++lu52i.d $r5,$r4,%got64_pc_hi12(.L1) ++ ++ ++/* GOT64 Insns. */ ++/* lu12i.w. */ ++lu12i.w $r4,%got_hi20(.L1) ++ori $r4,$r4,%got_lo12(.L1) ++lu32i.d $r4,%got64_lo20(.L1) ++lu52i.d $r5,$r4,%got64_hi12(.L1) ++ ++ ++/* TLS Insns. */ ++lu12i.w $r4,%le_hi20(TLSL1) ++ori $r5,$r4,%le_lo12(TLSL1) ++lu32i.d $r4,%le64_lo20(TLSL1) ++lu52i.d $r5,$r4,%le64_hi12(TLSL1) ++ ++ ++ ++/* Insns with addend. */ ++/* Jump Insns. */ ++/* b16. */ ++beq $r4,$r5,%b16(.L1 + 0x8) ++bne $r4,$r5,%b16(.L1 + 0x8) ++blt $r4,$r5,%b16(.L1 + 0x8) ++bge $r4,$r5,%b16(.L1 + 0x8) ++bltu $r4,$r5,%b16(.L1 + 0x8) ++bgeu $r4,$r5,%b16(.L1 + 0x8) ++jirl $r4,$r5,%b16(.L1 + 0x8) ++ ++/* b21. */ ++beqz $r4,%b21(.L1 + 0x8) ++bnez $r4,%b21(.L1 + 0x8) ++ ++/* b26. */ ++b %b26(.L1 + 0x8) ++bl %b26(.L1 + 0x8) ++ ++ ++/* ABS Insns. */ ++/* lu12i.w. */ ++lu12i.w $r4,%abs_hi20(.L1 + 0x8) ++ ++/* ori */ ++ori $r4,$r5,%abs_lo12(.L1 + 0x8) ++ ++/* lu32i.d. */ ++lu32i.d $r4,%abs64_lo20(.L1 + 0x8) ++ ++/* lu52i.d. */ ++lu52i.d $r5,$r4,%abs64_hi12(.L1 + 0x8) ++ ++ ++/* Pcala Insns. */ ++/* pcalau12i. */ ++pcalau12i $r4,%pc_hi20(.L1 + 0x8) ++pcalau12i $r4,%got_pc_hi20(.L1 + 0x8) ++pcalau12i $r4,%got_pc_lo12(.L1 + 0x8) ++pcalau12i $r4,%ie_pc_hi20(TLSL1 + 0x8) ++pcalau12i $r4,%ld_pc_hi20(TLSL1 + 0x8) ++pcalau12i $r4,%gd_pc_hi20(TLSL1 + 0x8) ++ ++/* addi.w/d ld.b/h/w/d. */ ++addi.w $r5,$r4,%pc_lo12(.L1 + 0x8) ++addi.d $r5,$r4,%pc_lo12(.L1 + 0x8) ++ld.b $r5,$r4,%pc_lo12(.L1 + 0x8) ++ld.h $r5,$r4,%pc_lo12(.L1 + 0x8) ++ld.w $r5,$r4,%pc_lo12(.L1 + 0x8) ++ld.d $r5,$r4,%pc_lo12(.L1 + 0x8) ++lu32i.d $r4,%pc64_lo20(.L1 + 0x8) ++lu52i.d $r5,$r4,%pc64_lo20(.L1 + 0x8) ++lu32i.d $r4,%got64_pc_lo20(.L1 + 0x8) ++lu52i.d $r5,$r4,%got64_pc_hi12(.L1 + 0x8) ++ ++ ++/* GOT64 Insns. */ ++/* lu12i.w. */ ++lu12i.w $r4,%got_hi20(.L1 + 0x8) ++ori $r4,$r4,%got_lo12(.L1 + 0x8) ++lu32i.d $r4,%got64_lo20(.L1 + 0x8) ++lu52i.d $r5,$r4,%got64_hi12(.L1 + 0x8) ++ ++ ++/* TLS Insns. */ ++lu12i.w $r4,%le_hi20(TLSL1 + 0x8) ++ori $r5,$r4,%le_lo12(TLSL1 + 0x8) ++lu32i.d $r4,%le64_lo20(TLSL1 + 0x8) ++lu52i.d $r5,$r4,%le64_hi12(TLSL1 + 0x8) +diff --git a/include/coff/loongarch64.h b/include/coff/loongarch64.h +new file mode 100644 +index 00000000..b80ca42a +--- /dev/null ++++ b/include/coff/loongarch64.h +@@ -0,0 +1,61 @@ ++/* LoongArch64 COFF support for BFD. ++ Copyright (C) 2022 Free Software Foundation, Inc. ++ ++ This file is part of BFD, the Binary File Descriptor library. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software Foundation, ++ Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ ++ ++#define COFFLOONGARCH64 1 ++ ++#define L_LNNO_SIZE 2 ++#define INCLUDE_COMDAT_FIELDS_IN_AUXENT ++#include "coff/external.h" ++ ++#define F_LOONGARCH64_ARCHITECTURE_MASK (0x4000) ++ ++#define LOONGARCH64MAGIC 0x6264 /* From Microsoft specification. */ ++ ++#undef BADMAG ++#define BADMAG(x) ((x).f_magic != LOONGARCH64MAGIC) ++#define LOONGARCH64 1 /* Customize coffcode.h. */ ++ ++#define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b ++ ++#define OMAGIC 0404 /* Object files, eg as output. */ ++#define ZMAGIC IMAGE_NT_OPTIONAL_HDR64_MAGIC /* Demand load format, eg normal ld output 0x10b. */ ++#define STMAGIC 0401 /* Target shlib. */ ++#define SHMAGIC 0443 /* Host shlib. */ ++ ++/* define some NT default values */ ++/* #define NT_IMAGE_BASE 0x400000 moved to internal.h */ ++#define NT_SECTION_ALIGNMENT 0x1000 ++#define NT_FILE_ALIGNMENT 0x200 ++#define NT_DEF_RESERVE 0x100000 ++#define NT_DEF_COMMIT 0x1000 ++ ++/* We use the .rdata section to hold read only data. */ ++#define _LIT ".rdata" ++ ++/********************** RELOCATION DIRECTIVES **********************/ ++struct external_reloc ++{ ++ char r_vaddr[4]; ++ char r_symndx[4]; ++ char r_type[2]; ++ char r_offset[4]; ++}; ++ ++#define RELOC struct external_reloc ++#define RELSZ 14 +diff --git a/include/coff/pe.h b/include/coff/pe.h +index c1746500..da600e1c 100644 +--- a/include/coff/pe.h ++++ b/include/coff/pe.h +@@ -163,6 +163,7 @@ + #define IMAGE_FILE_MACHINE_TRICORE 0x0520 + #define IMAGE_FILE_MACHINE_WCEMIPSV2 0x0169 + #define IMAGE_FILE_MACHINE_AMD64 0x8664 ++#define IMAGE_FILE_MACHINE_LOONGARCH64 0x6264 + + #define IMAGE_SUBSYSTEM_UNKNOWN 0 + #define IMAGE_SUBSYSTEM_NATIVE 1 +diff --git a/include/elf/loongarch.h b/include/elf/loongarch.h +index b7aa4ff0..a6341b46 100644 +--- a/include/elf/loongarch.h ++++ b/include/elf/loongarch.h +@@ -90,39 +90,176 @@ RELOC_NUMBER (R_LARCH_SUB64, 56) + RELOC_NUMBER (R_LARCH_GNU_VTINHERIT, 57) + RELOC_NUMBER (R_LARCH_GNU_VTENTRY, 58) + ++ ++/* B16: ++ beq/bne/blt/bge/bltu/bgeu/jirl ++ %b16 (sym). */ ++RELOC_NUMBER (R_LARCH_B16, 64) ++/* B21: ++ beqz/bnez ++ %b16 (sym). */ ++RELOC_NUMBER (R_LARCH_B21, 65) ++/* B26: ++ b/bl ++ %b26 (sym) or %plt (sym). */ ++RELOC_NUMBER (R_LARCH_B26, 66) ++ ++/* ABS: 32/64 ++ lu12i.w ++ %abs_hi20 (sym). */ ++RELOC_NUMBER (R_LARCH_ABS_HI20, 67) ++/* ABS: 32/64 ++ ori ++ %abs_lo12 (sym). */ ++RELOC_NUMBER (R_LARCH_ABS_LO12, 68) ++ ++/* ABS: 64 ++ lu32i.d ++ %abs64_lo20 (sym). */ ++RELOC_NUMBER (R_LARCH_ABS64_LO20, 69) ++/* ABS: 64 ++ lu52i.d ++ %abs64_hi12 (sym). */ ++RELOC_NUMBER (R_LARCH_ABS64_HI12, 70) ++ ++/* PCREL: 32/64 ++ pcalau12i ++ %pc_hi20 (sym). */ ++RELOC_NUMBER (R_LARCH_PCALA_HI20, 71) ++/* PCREL: 32/64 ++ addi.w/addi.d ++ %pc_lo12 (sym). */ ++RELOC_NUMBER (R_LARCH_PCALA_LO12, 72) ++/* PCREL: 64 ++ lu32i.d ++ %pc64_lo20 (sym). */ ++RELOC_NUMBER (R_LARCH_PCALA64_LO20, 73) ++/* PCREL: 64 ++ lu52i.d ++ %pc64_hi12 (sym). */ ++RELOC_NUMBER (R_LARCH_PCALA64_HI12, 74) ++ ++/* GOT: 32/64 ++ pcalau12i ++ %got_pc_hi20 (got). */ ++RELOC_NUMBER (R_LARCH_GOT_PC_HI20, 75) ++/* GOT: 32/64 ++ ld.w/ld.d ++ %got_pc_lo12 (got). */ ++RELOC_NUMBER (R_LARCH_GOT_PC_LO12, 76) ++/* GOT: 32/64 ++ lu32i.d ++ %got_pc_lo12 (got). */ ++RELOC_NUMBER (R_LARCH_GOT64_PC_LO20, 77) ++/* GOT64: PCREL ++ lu52i.d ++ %got64_pc_hi12 (got). */ ++RELOC_NUMBER (R_LARCH_GOT64_PC_HI12, 78) ++/* GOT32/64: ABS ++ lu12i.w ++ %got_hi20 (got). */ ++RELOC_NUMBER (R_LARCH_GOT_HI20, 79) ++/* GOT: 32/64: ABS ++ ori ++ %got_lo12 (got). */ ++RELOC_NUMBER (R_LARCH_GOT_LO12, 80) ++/* GOT64: ABS ++ lu32i.d ++ %got64_lo20 (got). */ ++RELOC_NUMBER (R_LARCH_GOT64_LO20, 81) ++/* GOT64: ABS ++ lu52i.d ++ %got64_hi12 (got). */ ++RELOC_NUMBER (R_LARCH_GOT64_HI12, 82) ++ ++/* TLS-LE: 32/64 ++ lu12i.w ++ %le_hi20 (sym). */ ++RELOC_NUMBER (R_LARCH_TLS_LE_HI20, 83) ++/* TLS-LE: 32/64 ++ ori ++ %le_lo12 (sym). */ ++RELOC_NUMBER (R_LARCH_TLS_LE_LO12, 84) ++/* TLS-LE: 64 ++ lu32i.d ++ %le64_lo20 (sym). */ ++RELOC_NUMBER (R_LARCH_TLS_LE64_LO20, 85) ++/* TLS-LE: 64 ++ lu52i.d ++ %le64_hi12 (sym). */ ++RELOC_NUMBER (R_LARCH_TLS_LE64_HI12, 86) ++ ++/* TLS-IE: 32/64 ++ pcalau12i ++ %ie_pc_hi20 (sym). */ ++RELOC_NUMBER (R_LARCH_TLS_IE_PC_HI20, 87) ++RELOC_NUMBER (R_LARCH_TLS_IE_PC_LO12, 88) ++RELOC_NUMBER (R_LARCH_TLS_IE64_PC_LO20, 89) ++RELOC_NUMBER (R_LARCH_TLS_IE64_PC_HI12, 90) ++ ++/* TLS-IE: 32/64: ABS ++ lu12i.w ++ %ie_hi20 (sym). */ ++RELOC_NUMBER (R_LARCH_TLS_IE_HI20, 91) ++RELOC_NUMBER (R_LARCH_TLS_IE_LO12, 92) ++RELOC_NUMBER (R_LARCH_TLS_IE64_LO20, 93) ++RELOC_NUMBER (R_LARCH_TLS_IE64_HI12, 94) ++ ++/* TLS-LD: 32/64 ++ pcalau12i ++ %ld_pc_hi20 (sym). */ ++RELOC_NUMBER (R_LARCH_TLS_LD_PC_HI20, 95) ++/* TLS-LD: 32/64: ABS ++ lu12i.w ++ %ld_hi20 (sym). */ ++RELOC_NUMBER (R_LARCH_TLS_LD_HI20, 96) ++ ++/* TLS-GD: 32/64 ++ pcalau12i ++ %gd_pc_hi20 (sym). */ ++RELOC_NUMBER (R_LARCH_TLS_GD_PC_HI20, 97) ++/* TLS-GD: 32/64: ABS ++ lu12i.w ++ %gd_hi20 (sym). */ ++RELOC_NUMBER (R_LARCH_TLS_GD_HI20, 98) ++ ++/* For eh_frame and debug info. */ ++RELOC_NUMBER (R_LARCH_32_PCREL, 99) ++ ++/* RELAX. */ ++RELOC_NUMBER (R_LARCH_RELAX, 100) ++ + END_RELOC_NUMBERS (R_LARCH_count) + + /* Processor specific flags for the ELF header e_flags field. */ +-/*The flag lp64s/lp64f/lp64d/ilp32s/ilp32f/ilp32d 3bits. */ +-#define EF_LOONGARCH_ABI_LP64_SOFT_FLOAT 0x1 +-#define EF_LOONGARCH_ABI_LP64_SINGLE_FLOAT 0x2 +-#define EF_LOONGARCH_ABI_LP64_DOUBLE_FLOAT 0x3 ++/* Base ABI modifier, 3bits. */ ++#define EF_LOONGARCH_ABI_SOFT_FLOAT 0x1 ++#define EF_LOONGARCH_ABI_SINGLE_FLOAT 0x2 ++#define EF_LOONGARCH_ABI_DOUBLE_FLOAT 0x3 ++#define EF_LOONGARCH_ABI_MODIFIER_MASK 0x7 + +-#define EF_LOONGARCH_ABI_ILP32_SOFT_FLOAT 0x5 +-#define EF_LOONGARCH_ABI_ILP32_SINGLE_FLOAT 0x6 +-#define EF_LOONGARCH_ABI_ILP32_DOUBLE_FLOAT 0x7 ++#define EF_LOONGARCH_OBJABI_V1 0x40 ++#define EF_LOONGARCH_OBJABI_MASK 0xC0 + +-#define EF_LOONGARCH_ABI_MASK 0x7 +-#define EF_LOONGARCH_ABI_ILP32_MASK 0x4 +-#define EF_LOONGARCH_ABI_FLOAT_MASK 0x3 +-#define EF_LOONGARCH_ABI_SOFT_FLOAT_MASK 0x1 +-#define EF_LOONGARCH_ABI_SINGLE_FLOAT_MASK 0x2 +-#define EF_LOONGARCH_ABI_DOUBLE_FLOAT_MASK 0x3 ++#define EF_LOONGARCH_ABI_MASK \ ++ (EF_LOONGARCH_OBJABI_MASK | EF_LOONGARCH_ABI_MODIFIER_MASK) + +-#define EF_LOONGARCH_ABI(abi) (EF_LOONGARCH_ABI_MASK & (abi)) ++#define EF_LOONGARCH_ABI_MODIFIER(abi) \ ++ (EF_LOONGARCH_ABI_MODIFIER_MASK & (abi)) ++#define EF_LOONGARCH_OBJABI(abi) \ ++ (EF_LOONGARCH_OBJABI_MASK & (abi)) + +-#define EF_LOONGARCH_IS_LP64(abi) \ +- (EF_LOONGARCH_ABI(abi) && (!(EF_LOONGARCH_ABI(abi) & EF_LOONGARCH_ABI_ILP32_MASK))) +-#define EF_LOONGARCH_IS_ILP32(abi) \ +- (EF_LOONGARCH_ABI(abi) && (EF_LOONGARCH_ABI(abi) & EF_LOONGARCH_ABI_ILP32_MASK)) ++#define EF_LOONGARCH_ABI(abi) ((abi) & EF_LOONGARCH_ABI_MASK) + + #define EF_LOONGARCH_IS_SOFT_FLOAT(abi) \ +- (!((EF_LOONGARCH_ABI(abi) & EF_LOONGARCH_ABI_FLOAT_MASK) ^ EF_LOONGARCH_ABI_SOFT_FLOAT_MASK)) +- ++ (EF_LOONGARCH_ABI_MODIFIER (abi) == EF_LOONGARCH_ABI_SOFT_FLOAT) + #define EF_LOONGARCH_IS_SINGLE_FLOAT(abi) \ +- (!((EF_LOONGARCH_ABI(abi) & EF_LOONGARCH_ABI_FLOAT_MASK) ^ EF_LOONGARCH_ABI_SINGLE_FLOAT_MASK)) +- ++ (EF_LOONGARCH_ABI_MODIFIER (abi) == EF_LOONGARCH_ABI_SINGLE_FLOAT) + #define EF_LOONGARCH_IS_DOUBLE_FLOAT(abi) \ +- (!((EF_LOONGARCH_ABI(abi) & EF_LOONGARCH_ABI_FLOAT_MASK) ^ EF_LOONGARCH_ABI_DOUBLE_FLOAT_MASK)) ++ (EF_LOONGARCH_ABI_MODIFIER (abi) == EF_LOONGARCH_ABI_DOUBLE_FLOAT) ++ ++#define EF_LOONGARCH_IS_OBJ_V0(abi) (!EF_LOONGARCH_OBJABI (abi)) ++#define EF_LOONGARCH_IS_OBJ_V1(abi) \ ++ (EF_LOONGARCH_OBJABI (abi) == EF_LOONGARCH_OBJABI_V1) + + #endif /* _ELF_LOONGARCH_H */ +diff --git a/ld/testsuite/ld-elf/eh5.d b/ld/testsuite/ld-elf/eh5.d +index d6142515..4a697482 100644 +--- a/ld/testsuite/ld-elf/eh5.d ++++ b/ld/testsuite/ld-elf/eh5.d +@@ -4,7 +4,7 @@ + #ld: + #readelf: -wf + #target: [check_as_cfi] +-#xfail: alpha-*-*ecoff hppa64-*-* tile*-*-* visium-*-* loongarch64-*-* ++#xfail: alpha-*-*ecoff hppa64-*-* tile*-*-* visium-*-* + + Contents of the .eh_frame section: + +diff --git a/ld/testsuite/ld-elf/elf.exp b/ld/testsuite/ld-elf/elf.exp +index 10c635e9..64b1d34f 100644 +--- a/ld/testsuite/ld-elf/elf.exp ++++ b/ld/testsuite/ld-elf/elf.exp +@@ -184,6 +184,7 @@ proc target_defaults_to_execstack {} { + || [istarget "arc*-*-*"] + || [istarget "cris*-*-*"] + || [istarget "ia64*-*-*"] ++ || [istarget "loongarch*-*-*"] + || [istarget "nios2*-*-*"] + || [istarget "powerpc64*-*-*"] + || [istarget "riscv*-*-*"] +diff --git a/ld/testsuite/ld-elf/pr26936.d b/ld/testsuite/ld-elf/pr26936.d +index 9115f810..c479f475 100644 +--- a/ld/testsuite/ld-elf/pr26936.d ++++ b/ld/testsuite/ld-elf/pr26936.d +@@ -9,7 +9,7 @@ + # sed. mn10300 and riscv put different numbers of local symbols in + # linkonce section and comdat sections. xtensa has more than one member + # in comdat groups. +-#xfail: am33_2.0-*-* hppa*-*-hpux* mn10300-*-* riscv*-*-* xtensa*-*-* loongarch*-*-* ++#xfail: am33_2.0-*-* hppa*-*-hpux* mn10300-*-* riscv*-*-* xtensa*-*-* + + #... + CU: .*/pr26936c.s: +diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp +index 3350ed94..78bcfaf9 100644 +--- a/ld/testsuite/ld-elf/shared.exp ++++ b/ld/testsuite/ld-elf/shared.exp +@@ -346,6 +346,7 @@ if { [check_gc_sections_available] } { + mips*-*-* { } + tic6x-*-* { } + xtensa-*-* { } ++ loongarch*-*-* { } + default { + run_ld_link_tests [list \ + [list \ +@@ -465,7 +466,7 @@ run_ld_link_tests [list \ + ] + + # These targets don't copy dynamic variables into .bss. +-setup_xfail "alpha-*-*" "bfin-*-*" "ia64-*-*" "xtensa-*-*" ++setup_xfail "alpha-*-*" "bfin-*-*" "ia64-*-*" "xtensa-*-*" *loongarch*-*-* + # or don't have .data.rel.ro + setup_xfail "hppa*64*-*-hpux*" "tic6x-*-*" + # or complain about relocs in read-only sections +@@ -485,7 +486,8 @@ run_ld_link_tests [list \ + {pr20995c.s} {{readelf {-l --wide} pr20995-2so.r}} "pr20995-2.so"] \ + ] {![check_relro_support]} + +-setup_xfail alpha-*-* xtensa-*-* ++# LoongArch: Read-only sections, merged into text segment in normal exe. ++setup_xfail alpha-*-* xtensa-*-* loongarch*-*-* + run_ld_link_tests [list \ + [list \ + "pr20995-2" \ +@@ -502,7 +504,8 @@ run_ld_link_tests [list \ + # but that is just an optimization so don't complain loudly. + setup_xfail *-*-* + clear_xfail alpha-*-* bfin-*-linux* csky-*-* frv-*-* hppa*-*-* i?86-*-* +-clear_xfail ia64-*-* microblaze-*-* powerpc*-*-* x86_64-*-* xtensa-*-* ++clear_xfail ia64-*-* loongarch*-*-* microblaze-*-* powerpc*-*-* x86_64-*-* ++clear_xfail xtensa-*-* + run_ld_link_tests { + {"pr22374 function pointer initialization" + "" "tmpdir/pr22374.so" "" "pr22374a.s" +diff --git a/ld/testsuite/ld-loongarch-elf/attr-ifunc-4.c b/ld/testsuite/ld-loongarch-elf/attr-ifunc-4.c +new file mode 100644 +index 00000000..5c87445b +--- /dev/null ++++ b/ld/testsuite/ld-loongarch-elf/attr-ifunc-4.c +@@ -0,0 +1,23 @@ ++/* { dg-do run } */ ++/* { dg-require-ifunc "" } */ ++/* { dg-options "" } */ ++ ++#include ++ ++static int implementation (void) ++{ ++ printf ("'ere I am JH\n"); ++ return 0; ++} ++ ++static __typeof__ (implementation)* resolver (void) ++{ ++ return implementation; ++} ++ ++static int magic (void) __attribute__ ((ifunc ("resolver"))); ++ ++int main () ++{ ++ return magic () != 0; ++} +diff --git a/ld/testsuite/ld-loongarch-elf/attr-ifunc-4.out b/ld/testsuite/ld-loongarch-elf/attr-ifunc-4.out +new file mode 100644 +index 00000000..2d9cc343 +--- /dev/null ++++ b/ld/testsuite/ld-loongarch-elf/attr-ifunc-4.out +@@ -0,0 +1 @@ ++'ere I am JH +diff --git a/ld/testsuite/ld-loongarch-elf/cmodel-libjirl.dd b/ld/testsuite/ld-loongarch-elf/cmodel-libjirl.dd +new file mode 100644 +index 00000000..52d3dca8 +--- /dev/null ++++ b/ld/testsuite/ld-loongarch-elf/cmodel-libjirl.dd +@@ -0,0 +1,4 @@ ++.*file format.*loongarch ++#... ++[0-9a-f]+ : ++#pass +diff --git a/ld/testsuite/ld-loongarch-elf/cmodel.exp b/ld/testsuite/ld-loongarch-elf/cmodel.exp +new file mode 100644 +index 00000000..bb28d336 +--- /dev/null ++++ b/ld/testsuite/ld-loongarch-elf/cmodel.exp +@@ -0,0 +1,40 @@ ++# Expect script for LoongArch ELF linker tests ++# Copyright (C) 2022 Free Software Foundation, Inc. ++# ++# This file is part of the GNU Binutils. ++# ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, ++# MA 02110-1301, USA. ++# ++ ++if ![istarget loongarch*-*-*] { ++ return ++} ++ ++if [check_shared_lib_support] { ++ run_ld_link_tests \ ++ [list \ ++ [list \ ++ "medium jirl plt" \ ++ "-shared" "" \ ++ "" \ ++ {libjirl.s} \ ++ [list \ ++ [list objdump -d cmodel-libjirl.dd] \ ++ ] \ ++ "libjirl.so" \ ++ ] \ ++ ] ++} +diff --git a/ld/testsuite/ld-loongarch-elf/disas-jirl-32.d b/ld/testsuite/ld-loongarch-elf/disas-jirl-32.d +index 6621c03e..2f2a41af 100644 +--- a/ld/testsuite/ld-loongarch-elf/disas-jirl-32.d ++++ b/ld/testsuite/ld-loongarch-elf/disas-jirl-32.d +@@ -1,15 +1,15 @@ +-#name: jirl zero-offset symbols for LoongArch32 +-#source: disas-jirl-32.s +-#ld: --no-relax +-#objdump: -d ++#as: ++#objdump: -dr + #skip: loongarch64-*-* + +-.*:[ ]+file format .* ++.*:[ ]+file format .* + + + Disassembly of section .text: + +-00010054 <_start>: +-[ ]+10054:[ ]+1c000014 [ ]+pcaddu12i[ ]+[ ]+\$t8, 0 +-[ ]+10058:[ ]+02800294 [ ]+addi.w[ ]+[ ]+\$t8, \$t8, 0 +-[ ]+1005c:[ ]+4c000281 [ ]+jirl[ ]+[ ]+\$ra, \$t8, 0 ++00000000.* <_start>: ++[ ]+0:[ ]+1a000014[ ]+pcalau12i[ ]+\$t8,[ ]+0 ++[ ]+0:[ ]+R_LARCH_PCALA_HI20[ ]+_start ++[ ]+4:[ ]+02800294[ ]+addi.w[ ]+\$t8,[ ]+\$t8,[ ]+0 ++[ ]+4:[ ]+R_LARCH_PCALA_LO12[ ]+_start ++[ ]+8:[ ]+4c000281[ ]+jirl[ ]+\$ra,[ ]+\$t8,[ ]+0 +diff --git a/ld/testsuite/ld-loongarch-elf/disas-jirl.d b/ld/testsuite/ld-loongarch-elf/disas-jirl.d +index f79111a5..595c30c7 100644 +--- a/ld/testsuite/ld-loongarch-elf/disas-jirl.d ++++ b/ld/testsuite/ld-loongarch-elf/disas-jirl.d +@@ -1,15 +1,14 @@ +-#name: jirl zero-offset symbols for LoongArch64 +-#source: disas-jirl.s +-#ld: --no-relax +-#objdump: -d +-#skip: loongarch32-*-* ++#as: ++#objdump: -dr + +-.*:[ ]+file format .* ++.*:[ ]+file format .* + + + Disassembly of section .text: + +-0000000120000078 <_start>: +-[ ]+120000078:[ ]+1c000014 [ ]+pcaddu12i[ ]+[ ]+\$t8, 0 +-[ ]+12000007c:[ ]+02c00294 [ ]+addi.d[ ]+[ ]+\$t8, \$t8, 0 +-[ ]+120000080:[ ]+4c000281 [ ]+jirl[ ]+[ ]+\$ra, \$t8, 0 ++00000000.*: ++[ ]+0:[ ]+1a000014[ ]+pcalau12i[ ]+\$t8,[ ]+0 ++[ ]+0:[ ]+R_LARCH_PCALA_HI20[ ]+_start ++[ ]+4:[ ]+02c00294[ ]+addi.d[ ]+\$t8,[ ]+\$t8,[ ]+0 ++[ ]+4:[ ]+R_LARCH_PCALA_LO12[ ]+_start ++[ ]+8:[ ]+4c000281[ ]+jirl[ ]+\$ra,[ ]+\$t8,[ ]+0 +diff --git a/ld/testsuite/ld-loongarch-elf/ifunc.exp b/ld/testsuite/ld-loongarch-elf/ifunc.exp +new file mode 100644 +index 00000000..2b55002f +--- /dev/null ++++ b/ld/testsuite/ld-loongarch-elf/ifunc.exp +@@ -0,0 +1,34 @@ ++# Expect script for LoongArch assembler tests. ++# Copyright (C) 2021-2022 Free Software Foundation, Inc. ++# ++# This file is part of the GNU Binutils. ++# ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, ++# MA 02110-1301, USA. ++ ++ ++ ++if [istarget loongarch*-*-*] { ++ run_ld_link_exec_tests [list \ ++ [list \ ++ "Run attr-ifunc-4" \ ++ "" \ ++ "" \ ++ {attr-ifunc-4.c} \ ++ "attr-ifunc-4" \ ++ "attr-ifunc-4.out" \ ++ ] \ ++ ] ++} +diff --git a/ld/testsuite/ld-loongarch-elf/jmp_op.d b/ld/testsuite/ld-loongarch-elf/jmp_op.d +index c68f7aa4..218c13f9 100644 +--- a/ld/testsuite/ld-loongarch-elf/jmp_op.d ++++ b/ld/testsuite/ld-loongarch-elf/jmp_op.d +@@ -1,68 +1,31 @@ + #as: + #objdump: -dr + +-.*:[ ]+file format .* ++.*:[ ]+file format .* + + + Disassembly of section .text: + +-0+0 <.text>: +-[ ]+0:[ ]+03400000 [ ]+andi[ ]+[ ]+\$zero, \$zero, 0x0 +-[ ]+4:[ ]+60000004 [ ]+bgtz[ ]+[ ]+\$a0, 0[ ]+# 0x4 +-[ ]+[ ]+[ ]+4: R_LARCH_SOP_PUSH_PCREL[ ]+L1 +-[ ]+[ ]+[ ]+4: R_LARCH_SOP_POP_32_S_10_16_S2[ ]+\*ABS\* +-[ ]+8:[ ]+64000080 [ ]+bgez[ ]+[ ]+\$a0, 0[ ]+# 0x8 +-[ ]+[ ]+[ ]+8: R_LARCH_SOP_PUSH_PCREL[ ]+L1 +-[ ]+[ ]+[ ]+8: R_LARCH_SOP_POP_32_S_10_16_S2[ ]+\*ABS\* +-[ ]+c:[ ]+64000004 [ ]+blez[ ]+[ ]+\$a0, 0[ ]+# 0xc +-[ ]+[ ]+[ ]+c: R_LARCH_SOP_PUSH_PCREL[ ]+L1 +-[ ]+[ ]+[ ]+c: R_LARCH_SOP_POP_32_S_10_16_S2[ ]+\*ABS\* +-[ ]+10:[ ]+40000080 [ ]+beqz[ ]+[ ]+\$a0, 0[ ]+# 0x10 +-[ ]+[ ]+[ ]+10: R_LARCH_SOP_PUSH_PCREL[ ]+L1 +-[ ]+[ ]+[ ]+10: R_LARCH_SOP_POP_32_S_0_5_10_16_S2[ ]+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-1,22 +1,23 @@ + .L1: +- nop +- bgtz $r4,L1 +- bgez $r4,L1 +- blez $r4,L1 +- beqz $r4,L1 +- bnez $r4,L1 +- bceqz $fcc0,L1 +- bcnez $fcc0,L1 +- jr $r4 +- b L1 +- bl L1 +- beq $r4,$r5,L1 +- bne $r4,$r5,L1 +- blt $r4,$r5,L1 +- bgt $r4,$r5,L1 +- bge $r4,$r5,L1 +- ble $r4,$r5,L1 +- bltu $r4,$r5,L1 +- bgtu $r4,$r5,L1 +- bgeu $r4,$r5,L1 +- bleu $r4,$r5,L1 ++nop ++bgtz $r4,.L1 ++bgez $r4,.L1 ++blez $r4,.L1 ++beqz $r4,.L1 ++bnez $r4,.L1 ++bceqz $fcc0,.L1 ++bcnez $fcc0,.L1 ++jr $r4 ++b .L1 ++bl .L1 ++beq $r4,$r5,.L1 ++bne $r4,$r5,.L1 ++blt $r4,$r5,.L1 ++bgt $r4,$r5,.L1 ++bge $r4,$r5,.L1 ++ble $r4,$r5,.L1 ++bltu $r4,$r5,.L1 ++bgtu $r4,$r5,.L1 ++bgeu $r4,$r5,.L1 ++bleu $r4,$r5,.L1 ++ret +diff --git a/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp b/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp +index dfa8ee18..726ee823 100644 +--- a/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp ++++ b/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp +@@ -31,6 +31,7 @@ if [istarget "loongarch64-*-*"] { + run_dump_test "macro_op" + run_dump_test "syscall" + run_dump_test "disas-jirl" ++ run_dump_test "local-ifunc-reloc" + } + + if [istarget "loongarch32-*-*"] { +diff --git a/ld/testsuite/ld-loongarch-elf/libjirl.s b/ld/testsuite/ld-loongarch-elf/libjirl.s +new file mode 100644 +index 00000000..4d963870 +--- /dev/null ++++ b/ld/testsuite/ld-loongarch-elf/libjirl.s +@@ -0,0 +1,2 @@ ++pcalau12i $r12, %pc_hi20(func) ++jirl $r1,$r12, %pc_lo12(func) +diff --git a/ld/testsuite/ld-loongarch-elf/libnopic-global.s b/ld/testsuite/ld-loongarch-elf/libnopic-global.s +new file mode 100644 +index 00000000..39d7dc68 +--- /dev/null ++++ b/ld/testsuite/ld-loongarch-elf/libnopic-global.s +@@ -0,0 +1,113 @@ ++ .file "libnopic-global.c" ++ .text ++.Ltext0: ++ .file 1 "libnopic-global.c" ++ .globl g_nopic ++ .data ++ .align 2 ++ .type g_nopic, @object ++ .size g_nopic, 4 ++g_nopic: ++ .word 305419896 ++ .text ++.Letext0: ++ .section .debug_info,"",@progbits ++.Ldebug_info0: ++ .4byte 0x38 ++ .2byte 0x5 ++ .byte 0x1 ++ .byte 0x8 ++ .4byte .Ldebug_abbrev0 ++ .uleb128 0x1 ++ .4byte .LASF0 ++ .byte 0x1d ++ .4byte .LASF1 ++ .4byte .LASF2 ++ .4byte .Ldebug_line0 ++ .uleb128 0x2 ++ .4byte .LASF3 ++ .byte 0x1 ++ .byte 0x1 ++ .byte 0x5 ++ .4byte 0x34 ++ .uleb128 0x9 ++ .byte 0x3 ++ .8byte g_nopic ++ .uleb128 0x3 ++ .byte 0x4 ++ .byte 0x5 ++ .ascii "int\000" ++ .byte 0 ++ .section .debug_abbrev,"",@progbits ++.Ldebug_abbrev0: ++ .uleb128 0x1 ++ .uleb128 0x11 ++ .byte 0x1 ++ .uleb128 0x25 ++ .uleb128 0xe ++ .uleb128 0x13 ++ .uleb128 0xb ++ .uleb128 0x3 ++ .uleb128 0xe ++ .uleb128 0x1b ++ .uleb128 0xe ++ .uleb128 0x10 ++ .uleb128 0x17 ++ .byte 0 ++ .byte 0 ++ .uleb128 0x2 ++ .uleb128 0x34 ++ .byte 0 ++ .uleb128 0x3 ++ .uleb128 0xe ++ .uleb128 0x3a ++ .uleb128 0xb ++ .uleb128 0x3b ++ .uleb128 0xb ++ .uleb128 0x39 ++ .uleb128 0xb ++ .uleb128 0x49 ++ .uleb128 0x13 ++ .uleb128 0x3f ++ .uleb128 0x19 ++ .uleb128 0x2 ++ .uleb128 0x18 ++ .byte 0 ++ .byte 0 ++ .uleb128 0x3 ++ .uleb128 0x24 ++ .byte 0 ++ .uleb128 0xb ++ .uleb128 0xb ++ .uleb128 0x3e ++ .uleb128 0xb ++ .uleb128 0x3 ++ .uleb128 0x8 ++ .byte 0 ++ .byte 0 ++ .byte 0 ++ .section .debug_aranges,"",@progbits ++ .4byte 0x1c ++ .2byte 0x2 ++ .4byte .Ldebug_info0 ++ .byte 0x8 ++ .byte 0 ++ .2byte 0 ++ .2byte 0 ++ .8byte 0 ++ .8byte 0 ++ .section .debug_line,"",@progbits ++.Ldebug_line0: ++ .section .debug_str,"MS",@progbits,1 ++.LASF1: ++ .ascii "libnopic-global.c\000" ++.LASF0: ++ .ascii "GNU C17 13.0.0 20220512 (experimental) -mabi=lp64d -marc" ++ .ascii "h=loongarch64 -mfpu=64 -mcmodel=normal -mtune=la464 -g -" ++ .ascii "O0 -fPIC\000" ++.LASF2: ++ .ascii "/home/liuzhensong/test/ld/nopic/test/global_var\000" ++.LASF3: ++ .ascii "g_nopic\000" ++ .ident "GCC: (GNU) 13.0.0 20220512 (experimental)" ++ .section .note.GNU-stack,"",@progbits +diff --git a/ld/testsuite/ld-loongarch-elf/local-ifunc-reloc.d b/ld/testsuite/ld-loongarch-elf/local-ifunc-reloc.d +new file mode 100644 +index 00000000..29f2d3f3 +--- /dev/null ++++ b/ld/testsuite/ld-loongarch-elf/local-ifunc-reloc.d +@@ -0,0 +1,10 @@ ++#as: ++#ld: -shared -z combreloc ++#objdump: -R ++ ++.*: +file format .* ++ ++DYNAMIC RELOCATION RECORDS ++OFFSET +TYPE +VALUE ++[[:xdigit:]]+ R_LARCH_IRELATIVE +\*ABS\*\+0x[[:xdigit:]]+ ++[[:xdigit:]]+ R_LARCH_64 +test +diff --git a/ld/testsuite/ld-loongarch-elf/local-ifunc-reloc.s b/ld/testsuite/ld-loongarch-elf/local-ifunc-reloc.s +new file mode 100644 +index 00000000..77c48746 +--- /dev/null ++++ b/ld/testsuite/ld-loongarch-elf/local-ifunc-reloc.s +@@ -0,0 +1,28 @@ ++.text ++.align 2 ++ ++.local ifunc ++.type ifunc, @gnu_indirect_function ++.set ifunc, resolver ++ ++resolver: ++ la.local $a0, impl ++ jr $ra ++ ++impl: ++ li.w $a0, 42 ++ jr $ra ++ ++.global test ++.type test, @function ++test: ++ move $s0, $ra ++ bl ifunc ++ xori $a0, $a0, 42 ++ jr $s0 ++ ++.data ++.global ptr ++.type ptr, @object ++ptr: ++ .dword test +diff --git a/ld/testsuite/ld-loongarch-elf/macro_op.d b/ld/testsuite/ld-loongarch-elf/macro_op.d +index af100608..39aa1fb9 100644 +--- a/ld/testsuite/ld-loongarch-elf/macro_op.d ++++ b/ld/testsuite/ld-loongarch-elf/macro_op.d +@@ -1,733 +1,164 @@ + #as: + #objdump: -dr +-#skip: loongarch32-*-* + +-.*:[ ]+file format .* ++.*:[ ]+file format .* + + + Disassembly of section .text: + +-0+0 <.text>: +-[ ]+0:[ ]+00150004 [ ]+move[ ]+[ ]+\$a0, \$zero +-[ ]+4:[ ]+02bffc04 [ ]+addi.w[ ]+[ ]+\$a0, \$zero, -1\(0xfff\) +-[ ]+8:[ ]+00150004 [ ]+move[ ]+[ ]+\$a0, \$zero +-[ ]+c:[ ]+02bffc04 [ ]+addi.w[ ]+[ ]+\$a0, \$zero, -1\(0xfff\) +-[ ]+10:[ ]+1c000004 [ ]+pcaddu12i[ ]+[ ]+\$a0, 0 +-[ ]+[ ]+[ ]+10: R_LARCH_SOP_PUSH_PCREL[ ]+_GLOBAL_OFFSET_TABLE_\+0x800 +-[ ]+[ ]+[ ]+10: R_LARCH_SOP_PUSH_GPREL[ ]+L1 +-[ ]+[ ]+[ ]+10: R_LARCH_SOP_ADD[ ]+\*ABS\* +-[ ]+[ ]+[ ]+10: R_LARCH_SOP_PUSH_ABSOLUTE[ ]+\*ABS\*\+0xc +-[ ]+[ ]+[ ]+10: R_LARCH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++[ ]+130:[ ]+00109484[ ]+add.d[ ]+\$a0,[ ]+\$a0,[ ]+\$a1 ++[ ]+134:[ ]+1a000004[ ]+pcalau12i[ ]+\$a0,[ ]+0 ++[ ]+134:[ ]+R_LARCH_TLS_GD_PC_HI20[ ]+TLS1 ++[ ]+138:[ ]+02c00084[ ]+addi.d[ ]+\$a0,[ ]+\$a0,[ ]+0 ++[ ]+138:[ ]+R_LARCH_GOT_PC_LO12[ ]+TLS1 ++[ ]+13c:[ ]+1a000004[ ]+pcalau12i[ ]+\$a0,[ ]+0 ++[ ]+13c:[ ]+R_LARCH_TLS_GD_PC_HI20[ ]+TLS1 ++[ ]+140:[ ]+02c00005[ ]+addi.d[ ]+\$a1,[ ]+\$zero,[ ]+0 ++[ ]+140:[ ]+R_LARCH_GOT_PC_LO12[ ]+TLS1 ++[ ]+144:[ ]+16000005[ ]+lu32i.d[ ]+\$a1,[ ]+0 ++[ ]+144:[ ]+R_LARCH_GOT64_PC_LO20[ ]+TLS1 ++[ ]+148:[ ]+030000a5[ ]+lu52i.d[ ]+\$a1,[ ]+\$a1,[ ]+0 ++[ ]+148:[ ]+R_LARCH_GOT64_PC_HI12[ ]+TLS1 ++[ ]+14c:[ ]+00109484[ ]+add.d[ ]+\$a0,[ ]+\$a0,[ ]+\$a1 +diff --git a/ld/testsuite/ld-loongarch-elf/macro_op.s b/ld/testsuite/ld-loongarch-elf/macro_op.s +index c15e364d..5cf066c3 100644 +--- a/ld/testsuite/ld-loongarch-elf/macro_op.s ++++ b/ld/testsuite/ld-loongarch-elf/macro_op.s +@@ -1,29 +1,30 @@ + .L1: +- li.w $r4,0 +- li.w $r4,0xffffffff +- li.d $r4,0 +- li.d $r4,0xffffffffffffffff +- la $r4,L1 +- la.global $r4,L1 +- la.global $r4,$r5,L1 +- la.global $r4,L1 +- la.global $r4,$r5,L1 +- la.global $r4,L1 +- la.global $r4,$r5,L1 +- la.local $r4,L1 +- la.local $r4,$r5,L1 +- la.local $r4,L1 +- la.local $r4,$r5,L1 +- la.abs $r4,L1 +- la.pcrel $r4,L1 +- la.pcrel $r4,L1 +- la.pcrel $r4,$r5,L1 +- la.got $r4,L1 +- la.got $r4,$r5,L1 +- la.tls.le $r4,L1 +- la.tls.ie $r4,L1 +- la.tls.ie $r4,$r5,L1 +- la.tls.ld $r4,L1 +- la.tls.ld $r4,$r5,L1 +- la.tls.gd $r4,L1 +- la.tls.gd $r4,$r5,L1 ++li.w $r4, 0 ++li.w $r4, 0xffffffff ++li.d $r4, 0 ++li.d $r4, 0xffffffffffffffff ++la $r4, .L1 ++la.global $r4, .L1 ++la.global $r4, $r5, .L1 ++la.global $r4, .L1 ++la.global $r4, $r5, .L1 ++la.global $r4, .L1 ++la.global $r4, $r5, .L1 ++la.local $r4, .L1 ++la.local $r4, $r5, .L1 ++la.local $r4, .L1 ++la.local $r4, $r5, .L1 ++la.abs $r4, .L1 ++la.pcrel $r4, .L1 ++la.pcrel $r4, .L1 ++la.pcrel $r4, $r5, .L1 ++la.got $r4, .L1 ++la.got $r4, $r5, .L1 ++ ++la.tls.le $r4, TLS1 ++la.tls.ie $r4, TLS1 ++la.tls.ie $r4, $r5, TLS1 ++la.tls.ld $r4, TLS1 ++la.tls.ld $r4, $r5, TLS1 ++la.tls.gd $r4, TLS1 ++la.tls.gd $r4, $r5, TLS1 +diff --git a/ld/testsuite/ld-loongarch-elf/macro_op_32.d b/ld/testsuite/ld-loongarch-elf/macro_op_32.d +index 24906ecf..a78c4579 100644 +--- a/ld/testsuite/ld-loongarch-elf/macro_op_32.d ++++ b/ld/testsuite/ld-loongarch-elf/macro_op_32.d +@@ -2,728 +2,54 @@ + #objdump: -dr + #skip: loongarch64-*-* + +-.*:[ ]+file format .* ++.*:[ ]+file format .* + + + Disassembly of section .text: + +-0+0 <.text>: +-[ ]+0:[ ]+00150004 [ ]+move[ ]+[ ]+\$a0, \$zero +-[ ]+4:[ ]+02bffc04 [ ]+addi.w[ ]+[ ]+\$a0, \$zero, -1\(0xfff\) +-[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e26b6b3..7f19565e 100644 +--- a/ld/testsuite/ld-loongarch-elf/macro_op_32.s ++++ b/ld/testsuite/ld-loongarch-elf/macro_op_32.s +@@ -1,29 +1,16 @@ + .L1: +- li.w $r4,0 +- li.w $r4,0xffffffff +- li.w $r4,0 +- li.w $r4,0xffffffff +- la $r4,L1 +- la.global $r4,L1 +- la.global $r4,$r5,L1 +- la.global $r4,L1 +- la.global $r4,$r5,L1 +- la.global $r4,L1 +- la.global $r4,$r5,L1 +- la.local $r4,L1 +- la.local $r4,$r5,L1 +- la.local $r4,L1 +- la.local $r4,$r5,L1 +- la.abs $r4,L1 +- la.pcrel $r4,L1 +- la.pcrel $r4,L1 +- la.pcrel $r4,$r5,L1 +- la.got $r4,L1 +- la.got $r4,$r5,L1 +- la.tls.le $r4,L1 +- la.tls.ie $r4,L1 +- la.tls.ie $r4,$r5,L1 +- la.tls.ld $r4,L1 +- la.tls.ld $r4,$r5,L1 +- la.tls.gd $r4,L1 +- la.tls.gd $r4,$r5,L1 ++ li.w $r4, 0 ++ li.w $r4, 0xffffffff ++ li.w $r4, 0 ++ li.w $r4, 0xffffffff ++ la $r4, .L1 ++ la.global $r4, .L1 ++ la.local $r4, .L1 ++ la.abs $r4, .L1 ++ la.pcrel $r4, .L1 ++ la.got $r4, .L1 ++ ++ la.tls.le $r4, TLS1 ++ la.tls.ie $r4, TLS1 ++ la.tls.ld $r4, TLS1 ++ la.tls.gd $r4, TLS1 +diff --git a/ld/testsuite/ld-loongarch-elf/nopic-global-so.rd b/ld/testsuite/ld-loongarch-elf/nopic-global-so.rd +new file mode 100644 +index 00000000..2bcc718a +--- /dev/null ++++ b/ld/testsuite/ld-loongarch-elf/nopic-global-so.rd +@@ -0,0 +1,5 @@ ++Relocation section '.rela.dyn'.* ++ +Offset +Info +Type +Sym\. +Value +Sym\. +Name +\+ +Addend ++#... ++[0-9a-f]+ +[0-9a-f]+ +R_LARCH_64 +[0-9a-f]+ +g_nopic +\+ +[0-9] ++#pass +diff --git a/ld/testsuite/ld-loongarch-elf/nopic-global-so.sd b/ld/testsuite/ld-loongarch-elf/nopic-global-so.sd +new file mode 100644 +index 00000000..c0e7a66b +--- /dev/null ++++ b/ld/testsuite/ld-loongarch-elf/nopic-global-so.sd +@@ -0,0 +1,10 @@ ++Symbol table '\.dynsym' contains [0-9]+ entries: ++ +Num: +Value +Size +Type +Bind +Vis +Ndx +Name ++#... ++ +[0-9]+: +[0-9a-f]+ +[0-9] +OBJECT +GLOBAL +DEFAULT +UND+ +g_nopic ++#... ++Symbol table '\.symtab' contains [0-9]+ entries: ++ +Num: +Value +Size +Type +Bind +Vis +Ndx +Name ++#... ++ +[0-9]+: +[0-9a-f]+ +[0-9] +OBJECT +GLOBAL +DEFAULT +UND+ +g_nopic ++#pass +diff --git a/ld/testsuite/ld-loongarch-elf/nopic-global.out b/ld/testsuite/ld-loongarch-elf/nopic-global.out +new file mode 100644 +index 00000000..3a179f66 +--- /dev/null ++++ b/ld/testsuite/ld-loongarch-elf/nopic-global.out +@@ -0,0 +1 @@ ++0x12345678 +diff --git a/ld/testsuite/ld-loongarch-elf/nopic-global.s b/ld/testsuite/ld-loongarch-elf/nopic-global.s +new file mode 100644 +index 00000000..189fa675 +--- /dev/null ++++ b/ld/testsuite/ld-loongarch-elf/nopic-global.s +@@ -0,0 +1,373 @@ ++ .file "nopic-global.c" ++ .text ++.Ltext0: ++ .file 1 "nopic-global.c" ++ .section .rodata ++ .align 3 ++.LC0: ++ .ascii "0x%x\012\000" ++ .text ++ .align 2 ++ .globl main ++ .type main, @function ++main: ++.LFB6 = . ++ .loc 1 7 1 ++ .cfi_startproc ++ addi.d $r3,$r3,-16 ++ .cfi_def_cfa_offset 16 ++ st.d $r1,$r3,8 ++ stptr.d $r22,$r3,0 ++ .cfi_offset 1, -8 ++ .cfi_offset 22, -16 ++ addi.d $r22,$r3,16 ++ .cfi_def_cfa 22, 0 ++ .loc 1 8 15 ++ pcalau12i $r12,%got_pc_hi20(g_nopic) ++ ld.d $r12,$r12,%got_pc_lo12(g_nopic) ++ ldptr.w $r12,$r12,0 ++ .loc 1 8 6 ++ or $r13,$r12,$r0 ++ lu12i.w $r12,305418240>>12 # 0x12345000 ++ ori $r12,$r12,1656 ++ bne $r13,$r12,.L2 ++ .loc 1 9 5 ++ pcalau12i $r12,%got_pc_hi20(g_nopic) ++ ld.d $r12,$r12,%got_pc_lo12(g_nopic) ++ ldptr.w $r12,$r12,0 ++ or $r5,$r12,$r0 ++ pcalau12i $r12,%pc_hi20(.LC0) ++ addi.d $r4,$r12,%pc_lo12(.LC0) ++ bl %plt(printf) ++ b .L5 ++.L2: ++ .loc 1 11 5 ++ bl %plt(abort) ++.L5: ++ .loc 1 12 10 ++ or $r12,$r0,$r0 ++ .loc 1 13 1 ++ or $r4,$r12,$r0 ++ ld.d $r1,$r3,8 ++ .cfi_restore 1 ++ ldptr.d $r22,$r3,0 ++ .cfi_restore 22 ++ addi.d $r3,$r3,16 ++ .cfi_def_cfa_register 3 ++ jr $r1 ++ .cfi_endproc ++.LFE6: ++ .size main, .-main ++.Letext0: ++ .file 2 "/usr/include/stdlib.h" ++ .file 3 "/usr/include/stdio.h" ++ .section .debug_info,"",@progbits ++.Ldebug_info0: ++ .4byte 0xce ++ .2byte 0x5 ++ .byte 0x1 ++ .byte 0x8 ++ .4byte .Ldebug_abbrev0 ++ .uleb128 0x2 ++ .4byte .LASF10 ++ .byte 0x1d ++ .4byte .LASF11 ++ .4byte .LASF12 ++ .8byte .Ltext0 ++ .8byte .Letext0-.Ltext0 ++ .4byte .Ldebug_line0 ++ .uleb128 0x1 ++ .byte 0x8 ++ .byte 0x7 ++ .4byte .LASF0 ++ .uleb128 0x1 ++ .byte 0x1 ++ .byte 0x8 ++ .4byte .LASF1 ++ .uleb128 0x1 ++ .byte 0x2 ++ .byte 0x7 ++ .4byte .LASF2 ++ .uleb128 0x1 ++ .byte 0x4 ++ .byte 0x7 ++ .4byte .LASF3 ++ .uleb128 0x1 ++ .byte 0x1 ++ .byte 0x6 ++ .4byte .LASF4 ++ .uleb128 0x1 ++ .byte 0x2 ++ .byte 0x5 ++ .4byte .LASF5 ++ .uleb128 0x3 ++ .byte 0x4 ++ .byte 0x5 ++ .ascii "int\000" ++ .uleb128 0x1 ++ .byte 0x8 ++ .byte 0x5 ++ .4byte .LASF6 ++ .uleb128 0x1 ++ .byte 0x1 ++ .byte 0x6 ++ .4byte .LASF7 ++ .uleb128 0x4 ++ .4byte 0x66 ++ .uleb128 0x1 ++ .byte 0x8 ++ .byte 0x5 ++ .4byte .LASF8 ++ .uleb128 0x1 ++ .byte 0x8 ++ .byte 0x7 ++ .4byte .LASF9 ++ .uleb128 0x5 ++ .4byte .LASF13 ++ .byte 0x1 ++ .byte 0x4 ++ .byte 0xc ++ .4byte 0x58 ++ .uleb128 0x6 ++ .4byte .LASF14 ++ .byte 0x2 ++ .2byte 0x256 ++ .byte 0xd ++ .uleb128 0x7 ++ .4byte .LASF15 ++ .byte 0x3 ++ .2byte 0x164 ++ .byte 0xc ++ .4byte 0x58 ++ .4byte 0xad ++ .uleb128 0x8 ++ .4byte 0xad ++ .uleb128 0x9 ++ .byte 0 ++ .uleb128 0xa ++ .byte 0x8 ++ .4byte 0x6d ++ .uleb128 0xb ++ .4byte .LASF16 ++ .byte 0x1 ++ .byte 0x6 ++ .byte 0x5 ++ .4byte 0x58 ++ .8byte .LFB6 ++ .8byte .LFE6-.LFB6 ++ .uleb128 0x1 ++ .byte 0x9c ++ .byte 0 ++ .section .debug_abbrev,"",@progbits ++.Ldebug_abbrev0: ++ .uleb128 0x1 ++ .uleb128 0x24 ++ .byte 0 ++ .uleb128 0xb ++ .uleb128 0xb ++ .uleb128 0x3e ++ .uleb128 0xb ++ .uleb128 0x3 ++ .uleb128 0xe ++ .byte 0 ++ .byte 0 ++ .uleb128 0x2 ++ .uleb128 0x11 ++ .byte 0x1 ++ .uleb128 0x25 ++ .uleb128 0xe ++ .uleb128 0x13 ++ .uleb128 0xb ++ .uleb128 0x3 ++ .uleb128 0xe ++ .uleb128 0x1b ++ .uleb128 0xe ++ .uleb128 0x11 ++ .uleb128 0x1 ++ .uleb128 0x12 ++ .uleb128 0x7 ++ .uleb128 0x10 ++ .uleb128 0x17 ++ .byte 0 ++ .byte 0 ++ .uleb128 0x3 ++ .uleb128 0x24 ++ .byte 0 ++ .uleb128 0xb ++ .uleb128 0xb ++ .uleb128 0x3e ++ .uleb128 0xb ++ .uleb128 0x3 ++ .uleb128 0x8 ++ .byte 0 ++ .byte 0 ++ .uleb128 0x4 ++ .uleb128 0x26 ++ .byte 0 ++ .uleb128 0x49 ++ .uleb128 0x13 ++ .byte 0 ++ .byte 0 ++ .uleb128 0x5 ++ .uleb128 0x34 ++ .byte 0 ++ .uleb128 0x3 ++ .uleb128 0xe ++ .uleb128 0x3a ++ .uleb128 0xb ++ .uleb128 0x3b ++ .uleb128 0xb ++ .uleb128 0x39 ++ .uleb128 0xb ++ .uleb128 0x49 ++ .uleb128 0x13 ++ .uleb128 0x3f ++ .uleb128 0x19 ++ .uleb128 0x3c ++ .uleb128 0x19 ++ .byte 0 ++ .byte 0 ++ .uleb128 0x6 ++ .uleb128 0x2e ++ .byte 0 ++ .uleb128 0x3f ++ .uleb128 0x19 ++ .uleb128 0x3 ++ .uleb128 0xe ++ .uleb128 0x3a ++ .uleb128 0xb ++ .uleb128 0x3b ++ .uleb128 0x5 ++ .uleb128 0x39 ++ .uleb128 0xb ++ .uleb128 0x27 ++ .uleb128 0x19 ++ .uleb128 0x87 ++ .uleb128 0x19 ++ .uleb128 0x3c ++ .uleb128 0x19 ++ .byte 0 ++ .byte 0 ++ .uleb128 0x7 ++ .uleb128 0x2e ++ .byte 0x1 ++ .uleb128 0x3f ++ .uleb128 0x19 ++ .uleb128 0x3 ++ .uleb128 0xe ++ .uleb128 0x3a ++ .uleb128 0xb ++ .uleb128 0x3b ++ .uleb128 0x5 ++ .uleb128 0x39 ++ .uleb128 0xb ++ .uleb128 0x27 ++ .uleb128 0x19 ++ .uleb128 0x49 ++ .uleb128 0x13 ++ .uleb128 0x3c ++ .uleb128 0x19 ++ .uleb128 0x1 ++ .uleb128 0x13 ++ .byte 0 ++ .byte 0 ++ .uleb128 0x8 ++ .uleb128 0x5 ++ .byte 0 ++ .uleb128 0x49 ++ .uleb128 0x13 ++ .byte 0 ++ .byte 0 ++ .uleb128 0x9 ++ .uleb128 0x18 ++ .byte 0 ++ .byte 0 ++ .byte 0 ++ .uleb128 0xa ++ .uleb128 0xf ++ .byte 0 ++ .uleb128 0xb ++ .uleb128 0xb ++ .uleb128 0x49 ++ .uleb128 0x13 ++ .byte 0 ++ .byte 0 ++ .uleb128 0xb ++ .uleb128 0x2e ++ .byte 0 ++ .uleb128 0x3f ++ .uleb128 0x19 ++ .uleb128 0x3 ++ .uleb128 0xe ++ .uleb128 0x3a ++ .uleb128 0xb ++ .uleb128 0x3b ++ .uleb128 0xb ++ .uleb128 0x39 ++ .uleb128 0xb ++ .uleb128 0x49 ++ .uleb128 0x13 ++ .uleb128 0x11 ++ .uleb128 0x1 ++ .uleb128 0x12 ++ .uleb128 0x7 ++ .uleb128 0x40 ++ .uleb128 0x18 ++ .uleb128 0x7c ++ .uleb128 0x19 ++ .byte 0 ++ .byte 0 ++ .byte 0 ++ .section .debug_aranges,"",@progbits ++ .4byte 0x2c ++ .2byte 0x2 ++ .4byte .Ldebug_info0 ++ .byte 0x8 ++ .byte 0 ++ .2byte 0 ++ .2byte 0 ++ .8byte .Ltext0 ++ .8byte .Letext0-.Ltext0 ++ .8byte 0 ++ .8byte 0 ++ .section .debug_line,"",@progbits ++.Ldebug_line0: ++ .section .debug_str,"MS",@progbits,1 ++.LASF8: ++ .ascii "long long int\000" ++.LASF3: ++ .ascii "unsigned int\000" ++.LASF11: ++ .ascii "nopic-global.c\000" ++.LASF0: ++ .ascii "long unsigned int\000" ++.LASF9: ++ .ascii "long long unsigned int\000" ++.LASF10: ++ .ascii "GNU C17 13.0.0 20220512 (experimental) -mabi=lp64d -marc" ++ .ascii "h=loongarch64 -mfpu=64 -mcmodel=normal -mtune=la464 -g -" ++ .ascii "O0\000" ++.LASF1: ++ .ascii "unsigned char\000" ++.LASF12: ++ .ascii "/home/liuzhensong/test/ld/nopic/test/global_var\000" ++.LASF7: ++ .ascii "char\000" ++.LASF6: ++ .ascii "long int\000" ++.LASF13: ++ .ascii "g_nopic\000" ++.LASF2: ++ .ascii "short unsigned int\000" ++.LASF15: ++ .ascii "printf\000" ++.LASF16: ++ .ascii "main\000" ++.LASF14: ++ .ascii "abort\000" ++.LASF5: ++ .ascii "short int\000" ++.LASF4: ++ .ascii "signed char\000" ++ .ident "GCC: (GNU) 13.0.0 20220512 (experimental)" ++ .section .note.GNU-stack,"",@progbits +diff --git a/ld/testsuite/ld-loongarch-elf/nopic-global.sd b/ld/testsuite/ld-loongarch-elf/nopic-global.sd +new file mode 100644 +index 00000000..605206a2 +--- /dev/null ++++ b/ld/testsuite/ld-loongarch-elf/nopic-global.sd +@@ -0,0 +1,5 @@ ++Symbol table '\.symtab' contains [0-9]+ entries: ++ +Num: +Value +Size +Type +Bind +Vis +Ndx +Name ++#... ++ +[0-9]: +[0-9]+ +[0-9] +OBJECT +GLOBAL +DEFAULT +[0-9] +g_nopic ++#xpass +diff --git a/ld/testsuite/ld-loongarch-elf/nopic-global.xd b/ld/testsuite/ld-loongarch-elf/nopic-global.xd +new file mode 100644 +index 00000000..d0130663 +--- /dev/null ++++ b/ld/testsuite/ld-loongarch-elf/nopic-global.xd +@@ -0,0 +1,3 @@ ++Hex dump of section '\.data': ++ +0x[0-9]+ +78563412.* ++#pass +diff --git a/ld/testsuite/ld-loongarch-elf/nopic-local.out b/ld/testsuite/ld-loongarch-elf/nopic-local.out +new file mode 100644 +index 00000000..3a179f66 +--- /dev/null ++++ b/ld/testsuite/ld-loongarch-elf/nopic-local.out +@@ -0,0 +1 @@ ++0x12345678 +diff --git a/ld/testsuite/ld-loongarch-elf/nopic-local.rd b/ld/testsuite/ld-loongarch-elf/nopic-local.rd +new file mode 100644 +index 00000000..e69de29b +diff --git a/ld/testsuite/ld-loongarch-elf/nopic-local.s b/ld/testsuite/ld-loongarch-elf/nopic-local.s +new file mode 100644 +index 00000000..4a496f03 +--- /dev/null ++++ b/ld/testsuite/ld-loongarch-elf/nopic-local.s +@@ -0,0 +1,383 @@ ++ .file "nopic-local.c" ++ .text ++.Ltext0: ++ .file 1 "nopic-local.c" ++ .globl g_nopic ++ .data ++ .align 2 ++ .type g_nopic, @object ++ .size g_nopic, 4 ++g_nopic: ++ .word 305419896 ++ .section .rodata ++ .align 3 ++.LC0: ++ .ascii "0x%x\012\000" ++ .text ++ .align 2 ++ .globl main ++ .type main, @function ++main: ++.LFB6 = . ++ .loc 1 7 1 ++ .cfi_startproc ++ addi.d $r3,$r3,-16 ++ .cfi_def_cfa_offset 16 ++ st.d $r1,$r3,8 ++ stptr.d $r22,$r3,0 ++ .cfi_offset 1, -8 ++ .cfi_offset 22, -16 ++ addi.d $r22,$r3,16 ++ .cfi_def_cfa 22, 0 ++ .loc 1 8 15 ++ pcalau12i $r12,%pc_hi20(g_nopic) ++ addi.d $r12,$r12,%pc_lo12(g_nopic) ++ ldptr.w $r12,$r12,0 ++ .loc 1 8 6 ++ or $r13,$r12,$r0 ++ lu12i.w $r12,305418240>>12 # 0x12345000 ++ ori $r12,$r12,1656 ++ bne $r13,$r12,.L2 ++ .loc 1 9 5 ++ pcalau12i $r12,%pc_hi20(g_nopic) ++ addi.d $r12,$r12,%pc_lo12(g_nopic) ++ ldptr.w $r12,$r12,0 ++ or $r5,$r12,$r0 ++ pcalau12i $r12,%pc_hi20(.LC0) ++ addi.d $r4,$r12,%pc_lo12(.LC0) ++ bl %plt(printf) ++ b .L5 ++.L2: ++ .loc 1 11 5 ++ bl %plt(abort) ++.L5: ++ .loc 1 12 10 ++ or $r12,$r0,$r0 ++ .loc 1 13 1 ++ or $r4,$r12,$r0 ++ ld.d $r1,$r3,8 ++ .cfi_restore 1 ++ ldptr.d $r22,$r3,0 ++ .cfi_restore 22 ++ addi.d $r3,$r3,16 ++ .cfi_def_cfa_register 3 ++ jr $r1 ++ .cfi_endproc ++.LFE6: ++ .size main, .-main ++.Letext0: ++ .file 2 "/usr/include/stdlib.h" ++ .file 3 "/usr/include/stdio.h" ++ .section .debug_info,"",@progbits ++.Ldebug_info0: ++ .4byte 0xd8 ++ .2byte 0x5 ++ .byte 0x1 ++ .byte 0x8 ++ .4byte .Ldebug_abbrev0 ++ .uleb128 0x2 ++ .4byte .LASF10 ++ .byte 0x1d ++ .4byte .LASF11 ++ .4byte .LASF12 ++ .8byte .Ltext0 ++ .8byte .Letext0-.Ltext0 ++ .4byte .Ldebug_line0 ++ .uleb128 0x1 ++ .byte 0x8 ++ .byte 0x7 ++ .4byte .LASF0 ++ .uleb128 0x1 ++ .byte 0x1 ++ .byte 0x8 ++ .4byte .LASF1 ++ .uleb128 0x1 ++ .byte 0x2 ++ .byte 0x7 ++ .4byte .LASF2 ++ .uleb128 0x1 ++ .byte 0x4 ++ .byte 0x7 ++ .4byte .LASF3 ++ .uleb128 0x1 ++ .byte 0x1 ++ .byte 0x6 ++ .4byte .LASF4 ++ .uleb128 0x1 ++ .byte 0x2 ++ .byte 0x5 ++ .4byte .LASF5 ++ .uleb128 0x3 ++ .byte 0x4 ++ .byte 0x5 ++ .ascii "int\000" ++ .uleb128 0x1 ++ .byte 0x8 ++ .byte 0x5 ++ .4byte .LASF6 ++ .uleb128 0x1 ++ .byte 0x1 ++ .byte 0x6 ++ .4byte .LASF7 ++ .uleb128 0x4 ++ .4byte 0x66 ++ .uleb128 0x1 ++ .byte 0x8 ++ .byte 0x5 ++ .4byte .LASF8 ++ .uleb128 0x1 ++ .byte 0x8 ++ .byte 0x7 ++ .4byte .LASF9 ++ .uleb128 0x5 ++ .4byte .LASF13 ++ .byte 0x1 ++ .byte 0x4 ++ .byte 0x5 ++ .4byte 0x58 ++ .uleb128 0x9 ++ .byte 0x3 ++ .8byte g_nopic ++ .uleb128 0x6 ++ .4byte .LASF14 ++ .byte 0x2 ++ .2byte 0x256 ++ .byte 0xd ++ .uleb128 0x7 ++ .4byte .LASF15 ++ .byte 0x3 ++ .2byte 0x164 ++ .byte 0xc ++ .4byte 0x58 ++ .4byte 0xb7 ++ .uleb128 0x8 ++ .4byte 0xb7 ++ .uleb128 0x9 ++ .byte 0 ++ .uleb128 0xa ++ .byte 0x8 ++ .4byte 0x6d ++ .uleb128 0xb ++ .4byte .LASF16 ++ .byte 0x1 ++ .byte 0x6 ++ .byte 0x5 ++ .4byte 0x58 ++ .8byte .LFB6 ++ .8byte .LFE6-.LFB6 ++ .uleb128 0x1 ++ .byte 0x9c ++ .byte 0 ++ .section .debug_abbrev,"",@progbits ++.Ldebug_abbrev0: ++ .uleb128 0x1 ++ .uleb128 0x24 ++ .byte 0 ++ .uleb128 0xb ++ .uleb128 0xb ++ .uleb128 0x3e ++ .uleb128 0xb ++ .uleb128 0x3 ++ .uleb128 0xe ++ .byte 0 ++ .byte 0 ++ .uleb128 0x2 ++ .uleb128 0x11 ++ .byte 0x1 ++ .uleb128 0x25 ++ .uleb128 0xe ++ .uleb128 0x13 ++ .uleb128 0xb ++ .uleb128 0x3 ++ .uleb128 0xe ++ .uleb128 0x1b ++ .uleb128 0xe ++ .uleb128 0x11 ++ .uleb128 0x1 ++ .uleb128 0x12 ++ .uleb128 0x7 ++ .uleb128 0x10 ++ .uleb128 0x17 ++ .byte 0 ++ .byte 0 ++ .uleb128 0x3 ++ .uleb128 0x24 ++ .byte 0 ++ .uleb128 0xb ++ .uleb128 0xb ++ .uleb128 0x3e ++ .uleb128 0xb ++ .uleb128 0x3 ++ .uleb128 0x8 ++ .byte 0 ++ .byte 0 ++ .uleb128 0x4 ++ .uleb128 0x26 ++ .byte 0 ++ .uleb128 0x49 ++ .uleb128 0x13 ++ .byte 0 ++ .byte 0 ++ .uleb128 0x5 ++ .uleb128 0x34 ++ .byte 0 ++ .uleb128 0x3 ++ .uleb128 0xe ++ .uleb128 0x3a ++ .uleb128 0xb ++ .uleb128 0x3b ++ .uleb128 0xb ++ .uleb128 0x39 ++ .uleb128 0xb ++ .uleb128 0x49 ++ .uleb128 0x13 ++ .uleb128 0x3f ++ .uleb128 0x19 ++ .uleb128 0x2 ++ .uleb128 0x18 ++ .byte 0 ++ .byte 0 ++ .uleb128 0x6 ++ .uleb128 0x2e ++ .byte 0 ++ .uleb128 0x3f ++ .uleb128 0x19 ++ .uleb128 0x3 ++ .uleb128 0xe ++ .uleb128 0x3a ++ .uleb128 0xb ++ .uleb128 0x3b ++ .uleb128 0x5 ++ .uleb128 0x39 ++ .uleb128 0xb ++ .uleb128 0x27 ++ .uleb128 0x19 ++ .uleb128 0x87 ++ .uleb128 0x19 ++ .uleb128 0x3c ++ .uleb128 0x19 ++ .byte 0 ++ .byte 0 ++ .uleb128 0x7 ++ .uleb128 0x2e ++ .byte 0x1 ++ .uleb128 0x3f ++ .uleb128 0x19 ++ .uleb128 0x3 ++ .uleb128 0xe ++ .uleb128 0x3a ++ .uleb128 0xb ++ .uleb128 0x3b ++ .uleb128 0x5 ++ .uleb128 0x39 ++ .uleb128 0xb ++ .uleb128 0x27 ++ .uleb128 0x19 ++ .uleb128 0x49 ++ .uleb128 0x13 ++ .uleb128 0x3c ++ .uleb128 0x19 ++ .uleb128 0x1 ++ .uleb128 0x13 ++ .byte 0 ++ .byte 0 ++ .uleb128 0x8 ++ .uleb128 0x5 ++ .byte 0 ++ .uleb128 0x49 ++ .uleb128 0x13 ++ .byte 0 ++ .byte 0 ++ .uleb128 0x9 ++ .uleb128 0x18 ++ .byte 0 ++ .byte 0 ++ .byte 0 ++ .uleb128 0xa ++ .uleb128 0xf ++ .byte 0 ++ .uleb128 0xb ++ .uleb128 0xb ++ .uleb128 0x49 ++ .uleb128 0x13 ++ .byte 0 ++ .byte 0 ++ .uleb128 0xb ++ .uleb128 0x2e ++ .byte 0 ++ .uleb128 0x3f ++ .uleb128 0x19 ++ .uleb128 0x3 ++ .uleb128 0xe ++ .uleb128 0x3a ++ .uleb128 0xb ++ .uleb128 0x3b ++ .uleb128 0xb ++ .uleb128 0x39 ++ .uleb128 0xb ++ .uleb128 0x49 ++ .uleb128 0x13 ++ .uleb128 0x11 ++ .uleb128 0x1 ++ .uleb128 0x12 ++ .uleb128 0x7 ++ .uleb128 0x40 ++ .uleb128 0x18 ++ .uleb128 0x7c ++ .uleb128 0x19 ++ .byte 0 ++ .byte 0 ++ .byte 0 ++ .section .debug_aranges,"",@progbits ++ .4byte 0x2c ++ .2byte 0x2 ++ .4byte .Ldebug_info0 ++ .byte 0x8 ++ .byte 0 ++ .2byte 0 ++ .2byte 0 ++ .8byte .Ltext0 ++ .8byte .Letext0-.Ltext0 ++ .8byte 0 ++ .8byte 0 ++ .section .debug_line,"",@progbits ++.Ldebug_line0: ++ .section .debug_str,"MS",@progbits,1 ++.LASF8: ++ .ascii "long long int\000" ++.LASF3: ++ .ascii "unsigned int\000" ++.LASF16: ++ .ascii "main\000" ++.LASF0: ++ .ascii "long unsigned int\000" ++.LASF9: ++ .ascii "long long unsigned int\000" ++.LASF11: ++ .ascii "nopic-local.c\000" ++.LASF10: ++ .ascii "GNU C17 13.0.0 20220512 (experimental) -mabi=lp64d -marc" ++ .ascii "h=loongarch64 -mfpu=64 -mcmodel=normal -mtune=la464 -g -" ++ .ascii "O0\000" ++.LASF1: ++ .ascii "unsigned char\000" ++.LASF7: ++ .ascii "char\000" ++.LASF6: ++ .ascii "long int\000" ++.LASF13: ++ .ascii "g_nopic\000" ++.LASF2: ++ .ascii "short unsigned int\000" ++.LASF15: ++ .ascii "printf\000" ++.LASF12: ++ .ascii "/home/liuzhensong/test/ld/nopic/test/local_var\000" ++.LASF14: ++ .ascii "abort\000" ++.LASF5: ++ .ascii "short int\000" ++.LASF4: ++ .ascii "signed char\000" ++ .ident "GCC: (GNU) 13.0.0 20220512 (experimental)" ++ .section .note.GNU-stack,"",@progbits +diff --git a/ld/testsuite/ld-loongarch-elf/nopic-local.sd b/ld/testsuite/ld-loongarch-elf/nopic-local.sd +new file mode 100644 +index 00000000..2dd16be5 +--- /dev/null ++++ b/ld/testsuite/ld-loongarch-elf/nopic-local.sd +@@ -0,0 +1,5 @@ ++Symbol table '\.symtab' contains [0-9]+ entries: ++ +Num: +Value +Size +Type +Bind +Vis +Ndx +Name ++#... ++ +[0-9]: +[0-9]+ +[0-9] +OBJECT +GLOBAL +DEFAULT +[0-9] +g_nopic ++#pass +diff --git a/ld/testsuite/ld-loongarch-elf/nopic-local.xd b/ld/testsuite/ld-loongarch-elf/nopic-local.xd +new file mode 100644 +index 00000000..d0130663 +--- /dev/null ++++ b/ld/testsuite/ld-loongarch-elf/nopic-local.xd +@@ -0,0 +1,3 @@ ++Hex dump of section '\.data': ++ +0x[0-9]+ +78563412.* ++#pass +diff --git a/ld/testsuite/ld-loongarch-elf/nopic-weak-global-so.rd b/ld/testsuite/ld-loongarch-elf/nopic-weak-global-so.rd +new file mode 100644 +index 00000000..2c32a543 +--- /dev/null ++++ b/ld/testsuite/ld-loongarch-elf/nopic-weak-global-so.rd +@@ -0,0 +1,5 @@ ++Relocation section '.rela.dyn'.* ++ +Offset +Info +Type +Sym\. +Value +Sym\. +Name +\+ +Addend ++#... ++[0-9a-f]+ +[0-9a-f]+ +R_LARCH_64 +[0-9a-f]+ +g_nopic +\+ +[0-9a-f] ++#... +diff --git a/ld/testsuite/ld-loongarch-elf/nopic-weak-global-so.sd b/ld/testsuite/ld-loongarch-elf/nopic-weak-global-so.sd +new file mode 100644 +index 00000000..4745ff78 +--- /dev/null ++++ b/ld/testsuite/ld-loongarch-elf/nopic-weak-global-so.sd +@@ -0,0 +1,10 @@ ++Symbol table '\.dynsym' contains [0-9]+ entries: ++ +Num: +Value +Size +Type +Bind +Vis +Ndx +Name ++#... ++ +[0-9]+: +[0-9]+ +[0-9] +OBJECT +WEAK +DEFAULT +UND +g_nopic ++#... ++Symbol table '\.symtab' contains [0-9]+ entries: ++ +Num: +Value +Size +Type +Bind +Vis +Ndx +Name ++#... ++ +[0-9]+: +[0-9]+ +[0-9] +OBJECT +WEAK +DEFAULT +UND +g_nopic ++#... +diff --git a/ld/testsuite/ld-loongarch-elf/nopic-weak-global.out b/ld/testsuite/ld-loongarch-elf/nopic-weak-global.out +new file mode 100644 +index 00000000..3a179f66 +--- /dev/null ++++ b/ld/testsuite/ld-loongarch-elf/nopic-weak-global.out +@@ -0,0 +1 @@ ++0x12345678 +diff --git a/ld/testsuite/ld-loongarch-elf/nopic-weak-global.s b/ld/testsuite/ld-loongarch-elf/nopic-weak-global.s +new file mode 100644 +index 00000000..298780a3 +--- /dev/null ++++ b/ld/testsuite/ld-loongarch-elf/nopic-weak-global.s +@@ -0,0 +1,374 @@ ++ .file "nopic-weak-global.c" ++ .text ++.Ltext0: ++ .file 1 "nopic-weak-global.c" ++ .section .rodata ++ .align 3 ++.LC0: ++ .ascii "0x%x\012\000" ++ .text ++ .align 2 ++ .globl main ++ .type main, @function ++main: ++.LFB6 = . ++ .loc 1 7 1 ++ .cfi_startproc ++ addi.d $r3,$r3,-16 ++ .cfi_def_cfa_offset 16 ++ st.d $r1,$r3,8 ++ stptr.d $r22,$r3,0 ++ .cfi_offset 1, -8 ++ .cfi_offset 22, -16 ++ addi.d $r22,$r3,16 ++ .cfi_def_cfa 22, 0 ++ .loc 1 8 15 ++ pcalau12i $r12,%got_pc_hi20(g_nopic) ++ ld.d $r12,$r12,%got_pc_lo12(g_nopic) ++ ldptr.w $r12,$r12,0 ++ .loc 1 8 6 ++ or $r13,$r12,$r0 ++ lu12i.w $r12,305418240>>12 # 0x12345000 ++ ori $r12,$r12,1656 ++ bne $r13,$r12,.L2 ++ .loc 1 9 5 ++ pcalau12i $r12,%got_pc_hi20(g_nopic) ++ ld.d $r12,$r12,%got_pc_lo12(g_nopic) ++ ldptr.w $r12,$r12,0 ++ or $r5,$r12,$r0 ++ pcalau12i $r12,%pc_hi20(.LC0) ++ addi.d $r4,$r12,%pc_lo12(.LC0) ++ bl %plt(printf) ++ b .L5 ++.L2: ++ .loc 1 11 5 ++ bl %plt(abort) ++.L5: ++ .loc 1 12 10 ++ or $r12,$r0,$r0 ++ .loc 1 13 1 ++ or $r4,$r12,$r0 ++ ld.d $r1,$r3,8 ++ .cfi_restore 1 ++ ldptr.d $r22,$r3,0 ++ .cfi_restore 22 ++ addi.d $r3,$r3,16 ++ .cfi_def_cfa_register 3 ++ jr $r1 ++ .cfi_endproc ++.LFE6: ++ .size main, .-main ++ .weak g_nopic ++.Letext0: ++ .file 2 "/usr/include/stdlib.h" ++ .file 3 "/usr/include/stdio.h" ++ .section .debug_info,"",@progbits ++.Ldebug_info0: ++ .4byte 0xce ++ .2byte 0x5 ++ .byte 0x1 ++ .byte 0x8 ++ .4byte .Ldebug_abbrev0 ++ .uleb128 0x2 ++ .4byte .LASF10 ++ .byte 0x1d ++ .4byte .LASF11 ++ .4byte .LASF12 ++ .8byte .Ltext0 ++ .8byte .Letext0-.Ltext0 ++ .4byte .Ldebug_line0 ++ .uleb128 0x1 ++ .byte 0x8 ++ .byte 0x7 ++ .4byte .LASF0 ++ .uleb128 0x1 ++ .byte 0x1 ++ .byte 0x8 ++ .4byte .LASF1 ++ .uleb128 0x1 ++ .byte 0x2 ++ .byte 0x7 ++ .4byte .LASF2 ++ .uleb128 0x1 ++ .byte 0x4 ++ .byte 0x7 ++ .4byte .LASF3 ++ .uleb128 0x1 ++ .byte 0x1 ++ .byte 0x6 ++ .4byte .LASF4 ++ .uleb128 0x1 ++ .byte 0x2 ++ .byte 0x5 ++ .4byte .LASF5 ++ .uleb128 0x3 ++ .byte 0x4 ++ .byte 0x5 ++ .ascii "int\000" ++ .uleb128 0x1 ++ .byte 0x8 ++ .byte 0x5 ++ .4byte .LASF6 ++ .uleb128 0x1 ++ .byte 0x1 ++ .byte 0x6 ++ .4byte .LASF7 ++ .uleb128 0x4 ++ .4byte 0x66 ++ .uleb128 0x1 ++ .byte 0x8 ++ .byte 0x5 ++ .4byte .LASF8 ++ .uleb128 0x1 ++ .byte 0x8 ++ .byte 0x7 ++ .4byte .LASF9 ++ .uleb128 0x5 ++ .4byte .LASF13 ++ .byte 0x1 ++ .byte 0x4 ++ .byte 0x22 ++ .4byte 0x58 ++ .uleb128 0x6 ++ .4byte .LASF14 ++ .byte 0x2 ++ .2byte 0x256 ++ .byte 0xd ++ .uleb128 0x7 ++ .4byte .LASF15 ++ .byte 0x3 ++ .2byte 0x164 ++ .byte 0xc ++ .4byte 0x58 ++ .4byte 0xad ++ .uleb128 0x8 ++ .4byte 0xad ++ .uleb128 0x9 ++ .byte 0 ++ .uleb128 0xa ++ .byte 0x8 ++ .4byte 0x6d ++ .uleb128 0xb ++ .4byte .LASF16 ++ .byte 0x1 ++ .byte 0x6 ++ .byte 0x5 ++ .4byte 0x58 ++ .8byte .LFB6 ++ .8byte .LFE6-.LFB6 ++ .uleb128 0x1 ++ .byte 0x9c ++ .byte 0 ++ .section .debug_abbrev,"",@progbits ++.Ldebug_abbrev0: ++ .uleb128 0x1 ++ .uleb128 0x24 ++ .byte 0 ++ .uleb128 0xb ++ .uleb128 0xb ++ .uleb128 0x3e ++ .uleb128 0xb ++ .uleb128 0x3 ++ .uleb128 0xe ++ .byte 0 ++ .byte 0 ++ .uleb128 0x2 ++ .uleb128 0x11 ++ .byte 0x1 ++ .uleb128 0x25 ++ .uleb128 0xe ++ .uleb128 0x13 ++ .uleb128 0xb ++ .uleb128 0x3 ++ .uleb128 0xe ++ .uleb128 0x1b ++ .uleb128 0xe ++ .uleb128 0x11 ++ .uleb128 0x1 ++ .uleb128 0x12 ++ .uleb128 0x7 ++ .uleb128 0x10 ++ .uleb128 0x17 ++ .byte 0 ++ .byte 0 ++ .uleb128 0x3 ++ .uleb128 0x24 ++ .byte 0 ++ .uleb128 0xb ++ .uleb128 0xb ++ .uleb128 0x3e ++ .uleb128 0xb ++ .uleb128 0x3 ++ .uleb128 0x8 ++ .byte 0 ++ .byte 0 ++ .uleb128 0x4 ++ .uleb128 0x26 ++ .byte 0 ++ .uleb128 0x49 ++ .uleb128 0x13 ++ .byte 0 ++ .byte 0 ++ .uleb128 0x5 ++ .uleb128 0x34 ++ .byte 0 ++ .uleb128 0x3 ++ .uleb128 0xe ++ .uleb128 0x3a ++ .uleb128 0xb ++ .uleb128 0x3b ++ .uleb128 0xb ++ .uleb128 0x39 ++ .uleb128 0xb ++ .uleb128 0x49 ++ .uleb128 0x13 ++ .uleb128 0x3f ++ .uleb128 0x19 ++ .uleb128 0x3c ++ .uleb128 0x19 ++ .byte 0 ++ .byte 0 ++ .uleb128 0x6 ++ .uleb128 0x2e ++ .byte 0 ++ .uleb128 0x3f ++ .uleb128 0x19 ++ .uleb128 0x3 ++ .uleb128 0xe ++ .uleb128 0x3a ++ .uleb128 0xb ++ .uleb128 0x3b ++ .uleb128 0x5 ++ .uleb128 0x39 ++ .uleb128 0xb ++ .uleb128 0x27 ++ .uleb128 0x19 ++ .uleb128 0x87 ++ .uleb128 0x19 ++ .uleb128 0x3c ++ .uleb128 0x19 ++ .byte 0 ++ .byte 0 ++ .uleb128 0x7 ++ .uleb128 0x2e ++ .byte 0x1 ++ .uleb128 0x3f ++ .uleb128 0x19 ++ .uleb128 0x3 ++ .uleb128 0xe ++ .uleb128 0x3a ++ .uleb128 0xb ++ .uleb128 0x3b ++ .uleb128 0x5 ++ .uleb128 0x39 ++ .uleb128 0xb ++ .uleb128 0x27 ++ .uleb128 0x19 ++ .uleb128 0x49 ++ .uleb128 0x13 ++ .uleb128 0x3c ++ .uleb128 0x19 ++ .uleb128 0x1 ++ .uleb128 0x13 ++ .byte 0 ++ .byte 0 ++ .uleb128 0x8 ++ .uleb128 0x5 ++ .byte 0 ++ .uleb128 0x49 ++ .uleb128 0x13 ++ .byte 0 ++ .byte 0 ++ .uleb128 0x9 ++ .uleb128 0x18 ++ .byte 0 ++ .byte 0 ++ .byte 0 ++ .uleb128 0xa ++ .uleb128 0xf ++ .byte 0 ++ .uleb128 0xb ++ .uleb128 0xb ++ .uleb128 0x49 ++ .uleb128 0x13 ++ .byte 0 ++ .byte 0 ++ .uleb128 0xb ++ .uleb128 0x2e ++ .byte 0 ++ .uleb128 0x3f ++ .uleb128 0x19 ++ .uleb128 0x3 ++ .uleb128 0xe ++ .uleb128 0x3a ++ .uleb128 0xb ++ .uleb128 0x3b ++ .uleb128 0xb ++ .uleb128 0x39 ++ .uleb128 0xb ++ .uleb128 0x49 ++ .uleb128 0x13 ++ .uleb128 0x11 ++ .uleb128 0x1 ++ .uleb128 0x12 ++ .uleb128 0x7 ++ .uleb128 0x40 ++ .uleb128 0x18 ++ .uleb128 0x7c ++ .uleb128 0x19 ++ .byte 0 ++ .byte 0 ++ .byte 0 ++ .section .debug_aranges,"",@progbits ++ .4byte 0x2c ++ .2byte 0x2 ++ .4byte .Ldebug_info0 ++ .byte 0x8 ++ .byte 0 ++ .2byte 0 ++ .2byte 0 ++ .8byte .Ltext0 ++ .8byte .Letext0-.Ltext0 ++ .8byte 0 ++ .8byte 0 ++ .section .debug_line,"",@progbits ++.Ldebug_line0: ++ .section .debug_str,"MS",@progbits,1 ++.LASF8: ++ .ascii "long long int\000" ++.LASF3: ++ .ascii "unsigned int\000" ++.LASF16: ++ .ascii "main\000" ++.LASF0: ++ .ascii "long unsigned int\000" ++.LASF9: ++ .ascii "long long unsigned int\000" ++.LASF10: ++ .ascii "GNU C17 13.0.0 20220512 (experimental) -mabi=lp64d -marc" ++ .ascii "h=loongarch64 -mfpu=64 -mcmodel=normal -mtune=la464 -g -" ++ .ascii "O0\000" ++.LASF1: ++ .ascii "unsigned char\000" ++.LASF12: ++ .ascii "/home/liuzhensong/test/ld/nopic/test/global_var\000" ++.LASF7: ++ .ascii "char\000" ++.LASF6: ++ .ascii "long int\000" ++.LASF13: ++ .ascii "g_nopic\000" ++.LASF2: ++ .ascii "short unsigned int\000" ++.LASF15: ++ .ascii "printf\000" ++.LASF14: ++ .ascii "abort\000" ++.LASF5: ++ .ascii "short int\000" ++.LASF11: ++ .ascii "nopic-weak-global.c\000" ++.LASF4: ++ .ascii "signed char\000" ++ .ident "GCC: (GNU) 13.0.0 20220512 (experimental)" ++ .section .note.GNU-stack,"",@progbits +diff --git a/ld/testsuite/ld-loongarch-elf/nopic-weak-global.sd b/ld/testsuite/ld-loongarch-elf/nopic-weak-global.sd +new file mode 100644 +index 00000000..f4634d20 +--- /dev/null ++++ b/ld/testsuite/ld-loongarch-elf/nopic-weak-global.sd +@@ -0,0 +1,5 @@ ++#xfail: *-*-* ++Symbol table '\.symtab' contains [0-9]+ entries: ++ +Num: +Value +Size +Type +Bind +Vis +Ndx +Name ++#... ++ +[0-9]: +[0-9]+ +[0-9] +OBJECT +GLOBAL +DEFAULT +[0-9] +g_nopic +diff --git a/ld/testsuite/ld-loongarch-elf/nopic-weak-global.xd b/ld/testsuite/ld-loongarch-elf/nopic-weak-global.xd +new file mode 100644 +index 00000000..d0130663 +--- /dev/null ++++ b/ld/testsuite/ld-loongarch-elf/nopic-weak-global.xd +@@ -0,0 +1,3 @@ ++Hex dump of section '\.data': ++ +0x[0-9]+ +78563412.* ++#pass +diff --git a/ld/testsuite/ld-loongarch-elf/nopic-weak-local.out b/ld/testsuite/ld-loongarch-elf/nopic-weak-local.out +new file mode 100644 +index 00000000..3a179f66 +--- /dev/null ++++ b/ld/testsuite/ld-loongarch-elf/nopic-weak-local.out +@@ -0,0 +1 @@ ++0x12345678 +diff --git a/ld/testsuite/ld-loongarch-elf/nopic-weak-local.rd b/ld/testsuite/ld-loongarch-elf/nopic-weak-local.rd +new file mode 100644 +index 00000000..e69de29b +diff --git a/ld/testsuite/ld-loongarch-elf/nopic-weak-local.s b/ld/testsuite/ld-loongarch-elf/nopic-weak-local.s +new file mode 100644 +index 00000000..00a4b616 +--- /dev/null ++++ b/ld/testsuite/ld-loongarch-elf/nopic-weak-local.s +@@ -0,0 +1,383 @@ ++ .file "nopic-weak-local.c" ++ .text ++.Ltext0: ++ .file 1 "nopic-weak-local.c" ++ .weak g_nopic ++ .data ++ .align 2 ++ .type g_nopic, @object ++ .size g_nopic, 4 ++g_nopic: ++ .word 305419896 ++ .section .rodata ++ .align 3 ++.LC0: ++ .ascii "0x%x\012\000" ++ .text ++ .align 2 ++ .globl main ++ .type main, @function ++main: ++.LFB6 = . ++ .loc 1 7 1 ++ .cfi_startproc ++ addi.d $r3,$r3,-16 ++ .cfi_def_cfa_offset 16 ++ st.d $r1,$r3,8 ++ stptr.d $r22,$r3,0 ++ .cfi_offset 1, -8 ++ .cfi_offset 22, -16 ++ addi.d $r22,$r3,16 ++ .cfi_def_cfa 22, 0 ++ .loc 1 8 15 ++ pcalau12i $r12,%pc_hi20(g_nopic) ++ addi.d $r12,$r12,%pc_lo12(g_nopic) ++ ldptr.w $r12,$r12,0 ++ .loc 1 8 6 ++ or $r13,$r12,$r0 ++ lu12i.w $r12,305418240>>12 # 0x12345000 ++ ori $r12,$r12,1656 ++ bne $r13,$r12,.L2 ++ .loc 1 9 5 ++ pcalau12i $r12,%pc_hi20(g_nopic) ++ addi.d $r12,$r12,%pc_lo12(g_nopic) ++ ldptr.w $r12,$r12,0 ++ or $r5,$r12,$r0 ++ pcalau12i $r12,%pc_hi20(.LC0) ++ addi.d $r4,$r12,%pc_lo12(.LC0) ++ bl %plt(printf) ++ b .L5 ++.L2: ++ .loc 1 11 5 ++ bl %plt(abort) ++.L5: ++ .loc 1 12 10 ++ or $r12,$r0,$r0 ++ .loc 1 13 1 ++ or $r4,$r12,$r0 ++ ld.d $r1,$r3,8 ++ .cfi_restore 1 ++ ldptr.d $r22,$r3,0 ++ .cfi_restore 22 ++ addi.d $r3,$r3,16 ++ .cfi_def_cfa_register 3 ++ jr $r1 ++ .cfi_endproc ++.LFE6: ++ .size main, .-main ++.Letext0: ++ .file 2 "/usr/include/stdlib.h" ++ .file 3 "/usr/include/stdio.h" ++ .section .debug_info,"",@progbits ++.Ldebug_info0: ++ .4byte 0xd8 ++ .2byte 0x5 ++ .byte 0x1 ++ .byte 0x8 ++ .4byte .Ldebug_abbrev0 ++ .uleb128 0x2 ++ .4byte .LASF10 ++ .byte 0x1d ++ .4byte .LASF11 ++ .4byte .LASF12 ++ .8byte .Ltext0 ++ .8byte .Letext0-.Ltext0 ++ .4byte .Ldebug_line0 ++ .uleb128 0x1 ++ .byte 0x8 ++ .byte 0x7 ++ .4byte .LASF0 ++ .uleb128 0x1 ++ .byte 0x1 ++ .byte 0x8 ++ .4byte .LASF1 ++ .uleb128 0x1 ++ .byte 0x2 ++ .byte 0x7 ++ .4byte .LASF2 ++ .uleb128 0x1 ++ .byte 0x4 ++ .byte 0x7 ++ .4byte .LASF3 ++ .uleb128 0x1 ++ .byte 0x1 ++ .byte 0x6 ++ .4byte .LASF4 ++ .uleb128 0x1 ++ .byte 0x2 ++ .byte 0x5 ++ .4byte .LASF5 ++ .uleb128 0x3 ++ .byte 0x4 ++ .byte 0x5 ++ .ascii "int\000" ++ .uleb128 0x1 ++ .byte 0x8 ++ .byte 0x5 ++ .4byte .LASF6 ++ .uleb128 0x1 ++ .byte 0x1 ++ .byte 0x6 ++ .4byte .LASF7 ++ .uleb128 0x4 ++ .4byte 0x66 ++ .uleb128 0x1 ++ .byte 0x8 ++ .byte 0x5 ++ .4byte .LASF8 ++ .uleb128 0x1 ++ .byte 0x8 ++ .byte 0x7 ++ .4byte .LASF9 ++ .uleb128 0x5 ++ .4byte .LASF13 ++ .byte 0x1 ++ .byte 0x4 ++ .byte 0x1b ++ .4byte 0x58 ++ .uleb128 0x9 ++ .byte 0x3 ++ .8byte g_nopic ++ .uleb128 0x6 ++ .4byte .LASF14 ++ .byte 0x2 ++ .2byte 0x256 ++ .byte 0xd ++ .uleb128 0x7 ++ .4byte .LASF15 ++ .byte 0x3 ++ .2byte 0x164 ++ .byte 0xc ++ .4byte 0x58 ++ .4byte 0xb7 ++ .uleb128 0x8 ++ .4byte 0xb7 ++ .uleb128 0x9 ++ .byte 0 ++ .uleb128 0xa ++ .byte 0x8 ++ .4byte 0x6d ++ .uleb128 0xb ++ .4byte .LASF16 ++ .byte 0x1 ++ .byte 0x6 ++ .byte 0x5 ++ .4byte 0x58 ++ .8byte .LFB6 ++ .8byte .LFE6-.LFB6 ++ .uleb128 0x1 ++ .byte 0x9c ++ .byte 0 ++ .section .debug_abbrev,"",@progbits ++.Ldebug_abbrev0: ++ .uleb128 0x1 ++ .uleb128 0x24 ++ .byte 0 ++ .uleb128 0xb ++ .uleb128 0xb ++ .uleb128 0x3e ++ .uleb128 0xb ++ .uleb128 0x3 ++ .uleb128 0xe ++ .byte 0 ++ .byte 0 ++ .uleb128 0x2 ++ .uleb128 0x11 ++ .byte 0x1 ++ .uleb128 0x25 ++ .uleb128 0xe ++ .uleb128 0x13 ++ .uleb128 0xb ++ .uleb128 0x3 ++ .uleb128 0xe ++ .uleb128 0x1b ++ .uleb128 0xe ++ .uleb128 0x11 ++ .uleb128 0x1 ++ .uleb128 0x12 ++ .uleb128 0x7 ++ .uleb128 0x10 ++ .uleb128 0x17 ++ .byte 0 ++ .byte 0 ++ .uleb128 0x3 ++ .uleb128 0x24 ++ .byte 0 ++ .uleb128 0xb ++ .uleb128 0xb ++ .uleb128 0x3e ++ .uleb128 0xb ++ .uleb128 0x3 ++ .uleb128 0x8 ++ .byte 0 ++ .byte 0 ++ .uleb128 0x4 ++ .uleb128 0x26 ++ .byte 0 ++ .uleb128 0x49 ++ .uleb128 0x13 ++ .byte 0 ++ .byte 0 ++ .uleb128 0x5 ++ .uleb128 0x34 ++ .byte 0 ++ .uleb128 0x3 ++ .uleb128 0xe ++ .uleb128 0x3a ++ .uleb128 0xb ++ .uleb128 0x3b ++ .uleb128 0xb ++ .uleb128 0x39 ++ .uleb128 0xb ++ .uleb128 0x49 ++ .uleb128 0x13 ++ .uleb128 0x3f ++ .uleb128 0x19 ++ .uleb128 0x2 ++ .uleb128 0x18 ++ .byte 0 ++ .byte 0 ++ .uleb128 0x6 ++ .uleb128 0x2e ++ .byte 0 ++ .uleb128 0x3f ++ .uleb128 0x19 ++ .uleb128 0x3 ++ .uleb128 0xe ++ .uleb128 0x3a ++ .uleb128 0xb ++ .uleb128 0x3b ++ .uleb128 0x5 ++ .uleb128 0x39 ++ .uleb128 0xb ++ .uleb128 0x27 ++ .uleb128 0x19 ++ .uleb128 0x87 ++ .uleb128 0x19 ++ .uleb128 0x3c ++ .uleb128 0x19 ++ .byte 0 ++ .byte 0 ++ .uleb128 0x7 ++ .uleb128 0x2e ++ .byte 0x1 ++ .uleb128 0x3f ++ .uleb128 0x19 ++ .uleb128 0x3 ++ .uleb128 0xe ++ .uleb128 0x3a ++ .uleb128 0xb ++ .uleb128 0x3b ++ .uleb128 0x5 ++ .uleb128 0x39 ++ .uleb128 0xb ++ .uleb128 0x27 ++ .uleb128 0x19 ++ .uleb128 0x49 ++ .uleb128 0x13 ++ .uleb128 0x3c ++ .uleb128 0x19 ++ .uleb128 0x1 ++ .uleb128 0x13 ++ .byte 0 ++ .byte 0 ++ .uleb128 0x8 ++ .uleb128 0x5 ++ .byte 0 ++ .uleb128 0x49 ++ .uleb128 0x13 ++ .byte 0 ++ .byte 0 ++ .uleb128 0x9 ++ .uleb128 0x18 ++ .byte 0 ++ .byte 0 ++ .byte 0 ++ .uleb128 0xa ++ .uleb128 0xf ++ .byte 0 ++ .uleb128 0xb ++ .uleb128 0xb ++ .uleb128 0x49 ++ .uleb128 0x13 ++ .byte 0 ++ .byte 0 ++ .uleb128 0xb ++ .uleb128 0x2e ++ .byte 0 ++ .uleb128 0x3f ++ .uleb128 0x19 ++ .uleb128 0x3 ++ .uleb128 0xe ++ .uleb128 0x3a ++ .uleb128 0xb ++ .uleb128 0x3b ++ .uleb128 0xb ++ .uleb128 0x39 ++ .uleb128 0xb ++ .uleb128 0x49 ++ .uleb128 0x13 ++ .uleb128 0x11 ++ .uleb128 0x1 ++ .uleb128 0x12 ++ .uleb128 0x7 ++ .uleb128 0x40 ++ .uleb128 0x18 ++ .uleb128 0x7c ++ .uleb128 0x19 ++ .byte 0 ++ .byte 0 ++ .byte 0 ++ .section .debug_aranges,"",@progbits ++ .4byte 0x2c ++ .2byte 0x2 ++ .4byte .Ldebug_info0 ++ .byte 0x8 ++ .byte 0 ++ .2byte 0 ++ .2byte 0 ++ .8byte .Ltext0 ++ .8byte .Letext0-.Ltext0 ++ .8byte 0 ++ .8byte 0 ++ .section .debug_line,"",@progbits ++.Ldebug_line0: ++ .section .debug_str,"MS",@progbits,1 ++.LASF8: ++ .ascii "long long int\000" ++.LASF3: ++ .ascii "unsigned int\000" ++.LASF16: ++ .ascii "main\000" ++.LASF0: ++ .ascii "long unsigned int\000" ++.LASF9: ++ .ascii "long long unsigned int\000" ++.LASF10: ++ .ascii "GNU C17 13.0.0 20220512 (experimental) -mabi=lp64d -marc" ++ .ascii "h=loongarch64 -mfpu=64 -mcmodel=normal -mtune=la464 -g -" ++ .ascii "O0\000" ++.LASF1: ++ .ascii "unsigned char\000" ++.LASF7: ++ .ascii "char\000" ++.LASF6: ++ .ascii "long int\000" ++.LASF11: ++ .ascii "nopic-weak-local.c\000" ++.LASF13: ++ .ascii "g_nopic\000" ++.LASF2: ++ .ascii "short unsigned int\000" ++.LASF15: ++ .ascii "printf\000" ++.LASF12: ++ .ascii "/home/liuzhensong/test/ld/nopic/test/local_var\000" ++.LASF14: ++ .ascii "abort\000" ++.LASF5: ++ .ascii "short int\000" ++.LASF4: ++ .ascii "signed char\000" ++ .ident "GCC: (GNU) 13.0.0 20220512 (experimental)" ++ .section .note.GNU-stack,"",@progbits +diff --git a/ld/testsuite/ld-loongarch-elf/nopic-weak-local.sd b/ld/testsuite/ld-loongarch-elf/nopic-weak-local.sd +new file mode 100644 +index 00000000..b2970676 +--- /dev/null ++++ b/ld/testsuite/ld-loongarch-elf/nopic-weak-local.sd +@@ -0,0 +1,5 @@ ++Symbol table '\.symtab' contains [0-9]+ entries: ++ +Num: +Value +Size +Type +Bind +Vis +Ndx +Name ++#... ++ +[0-9]: +[0-9]+ +[0-9] +OBJECT +WEAK +DEFAULT +[0-9] +g_nopic ++#pass +diff --git a/ld/testsuite/ld-loongarch-elf/nopic-weak-local.xd b/ld/testsuite/ld-loongarch-elf/nopic-weak-local.xd +new file mode 100644 +index 00000000..d0130663 +--- /dev/null ++++ b/ld/testsuite/ld-loongarch-elf/nopic-weak-local.xd +@@ -0,0 +1,3 @@ ++Hex dump of section '\.data': ++ +0x[0-9]+ +78563412.* ++#pass +diff --git a/ld/testsuite/ld-loongarch-elf/pic.exp b/ld/testsuite/ld-loongarch-elf/pic.exp +new file mode 100644 +index 00000000..40a5138a +--- /dev/null ++++ b/ld/testsuite/ld-loongarch-elf/pic.exp +@@ -0,0 +1,202 @@ ++# Expect script for LoongArch ELF linker tests ++# Copyright (C) 2022 Free Software Foundation, Inc. ++# ++# This file is part of the GNU Binutils. ++# ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, ++# MA 02110-1301, USA. ++# ++ ++if ![istarget loongarch*-*-*] { ++ return ++} ++ ++global verbose ++set old_verbose verbose ++# set verbose 3 ++ ++# Check to see if the C compiler works ++if { ![check_compiler_available] } { ++ return ++} ++ ++ ++set testname "nopic link test pre build" ++set pre_builds [list \ ++ [list \ ++ "$testname" \ ++ "-shared $NOSANITIZE_CFLAGS" \ ++ "-fPIC $NOSANITIZE_CFLAGS" \ ++ {libnopic-global.s} \ ++ {} \ ++ "libnopic-global.so" \ ++ ] \ ++] ++ ++# 0:name ++# 1:ld or ar options ++# 2:compile options ++# 3:filenames of source files ++# 4:action and options. ++# 5:name of output file ++# 6:language (optional) ++run_cc_link_tests $pre_builds ++ ++ ++ ++set testname "nopic link test" ++ ++set link_tests [list \ ++ [list \ ++ "$testname readelf -s/-x nopic-local" \ ++ "-T pic.ld" "" \ ++ "" \ ++ { nopic-local.s } \ ++ [list \ ++ [list readelf -s nopic-local.sd] \ ++ [list readelf "-x .data" nopic-local.xd] \ ++ ] \ ++ "nopic-local" \ ++ ] \ ++ [list \ ++ "$testname readelf -s/-x nopic-weak-local" \ ++ "-T pic.ld" "" \ ++ "" \ ++ {nopic-weak-local.s} \ ++ [list \ ++ [list readelf -s nopic-weak-local.sd] \ ++ [list readelf "-x .data" nopic-weak-local.xd] \ ++ ] \ ++ "nopic-weak-local" \ ++ ] \ ++ [list \ ++ "$testname readelf -s/-x nopic-global" \ ++ "-T pic.ld" "" \ ++ "" \ ++ {nopic-global.s libnopic-global.s} \ ++ [list \ ++ [list readelf -s nopic-global.sd] \ ++ [list readelf "-x .data" nopic-global.xd] \ ++ ] \ ++ "nopic-global" \ ++ ] \ ++ [list \ ++ "$testname readelf -s/-r nopic-global-so" \ ++ "-L./tmpdir -lnopic-global -L/usr/lib -lc" "" \ ++ "" \ ++ {nopic-global.s} \ ++ [list \ ++ [list readelf -s nopic-global-so.sd] \ ++ [list readelf -r nopic-global-so.rd] \ ++ ] \ ++ "nopic-global-so" \ ++ ] \ ++ [list \ ++ "$testname readelf -s/-x nopic-weak-global" \ ++ "-T pic.ld" "" \ ++ "" \ ++ {nopic-weak-global.s libnopic-global.s} \ ++ [list \ ++ [list readelf -s nopic-weak-global.sd] \ ++ [list readelf "-x .data" nopic-weak-global.xd] \ ++ ] \ ++ "nopic-weak-global" \ ++ ] \ ++ [list \ ++ "$testname readelf -s/-x nopic-weak-global-so" \ ++ "-L./tmpdir -lnopic-global -L/usr/lib -lc" "" \ ++ "" \ ++ {nopic-weak-global.s} \ ++ [list \ ++ [list readelf -s nopic-weak-global-so.sd] \ ++ [list readelf -r nopic-weak-global-so.rd] \ ++ ] \ ++ "nopic-weak-global-so" \ ++ ] \ ++] ++ ++# 0:name ++# 1:ld/ar leading options, placed before object files ++# 2:ld/ar trailing options, placed after object files ++# 3:assembler options ++# 4:filenames of assembler files ++# 5:list of actions, options and expected outputs. ++# 6:name of output file ++# 7:compiler flags (optional) ++run_ld_link_tests $link_tests ++ ++set testname "nopic link exec test" ++ ++set link_exec_tests [list \ ++ [list \ ++ "$testname" \ ++ "" "" \ ++ { nopic-local.s } \ ++ "nopic-local" \ ++ "nopic-local.out" \ ++ ] \ ++ [list \ ++ "$testname" \ ++ "" "" \ ++ { nopic-weak-local.s } \ ++ "nopic-weak-local" \ ++ "nopic-weak-local.out" \ ++ ] \ ++ [list \ ++ "$testname" \ ++ "" "" \ ++ { nopic-global.s libnopic-global.s } \ ++ "nopic-global" \ ++ "nopic-global.out" \ ++ ] \ ++ [list \ ++ "$testname" \ ++ "-L./tmpdir -lnopic-global -lc -Wl,-rpath=./tmpdir -no-pie" "" \ ++ { nopic-global.s } \ ++ "nopic-global-so" \ ++ "nopic-global.out" \ ++ ] \ ++ [list \ ++ "$testname" \ ++ "" "" \ ++ { nopic-weak-global.s libnopic-global.s } \ ++ "nopic-weak-global" \ ++ "nopic-weak-global.out" \ ++ ] \ ++ [list \ ++ "$testname" \ ++ "-L./tmpdir -lnopic-global -lc -Wl,-rpath=./tmpdir -no-pie" "" \ ++ { nopic-weak-global.s } \ ++ "nopic-weak-global-so" \ ++ "nopic-weak-global.out" \ ++ ] \ ++] ++ ++# ldtests contains test-items with 3 items followed by 1 lists, 2 items ++# and 3 optional items: ++# 0:name ++# 1:ld leading options, placed before object files ++# 2:assembler options ++# 3:filenames of source files ++# 4:name of output file ++# 5:expected output ++# 6:compiler flags (optional) ++# 7:language (optional) ++# 8:linker warning (optional) ++# 9:ld trailing options, placed after object files (optional) ++run_ld_link_exec_tests $link_exec_tests ++ ++ ++#set verbose old_verbose +diff --git a/ld/testsuite/ld-loongarch-elf/pic.ld b/ld/testsuite/ld-loongarch-elf/pic.ld +new file mode 100644 +index 00000000..d57b37f5 +--- /dev/null ++++ b/ld/testsuite/ld-loongarch-elf/pic.ld +@@ -0,0 +1,18 @@ ++SECTIONS ++{ ++ .bss : { *(.dynbss) } ++ .got : { *(.got.plt) *(.got) } ++ .dynamic : { *(.dynamic) } ++ .data : { *(.data) } ++ .rela.dyn : { *(.rela.*) } ++ .interp : { *(.interp) } ++ .hash : { *(.hash) } ++ .gnu.hash : { *(.gnu.hash) } ++ .dynsym : { *(.dynsym) } ++ .dynstr : { *(.dynstr) } ++ .debug_foo : { *(.debug_foo) } ++ .shstrtab : { *(.shstrtab) } ++ .symtab : { *(.symtab) } ++ .strtab : { *(.strtab) } ++ /DISCARD/ : { *(*) } ++} +diff --git a/opcodes/loongarch-opc.c b/opcodes/loongarch-opc.c +index 62a2edb1..1b510048 100644 +--- a/opcodes/loongarch-opc.c ++++ b/opcodes/loongarch-opc.c +@@ -103,158 +103,230 @@ const char *const loongarch_x_normal_name[32] = + "$xr24", "$xr25", "$xr26", "$xr27", "$xr28", "$xr29", "$xr30", "$xr31", + }; + ++/* Can not use xx_pa for abs. */ ++ ++/* For LoongArch32 abs. */ ++#define INSN_LA_ABS32 \ ++ "lu12i.w %1,%%abs_hi20(%2);" \ ++ "ori %1,%1,%%abs_lo12(%2);", \ ++ &LARCH_opts.ase_ilp32, \ ++ &LARCH_opts.ase_lp64 ++#define INSN_LA_ABS64 \ ++ "lu12i.w %1,%%abs_hi20(%2);" \ ++ "ori %1,%1,%%abs_lo12(%2);" \ ++ "lu32i.d %1,%%abs64_lo20(%2);" \ ++ "lu52i.d %1,%1,%%abs64_hi12(%2);", \ ++ &LARCH_opts.ase_lp64, 0 ++ ++#define INSN_LA_PCREL32 \ ++ "pcalau12i %1,%%pc_hi20(%2);" \ ++ "addi.w %1,%1,%%pc_lo12(%2);", \ ++ &LARCH_opts.ase_ilp32, \ ++ &LARCH_opts.ase_lp64 ++#define INSN_LA_PCREL64 \ ++ "pcalau12i %1,%%pc_hi20(%2);" \ ++ "addi.d %1,%1,%%pc_lo12(%2);", \ ++ &LARCH_opts.ase_lp64, 0 ++#define INSN_LA_PCREL64_LARGE \ ++ "pcalau12i %1,%%pc_hi20(%3);" \ ++ "addi.d %2,$r0,%%pc_lo12(%3);" \ ++ "lu32i.d %2,%%pc64_lo20(%3);" \ ++ "lu52i.d %2,%2,%%pc64_hi12(%3);" \ ++ "add.d %1,%1,%2;", \ ++ &LARCH_opts.ase_lp64, 0 ++ ++#define INSN_LA_GOT32 \ ++ "pcalau12i %1,%%got_pc_hi20(%2);" \ ++ "ld.w %1,%1,%%got_pc_lo12(%2);", \ ++ &LARCH_opts.ase_ilp32, \ ++ &LARCH_opts.ase_lp64 ++/* got32 abs. */ ++#define INSN_LA_GOT32_ABS \ ++ "lu12i.w %1,%%got_hi20(%2);" \ ++ "ori %1,%1,%%got_lo12(%2);" \ ++ "ld.w %1,%1,0;", \ ++ &LARCH_opts.ase_gabs, \ ++ &LARCH_opts.ase_lp64 ++#define INSN_LA_GOT64 \ ++ "pcalau12i %1,%%got_pc_hi20(%2);" \ ++ "ld.d %1,%1,%%got_pc_lo12(%2);", \ ++ &LARCH_opts.ase_lp64, 0 ++/* got64 abs. */ ++#define INSN_LA_GOT64_LARGE_ABS \ ++ "lu12i.w %1,%%got_hi20(%2);" \ ++ "ori %1,%1,%%got_lo12(%2);" \ ++ "lu32i.d %1,%%got64_lo20(%2);" \ ++ "lu52i.d %1,%1,%%got64_hi12(%2);" \ ++ "ld.d %1,%1,0", \ ++ &LARCH_opts.ase_lp64, \ ++ &LARCH_opts.ase_gpcr ++/* got64 pic. */ ++#define INSN_LA_GOT64_LARGE_PCREL \ ++ "pcalau12i %1,%%got_pc_hi20(%3);" \ ++ "addi.d %2,$r0,%%got_pc_lo12(%3);" \ ++ "lu32i.d %2,%%got64_pc_lo20(%3);" \ ++ "lu52i.d %2,%2,%%got64_pc_hi12(%3);"\ ++ "ldx.d %1,%1,%2;", \ ++ &LARCH_opts.ase_lp64, \ ++ &LARCH_opts.ase_gabs ++ ++/* For LoongArch32/64 cmode=normal. */ ++#define INSN_LA_TLS_LE \ ++ "lu12i.w %1,%%le_hi20(%2);" \ ++ "ori %1,%1,%%le_lo12(%2);", \ ++ &LARCH_opts.ase_ilp32, 0 ++ ++/* For LoongArch64 cmode=large. */ ++#define INSN_LA_TLS_LE64_LARGE \ ++ "lu12i.w %1,%%le_hi20(%2);" \ ++ "ori %1,%1,%%le_lo12(%2);" \ ++ "lu32i.d %1,%%le64_lo20(%2);" \ ++ "lu52i.d %1,%1,%%le64_hi12(%2);", \ ++ &LARCH_opts.ase_lp64, 0 ++ ++#define INSN_LA_TLS_IE32 \ ++ "pcalau12i %1,%%ie_pc_hi20(%2);" \ ++ "ld.w %1,%1,%%ie_pc_lo12(%2);", \ ++ &LARCH_opts.ase_ilp32, \ ++ &LARCH_opts.ase_lp64 ++/* For ie32 abs. */ ++#define INSN_LA_TLS_IE32_ABS \ ++ "lu12i.w %1,%%ie_hi20(%2);" \ ++ "ori %1,%1,%%ie_lo12(%2);" \ ++ "ld.w %1,%1,0", \ ++ &LARCH_opts.ase_gabs, \ ++ &LARCH_opts.ase_lp64 ++#define INSN_LA_TLS_IE64 \ ++ "pcalau12i %1,%%ie_pc_hi20(%2);" \ ++ "ld.d %1,%1,%%ie_pc_lo12(%2);", \ ++ &LARCH_opts.ase_lp64, 0 ++/* For ie64 pic. */ ++#define INSN_LA_TLS_IE64_LARGE_PCREL \ ++ "pcalau12i %1,%%ie_pc_hi20(%3);" \ ++ "addi.d %2,$r0,%%ie_pc_lo12(%3);" \ ++ "lu32i.d %2,%%ie64_pc_lo20(%3);" \ ++ "lu52i.d %2,%2,%%ie64_pc_hi12(%3);"\ ++ "ldx.d %1,%1,%2;", \ ++ &LARCH_opts.ase_lp64, \ ++ &LARCH_opts.ase_gabs ++/* For ie64 abs. */ ++#define INSN_LA_TLS_IE64_LARGE_ABS \ ++ "lu12i.w %1,%%ie_hi20(%2);" \ ++ "ori %1,%1,%%ie_lo12(%2);" \ ++ "lu32i.d %1,%%ie64_lo20(%2);" \ ++ "lu52i.d %1,%1,%%ie64_hi12(%2);" \ ++ "ld.d %1,%1,0", \ ++ &LARCH_opts.ase_lp64, \ ++ &LARCH_opts.ase_gpcr ++ ++/* For LoongArch32/64 cmode=normal. */ ++#define INSN_LA_TLS_LD32 \ ++ "pcalau12i %1,%%ld_pc_hi20(%2);" \ ++ "addi.w %1,%1,%%got_pc_lo12(%2);", \ ++ &LARCH_opts.ase_ilp32, \ ++ &LARCH_opts.ase_lp64 ++#define INSN_LA_TLS_LD32_ABS \ ++ "lu12i.w %1,%%ld_hi20(%2);" \ ++ "ori %1,%1,%%got_lo12(%2);", \ ++ &LARCH_opts.ase_gabs, \ ++ &LARCH_opts.ase_lp64 ++#define INSN_LA_TLS_LD64 \ ++ "pcalau12i %1,%%ld_pc_hi20(%2);" \ ++ "addi.d %1,%1,%%got_pc_lo12(%2);", \ ++ &LARCH_opts.ase_lp64, 0 ++#define INSN_LA_TLS_LD64_LARGE_PCREL \ ++ "pcalau12i %1,%%ld_pc_hi20(%3);" \ ++ "addi.d %2,$r0,%%got_pc_lo12(%3);" \ ++ "lu32i.d %2,%%got64_pc_lo20(%3);" \ ++ "lu52i.d %2,%2,%%got64_pc_hi12(%3);"\ ++ "add.d %1,%1,%2;", \ ++ &LARCH_opts.ase_lp64, \ ++ &LARCH_opts.ase_gabs ++#define INSN_LA_TLS_LD64_LARGE_ABS \ ++ "lu12i.w %1,%%ld_hi20(%2);" \ ++ "ori %1,%1,%%got_lo12(%2);" \ ++ "lu32i.d %1,%%got64_lo20(%2);" \ ++ "lu52i.d %1,%1,%%got64_hi12(%2);", \ ++ &LARCH_opts.ase_lp64, \ ++ &LARCH_opts.ase_gpcr ++ ++#define INSN_LA_TLS_GD32 \ ++ "pcalau12i %1,%%gd_pc_hi20(%2);" \ ++ "addi.w %1,%1,%%got_pc_lo12(%2);", \ ++ &LARCH_opts.ase_ilp32, \ ++ &LARCH_opts.ase_lp64 ++#define INSN_LA_TLS_GD32_ABS \ ++ "lu12i.w %1,%%gd_hi20(%2);" \ ++ "ori %1,%1,%%got_lo12(%2);", \ ++ &LARCH_opts.ase_gabs, \ ++ &LARCH_opts.ase_lp64 ++#define INSN_LA_TLS_GD64 \ ++ "pcalau12i %1,%%gd_pc_hi20(%2);" \ ++ "addi.d %1,%1,%%got_pc_lo12(%2);", \ ++ &LARCH_opts.ase_lp64, 0 ++#define INSN_LA_TLS_GD64_LARGE_PCREL \ ++ "pcalau12i %1,%%gd_pc_hi20(%3);" \ ++ "addi.d %2,$r0,%%got_pc_lo12(%3);" \ ++ "lu32i.d %2,%%got64_pc_lo20(%3);" \ ++ "lu52i.d %2,%2,%%got64_pc_hi12(%3);"\ ++ "add.d %1,%1,%2;", \ ++ &LARCH_opts.ase_lp64, \ ++ &LARCH_opts.ase_gabs ++#define INSN_LA_TLS_GD64_LARGE_ABS \ ++ "lu12i.w %1,%%gd_hi20(%2);" \ ++ "ori %1,%1,%%got_lo12(%2);" \ ++ "lu32i.d %1,%%got64_lo20(%2);" \ ++ "lu52i.d %1,%1,%%got64_hi12(%2);", \ ++ &LARCH_opts.ase_lp64, \ ++ &LARCH_opts.ase_gpcr ++ ++ + static struct loongarch_opcode loongarch_macro_opcodes[] = + { +- /* match, mask, name, format, macro, include, exclude, pinfo. */ +- { 0, 0, "li.w", "r,sc", "%f", 0, 0, 0}, +- { 0, 0, "li.d", "r,sc", "%f", 0, 0, 0}, +- { 0, 0, "la", "r,la", "la.global %1,%2", 0, 0, 0 }, +- +- { 0, 0, "la.global", "r,la", "la.pcrel %1,%2", +- &LARCH_opts.ase_gpcr, 0, 0 }, +- { 0, 0, "la.global", "r,r,la", "la.pcrel %1,%2,%3", +- &LARCH_opts.ase_gpcr, 0, 0 }, +- { 0, 0, "la.global", "r,la", "la.abs %1,%2", +- &LARCH_opts.ase_gabs, 0, 0 }, +- { 0, 0, "la.global", "r,r,la", "la.abs %1,%3", +- &LARCH_opts.ase_gabs, 0, 0 }, +- { 0, 0, "la.global", "r,l", "la.got %1,%2", 0, 0, 0 }, +- { 0, 0, "la.global", "r,r,l", "la.got %1,%2,%3", 0, 0, 0 }, +- +- { 0, 0, "la.local", "r,la", "la.abs %1,%2", +- &LARCH_opts.ase_labs, 0, 0 }, +- { 0, 0, "la.local", "r,r,la", "la.abs %1,%3", +- &LARCH_opts.ase_labs, 0, 0 }, +- { 0, 0, "la.local", "r,la", "la.pcrel %1,%2", 0, 0, 0 }, +- { 0, 0, "la.local", "r,r,la", "la.pcrel %1,%2,%3", 0, 0, 0 }, +- +- { 0, 0, "la.abs", "r,la", +- "lu12i.w %1,%%abs(%2)>>12;" +- "ori %1,%1,%%abs(%2)&0xfff;", +- &LARCH_opts.ase_ilp32, &LARCH_opts.ase_lp64, 0 }, +- { 0, 0, "la.abs", "r,la", +- "lu12i.w %1,%%abs(%2)<<32>>44;" +- "ori %1,%1,%%abs(%2)&0xfff;" +- "lu32i.d %1,%%abs(%2)<<12>>44;" +- "lu52i.d %1,%1,%%abs(%2)>>52;", +- &LARCH_opts.ase_lp64, 0, 0 }, +- +- { 0, 0, "la.pcrel", "r,la", +- "pcaddu12i %1,%%pcrel(%2+0x800)<<32>>44;" +- "addi.w %1,%1,%%pcrel(%2+4)-(%%pcrel(%2+4+0x800)>>12<<12);", +- &LARCH_opts.ase_ilp32, &LARCH_opts.ase_lp64, 0 }, +- +- { 0, 0, "la.pcrel", "r,la", +- "pcaddu12i %1,%%pcrel(%2+0x800)>>12;" +- "addi.d %1,%1,%%pcrel(%2+4)-(%%pcrel(%2+4+0x800)>>12<<12);", +- &LARCH_opts.ase_lp64, 0, 0 }, +- { 0, 0, "la.pcrel", "r,r,la", +- "pcaddu12i %1,(%%pcrel(%3)-(%%pcrel(%3+0x80000000)>>32<<32))<<32>>44;" +- "ori %2,$r0,(%%pcrel(%3+4)-(%%pcrel(%3+4+0x80000000)>>32<<32))&0xfff;" +- "lu32i.d %2,%%pcrel(%3+8+0x80000000)<<12>>44;" +- "lu52i.d %2,%2,%%pcrel(%3+12+0x80000000)>>52;" +- "add.d %1,%1,%2;", +- &LARCH_opts.ase_lp64, 0, 0 }, +- +- { 0, 0, "la.got", "r,l", +- "pcaddu12i %1,(%%pcrel(_GLOBAL_OFFSET_TABLE_+0x800)+%%gprel(%2))<<32>>44;" +- "ld.w " +- "%1,%1,%%pcrel(_GLOBAL_OFFSET_TABLE_+4)+%%gprel(%2)-((%%pcrel(_GLOBAL_" +- "OFFSET_TABLE_+4+0x800)+%%gprel(%2))>>12<<12);", +- &LARCH_opts.ase_ilp32, &LARCH_opts.ase_lp64, 0 }, +- +- { 0, 0, "la.got", "r,l", +- "pcaddu12i %1,(%%pcrel(_GLOBAL_OFFSET_TABLE_+0x800)+%%gprel(%2))>>12;" +- "ld.d " +- "%1,%1,%%pcrel(_GLOBAL_OFFSET_TABLE_+4)+%%gprel(%2)-((%%pcrel(_GLOBAL_" +- "OFFSET_TABLE_+4+0x800)+%%gprel(%2))>>12<<12);", +- &LARCH_opts.ase_lp64, 0, 0 }, +- { 0, 0, "la.got", "r,r,l", +- "pcaddu12i " +- "%1,(%%pcrel(_GLOBAL_OFFSET_TABLE_)+%%gprel(%3)-((%%pcrel(_GLOBAL_OFFSET_" +- "TABLE_+0x80000000)+%%gprel(%3))>>32<<32))<<32>>44;" +- "ori " +- "%2,$r0,(%%pcrel(_GLOBAL_OFFSET_TABLE_+4)+%%gprel(%3)-((%%pcrel(_GLOBAL_" +- "OFFSET_TABLE_+4+0x80000000)+%%gprel(%3))>>32<<32))&0xfff;" +- "lu32i.d " +- "%2,(%%pcrel(_GLOBAL_OFFSET_TABLE_+8+0x80000000)+%%gprel(%3))<<12>>44;" +- "lu52i.d " +- "%2,%2,(%%pcrel(_GLOBAL_OFFSET_TABLE_+12+0x80000000)+%%gprel(%3))>>52;" +- "ldx.d %1,%1,%2;", +- &LARCH_opts.ase_lp64, 0, 0 }, +- +- { 0, 0, "la.tls.le", "r,la", +- "lu12i.w %1,%%tprel(%2)>>12;" +- "ori %1,%1,%%tprel(%2)&0xfff", +- &LARCH_opts.ase_ilp32, &LARCH_opts.ase_lp64, 0 }, +- /* { 0, 0, "la.tls.le", "r,la", +- * "lu12i.w %1,%%tprel(%2)>>12;" +- * "ori %1,%1,%%tprel(%2)&0xfff" +- * , &LARCH_opts.addrwidth_is_64, 0, 0}, */ +- { 0, 0, "la.tls.le", "r,la", +- "lu12i.w %1,%%tprel(%2)<<32>>44;" +- "ori %1,%1,%%tprel(%2)&0xfff;" +- "lu32i.d %1,%%tprel(%2)<<12>>44;" +- "lu52i.d %1,%1,%%tprel(%2)>>52;", +- &LARCH_opts.ase_lp64, 0, 0 }, +- +- { 0, 0, "la.tls.ie", "r,l", +- "pcaddu12i %1,(%%pcrel(_GLOBAL_OFFSET_TABLE_+0x800)+%%tlsgot(%2))<<32>>44;" +- "ld.w " +- "%1,%1,%%pcrel(_GLOBAL_OFFSET_TABLE_+4)+%%tlsgot(%2)-((%%pcrel(_GLOBAL_" +- "OFFSET_TABLE_+4+0x800)+%%tlsgot(%2))>>12<<12);", +- &LARCH_opts.ase_ilp32, &LARCH_opts.ase_lp64, 0 }, +- +- { 0, 0, "la.tls.ie", "r,l", +- "pcaddu12i %1,(%%pcrel(_GLOBAL_OFFSET_TABLE_+0x800)+%%tlsgot(%2))>>12;" +- "ld.d " +- "%1,%1,%%pcrel(_GLOBAL_OFFSET_TABLE_+4)+%%tlsgot(%2)-((%%pcrel(_GLOBAL_" +- "OFFSET_TABLE_+4+0x800)+%%tlsgot(%2))>>12<<12);", +- &LARCH_opts.ase_lp64, 0, 0 }, +- { 0, 0, "la.tls.ie", "r,r,l", +- "pcaddu12i " +- "%1,(%%pcrel(_GLOBAL_OFFSET_TABLE_)+%%tlsgot(%3)-((%%pcrel(_GLOBAL_OFFSET_" +- "TABLE_+0x80000000)+%%tlsgot(%3))>>32<<32))<<32>>44;" +- "ori " +- "%2,$r0,(%%pcrel(_GLOBAL_OFFSET_TABLE_+4)+%%tlsgot(%3)-((%%pcrel(_GLOBAL_" +- "OFFSET_TABLE_+4+0x80000000)+%%tlsgot(%3))>>32<<32))&0xfff;" +- "lu32i.d " +- "%2,(%%pcrel(_GLOBAL_OFFSET_TABLE_+8+0x80000000)+%%tlsgot(%3))<<12>>44;" +- "lu52i.d " +- "%2,%2,(%%pcrel(_GLOBAL_OFFSET_TABLE_+12+0x80000000)+%%tlsgot(%3))>>52;" +- "ldx.d %1,%1,%2;", +- &LARCH_opts.ase_lp64, 0, 0 }, +- +- { 0, 0, "la.tls.ld", "r,l", "la.tls.gd %1,%2", 0, 0, 0 }, +- { 0, 0, "la.tls.ld", "r,r,l", "la.tls.gd %1,%2,%3", +- &LARCH_opts.ase_lp64, 0, 0 }, +- +- { 0, 0, "la.tls.gd", "r,l", +- "pcaddu12i %1,(%%pcrel(_GLOBAL_OFFSET_TABLE_+0x800)+%%tlsgd(%2))<<32>>44;" +- "addi.w " +- "%1,%1,%%pcrel(_GLOBAL_OFFSET_TABLE_+4)+%%tlsgd(%2)-((%%pcrel(_GLOBAL_" +- "OFFSET_TABLE_+4+0x800)+%%tlsgd(%2))>>12<<12);", +- &LARCH_opts.ase_ilp32, &LARCH_opts.ase_lp64, 0 }, +- +- { 0, 0, "la.tls.gd", "r,l", +- "pcaddu12i %1,(%%pcrel(_GLOBAL_OFFSET_TABLE_+0x800)+%%tlsgd(%2))>>12;" +- "addi.d " +- "%1,%1,%%pcrel(_GLOBAL_OFFSET_TABLE_+4)+%%tlsgd(%2)-((%%pcrel(_GLOBAL_" +- "OFFSET_TABLE_+4+0x800)+%%tlsgd(%2))>>12<<12);", +- &LARCH_opts.ase_lp64, 0, 0 }, +- { 0, 0, "la.tls.gd", "r,r,l", +- "pcaddu12i " +- "%1,(%%pcrel(_GLOBAL_OFFSET_TABLE_)+%%tlsgd(%3)-((%%pcrel(_GLOBAL_OFFSET_" +- "TABLE_+0x80000000)+%%tlsgd(%3))>>32<<32))<<32>>44;" +- "ori " +- "%2,$r0,(%%pcrel(_GLOBAL_OFFSET_TABLE_+4)+%%tlsgd(%3)-((%%pcrel(_GLOBAL_" +- "OFFSET_TABLE_+4+0x80000000)+%%tlsgd(%3))>>32<<32))&0xfff;" +- "lu32i.d " +- "%2,(%%pcrel(_GLOBAL_OFFSET_TABLE_+8+0x80000000)+%%tlsgd(%3))<<12>>44;" +- "lu52i.d " +- "%2,%2,(%%pcrel(_GLOBAL_OFFSET_TABLE_+12+0x80000000)+%%tlsgd(%3))>>52;" +- "add.d %1,%1,%2;", +- &LARCH_opts.ase_lp64, 0, 0 }, ++ /* match, mask, name, format, macro, include, exclude, pinfo. */ ++ { 0, 0, "li.w", "r,sc", "%f", 0, 0, 0 }, ++ { 0, 0, "li.d", "r,sc", "%f", 0, 0, 0 }, ++ ++ { 0, 0, "la", "r,la", "la.global %1,%2", 0, 0, 0 }, ++ { 0, 0, "la.global", "r,la", "la.pcrel %1,%2", &LARCH_opts.ase_gpcr, 0, 0 }, ++ { 0, 0, "la.global", "r,r,la", "la.pcrel %1,%2,%3", &LARCH_opts.ase_gpcr, 0, 0 }, ++ { 0, 0, "la.global", "r,la", "la.abs %1,%2", &LARCH_opts.ase_gabs, 0, 0 }, ++ { 0, 0, "la.global", "r,r,la", "la.abs %1,%3", &LARCH_opts.ase_gabs, 0, 0 }, ++ { 0, 0, "la.global", "r,la", "la.got %1,%2", 0, 0, 0 }, ++ { 0, 0, "la.global", "r,r,la", "la.got %1,%2,%3", &LARCH_opts.ase_lp64, 0, 0 }, ++ ++ { 0, 0, "la.local", "r,la", "la.abs %1,%2", &LARCH_opts.ase_labs, 0, 0 }, ++ { 0, 0, "la.local", "r,r,la", "la.abs %1,%3", &LARCH_opts.ase_labs, 0, 0 }, ++ { 0, 0, "la.local", "r,la", "la.pcrel %1,%2", 0, 0, 0 }, ++ { 0, 0, "la.local", "r,r,la", "la.pcrel %1,%2,%3", &LARCH_opts.ase_lp64, 0, 0 }, ++ ++ { 0, 0, "la.abs", "r,la", INSN_LA_ABS32, 0 }, ++ { 0, 0, "la.abs", "r,la", INSN_LA_ABS64, 0 }, ++ { 0, 0, "la.pcrel", "r,la", INSN_LA_PCREL32, 0 }, ++ { 0, 0, "la.pcrel", "r,la", INSN_LA_PCREL64, 0 }, ++ { 0, 0, "la.pcrel", "r,r,la", INSN_LA_PCREL64_LARGE, 0 }, ++ { 0, 0, "la.got", "r,la", INSN_LA_GOT32, 0 }, ++ { 0, 0, "la.got", "r,la", INSN_LA_GOT32_ABS, 0 }, ++ { 0, 0, "la.got", "r,la", INSN_LA_GOT64, 0 }, ++ { 0, 0, "la.got", "r,la", INSN_LA_GOT64_LARGE_ABS, 0 }, ++ { 0, 0, "la.got", "r,r,la", INSN_LA_GOT64_LARGE_PCREL, 0 }, ++ { 0, 0, "la.tls.le", "r,l", INSN_LA_TLS_LE, 0 }, ++ { 0, 0, "la.tls.le", "r,l", INSN_LA_TLS_LE64_LARGE, 0 }, ++ { 0, 0, "la.tls.ie", "r,l", INSN_LA_TLS_IE32, 0 }, ++ { 0, 0, "la.tls.ie", "r,l", INSN_LA_TLS_IE32_ABS, 0 }, ++ { 0, 0, "la.tls.ie", "r,l", INSN_LA_TLS_IE64, 0 }, ++ { 0, 0, "la.tls.ie", "r,l", INSN_LA_TLS_IE64_LARGE_ABS, 0 }, ++ { 0, 0, "la.tls.ie", "r,r,l", INSN_LA_TLS_IE64_LARGE_PCREL, 0 }, ++ { 0, 0, "la.tls.ld", "r,l", INSN_LA_TLS_LD32, 0 }, ++ { 0, 0, "la.tls.ld", "r,l", INSN_LA_TLS_LD32_ABS, 0 }, ++ { 0, 0, "la.tls.ld", "r,l", INSN_LA_TLS_LD64, 0 }, ++ { 0, 0, "la.tls.ld", "r,l", INSN_LA_TLS_LD64_LARGE_ABS, 0 }, ++ { 0, 0, "la.tls.ld", "r,r,l", INSN_LA_TLS_LD64_LARGE_PCREL, 0 }, ++ { 0, 0, "la.tls.gd", "r,l", INSN_LA_TLS_GD32, 0 }, ++ { 0, 0, "la.tls.gd", "r,l", INSN_LA_TLS_GD32_ABS, 0 }, ++ { 0, 0, "la.tls.gd", "r,l", INSN_LA_TLS_GD64, 0 }, ++ { 0, 0, "la.tls.gd", "r,l", INSN_LA_TLS_GD64_LARGE_ABS, 0 }, ++ { 0, 0, "la.tls.gd", "r,r,l", INSN_LA_TLS_GD64_LARGE_PCREL, 0 }, + + { 0 } /* Terminate the list. */ + }; +@@ -728,9 +800,9 @@ static struct loongarch_opcode loongarch_double_float_load_store_opcodes[] = + + static struct loongarch_opcode loongarch_float_jmp_opcodes[] = + { +- { 0x0, 0x0, "bceqz", "c,la", "bceqz %1,%%pcrel(%2)", 0, 0, 0 }, ++ { 0x0, 0x0, "bceqz", "c,la", "bceqz %1,%%b21(%2)", 0, 0, 0 }, + { 0x48000000, 0xfc000300, "bceqz", "c5:3,sb0:5|10:16<<2", 0, 0, 0, 0 }, +- { 0x0, 0x0, "bcnez", "c,la", "bcnez %1,%%pcrel(%2)", 0, 0, 0 }, ++ { 0x0, 0x0, "bcnez", "c,la", "bcnez %1,%%b21(%2)", 0, 0, 0 }, + { 0x48000100, 0xfc000300, "bcnez", "c5:3,sb0:5|10:16<<2", 0, 0, 0, 0 }, + { 0 } /* Terminate the list. */ + }; +@@ -738,44 +810,38 @@ static struct loongarch_opcode loongarch_float_jmp_opcodes[] = + static struct loongarch_opcode loongarch_jmp_opcodes[] = + { + /* match, mask, name, format, macro, include, exclude, pinfo. */ +- { 0x0, 0x0, "bltz", "r,la", "bltz %1,%%pcrel(%2)", 0, 0, 0 }, +- { 0x60000000, 0xfc00001f, "bltz", "r5:5,sb10:16<<2", 0, 0, 0, 0 }, +- { 0x0, 0x0, "bgtz", "r,la", "bgtz %1,%%pcrel(%2)", 0, 0, 0 }, +- { 0x60000000, 0xfc0003e0, "bgtz", "r0:5,sb10:16<<2", 0, 0, 0, 0 }, +- { 0x0, 0x0, "bgez", "r,la", "bgez %1,%%pcrel(%2)", 0, 0, 0 }, +- { 0x64000000, 0xfc00001f, "bgez", "r5:5,sb10:16<<2", 0, 0, 0, 0 }, +- { 0x0, 0x0, "blez", "r,la", "blez %1,%%pcrel(%2)", 0, 0, 0 }, +- { 0x64000000, 0xfc0003e0, "blez", "r0:5,sb10:16<<2", 0, 0, 0, 0 }, +- { 0x0, 0x0, "beqz", "r,la", "beqz %1,%%pcrel(%2)", 0, 0, 0 }, ++ { 0x0, 0x0, "beqz", "r,la", "beqz %1,%%b21(%2)", 0, 0, 0 }, + { 0x40000000, 0xfc000000, "beqz", "r5:5,sb0:5|10:16<<2", 0, 0, 0, 0 }, +- { 0x0, 0x0, "bnez", "r,la", "bnez %1,%%pcrel(%2)", 0, 0, 0 }, ++ { 0x0, 0x0, "bnez", "r,la", "bnez %1,%%b21(%2)", 0, 0, 0 }, + { 0x44000000, 0xfc000000, "bnez", "r5:5,sb0:5|10:16<<2", 0, 0, 0, 0 }, +- { 0x0, 0x0, "jr", "r", "jirl $r0,%1,0", 0, 0, 0 }, +- { 0x50000000, 0xfc000000, "b", "sb0:10|10:16<<2", 0, 0, 0, 0 }, +- { 0x0, 0x0, "b", "la", "b %%pcrel(%1)", 0, 0, 0 }, + { 0x4c000000, 0xfc000000, "jirl", "r0:5,r5:5,s10:16<<2", 0, 0, 0, 0 }, +- { 0x0, 0x0, "bl", "la", "bl %%pcrel(%1)", 0, 0, 0 }, ++ { 0x0, 0x0, "b", "la", "b %%b26(%1)", 0, 0, 0 }, ++ { 0x50000000, 0xfc000000, "b", "sb0:10|10:16<<2", 0, 0, 0, 0 }, ++ { 0x0, 0x0, "bl", "la", "bl %%b26(%1)", 0, 0, 0 }, + { 0x54000000, 0xfc000000, "bl", "sb0:10|10:16<<2", 0, 0, 0, 0 }, +- { 0x0, 0x0, "beq", "r,r,la", "beq %1,%2,%%pcrel(%3)", 0, 0, 0 }, ++ { 0x0, 0x0, "beq", "r,r,la", "beq %1,%2,%%b16(%3)", 0, 0, 0 }, + { 0x58000000, 0xfc000000, "beq", "r5:5,r0:5,sb10:16<<2", 0, 0, 0, 0 }, +- { 0x0, 0x0, "bne", "r,r,la", "bne %1,%2,%%pcrel(%3)", 0, 0, 0 }, ++ { 0x0, 0x0, "bne", "r,r,la", "bne %1,%2,%%b16(%3)", 0, 0, 0 }, + { 0x5c000000, 0xfc000000, "bne", "r5:5,r0:5,sb10:16<<2", 0, 0, 0, 0 }, +- { 0x0, 0x0, "blt", "r,r,la", "blt %1,%2,%%pcrel(%3)", 0, 0, 0 }, ++ { 0x0, 0x0, "blt", "r,r,la", "blt %1,%2,%%b16(%3)", 0, 0, 0 }, + { 0x60000000, 0xfc000000, "blt", "r5:5,r0:5,sb10:16<<2", 0, 0, 0, 0 }, +- { 0x0, 0x0, "bgt", "r,r,la", "bgt %1,%2,%%pcrel(%3)", 0, 0, 0 }, +- { 0x60000000, 0xfc000000, "bgt", "r0:5,r5:5,sb10:16<<2", 0, 0, 0, 0 }, +- { 0x0, 0x0, "bge", "r,r,la", "bge %1,%2,%%pcrel(%3)", 0, 0, 0 }, ++ { 0x0, 0x0, "bge", "r,r,la", "bge %1,%2,%%b16(%3)", 0, 0, 0 }, + { 0x64000000, 0xfc000000, "bge", "r5:5,r0:5,sb10:16<<2", 0, 0, 0, 0 }, +- { 0x0, 0x0, "ble", "r,r,la", "ble %1,%2,%%pcrel(%3)", 0, 0, 0 }, +- { 0x64000000, 0xfc000000, "ble", "r0:5,r5:5,sb10:16<<2", 0, 0, 0, 0 }, +- { 0x0, 0x0, "bltu", "r,r,la", "bltu %1,%2,%%pcrel(%3)", 0, 0, 0 }, ++ { 0x0, 0x0, "bltu", "r,r,la", "bltu %1,%2,%%b16(%3)", 0, 0, 0 }, + { 0x68000000, 0xfc000000, "bltu", "r5:5,r0:5,sb10:16<<2", 0, 0, 0, 0 }, +- { 0x0, 0x0, "bgtu", "r,r,la", "bgtu %1,%2,%%pcrel(%3)", 0, 0, 0 }, +- { 0x68000000, 0xfc000000, "bgtu", "r0:5,r5:5,sb10:16<<2", 0, 0, 0, 0 }, +- { 0x0, 0x0, "bgeu", "r,r,la", "bgeu %1,%2,%%pcrel(%3)", 0, 0, 0 }, ++ { 0x0, 0x0, "bgeu", "r,r,la", "bgeu %1,%2,%%b16(%3)", 0, 0, 0 }, + { 0x6c000000, 0xfc000000, "bgeu", "r5:5,r0:5,sb10:16<<2", 0, 0, 0, 0 }, +- { 0x0, 0x0, "bleu", "r,r,la", "bleu %1,%2,%%pcrel(%3)", 0, 0, 0 }, +- { 0x6c000000, 0xfc000000, "bleu", "r0:5,r5:5,sb10:16<<2", 0, 0, 0, 0 }, ++ /* Jumps implemented with macros. */ ++ { 0x0, 0x0, "bgt", "r,r,la", "blt %2,%1,%%b16(%3)", 0, 0, 0 }, ++ { 0x0, 0x0, "bltz", "r,la", "blt %1,$r0,%%b16(%2)", 0, 0, 0 }, ++ { 0x0, 0x0, "bgtz", "r,la", "blt $r0,%1,%%b16(%2)", 0, 0, 0 }, ++ { 0x0, 0x0, "ble", "r,r,la", "bge %2,%1,%%b16(%3)", 0, 0, 0 }, ++ { 0x0, 0x0, "bgez", "r,la", "bge %1,$r0,%%b16(%2)", 0, 0, 0 }, ++ { 0x0, 0x0, "blez", "r,la", "bge $r0,%1,%%b16(%2)", 0, 0, 0 }, ++ { 0x0, 0x0, "bgtu", "r,r,la", "bltu %2,%1,%%b16(%3)", 0, 0, 0 }, ++ { 0x0, 0x0, "bleu", "r,r,la", "bgeu %2,%1,%%b16(%3)", 0, 0, 0 }, ++ { 0x0, 0x0, "jr", "r", "jirl $r0,%1,0", 0, 0, 0 }, ++ { 0x0, 0x0, "ret", "", "jirl $r0,$r1,0", 0, 0, 0 }, + { 0 } /* Terminate the list. */ + }; + +-- +2.38.1 + diff --git a/binutils.spec b/binutils.spec index 552f65a7c24f18744887c817df23faa9f415ef28..d0173c78f09c4ffb23ccf97124c7cc7dd21ec349 100644 --- a/binutils.spec +++ b/binutils.spec @@ -1,4 +1,4 @@ -%define anolis_release 1 +%define anolis_release 2 # Determine if this is a native build or a cross build. # # For a cross build add --define "binutils_target " to the command @@ -309,6 +309,9 @@ Patch0023: 0023-binutils-libiberty-configure-compile-warnings.patch # Lifetime: Fixed in 2.40 Patch0024: 0024-binutils-CVE-2022-4285.patch +# Purpose: Add new relocations for LoongArch. +# Lifetime: Permanent. +Patch0025: 0025-LoongArch-add-new-relocations-and-fix-bugs-from-upst.patch #---------------------------------------------------------------------------- Provides: bundled(libiberty) @@ -909,6 +912,10 @@ exit 0 %doc README ChangeLog MAINTAINERS README-maintainer-mode %changelog +* Tue Aug 8 2023 Peng Fan - 2.39-2 +- LoongArch: add new relocs and backports. +- Last upstream commit: 6a1cf1bfedbcdb977d9ead3bf6a228360d78cc1b + * Fri Jan 06 2023 yuanhui - 2.39-1 - Update version to 2.39