public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Nelson Chu <nelson.chu@sifive.com>
To: binutils@sourceware.org, gdb-patches@sourceware.org,
	jimw@sifive.com, andrew.burgess@embecosm.com,
	kito.cheng@sifive.com, palmer@dabbelt.com, andrew@sifive.com
Subject: [PATCH v2 1/3] RISC-V: Enable elf attributes when default configure option isn't set.
Date: Fri,  9 Jul 2021 00:28:23 -0700	[thread overview]
Message-ID: <20210709072825.13709-2-nelson.chu@sifive.com> (raw)
In-Reply-To: <20210709072825.13709-1-nelson.chu@sifive.com>

Since gcc commit, 3c70b3ca1ef58f302bf8c16d9e7c7bb8626408bf, we now enable
elf attributes for all riscv targets by default in gcc.  Therefore, I
think binutils should have the same behavior, in case users are writing
assembly files.

ChangLog:

binutils/

	* testsuite/binutils-all/readelf.s: Add comments for riscv.
	* testsuite/binutils-all/readelf.s-64: Likewise.
	* testsuite/binutils-all/readelf.s-64-unused: Likewise.
	* testsuite/binutils-all/readelf.ss: Likewise.
	* testsuite/binutils-all/readelf.ss-64: Likewise.
	* testsuite/binutils-all/readelf.ss-64-unused: Likewise.

gas/

	* configure.ac: If --enable-default-riscv-attribute isn't set,
	then we enable the elf attributes for all riscv targets by
	default.
	* configure: Regenerated.
---
 binutils/testsuite/binutils-all/readelf.s            | 3 ++-
 binutils/testsuite/binutils-all/readelf.s-64         | 2 ++
 binutils/testsuite/binutils-all/readelf.s-64-unused  | 2 ++
 binutils/testsuite/binutils-all/readelf.ss           | 1 +
 binutils/testsuite/binutils-all/readelf.ss-64        | 1 +
 binutils/testsuite/binutils-all/readelf.ss-64-unused | 1 +
 gas/configure                                        | 9 +--------
 gas/configure.ac                                     | 9 +--------
 8 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/binutils/testsuite/binutils-all/readelf.s b/binutils/testsuite/binutils-all/readelf.s
index 6ae4dc756b9..ff37acb4da8 100644
--- a/binutils/testsuite/binutils-all/readelf.s
+++ b/binutils/testsuite/binutils-all/readelf.s
@@ -11,9 +11,10 @@ Section Headers:
 #...
  +\[ .\] .* +PROGBITS +00000000 0000(3c|40|44|48|50) 0000(04|10) 00 +WA +0 +0 +(.|..)
  +\[ .\] .* +NOBITS +00000000 0000(40|44|48|4c|60) 000000 00 +WA +0 +0 +(.|..)
-# ARM targets put .ARM.attributes here
+# ARM targets put .ARM.attributes here.
 # MIPS targets put .reginfo, .mdebug, .MIPS.abiflags and .gnu.attributes here.
 # v850 targets put .call_table_data and .call_table_text here.
+# riscv targets put .riscv.attributes here.
 #...
  +\[..\] .symtab +SYMTAB +00000000 0+.* 0+.* 10 +.. +.+ +4
  +\[..\] .strtab +STRTAB +00000000 0+.* 0+.* 00 .* +0 +0 +1
diff --git a/binutils/testsuite/binutils-all/readelf.s-64 b/binutils/testsuite/binutils-all/readelf.s-64
index 92ec05f0376..4c957f7a938 100644
--- a/binutils/testsuite/binutils-all/readelf.s-64
+++ b/binutils/testsuite/binutils-all/readelf.s-64
@@ -14,10 +14,12 @@ Section Headers:
  +\[ 4\] .bss +NOBITS +0000000000000000 +000000(4c|50|54|58|68)
  +0000000000000000 +0000000000000000 +WA +0 +0 +.*
 # x86 targets may put .note.gnu.property here.
+# riscv targets put .riscv.attributes here.
 #...
  +\[ .\] .symtab +SYMTAB +0000000000000000 +0+.*
 # aarch64-elf targets have one more data symbol.
 # x86 targets may have .note.gnu.property.
+# riscv targets have .riscv.attributes.
  +0+.* +0000000000000018 +(6|7) +(3|4) +8
  +\[ .\] .strtab +STRTAB +0000000000000000 +0+.*
  +0+.* +0000000000000000 .* +0 +0 +1
diff --git a/binutils/testsuite/binutils-all/readelf.s-64-unused b/binutils/testsuite/binutils-all/readelf.s-64-unused
index a1e6cd1bbd8..771439411a0 100644
--- a/binutils/testsuite/binutils-all/readelf.s-64-unused
+++ b/binutils/testsuite/binutils-all/readelf.s-64-unused
@@ -14,10 +14,12 @@ Section Headers:
  +\[ 4\] .bss +NOBITS +0000000000000000 +000000(4c|50|54|58)
  +0000000000000000 +0000000000000000 +WA +0 +0 +.*
 # x86 targets may put .note.gnu.property here.
+# riscv targets put .riscv.attributes here.
 #...
  +\[ .\] .symtab +SYMTAB +0000000000000000 +0+.*
 # aarch64-elf targets have one more data symbol.
 # x86 targets may have .note.gnu.property.
+# riscv targets have .riscv.attributes.
  +0+.* +0000000000000018 +(6|7) +(6|7) +8
  +\[ .\] .strtab +STRTAB +0000000000000000 +0+.*
  +0+.* +0000000000000000 .* +0 +0 +1
