From 663252086fd0cf1d63eebe2860716e9e07dc738d Mon Sep 17 00:00:00 2001 From: Juan Hoyos <19413848+hoyosjs@users.noreply.github.com> Date: Thu, 2 Apr 2026 23:43:04 -0700 Subject: [PATCH] Add stack section directives to work around noexecstack issue in newer compiler --- src/shared/pal/inc/unixasmmacros.inc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/shared/pal/inc/unixasmmacros.inc b/src/shared/pal/inc/unixasmmacros.inc index 120b26543e..733a1c8fd4 100644 --- a/src/shared/pal/inc/unixasmmacros.inc +++ b/src/shared/pal/inc/unixasmmacros.inc @@ -38,6 +38,23 @@ .equiv \New, \Old .endm +// GC type flags +#define GC_ALLOC_FINALIZE 1 +#define GC_ALLOC_ALIGN8_BIAS 4 +#define GC_ALLOC_ALIGN8 8 + +#define G_FREE_OBJECT_METHOD_TABLE g_pFreeObjectMethodTable + +// Offset of ee_alloc_context relative to INLINE_GET_ALLOC_CONTEXT_BASE. +// +// Since we have a disparity on how thread locals are accessed on various platforms and +// the current value of OFFSETOF__RuntimeThreadLocals__ee_alloc_context is zero we expect +// the helpers to add the OFFSETOF__RuntimeThreadLocals__ee_alloc_context constant to the +// base and set the additional offset to zero. +// In other words, we treat INLINE_GET_ALLOC_CONTEXT_BASE as returning the same value as +// GetThreadEEAllocContext. +#define OFFSETOF__ee_alloc_context 0 + #if defined(HOST_X86) #include "unixasmmacrosx86.inc" #elif defined(HOST_AMD64) @@ -57,3 +74,10 @@ #elif defined(HOST_POWERPC64) #include "unixasmmacrosppc64le.inc" #endif + +// Mark the stack as non-executable for ELF targets. +// https://github.com/dotnet/runtime/issues/125469 +#if !defined(__APPLE__) +.pushsection .note.GNU-stack,"",%progbits +.popsection +#endif