]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
ELF: give .note.GNU-stack proper section type
authorJan Beulich <jbeulich@suse.com>
Fri, 9 Jan 2026 07:39:38 +0000 (08:39 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 9 Jan 2026 07:39:38 +0000 (08:39 +0100)
Like all .note and .note.* sections it should be SHT_NOTE, not
SHT_PROGBITS.

gas/as.c
ld/ldelf.c

index 3d035830c839e64805f1cf695b1d56dd1550fd4a..d0e508cb2e397ca65923efef110a2c4873462630 100644 (file)
--- 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
 
index a67f540b2df169f255c9a21b3b63af7a8b24315c..fe4ab17b01f06e7d02da51a223f7716cfa8797fd 100644 (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;
     }