[Git][ghc/ghc][master] rts: Allow use of GNU-stack notes on FreeBSD

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Fri Nov 15 11:11:50 UTC 2024



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
8f2e0832 by Ben Gamari at 2024-11-15T06:11:24-05:00
rts: Allow use of GNU-stack notes on FreeBSD

Previously we gated use of GNU-style non-executable stack notes to only
apply on Linux. However, these are also supported by FreeBSD, which also
uses ELF. Fix this.

Fixes #25475.

- - - - -


5 changed files:

- rts/StgCRunAsm.S
- rts/adjustor/NativeAmd64Asm.S
- rts/adjustor/NativeAmd64MingwAsm.S
- rts/adjustor/Nativei386Asm.S
- rts/configure.ac


Changes:

=====================================
rts/StgCRunAsm.S
=====================================
@@ -497,6 +497,6 @@ StgReturn:
 #endif /* !USE_MINIINTERPRETER */
 
 /* mark stack as nonexecutable */
-#if defined(__linux__) && defined(__ELF__)
+#if defined(HAVE_GNU_NONEXEC_STACK)
 .section .note.GNU-stack,"", at progbits
 #endif


=====================================
rts/adjustor/NativeAmd64Asm.S
=====================================
@@ -113,6 +113,6 @@ complex_ccall_ret_code:
     ret
 
 /* mark stack as nonexecutable */
-#if defined(__linux__) && defined(__ELF__)
+#if defined(HAVE_GNU_NONEXEC_STACK)
 .section .note.GNU-stack,"", at progbits
 #endif


=====================================
rts/adjustor/NativeAmd64MingwAsm.S
=====================================
@@ -135,6 +135,6 @@ complex_ccall_ret_code:
     ret
 
 /* mark stack as nonexecutable */
-#if defined(__linux__) && defined(__ELF__)
+#if defined(HAVE_GNU_NONEXEC_STACK)
 .section .note.GNU-stack,"", at progbits
 #endif


=====================================
rts/adjustor/Nativei386Asm.S
=====================================
@@ -52,6 +52,6 @@ DECLARE_CSYM(ccall_adjustor)
     ret
 
 /* mark stack as nonexecutable */
-#if defined(__linux__) && defined(__ELF__)
+#if defined(HAVE_GNU_NONEXEC_STACK)
 .section .note.GNU-stack,"", at progbits
 #endif


=====================================
rts/configure.ac
=====================================
@@ -83,6 +83,10 @@ AS_IF([test x"${TargetHasSubsectionsViaSymbols}" = x"YES"],
   [AC_DEFINE([HAVE_SUBSECTIONS_VIA_SYMBOLS],[1],
     [Define to 1 if Apple-style dead-stripping is supported.])])
 
+GHC_GNU_NONEXEC_STACK
+AS_IF([test x"$TargetHasGnuNonexecStack" = x"YES"],
+  [AC_DEFINE([HAVE_GNU_NONEXEC_STACK], [1], [Define (to 1) if GNU-style non-executable stack note is supported])])
+
 dnl --------------------------------------------------
 dnl * Platform header file and syscall feature tests
 dnl ### checking the state of the local header files and syscalls ###



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/8f2e08320f846ed72ef0306ebbe75bdb3752226a

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/8f2e08320f846ed72ef0306ebbe75bdb3752226a
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20241115/62901c83/attachment-0001.html>


More information about the ghc-commits mailing list