GCC Newspaper
JULY 29, 2026
Date
/
Architectures
Components
Topics
News & Policy
libphobos

libphobos: Disable .note.GNU-stack on NetBSD

Disables the emission of .note.GNU-stack section on NetBSD to fix linker warnings and align with system behavior.

This commit disables the generation of the .note.GNU-stack section for libphobos on NetBSD to resolve linker warnings about executable stacks. NetBSD’s linker (gld) warns when this section is missing, but the NetBSD platform does not require or use it, unlike FreeBSD and OpenBSD. The change removes its inclusion from libdruntime/config/common/threadasm.S for NetBSD.

In Details

This commit modifies libdruntime/config/common/threadasm.S to prevent the emission of the .note.GNU-stack section on NetBSD. This addresses linker warnings from gld on NetBSD/amd64, which differ from FreeBSD/OpenBSD in their handling of this ELF note. NetBSD does not define TARGET_ASM_FILE_END, and the bundled GCC does not emit this note, so explicitly including it is unnecessary and introduces warnings.

For Context
.note.GNU-stack
An ELF section that indicates whether the stack segment is executable. This is used by some security mechanisms and loaders, but its presence or absence can lead to warnings if not handled consistently across platforms.
libphobos
The runtime library for the D programming language in GCC. It provides essential functionalities like memory management, concurrency, and I/O.
gld
GNU Linker, the standard linker used by GCC. It combines object files and libraries into an executable or library, resolving symbols and applying relocations.
Filed Under: libphobosnetbsdlinkerELF