From 04acf63ad5066e288236c3cc6df1019cf4ffe066 Mon Sep 17 00:00:00 2001 From: Chris Lalancette Date: Thu, 20 Jul 2023 11:41:17 -0400 Subject: [PATCH 1/2] Mark asm code with no-executable-stack. Newer versions of binutils (2.39 and above) complain if you have assembly without explicitly marking that it is not using an executable stack (see https://www.redhat.com/en/blog/linkers-warnings-about-executable-stacks-and-segments for more details). Mark it here to quiet that warning. Signed-off-by: Chris Lalancette --- src/asm/trampoline-aarch64.S | 2 ++ src/asm/trampoline-x86_64-systemv.S | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/asm/trampoline-aarch64.S b/src/asm/trampoline-aarch64.S index dc00aae..772ad82 100644 --- a/src/asm/trampoline-aarch64.S +++ b/src/asm/trampoline-aarch64.S @@ -76,3 +76,5 @@ ret_ctx: .globl MANGLE(mmk_trampoline_end) MANGLE(mmk_trampoline_end): nop + +.section .note.GNU-stack, "", @progbits diff --git a/src/asm/trampoline-x86_64-systemv.S b/src/asm/trampoline-x86_64-systemv.S index 01d370c..7939607 100644 --- a/src/asm/trampoline-x86_64-systemv.S +++ b/src/asm/trampoline-x86_64-systemv.S @@ -111,3 +111,5 @@ ret_ctx: // Return context .globl MANGLE(mmk_trampoline_end) MANGLE(mmk_trampoline_end): nop + +.section .note.GNU-stack, "", @progbits From 77dd9e6fabc24cfbba9b8b340e1dbe9f2edc2537 Mon Sep 17 00:00:00 2001 From: Chris Lalancette Date: Fri, 3 Nov 2023 12:10:56 -0400 Subject: [PATCH 2/2] Fix build with the macOS linker. Signed-off-by: Chris Lalancette --- src/asm/trampoline-aarch64.S | 2 ++ src/asm/trampoline-x86_64-systemv.S | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/asm/trampoline-aarch64.S b/src/asm/trampoline-aarch64.S index 772ad82..651ad55 100644 --- a/src/asm/trampoline-aarch64.S +++ b/src/asm/trampoline-aarch64.S @@ -77,4 +77,6 @@ ret_ctx: MANGLE(mmk_trampoline_end): nop +#ifdef __ELF__ .section .note.GNU-stack, "", @progbits +#endif diff --git a/src/asm/trampoline-x86_64-systemv.S b/src/asm/trampoline-x86_64-systemv.S index 7939607..774d6a8 100644 --- a/src/asm/trampoline-x86_64-systemv.S +++ b/src/asm/trampoline-x86_64-systemv.S @@ -112,4 +112,6 @@ ret_ctx: // Return context MANGLE(mmk_trampoline_end): nop +#ifdef __ELF__ .section .note.GNU-stack, "", @progbits +#endif