public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
From: liu & zhensong <liuzhensong@sourceware.org>
To: bfd-cvs@sourceware.org
Subject: [binutils-gdb] LoongArch: opcodes: Add support for linker relaxation.
Date: Tue, 30 May 2023 12:04:04 +0000 (GMT)	[thread overview]
Message-ID: <20230530120404.2BE003858C2D@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7ad9de1188609dee11a5c196869fca62da8154a3

commit 7ad9de1188609dee11a5c196869fca62da8154a3
Author: mengqinggang <mengqinggang@loongson.cn>
Date:   Thu Dec 1 16:01:27 2022 +0800

    LoongArch: opcodes: Add support for linker relaxation.
    
    Set gas default to enable relax.
    
    opcodes/ChangeLog:
    
            * loongarch-opc.c (struct loongarch_ASEs_option): New member relax
            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,
 
 /* Relax pcalau12i,addi.d => 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 = 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"
 
-struct loongarch_ASEs_option LARCH_opts;
+struct loongarch_ASEs_option LARCH_opts =
+{
+  .relax = 1
+};
 
 size_t
 loongarch_insn_length (insn_t insn ATTRIBUTE_UNUSED)

                 reply	other threads:[~2023-05-30 12:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230530120404.2BE003858C2D@sourceware.org \
    --to=liuzhensong@sourceware.org \
    --cc=bfd-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).