elf: Add is_standard_elf

PR ld/31289 tests failed for fr30-elf, frv-elf, ft32-elf, iq2000-elf,
mn10200-elf, ms1-elf and msp430-elf targets:

FAIL: ld-elf/fatal-warnings-2a
FAIL: ld-elf/fatal-warnings-2b
FAIL: ld-elf/fatal-warnings-3a
FAIL: ld-elf/fatal-warnings-3b
FAIL: ld-elf/fatal-warnings-4a
FAIL: ld-elf/fatal-warnings-4b

even though PR ld/31289 targets xfail for [is_generic] targets.  These
targets not only don't use the generic_link_hash_table linker, but also
don't use the standard ELF emulation.  Add is_standard_elf for ELF
targets which use the standard ELF emulation and replace [is_generic]
with ![is_standard_elf] in PR ld/31289 tests.

binutils/

	PR ld/31289
	* testsuite/lib/binutils-common.exp (is_standard_elf): New.

ld/

	PR ld/31289
	* testsuite/lib/binutils-common.exp (is_generic): Return 1 for
	fr30-*-*, frv-*-elf, ft32-*-*, iq2000-*-*, mn10200-*-*,
	moxie-*-moxiebox*, msp430-*-* and mt-*-*.
	* testsuite/ld-elf/fatal-warnings-2a.d: Replace [is_generic]
	with ![is_standard_elf].
	* testsuite/ld-elf/fatal-warnings-2b.d: Likewise.
	* testsuite/ld-elf/fatal-warnings-3a.d: Likewise.
	* testsuite/ld-elf/fatal-warnings-3b.d: Likewise.
	* testsuite/ld-elf/fatal-warnings-4a.d: Likewise.
	* testsuite/ld-elf/fatal-warnings-4b.d: Likewise.
This commit is contained in:
H.J. Lu
2024-01-25 10:08:04 -08:00
parent 624c610dd4
commit eb12b17047
7 changed files with 33 additions and 12 deletions

View File

@@ -275,6 +275,27 @@ proc is_generic { } {
return 0 return 0
} }
# Return true if target uses the standard ELF emulation.
proc is_standard_elf { } {
if { ![is_elf_format] || [is_generic] } {
return 0
}
# These targets don't use elf.em.
if { [istarget "fr30-*-*"]
|| [istarget "frv-*-elf"]
|| [istarget "ft32-*-*"]
|| [istarget "iq2000-*-*"]
|| [istarget "mn10200-*-*"]
|| [istarget "moxie-*-moxiebox*"]
|| [istarget "msp430-*-*"]
|| [istarget "mt-*-*"] } {
return 0
}
return 1
}
# True if the object format is ELF with unused section symbols. # True if the object format is ELF with unused section symbols.
proc is_elf_unused_section_symbols {} { proc is_elf_unused_section_symbols {} {
global AS ASFLAGS READELF global AS ASFLAGS READELF

View File

@@ -2,5 +2,5 @@
#source: start.s #source: start.s
#ld: -z bad-option1 -z bad-option2 #ld: -z bad-option1 -z bad-option2
#warning: -z bad-option1 ignored #warning: -z bad-option1 ignored
#xfail: [is_generic] #xfail: ![is_standard_elf]
# generic linker targets don't support -z options. # These targets don't support -z options.

View File

@@ -2,5 +2,5 @@
#source: start.s #source: start.s
#ld: -z bad-option1 -z bad-option2 #ld: -z bad-option1 -z bad-option2
#warning: -z bad-option2 ignored #warning: -z bad-option2 ignored
#xfail: [is_generic] #xfail: ![is_standard_elf]
# generic linker targets don't support -z options. # These targets don't support -z options.

View File

@@ -2,5 +2,5 @@
#source: start.s #source: start.s
#ld: --fatal-warnings -z bad-option1 -z bad-option2 #ld: --fatal-warnings -z bad-option1 -z bad-option2
#error: unsupported option: -z bad-option1 #error: unsupported option: -z bad-option1
#xfail: [is_generic] #xfail: ![is_standard_elf]
# generic linker targets don't support -z options. # These targets don't support -z options.

View File

@@ -2,5 +2,5 @@
#source: start.s #source: start.s
#ld: --fatal-warnings -z bad-option1 -z bad-option2 #ld: --fatal-warnings -z bad-option1 -z bad-option2
#error: unsupported option: -z bad-option2 #error: unsupported option: -z bad-option2
#xfail: [is_generic] #xfail: ![is_standard_elf]
# generic linker targets don't support -z options. # These targets don't support -z options.

View File

@@ -2,5 +2,5 @@
#source: start.s #source: start.s
#ld: -z bad-option1 -z bad-option2 --fatal-warnings #ld: -z bad-option1 -z bad-option2 --fatal-warnings
#error: unsupported option: -z bad-option1 #error: unsupported option: -z bad-option1
#xfail: [is_generic] #xfail: ![is_standard_elf]
# generic linker targets don't support -z options. # These targets don't support -z options.

View File

@@ -2,5 +2,5 @@
#source: start.s #source: start.s
#ld: -z bad-option1 -z bad-option2 --fatal-warnings #ld: -z bad-option1 -z bad-option2 --fatal-warnings
#error: unsupported option: -z bad-option2 #error: unsupported option: -z bad-option2
#xfail: [is_generic] #xfail: ![is_standard_elf]
# generic linker targets don't support -z options. # These targets don't support -z options.