File gnu-efi-bsc1213923-gnu-stack-note-section.patch of Package gnu-efi.30161
From 803b49c40bb0b720b90d9c31d372911f1b946aa7 Mon Sep 17 00:00:00 2001
From: Sergei Trofimovich <slyich@gmail.com>
Date: Sat, 6 Aug 2022 11:16:29 +0100
Subject: [PATCH] */*.S: add non-executable GNU stack marking on ELF-linux
binutils-2.39 enabed a few warning by default
(https://sourceware.org/pipermail/binutils/2022-August/122246.html):
> The ELF linker will now generate a warning message if the stack is made executable.
Let's suppress the warnings in assembly files by adding non-executables
stack markings. This fixes at least systemd build which uses '-Wl,--fatal-warnings':
https://github.com/systemd/systemd/issues/24226
---
apps/trivial.S | 4 ++++
gnuefi/crt0-efi-aarch64.S | 4 ++++
gnuefi/crt0-efi-arm.S | 4 ++++
gnuefi/crt0-efi-ia32.S | 4 ++++
gnuefi/crt0-efi-ia64.S | 4 ++++
gnuefi/crt0-efi-mips64el.S | 4 ++++
gnuefi/crt0-efi-riscv64.S | 4 ++++
gnuefi/crt0-efi-x86_64.S | 3 +++
gnuefi/reloc_ia64.S | 4 ++++
lib/aarch64/efi_stub.S | 4 ++++
lib/aarch64/setjmp.S | 4 ++++
lib/arm/div.S | 4 ++++
lib/arm/efi_stub.S | 4 ++++
lib/arm/ldivmod.S | 5 +++--
lib/arm/llsl.S | 4 ++++
lib/arm/llsr.S | 4 ++++
lib/arm/mullu.S | 4 ++++
lib/arm/setjmp.S | 4 ++++
lib/arm/uldiv.S | 4 +++-
lib/ia32/efi_stub.S | 4 ++++
lib/ia32/setjmp.S | 4 ++++
lib/ia64/palproc.S | 3 +++
lib/ia64/setjmp.S | 4 ++++
lib/mips64el/efi_stub.S | 4 ++++
lib/mips64el/setjmp.S | 4 ++++
lib/riscv64/setjmp.S | 4 ++++
lib/x86_64/efi_stub.S | 4 ++++
lib/x86_64/setjmp.S | 4 ++++
28 files changed, 108 insertions(+), 3 deletions(-)
Index: gnu-efi-3.0.3/apps/trivial.S
===================================================================
--- gnu-efi-3.0.3.orig/apps/trivial.S
+++ gnu-efi-3.0.3/apps/trivial.S
@@ -41,3 +41,7 @@ _start:
hello: .byte 'h',0,'e',0,'l',0,'l',0,'o',0,'\n',0,'\r',0,0,0
#endif
+
+#if defined(__ELF__) && defined(__linux__)
+ .section .note.GNU-stack,"",%progbits
+#endif
Index: gnu-efi-3.0.3/gnuefi/crt0-efi-aarch64.S
===================================================================
--- gnu-efi-3.0.3.orig/gnuefi/crt0-efi-aarch64.S
+++ gnu-efi-3.0.3/gnuefi/crt0-efi-aarch64.S
@@ -138,3 +138,7 @@ _start:
0: ldp x29, x30, [sp], #32
ret
+
+#if defined(__ELF__) && defined(__linux__)
+ .section .note.GNU-stack,"",%progbits
+#endif
Index: gnu-efi-3.0.3/gnuefi/crt0-efi-arm.S
===================================================================
--- gnu-efi-3.0.3.orig/gnuefi/crt0-efi-arm.S
+++ gnu-efi-3.0.3/gnuefi/crt0-efi-arm.S
@@ -136,3 +136,7 @@ _start:
.L_DYNAMIC:
.word _DYNAMIC - .
+
+#if defined(__ELF__) && defined(__linux__)
+ .section .note.GNU-stack,"",%progbits
+#endif
Index: gnu-efi-3.0.3/gnuefi/crt0-efi-ia32.S
===================================================================
--- gnu-efi-3.0.3.orig/gnuefi/crt0-efi-ia32.S
+++ gnu-efi-3.0.3/gnuefi/crt0-efi-ia32.S
@@ -74,3 +74,7 @@ dummy: .long 0
.long dummy // Page RVA
.long 10 // Block Size (2*4+2)
.word (IMAGE_REL_ABSOLUTE<<12) + 0 // reloc for dummy
+
+#if defined(__ELF__) && defined(__linux__)
+ .section .note.GNU-stack,"",%progbits
+#endif
Index: gnu-efi-3.0.3/gnuefi/crt0-efi-ia64.S
===================================================================
--- gnu-efi-3.0.3.orig/gnuefi/crt0-efi-ia64.S
+++ gnu-efi-3.0.3/gnuefi/crt0-efi-ia64.S
@@ -85,3 +85,7 @@ _start_plabel:
data4 12 // Block Size (2*4+2*2)
data2 (IMAGE_REL_BASED_DIR64<<12) + 0 // reloc for plabel's entry point
data2 (IMAGE_REL_BASED_DIR64<<12) + 8 // reloc for plabel's global pointer
+
+#if defined(__ELF__) && defined(__linux__)
+ .section .note.GNU-stack,"",%progbits
+#endif
Index: gnu-efi-3.0.3/gnuefi/crt0-efi-x86_64.S
===================================================================
--- gnu-efi-3.0.3.orig/gnuefi/crt0-efi-x86_64.S
+++ gnu-efi-3.0.3/gnuefi/crt0-efi-x86_64.S
@@ -74,3 +74,6 @@ label1:
.long 10 // Block Size (2*4+2)
.word (IMAGE_REL_ABSOLUTE<<12) + 0 // reloc for dummy
+#if defined(__ELF__) && defined(__linux__)
+ .section .note.GNU-stack,"",%progbits
+#endif
Index: gnu-efi-3.0.3/gnuefi/reloc_ia64.S
===================================================================
--- gnu-efi-3.0.3.orig/gnuefi/reloc_ia64.S
+++ gnu-efi-3.0.3/gnuefi/reloc_ia64.S
@@ -225,3 +225,7 @@ apply_FPTR64:
fptr_mem_base:
.space MAX_FUNCTION_DESCRIPTORS*16
fptr_mem_limit:
+
+#if defined(__ELF__) && defined(__linux__)
+ .section .note.GNU-stack,"",%progbits
+#endif
Index: gnu-efi-3.0.3/lib/aarch64/efi_stub.S
===================================================================
--- gnu-efi-3.0.3.orig/lib/aarch64/efi_stub.S
+++ gnu-efi-3.0.3/lib/aarch64/efi_stub.S
@@ -1 +1,5 @@
/* This stub is a stub to make the build happy */
+
+#if defined(__ELF__) && defined(__linux__)
+ .section .note.GNU-stack,"",%progbits
+#endif
Index: gnu-efi-3.0.3/lib/aarch64/setjmp.S
===================================================================
--- gnu-efi-3.0.3.orig/lib/aarch64/setjmp.S
+++ gnu-efi-3.0.3/lib/aarch64/setjmp.S
@@ -58,3 +58,7 @@ longjmp:
mov w0, #1
csel w0, w1, w0, ne
br x30
+
+#if defined(__ELF__) && defined(__linux__)
+ .section .note.GNU-stack,"",%progbits
+#endif
Index: gnu-efi-3.0.3/lib/arm/efi_stub.S
===================================================================
--- gnu-efi-3.0.3.orig/lib/arm/efi_stub.S
+++ gnu-efi-3.0.3/lib/arm/efi_stub.S
@@ -1 +1,5 @@
/* This stub is a stub to make the build happy */
+
+#if defined(__ELF__) && defined(__linux__)
+ .section .note.GNU-stack,"",%progbits
+#endif
Index: gnu-efi-3.0.3/lib/arm/setjmp.S
===================================================================
--- gnu-efi-3.0.3.orig/lib/arm/setjmp.S
+++ gnu-efi-3.0.3/lib/arm/setjmp.S
@@ -26,3 +26,7 @@ setjmp:
.type longjmp, @function
longjmp:
ldmia r0, {r3-r12,r14}
+
+#if defined(__ELF__) && defined(__linux__)
+ .section .note.GNU-stack,"",%progbits
+#endif
Index: gnu-efi-3.0.3/lib/ia32/efi_stub.S
===================================================================
--- gnu-efi-3.0.3.orig/lib/ia32/efi_stub.S
+++ gnu-efi-3.0.3/lib/ia32/efi_stub.S
@@ -1 +1,5 @@
/* This stub is a stub to make the build happy */
+
+#if defined(__ELF__) && defined(__linux__)
+ .section .note.GNU-stack,"",%progbits
+#endif
Index: gnu-efi-3.0.3/lib/ia32/setjmp.S
===================================================================
--- gnu-efi-3.0.3.orig/lib/ia32/setjmp.S
+++ gnu-efi-3.0.3/lib/ia32/setjmp.S
@@ -35,3 +35,7 @@ longjmp:
movl (%edx), %ebx
movl 4(%edx), %esi
movl 8(%edx), %edi
+
+#if defined(__ELF__) && defined(__linux__)
+ .section .note.GNU-stack,"",%progbits
+#endif
Index: gnu-efi-3.0.3/lib/ia64/palproc.S
===================================================================
--- gnu-efi-3.0.3.orig/lib/ia64/palproc.S
+++ gnu-efi-3.0.3/lib/ia64/palproc.S
@@ -159,3 +159,6 @@ StackedComeBackFromPALCall:
PROCEDURE_EXIT(MakeStackedPALCall)
+#if defined(__ELF__) && defined(__linux__)
+ .section .note.GNU-stack,"",%progbits
+#endif
Index: gnu-efi-3.0.3/lib/ia64/setjmp.S
===================================================================
--- gnu-efi-3.0.3.orig/lib/ia64/setjmp.S
+++ gnu-efi-3.0.3/lib/ia64/setjmp.S
@@ -198,3 +198,7 @@ _skip_flushrs:
mov ar.bspstore = r14
mov ar.rnat = r31
;;
+
+#if defined(__ELF__) && defined(__linux__)
+ .section .note.GNU-stack,"",%progbits
+#endif
Index: gnu-efi-3.0.3/lib/x86_64/efi_stub.S
===================================================================
--- gnu-efi-3.0.3.orig/lib/x86_64/efi_stub.S
+++ gnu-efi-3.0.3/lib/x86_64/efi_stub.S
@@ -187,3 +187,7 @@ ENTRY(efi_call10)
ret
#endif
+
+#if defined(__ELF__) && defined(__linux__)
+ .section .note.GNU-stack,"",%progbits
+#endif
Index: gnu-efi-3.0.3/lib/x86_64/setjmp.S
===================================================================
--- gnu-efi-3.0.3.orig/lib/x86_64/setjmp.S
+++ gnu-efi-3.0.3/lib/x86_64/setjmp.S
@@ -31,3 +31,7 @@ longjmp:
cmp %rax,%rdx
cmove %rcx,%rax
jmp *0x38(%rdi)
+
+#if defined(__ELF__) && defined(__linux__)
+ .section .note.GNU-stack,"",%progbits
+#endif