gas/ELF: drop bogus check for ELFOSABI_STANDALONE

obj_elf_parse_section_letters() checking for that ABI, when the checking
at the bottom of obj_elf_section() and the logic in
_bfd_elf_final_write_processing() don't, makes no sense. Either
STANDALONE is meant to be GNU-ish, or it is not, I would think. Drop the
one inconsistent check.

If it was not GNU-ish (as the other two locations suggest), what did the
section23b testcase actually mean to check? The numeric attribute value
0x200000 has an entirely unknown (or more precisely, OS-defined, which
we may or may not know of) meaning then, so ought to be accepted. If it
was GNU-ish, the other testcase, elf/section23a, would want running for
those targets as well, and the testcase in question would still be wrong
to have. Hence that testcase is removed, and section23a is renamed to
just section23.
This commit is contained in:
Jan Beulich
2025-08-15 12:18:03 +02:00
parent b3743a2c05
commit a1b33b8cc4
5 changed files with 3 additions and 13 deletions

View File

@@ -950,14 +950,13 @@ obj_elf_parse_section_letters (char *str, size_t len,
bed = get_elf_backend_data (stdoutput);
if (bed->elf_osabi == ELFOSABI_NONE
|| bed->elf_osabi == ELFOSABI_STANDALONE
|| bed->elf_osabi == ELFOSABI_GNU
|| bed->elf_osabi == ELFOSABI_FREEBSD)
{
/* Add flags in the SHF_MASKOS range to gnu_attr for
OSABIs that support those flags.
Also adding the flags for ELFOSABI_{NONE,STANDALONE}
allows them to be validated later in obj_elf_section.
Also adding the flags for ELFOSABI_NONE allows them
to be validated later in obj_elf_section.
We can't just always set these bits in gnu_attr for
all OSABIs, since Binutils does not recognize all
SHF_MASKOS bits for non-GNU OSABIs. It's therefore

View File

@@ -281,8 +281,7 @@ if { [is_elf_format] } then {
run_dump_test "section20"
run_dump_test "section21"
run_dump_test "section22"
run_dump_test "section23a"
run_dump_test "section23b"
run_dump_test "section23"
run_dump_test "section24a"
run_dump_test "section24b"
run_dump_test "section25"

View File

@@ -1,6 +0,0 @@
#name: SHF_GNU_RETAIN set with numeric flag value in .section for non-GNU OSABI target
#source: section23.s
#error_output: section23b.err
#target: msp430-*-elf visium-*-elf
# This test only runs for targets which set ELFOSABI_STANDALONE.

View File

@@ -1,2 +0,0 @@
.*: Assembler messages:
.*:1: Error: GNU_RETAIN section is supported only by GNU and FreeBSD targets