diff --git a/binutils/testsuite/binutils-all/readelf.ss b/binutils/testsuite/binutils-all/readelf.ss
index 5fbb5d002e3..b81c016e9e7 100644
--- a/binutils/testsuite/binutils-all/readelf.ss
+++ b/binutils/testsuite/binutils-all/readelf.ss
@@ -9,6 +9,7 @@ Symbol table '.symtab' contains .* entries:
  +.: 00000000 +0 +NOTYPE +LOCAL +DEFAULT +[34] static_data_symbol
 # v850 targets include extra SECTION symbols here for the .call_table_data
 # and .call_table_text sections.
+# riscv targets add .riscv.attribute symbol here...
 #...
  +[0-9]+: 00000000 +0 +NOTYPE +GLOBAL +DEFAULT +1 text_symbol
  +[0-9]+: 00000000 +0 +NOTYPE +GLOBAL +DEFAULT +UND external_symbol
diff --git a/binutils/testsuite/binutils-all/readelf.ss-64 b/binutils/testsuite/binutils-all/readelf.ss-64
index 99a732f71f5..c6ffb0fc523 100644
--- a/binutils/testsuite/binutils-all/readelf.ss-64
+++ b/binutils/testsuite/binutils-all/readelf.ss-64
@@ -7,6 +7,7 @@ Symbol table '.symtab' contains .* entries:
 #...
  +.: 0000000000000000 +0 +NOTYPE +LOCAL +DEFAULT +3 static_data_symbol
 # ... or here ...
+# riscv targets add .riscv.attribute symbol here...
 #...
 .* +.: 0000000000000000 +0 +NOTYPE +GLOBAL +DEFAULT +1 text_symbol
  +.: 0000000000000000 +0 +NOTYPE +GLOBAL +DEFAULT +UND external_symbol
diff --git a/binutils/testsuite/binutils-all/readelf.ss-64-unused b/binutils/testsuite/binutils-all/readelf.ss-64-unused
index f48a4b2bbd2..cf515aa60d0 100644
--- a/binutils/testsuite/binutils-all/readelf.ss-64-unused
+++ b/binutils/testsuite/binutils-all/readelf.ss-64-unused
@@ -10,6 +10,7 @@ Symbol table '.symtab' contains .* entries:
 #...
  +.: 0000000000000000 +0 +NOTYPE +LOCAL +DEFAULT +3 static_data_symbol
 # ... or here ...
+# riscv targets add .riscv.attribute symbol here...
 #...
 .* +.: 0000000000000000 +0 +NOTYPE +GLOBAL +DEFAULT +1 text_symbol
  +.: 0000000000000000 +0 +NOTYPE +GLOBAL +DEFAULT +UND external_symbol
diff --git a/gas/configure b/gas/configure
index 110d707f079..7a528fd485e 100755
--- a/gas/configure
+++ b/gas/configure
@@ -12550,14 +12550,7 @@ _ACEOF
 
 
 if test ${ac_default_generate_riscv_attr} = unset; then
-    case ${target_os} in
-      elf)
-	ac_default_generate_riscv_attr=1
-	;;
-      *)
-	ac_default_generate_riscv_attr=0
-	;;
-  esac
+  ac_default_generate_riscv_attr=1
 fi
 
 
diff --git a/gas/configure.ac b/gas/configure.ac
index 78efba88e23..e2374268c56 100644
--- a/gas/configure.ac
+++ b/gas/configure.ac
@@ -727,14 +727,7 @@ AC_DEFINE_UNQUOTED(DEFAULT_X86_USED_NOTE,
    properties by default.])
 
 if test ${ac_default_generate_riscv_attr} = unset; then
-    case ${target_os} in
-      elf)
-	ac_default_generate_riscv_attr=1
-	;;
-      *)
-	ac_default_generate_riscv_attr=0
-	;;
-  esac
+  ac_default_generate_riscv_attr=1
 fi
 
 AC_DEFINE_UNQUOTED(DEFAULT_RISCV_ATTR,
-- 
2.30.2


  reply	other threads:[~2021-07-09  7:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-09  7:28 [PATCH v2 0/3] RISC-V: The series to supporting mapping symbols Nelson Chu
2021-07-09  7:28 ` Nelson Chu [this message]
2021-07-09  8:00   ` [PATCH v2 1/3] RISC-V: Enable elf attributes when default configure option isn't set Kito Cheng
2021-07-13  7:07     ` Nelson Chu
2021-07-13 20:38   ` Palmer Dabbelt
2021-07-15  1:47     ` Nelson Chu
2022-02-25 13:57   ` Sebastian Huber
2021-07-09  7:28 ` [PATCH v2 2/3] RISC-V: PR27916, Support mapping symbols Nelson Chu
2021-07-15 15:16   ` Palmer Dabbelt
2021-07-16  2:58     ` Nelson Chu
2021-07-09  7:28 ` [PATCH v2 3/3] RISC-V: PR27916, Extend .insn directive to support hardcode encoding Nelson Chu
2021-07-09  8:01   ` Kito Cheng
2021-07-14 20:38     ` Palmer Dabbelt

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=20210709072825.13709-2-nelson.chu@sifive.com \
    --to=nelson.chu@sifive.com \
    --cc=andrew.burgess@embecosm.com \
    --cc=andrew@sifive.com \
    --cc=binutils@sourceware.org \
    --cc=gdb-patches@sourceware.org \
    --cc=jimw@sifive.com \
    --cc=kito.cheng@sifive.com \
    --cc=palmer@dabbelt.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).