https://gcc.gnu.org/g:dadfcb36d905c619f196106ceea6e0f37831f5be

commit r17-2317-gdadfcb36d905c619f196106ceea6e0f37831f5be
Author: Rainer Orth <[email protected]>
Date:   Fri Jul 10 19:10:16 2026 +0200

    libphobos: Disable .note.GNU-stack on NetBSD
    
    When linking with a static libgphobos on NetBSD/amd64, gld 2.46 warns
    
    gld-2.46: warning: /usr/lib/crtn.o: missing .note.GNU-stack section implies 
executable stack
    
    This is caused by libdruntime/config/common/threadasm.S including the
    note on NetBSD.  This was introduced in the original druntime repo with
    
    commit 3d8d4a45c01832fb657c16a656b6e1566d77fb21
    Author: Nikolay Tolstokulakov <[email protected]>
    Date:   Thu Feb 4 13:40:21 2016 +0600
    
        netbsd patch
    
    apparently by simply matching what FreeBSD and OpenBSD do.  However,
    NetBSD doesn't use those notes: TARGET_ASM_FILE_END isn't defined and
    the bundled GCC 10.5.0 doesn't emit it either.
    
    Therefore this patch omits it.
    
    The same issue is still present in upstream DMD in
    druntime/src/core/thread/fiber/switch_context_asm.S.
    
    Bootstapped without regressions on amd64-pc-netbsd10.1.
    
    2026-07-05  Rainer Orth  <[email protected]>
    
            libphobos:
            * libdruntime/config/common/threadasm.S: Don't emit
            .note.GNU-stack on NetBSD.

Diff:
---
 libphobos/libdruntime/config/common/threadasm.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libphobos/libdruntime/config/common/threadasm.S 
b/libphobos/libdruntime/config/common/threadasm.S
index fc830fe7d821..d879dbfc032b 100644
--- a/libphobos/libdruntime/config/common/threadasm.S
+++ b/libphobos/libdruntime/config/common/threadasm.S
@@ -22,7 +22,7 @@ a copy of the GCC Runtime Library Exception along with this 
program;
 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
-#if (__linux__ || __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__) 
&& __ELF__
+#if (__linux__ || __FreeBSD__ || __OpenBSD__ || __DragonFly__) && __ELF__
 /*
  * Mark the resulting object file as not requiring execution permissions on
  * stack memory. The absence of this section would mark the whole resulting

Reply via email to