From: Jan Beulich Date: Thu, 29 Jan 2026 13:19:54 +0000 (+0100) Subject: Revert "ld: testcase for .note.GNU-stack wanting to be SHT_NOTE" etc X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=21c3a81d96243b967cd44ba87475f25e2c70b4e4;p=thirdparty%2Fbinutils-gdb.git Revert "ld: testcase for .note.GNU-stack wanting to be SHT_NOTE" etc This reverts commits a1c2fa92ac93bf50227941bd82094e6997c5fd56, bc6e40a093e700e84b549902d55e73bfe92a113b ("amend "ELF: give .note.GNU-stack proper section type""), and c8db2c887b4129732341c4a1a51cdcd3191db271 ("ELF: give .note.GNU-stack proper section type"). They're deemed to require a little more testing before being ready for a release. --- diff --git a/bfd/elf.c b/bfd/elf.c index 75a2e0b9358..1177c3c3016 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -3139,7 +3139,7 @@ static const struct bfd_elf_special_section special_sections_l[] = static const struct bfd_elf_special_section special_sections_n[] = { { STRING_COMMA_LEN (".noinit"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, - { STRING_COMMA_LEN (".note.GNU-stack"), 0, SHT_NOTE, 0 }, + { STRING_COMMA_LEN (".note.GNU-stack"), 0, SHT_PROGBITS, 0 }, { STRING_COMMA_LEN (".note"), -1, SHT_NOTE, 0 }, { NULL, 0, 0, 0, 0 } }; diff --git a/gas/as.c b/gas/as.c index f08c7c71d73..eefcddeaa49 100644 --- a/gas/as.c +++ b/gas/as.c @@ -1519,7 +1519,7 @@ main (int argc, char ** argv) gnustack = subseg_new (".note.GNU-stack", 0); bfd_set_section_flags (gnustack, SEC_READONLY | (flag_execstack ? SEC_CODE : 0)); - elf_section_type (gnustack) = SHT_NOTE; + } #endif diff --git a/ld/ldelf.c b/ld/ldelf.c index fbab75aeefb..a623d37c4d0 100644 --- a/ld/ldelf.c +++ b/ld/ldelf.c @@ -1328,10 +1328,8 @@ ldelf_after_open (int use_libpath, int native, int is_linux, int is_freebsd, effect. Instead we create a .note.GNU-stack section in much the same way as the assembler does with its --[no]execstack option. */ flagword flags = SEC_READONLY | (link_info.execstack ? SEC_CODE : 0); - s = bfd_make_section_with_flags (link_info.input_bfds, - ".note.GNU-stack", flags); - if (s && bfd_get_flavour (s->owner) == bfd_target_elf_flavour) - elf_section_type (s) = SHT_NOTE; + (void) bfd_make_section_with_flags (link_info.input_bfds, + ".note.GNU-stack", flags); } return; } diff --git a/ld/testsuite/ld-elf/note2.d b/ld/testsuite/ld-elf/note2.d deleted file mode 100644 index 16012aa4fc7..00000000000 --- a/ld/testsuite/ld-elf/note2.d +++ /dev/null @@ -1,18 +0,0 @@ -#name: .note.GNU-stack using SHT_NOTE -#source: empty.s -#source: property-or-1.s -#as: --noexecstack --generate-missing-build-notes=no -#ld: -shared --script note2.t -#readelf: --notes -#target: [check_shared_lib_support] -# Assembly source file for the HPPA assembler is renamed and modifed by -# sed. mn10300 has relocations in .note.gnu.property section which -# elf_parse_notes doesn't support. -#notarget: am33_2.0-*-* hppa*-*-hpux* mn10300-*-* - -#... -Displaying notes found in: .note -[ ]+Owner[ ]+Data size[ ]+Description - GNU 0x[0-9a-f]+ NT_GNU_PROPERTY_TYPE_0 - Properties: UINT32_OR .* -#pass diff --git a/ld/testsuite/ld-elf/note2.t b/ld/testsuite/ld-elf/note2.t deleted file mode 100644 index 1bf8c18d94c..00000000000 --- a/ld/testsuite/ld-elf/note2.t +++ /dev/null @@ -1,7 +0,0 @@ -SECTIONS -{ - . = . + SIZEOF_HEADERS; - .text : { *(.text) *(.plt) *(.rodata) *(.got*) } - .note : { *(.note) *(.note.*) } - /DISCARD/ : { *(*) } -}