diff --git a/patches.suse/arm64-Discard-.note.GNU-stack-section.patch b/patches.suse/arm64-Discard-.note.GNU-stack-section.patch new file mode 100644 index 0000000..210f52a --- /dev/null +++ b/patches.suse/arm64-Discard-.note.GNU-stack-section.patch @@ -0,0 +1,50 @@ +From fa71cc4400924859467812705749ee9b98b3eec6 Mon Sep 17 00:00:00 2001 +From: Oscar Salvador +Date: Wed, 5 Oct 2022 18:09:21 +0200 +Subject: [PATCH] arm64: Discard .note.GNU-stack section +Patch-mainline: Never, SUSE specific +References: bsc#1203693 + +Commit "Makefile: link with -z noexecstack --no-warn-rwx-segments: ddbd47d2219a" +creates a new section .note.GNU-stack, which is not discarded by arm64. +This changes the ELF layout and causes the build to fail on arm64. + +Quoting Michal Matz: + + "The .note.GNU-stack section in head.o is created by 'ld -r -z noexecstack', + when relinking head.o into head.o (for various reasons). That section is created + with SHT_PROGBITS, and as the kernel linker script doesn't discard those + it also makes the output ".notes" section (which + collects all .note* sections) SHT_PROGBITS, which in turn makes ld not generate + a PT_NOTE segment covering all these. + + Now, I initially thought the linker with 'ld -r', when generating a + .note.GNU-stack section because of a command line option should simply create it + with the type SHT_NOTE and all would be well. That somewhat works, but is actually + wrong: a SHT_NOTE section has a specific layout per the gABI (at least + it must contain a header), but .note.GNU-stack is empty. So it really can't + be SHT_NOTE but must remain either SHT_PROGBITS or SHT_NOBITS." + +Fix it for now by discarding that section. + +Signed-off-by: Oscar Salvador +Suggested-by: Michael Matz