git: 23dff4fdba98 - main - kernel: Sync ldscript files wrt gnu.attributes and .note.GNU-stack

From: Warner Losh <imp_at_FreeBSD.org>
Date: Thu, 29 Feb 2024 16:31:01 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=23dff4fdba987a56f4118f065cdb534cb6faba37

commit 23dff4fdba987a56f4118f065cdb534cb6faba37
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2024-02-29 16:30:37 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-02-29 16:30:37 +0000

    kernel: Sync ldscript files wrt gnu.attributes and .note.GNU-stack
    
    Bring the keeping of .gnu.attributes to all architectures. Also discard
    .note.GNU-stack on all archtiectures. Plus delete obsolete comment that
    was removed from i386 in 2010.
    
    Sponsored by:           Netflix
    Reviewed by:            kib
    Differential Revision:  https://reviews.freebsd.org/D44069
---
 sys/conf/ldscript.amd64       | 1 +
 sys/conf/ldscript.arm         | 4 +++-
 sys/conf/ldscript.arm64       | 4 +++-
 sys/conf/ldscript.i386        | 1 +
 sys/conf/ldscript.powerpc     | 6 +++---
 sys/conf/ldscript.powerpc64   | 6 +++---
 sys/conf/ldscript.powerpc64le | 6 +++---
 sys/conf/ldscript.powerpcspe  | 5 +++--
 sys/conf/ldscript.riscv       | 4 +++-
 9 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/sys/conf/ldscript.amd64 b/sys/conf/ldscript.amd64
index 9c6e603a5753..302f5cd2c4f8 100644
--- a/sys/conf/ldscript.amd64
+++ b/sys/conf/ldscript.amd64
@@ -213,6 +213,7 @@ SECTIONS
   /* DWARF 3 */
   .debug_pubtypes 0 : { *(.debug_pubtypes) }
   .debug_ranges   0 : { *(.debug_ranges) }
+
   .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
   /DISCARD/ : { *(.note.GNU-stack) }
 }
diff --git a/sys/conf/ldscript.arm b/sys/conf/ldscript.arm
index a9c39977a6fc..57ce8c068c44 100644
--- a/sys/conf/ldscript.arm
+++ b/sys/conf/ldscript.arm
@@ -153,5 +153,7 @@ SECTIONS
   .debug_funcnames 0 : { *(.debug_funcnames) }
   .debug_typenames 0 : { *(.debug_typenames) }
   .debug_varnames  0 : { *(.debug_varnames) }
-  /* These must appear regardless of  .  */
+
+  .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
+  /DISCARD/ : { *(.note.GNU-stack) }
 }
diff --git a/sys/conf/ldscript.arm64 b/sys/conf/ldscript.arm64
index afb2687f0368..e9edbd8b7402 100644
--- a/sys/conf/ldscript.arm64
+++ b/sys/conf/ldscript.arm64
@@ -170,5 +170,7 @@ SECTIONS
   .debug_funcnames 0 : { *(.debug_funcnames) }
   .debug_typenames 0 : { *(.debug_typenames) }
   .debug_varnames  0 : { *(.debug_varnames) }
-  /* These must appear regardless of  .  */
+
+  .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
+  /DISCARD/ : { *(.note.GNU-stack) }
 }
diff --git a/sys/conf/ldscript.i386 b/sys/conf/ldscript.i386
index 6563ed2cd623..c7fe91c9d4d5 100644
--- a/sys/conf/ldscript.i386
+++ b/sys/conf/ldscript.i386
@@ -198,6 +198,7 @@ SECTIONS
   /* DWARF 3 */
   .debug_pubtypes 0 : { *(.debug_pubtypes) }
   .debug_ranges   0 : { *(.debug_ranges) }
+
   .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
   /DISCARD/ : { *(.note.GNU-stack) }
 }
