RISC-V: Enable elf attributes when default configure option isn't set.

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.  If --enable-default-riscv-attribute isn't set, then we
enable the elf attributes for all riscv targets by default.

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.
This commit is contained in:
Nelson Chu
2021-07-08 20:22:20 -07:00
parent f148d9d334
commit aa0587b290
8 changed files with 11 additions and 17 deletions

View File

@ -11,9 +11,10 @@ Section Headers:
#... #...
+\[ .\] .* +PROGBITS +00000000 0000(3c|40|44|48|50) 0000(04|10) 00 +WA +0 +0 +(.|..) +\[ .\] .* +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 +(.|..) +\[ .\] .* +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. # MIPS targets put .reginfo, .mdebug, .MIPS.abiflags and .gnu.attributes here.
# v850 targets put .call_table_data and .call_table_text 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 +\[..\] .symtab +SYMTAB +00000000 0+.* 0+.* 10 +.. +.+ +4
+\[..\] .strtab +STRTAB +00000000 0+.* 0+.* 00 .* +0 +0 +1 +\[..\] .strtab +STRTAB +00000000 0+.* 0+.* 00 .* +0 +0 +1

View File

@ -14,10 +14,12 @@ Section Headers:
+\[ 4\] .bss +NOBITS +0000000000000000 +000000(4c|50|54|58|68) +\[ 4\] .bss +NOBITS +0000000000000000 +000000(4c|50|54|58|68)
+0000000000000000 +0000000000000000 +WA +0 +0 +.* +0000000000000000 +0000000000000000 +WA +0 +0 +.*
# x86 targets may put .note.gnu.property here. # x86 targets may put .note.gnu.property here.
# riscv targets put .riscv.attributes here.
#... #...
+\[ .\] .symtab +SYMTAB +0000000000000000 +0+.* +\[ .\] .symtab +SYMTAB +0000000000000000 +0+.*
# aarch64-elf targets have one more data symbol. # aarch64-elf targets have one more data symbol.
# x86 targets may have .note.gnu.property. # x86 targets may have .note.gnu.property.
# riscv targets have .riscv.attributes.
+0+.* +0000000000000018 +(6|7) +(3|4) +8 +0+.* +0000000000000018 +(6|7) +(3|4) +8
+\[ .\] .strtab +STRTAB +0000000000000000 +0+.* +\[ .\] .strtab +STRTAB +0000000000000000 +0+.*
+0+.* +0000000000000000 .* +0 +0 +1 +0+.* +0000000000000000 .* +0 +0 +1

View File

@ -14,10 +14,12 @@ Section Headers:
+\[ 4\] .bss +NOBITS +0000000000000000 +000000(4c|50|54|58) +\[ 4\] .bss +NOBITS +0000000000000000 +000000(4c|50|54|58)
+0000000000000000 +0000000000000000 +WA +0 +0 +.* +0000000000000000 +0000000000000000 +WA +0 +0 +.*
# x86 targets may put .note.gnu.property here. # x86 targets may put .note.gnu.property here.
# riscv targets put .riscv.attributes here.
#... #...
+\[ .\] .symtab +SYMTAB +0000000000000000 +0+.* +\[ .\] .symtab +SYMTAB +0000000000000000 +0+.*
# aarch64-elf targets have one more data symbol. # aarch64-elf targets have one more data symbol.
# x86 targets may have .note.gnu.property. # x86 targets may have .note.gnu.property.
# riscv targets have .riscv.attributes.
+0+.* +0000000000000018 +(6|7) +(6|7) +8 +0+.* +0000000000000018 +(6|7) +(6|7) +8
+\[ .\] .strtab +STRTAB +0000000000000000 +0+.* +\[ .\] .strtab +STRTAB +0000000000000000 +0+.*
+0+.* +0000000000000000 .* +0 +0 +1 +0+.* +0000000000000000 .* +0 +0 +1

View File

@ -9,6 +9,7 @@ Symbol table '.symtab' contains .* entries:
+.: 00000000 +0 +NOTYPE +LOCAL +DEFAULT +[34] static_data_symbol +.: 00000000 +0 +NOTYPE +LOCAL +DEFAULT +[34] static_data_symbol
# v850 targets include extra SECTION symbols here for the .call_table_data # v850 targets include extra SECTION symbols here for the .call_table_data
# and .call_table_text sections. # 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 +1 text_symbol
+[0-9]+: 00000000 +0 +NOTYPE +GLOBAL +DEFAULT +UND external_symbol +[0-9]+: 00000000 +0 +NOTYPE +GLOBAL +DEFAULT +UND external_symbol

View File

@ -7,6 +7,7 @@ Symbol table '.symtab' contains .* entries:
#... #...
+.: 0000000000000000 +0 +NOTYPE +LOCAL +DEFAULT +3 static_data_symbol +.: 0000000000000000 +0 +NOTYPE +LOCAL +DEFAULT +3 static_data_symbol
# ... or here ... # ... or here ...
# riscv targets add .riscv.attribute symbol here...
#... #...
.* +.: 0000000000000000 +0 +NOTYPE +GLOBAL +DEFAULT +1 text_symbol .* +.: 0000000000000000 +0 +NOTYPE +GLOBAL +DEFAULT +1 text_symbol
+.: 0000000000000000 +0 +NOTYPE +GLOBAL +DEFAULT +UND external_symbol +.: 0000000000000000 +0 +NOTYPE +GLOBAL +DEFAULT +UND external_symbol

View File

@ -10,6 +10,7 @@ Symbol table '.symtab' contains .* entries:
#... #...
+.: 0000000000000000 +0 +NOTYPE +LOCAL +DEFAULT +3 static_data_symbol +.: 0000000000000000 +0 +NOTYPE +LOCAL +DEFAULT +3 static_data_symbol
# ... or here ... # ... or here ...
# riscv targets add .riscv.attribute symbol here...
#... #...
.* +.: 0000000000000000 +0 +NOTYPE +GLOBAL +DEFAULT +1 text_symbol .* +.: 0000000000000000 +0 +NOTYPE +GLOBAL +DEFAULT +1 text_symbol
+.: 0000000000000000 +0 +NOTYPE +GLOBAL +DEFAULT +UND external_symbol +.: 0000000000000000 +0 +NOTYPE +GLOBAL +DEFAULT +UND external_symbol

7
gas/configure vendored
View File

@ -12550,14 +12550,7 @@ _ACEOF
if test ${ac_default_generate_riscv_attr} = unset; then 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=1
;;
*)
ac_default_generate_riscv_attr=0
;;
esac
fi fi

View File

@ -727,14 +727,7 @@ AC_DEFINE_UNQUOTED(DEFAULT_X86_USED_NOTE,
properties by default.]) properties by default.])
if test ${ac_default_generate_riscv_attr} = unset; then 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=1
;;
*)
ac_default_generate_riscv_attr=0
;;
esac
fi fi
AC_DEFINE_UNQUOTED(DEFAULT_RISCV_ATTR, AC_DEFINE_UNQUOTED(DEFAULT_RISCV_ATTR,