public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Nelson Chu <nelson@rivosinc.com>
To: binutils@sourceware.org, kito.cheng@sifive.com,
	research_trasio@irq.a4lg.com
Cc: Nelson Chu <nelson@rivosinc.com>
Subject: [committed] RISC-V: Always generate mapping symbols at the start of the sections.
Date: Sat, 29 Oct 2022 11:44:32 +0800	[thread overview]
Message-ID: <20221029034432.49859-1-nelson@rivosinc.com> (raw)

Before figuring out the suppress rule of mapping symbol with architecture
(changed back to $x), always generate them at the start of the sections.

gas/
    * config/tc-riscv.c (need_arch_map_symbol): Removed.
    (riscv_mapping_state): Updated.
    (riscv_check_mapping_symbols): Updated.
    * testsuite/gas/riscv/mapping-non-arch.d: Removed.
    * testsuite/gas/riscv/mapping-non-arch.s: Likewise.
---
 gas/config/tc-riscv.c                      | 13 -------------
 gas/testsuite/gas/riscv/mapping-non-arch.d | 17 -----------------
 gas/testsuite/gas/riscv/mapping-non-arch.s | 11 -----------
 3 files changed, 41 deletions(-)
 delete mode 100644 gas/testsuite/gas/riscv/mapping-non-arch.d
 delete mode 100644 gas/testsuite/gas/riscv/mapping-non-arch.s

diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
index 3237369f11f..b664116af6d 100644
--- a/gas/config/tc-riscv.c
+++ b/gas/config/tc-riscv.c
@@ -470,11 +470,6 @@ static char *expr_end;
 #define OPCODE_MATCHES(OPCODE, OP) \
   (((OPCODE) & MASK_##OP) == MATCH_##OP)
 
-/* Indicate if .option directives do affect instructions.  Set to true means
-   we need to add $x+arch at somewhere; Otherwise just add $x for instructions
-   should be enough.  */
-static bool need_arch_map_symbol = false;
-
 /* Create a new mapping symbol for the transition to STATE.  */
 
 static void
@@ -579,7 +574,6 @@ riscv_mapping_state (enum riscv_seg_mstate to_state,
 		      S_GET_NAME (seg_arch_symbol) + 2) != 0)
     {
       reset_seg_arch_str = true;
-      need_arch_map_symbol = true;
     }
   else if (from_state == to_state)
     return;
@@ -634,13 +628,6 @@ riscv_check_mapping_symbols (bfd *abfd ATTRIBUTE_UNUSED,
   if (seginfo == NULL || seginfo->frchainP == NULL)
     return;
 
-  /* If we don't set any .option arch directive, then the arch_map_symbol
-     in each segment must be the first instruction, and we don't need to
-     add $x+arch for them.  */
-  if (!need_arch_map_symbol
-      && seginfo->tc_segment_info_data.arch_map_symbol != 0)
-    S_SET_NAME (seginfo->tc_segment_info_data.arch_map_symbol, "$x");
-
   for (fragp = seginfo->frchainP->frch_root;
        fragp != NULL;
        fragp = fragp->fr_next)
diff --git a/gas/testsuite/gas/riscv/mapping-non-arch.d b/gas/testsuite/gas/riscv/mapping-non-arch.d
deleted file mode 100644
index f69e719ff30..00000000000
--- a/gas/testsuite/gas/riscv/mapping-non-arch.d
+++ /dev/null
@@ -1,17 +0,0 @@
-#as:
-#source: mapping-non-arch.s
-#objdump: --syms --special-syms
-
-.*file format.*riscv.*
-
-SYMBOL TABLE:
-00+00 l    d  .text	00+00 .text
-00+00 l    d  .data	00+00 .data
-00+00 l    d  .bss	00+00 .bss
-00+00 l       .text	00+00 \$x
-00+08 l       .text	00+00 \$d
-00+0c l       .text	00+00 \$x
-00+00 l    d  text.A	00+00 text.A
-00+00 l       text.A	00+00 \$x
-00+02 l       text.A	00+00 \$d
-00+00 l    d  .riscv.attributes	00+00 .riscv.attributes
diff --git a/gas/testsuite/gas/riscv/mapping-non-arch.s b/gas/testsuite/gas/riscv/mapping-non-arch.s
deleted file mode 100644
index 03b2d75a5dd..00000000000
--- a/gas/testsuite/gas/riscv/mapping-non-arch.s
+++ /dev/null
@@ -1,11 +0,0 @@
-.attribute arch, "rv32i"
-.option arch, +c
-.text
-addi	a0, zero, 1
-.align 3
-.word 0x1
-addi	a0, zero, 2
-
-.section text.A, "ax"
-addi	a0, zero, 3
-.word 0x2
-- 
2.37.0 (Apple Git-136)


                 reply	other threads:[~2022-10-29  3:44 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=20221029034432.49859-1-nelson@rivosinc.com \
    --to=nelson@rivosinc.com \
    --cc=binutils@sourceware.org \
    --cc=kito.cheng@sifive.com \
    --cc=research_trasio@irq.a4lg.com \
    /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).