From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7867) id 2BE003858C2D; Tue, 30 May 2023 12:04:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2BE003858C2D Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: liu & zhensong To: bfd-cvs@sourceware.org Subject: [binutils-gdb] LoongArch: opcodes: Add support for linker relaxation. X-Act-Checkin: binutils-gdb X-Git-Author: mengqinggang X-Git-Refname: refs/heads/master X-Git-Oldrev: 1b6fccd28db14fffe75ff6755307047ef932c81e X-Git-Newrev: 7ad9de1188609dee11a5c196869fca62da8154a3 Message-Id: <20230530120404.2BE003858C2D@sourceware.org> Date: Tue, 30 May 2023 12:04:04 +0000 (GMT) X-BeenThere: binutils-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 May 2023 12:04:04 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D7ad9de118860= 9dee11a5c196869fca62da8154a3 commit 7ad9de1188609dee11a5c196869fca62da8154a3 Author: mengqinggang Date: Thu Dec 1 16:01:27 2022 +0800 LoongArch: opcodes: Add support for linker relaxation. =20 Set gas default to enable relax. =20 opcodes/ChangeLog: =20 * loongarch-opc.c (struct loongarch_ASEs_option): New member re= lax with the default value 1. Diff: --- bfd/elfnn-loongarch.c | 6 +++--- opcodes/loongarch-opc.c | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c index d501991e4cf..b16066c5d91 100644 --- a/bfd/elfnn-loongarch.c +++ b/bfd/elfnn-loongarch.c @@ -3698,7 +3698,7 @@ loongarch_relax_delete_bytes (bfd *abfd, =20 /* Relax pcalau12i,addi.d =3D> pcaddi. */ static bool -loongarch_relax_pcala_addi(bfd *abfd, asection *sec, +loongarch_relax_pcala_addi (bfd *abfd, asection *sec, Elf_Internal_Rela *rel_hi, bfd_vma symval) { bfd_byte *contents =3D elf_section_data (sec)->this_hdr.contents; @@ -3967,7 +3967,7 @@ loongarch_elf_relax_section (bfd *abfd, asection *sec, { if (i + 4 > sec->reloc_count) break; - loongarch_relax_pcala_addi(abfd, sec, rel, symval); + loongarch_relax_pcala_addi (abfd, sec, rel, symval); } break; case R_LARCH_GOT_PC_HI20: @@ -3977,7 +3977,7 @@ loongarch_elf_relax_section (bfd *abfd, asection *sec, break; if (loongarch_relax_pcala_ld (abfd, sec, rel)) { - loongarch_relax_pcala_addi(abfd, sec, rel, symval); + loongarch_relax_pcala_addi (abfd, sec, rel, symval); } } break; diff --git a/opcodes/loongarch-opc.c b/opcodes/loongarch-opc.c index 39d724a3398..573b691c1fd 100644 --- a/opcodes/loongarch-opc.c +++ b/opcodes/loongarch-opc.c @@ -22,7 +22,10 @@ #include "opcode/loongarch.h" #include "libiberty.h" =20 -struct loongarch_ASEs_option LARCH_opts; +struct loongarch_ASEs_option LARCH_opts =3D +{ + .relax =3D 1 +}; =20 size_t loongarch_insn_length (insn_t insn ATTRIBUTE_UNUSED)