diff --git a/sys/conf/ldscript.powerpc b/sys/conf/ldscript.powerpc
index c08123e4eaba..0fa3fc9b3fa7 100644
--- a/sys/conf/ldscript.powerpc
+++ b/sys/conf/ldscript.powerpc
@@ -1,4 +1,3 @@
-
 OUTPUT_FORMAT("elf32-powerpc-freebsd", "elf32-powerpc-freebsd",
 	      "elf32-powerpc-freebsd")
 OUTPUT_ARCH(powerpc)
@@ -149,6 +148,7 @@ SECTIONS
   .debug_funcnames 0 : { *(.debug_funcnames) }
   .debug_typenames 0 : { *(.debug_typenames) }
   .debug_varnames  0 : { *(.debug_varnames) }
-  /* These must appear regardless of  .  */
-}
 
+  .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
+  /DISCARD/ : { *(.note.GNU-stack) }
+}
diff --git a/sys/conf/ldscript.powerpc64 b/sys/conf/ldscript.powerpc64
index df279576193f..3e418c3c1189 100644
--- a/sys/conf/ldscript.powerpc64
+++ b/sys/conf/ldscript.powerpc64
@@ -1,4 +1,3 @@
-
 OUTPUT_FORMAT("elf64-powerpc-freebsd", "elf64-powerpc-freebsd",
 	      "elf64-powerpc-freebsd")
 OUTPUT_ARCH(powerpc:common64)
@@ -174,6 +173,7 @@ SECTIONS
   .debug_funcnames 0 : { *(.debug_funcnames) }
   .debug_typenames 0 : { *(.debug_typenames) }
   .debug_varnames  0 : { *(.debug_varnames) }
-  /* These must appear regardless of  .  */
-}
 
+  .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
+  /DISCARD/ : { *(.note.GNU-stack) }
+}
diff --git a/sys/conf/ldscript.powerpc64le b/sys/conf/ldscript.powerpc64le
index 3fd80d3130fb..4fdfcb295ab7 100644
--- a/sys/conf/ldscript.powerpc64le
+++ b/sys/conf/ldscript.powerpc64le
@@ -1,4 +1,3 @@
-
 OUTPUT_FORMAT("elf64-powerpcle-freebsd", "elf64-powerpcle-freebsd",
 	      "elf64-powerpcle-freebsd")
 OUTPUT_ARCH(powerpc:common64)
@@ -175,6 +174,7 @@ SECTIONS
   .debug_funcnames 0 : { *(.debug_funcnames) }
   .debug_typenames 0 : { *(.debug_typenames) }
   .debug_varnames  0 : { *(.debug_varnames) }
-  /* These must appear regardless of  .  */
-}
 
+  .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
+  /DISCARD/ : { *(.note.GNU-stack) }
+}
diff --git a/sys/conf/ldscript.powerpcspe b/sys/conf/ldscript.powerpcspe
index 7d5b54a655a6..f35a15816108 100644
--- a/sys/conf/ldscript.powerpcspe
+++ b/sys/conf/ldscript.powerpcspe
@@ -1,4 +1,3 @@
-
 OUTPUT_FORMAT("elf32-powerpc-freebsd", "elf32-powerpc-freebsd",
 	      "elf32-powerpc-freebsd")
 OUTPUT_ARCH(powerpc)
@@ -150,6 +149,8 @@ SECTIONS
   .debug_funcnames 0 : { *(.debug_funcnames) }
   .debug_typenames 0 : { *(.debug_typenames) }
   .debug_varnames  0 : { *(.debug_varnames) }
-  /* These must appear regardless of  .  */
+
+  .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
+  /DISCARD/ : { *(.note.GNU-stack) }
 }
 
diff --git a/sys/conf/ldscript.riscv b/sys/conf/ldscript.riscv
index 9a2764a23789..15f896112d04 100644
--- a/sys/conf/ldscript.riscv
+++ b/sys/conf/ldscript.riscv
@@ -144,5 +144,7 @@ SECTIONS
   .debug_funcnames 0 : { *(.debug_funcnames) }
   .debug_typenames 0 : { *(.debug_typenames) }
   .debug_varnames  0 : { *(.debug_varnames) }
-  /* These must appear regardless of  .  */
+
+  .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
+  /DISCARD/ : { *(.note.GNU-stack) }
 }