ELF: give .note.GNU-stack proper section type

Like all .note and .note.* sections it should be SHT_NOTE, not
SHT_PROGBITS.
This commit is contained in:
Jan Beulich
2026-01-09 08:39:38 +01:00
parent f463751648
commit c8db2c887b
2 changed files with 5 additions and 3 deletions

View File

@@ -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

View File

@@ -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;
}