From: Jan Beulich Date: Fri, 9 Jan 2026 07:39:38 +0000 (+0100) Subject: ELF: give .note.GNU-stack proper section type X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c8db2c887b4129732341c4a1a51cdcd3191db271;p=thirdparty%2Fbinutils-gdb.git ELF: give .note.GNU-stack proper section type Like all .note and .note.* sections it should be SHT_NOTE, not SHT_PROGBITS. --- diff --git a/gas/as.c b/gas/as.c index 3d035830c83..d0e508cb2e3 100644 --- a/gas/as.c +++ b/gas/as.c @@ -1505,7 +1505,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 a67f540b2df..fe4ab17b01f 100644 --- a/ld/ldelf.c +++ b/ld/ldelf.c @@ -1327,8 +1327,10 @@ 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); - (void) bfd_make_section_with_flags (link_info.input_bfds, - ".note.GNU-stack", flags); + s = bfd_make_section_with_flags (link_info.input_bfds, + ".note.GNU-stack", flags); + if (s) + elf_section_type (s) = SHT_NOTE; } return; }