commit:     916dd11903b06abed6631b10f1bea7a0cce47bbf
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 10 08:05:26 2026 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jan 10 08:05:31 2026 +0000
URL:        
https://gitweb.gentoo.org/proj/toolchain/binutils-patches.git/commit/?id=916dd119

9999: update revert patch

Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...-give-.note.GNU-stack-proper-section-type.patch | 119 ++++++++++++++++++---
 1 file changed, 105 insertions(+), 14 deletions(-)

diff --git 
a/9999/0006-Revert-ELF-give-.note.GNU-stack-proper-section-type.patch 
b/9999/0006-Revert-ELF-give-.note.GNU-stack-proper-section-type.patch
index 249ba83..9e55256 100644
--- a/9999/0006-Revert-ELF-give-.note.GNU-stack-proper-section-type.patch
+++ b/9999/0006-Revert-ELF-give-.note.GNU-stack-proper-section-type.patch
@@ -1,30 +1,99 @@
-From 684d0071d3ed48351325d8935c0697cf43a30902 Mon Sep 17 00:00:00 2001
-Message-ID: 
<684d0071d3ed48351325d8935c0697cf43a30902.1768011380.git....@gentoo.org>
-From: Sam James <[email protected]>
-Date: Sat, 10 Jan 2026 02:16:18 +0000
-Subject: [PATCH] Revert "ELF: give .note.GNU-stack proper section type"
+From c11a9a01b6afbdb9ba989ad36a7bcb6cfac86f15 Mon Sep 17 00:00:00 2001
+Message-ID: 
<c11a9a01b6afbdb9ba989ad36a7bcb6cfac86f15.1768032306.git....@gentoo.org>
+From: "H.J. Lu" <[email protected]>
+Date: Sat, 10 Jan 2026 11:41:48 +0800
+Subject: [PATCH] elf: Don't set .note.GNU-stack type to SHT_NOTE
 
-This reverts commit c8db2c887b4129732341c4a1a51cdcd3191db271.
+.note.GNU-stack section doesn't conform to SHT_NOTE spec:
 
-Bug: https://sourceware.org/PR33780
+https://gabi.xinuos.com/v42/elf/07-pheader.html#note-sections
+
+since it is an empty section with the corresponding fields.  It maps to
+PT_GNU_STACK segment, not PT_NOTE segment.  It is inappropriate to set
+its type to SHT_NOTE.
+
+Revert
+
+commit c8db2c887b4129732341c4a1a51cdcd3191db271
+Author: Jan Beulich <[email protected]>
+Date:   Fri Jan 9 08:39:38 2026 +0100
+
+    ELF: give .note.GNU-stack proper section type
+
+and add tests.
+
+gas/
+
+       PR ld/33780
+       * as.c (main): Don't set .note.GNU-stack section type to SHT_NOTE.
+       * testsuite/gas/elf/elf.exp: Run section-GNU-stack.
+       * testsuite/gas/elf/section-GNU-stack.d: New file.
+       * testsuite/gas/elf/section-GNU-stack.s: Likewise.
+
+ld/
+
+       PR ld/33780
+       * ldelf.c (ldelf_after_open): Don't set .note.GNU-stack section
+       type to SHT_NOTE.
+       * testsuite/ld-elf/pr33780.d: New file.
+       * testsuite/ld-elf/pr33780.s: Likewise.
+
+Signed-off-by: H.J. Lu <[email protected]>
 ---
- gas/as.c   | 2 +-
- ld/ldelf.c | 6 ++----
- 2 files changed, 3 insertions(+), 5 deletions(-)
+ gas/as.c                                  | 1 -
+ gas/testsuite/gas/elf/elf.exp             | 1 +
+ gas/testsuite/gas/elf/section-GNU-stack.d | 5 +++++
+ gas/testsuite/gas/elf/section-GNU-stack.s | 1 +
+ ld/ldelf.c                                | 6 ++----
+ ld/testsuite/ld-elf/pr33780.d             | 6 ++++++
+ ld/testsuite/ld-elf/pr33780.s             | 4 ++++
+ 7 files changed, 19 insertions(+), 5 deletions(-)
+ create mode 100644 gas/testsuite/gas/elf/section-GNU-stack.d
+ create mode 100644 gas/testsuite/gas/elf/section-GNU-stack.s
+ create mode 100644 ld/testsuite/ld-elf/pr33780.d
+ create mode 100644 ld/testsuite/ld-elf/pr33780.s
 
 diff --git a/gas/as.c b/gas/as.c
-index d0e508cb2e3..3d035830c83 100644
+index d0e508cb2e3..200835b9311 100644
 --- a/gas/as.c
 +++ b/gas/as.c
-@@ -1505,7 +1505,7 @@ main (int argc, char ** argv)
+@@ -1505,7 +1505,6 @@ 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/gas/testsuite/gas/elf/elf.exp b/gas/testsuite/gas/elf/elf.exp
+index 35e06ce58b3..35273d42d0c 100644
+--- a/gas/testsuite/gas/elf/elf.exp
++++ b/gas/testsuite/gas/elf/elf.exp
+@@ -389,5 +389,6 @@ if { [is_elf_format] } then {
+ 
+     run_dump_test "bignums" $dump_opts
+     run_dump_test "section-symbol-redef"
++    run_dump_test "section-GNU-stack"
+     run_dump_test "pr27228"
+ }
+diff --git a/gas/testsuite/gas/elf/section-GNU-stack.d 
b/gas/testsuite/gas/elf/section-GNU-stack.d
+new file mode 100644
+index 00000000000..9bdc4d23ccd
+--- /dev/null
++++ b/gas/testsuite/gas/elf/section-GNU-stack.d
+@@ -0,0 +1,5 @@
++#readelf: -SW
++
++#...
++  \[[ 0-9]+\] \.note\.GNU-stack[ \t]+PROGBITS[ \t]+0+ +[0-9a-f]+ +0+ +00 +0 
+0 +1
++#pass
+diff --git a/gas/testsuite/gas/elf/section-GNU-stack.s 
b/gas/testsuite/gas/elf/section-GNU-stack.s
+new file mode 100644
+index 00000000000..a096c762633
+--- /dev/null
++++ b/gas/testsuite/gas/elf/section-GNU-stack.s
+@@ -0,0 +1 @@
++      .section .note.GNU-stack
 diff --git a/ld/ldelf.c b/ld/ldelf.c
 index fe4ab17b01f..a67f540b2df 100644
 --- a/ld/ldelf.c
@@ -42,8 +111,30 @@ index fe4ab17b01f..a67f540b2df 100644
        }
        return;
      }
+diff --git a/ld/testsuite/ld-elf/pr33780.d b/ld/testsuite/ld-elf/pr33780.d
+new file mode 100644
+index 00000000000..7ebfb691ba4
+--- /dev/null
++++ b/ld/testsuite/ld-elf/pr33780.d
+@@ -0,0 +1,6 @@
++#ld: -r -z noexecstack --format=binary
++#readelf: -SW
++
++#...
++  \[[ 0-9]+\] \.note\.GNU-stack[ \t]+PROGBITS[ \t]+0+ +[0-9a-f]+ +0+ +00 +0 
+0 +1
++#pass
+diff --git a/ld/testsuite/ld-elf/pr33780.s b/ld/testsuite/ld-elf/pr33780.s
+new file mode 100644
+index 00000000000..4888b539c6b
+--- /dev/null
++++ b/ld/testsuite/ld-elf/pr33780.s
+@@ -0,0 +1,4 @@
++      .data
++      .globl foo
++foo:
++      .dc.a 0
 
-base-commit: d1d83ec7dbd9bbe53dac9b5f783f35522361a593
+base-commit: fa20c3de21cd86a90dfe94328626ce6730df3a63
 -- 
 2.52.0
 

Reply via email to