Skip to content

Linux amd64 build issue with new clang/gcc versions (warning: missing .note.GNU-stack section implies executable stack) #5788

@viewizard

Description

@viewizard

I faced with libdbgshim/diagnostics build warnings during Linux build:

[ 25%] Building ASM object third_party/diagnostics/src/shared/pal/src/CMakeFiles/coreclrpal.dir/arch/amd64/debugbreak.S.o
/usr/x86_64-unknown-linux-gnu/bin/ld.bfd: warning: debugbreak.S.o: missing .note.GNU-stack section implies executable stack
/usr/x86_64-unknown-linux-gnu/bin/ld.bfd: NOTE: This behaviour is deprecated and will be removed in a future version of the linker

installed version gcc and clang:

sh-5.3$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-unknown-linux-gnu/15.2.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/bin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu lt_cv_sys_lib_dlsearch_path_spec=/usr/lib/x86_64-linux-gnu --target=x86_64-unknown-linux-gnu --disable-multilib --enable-multiarch --disable-bootstrap --enable-languages=c,c++,fortran,objc,obj-c++ --enable-default-pie --enable-default-ssp --with-isl --disable-libssp --enable-linker-build-id --disable-libstdcxx-filesystem-ts --enable-cet --with-system-zlib --with-zstd --with-tune=generic --with-arch_64=x86-64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 15.2.0 (GCC) 

sh-5.3$ clang -v
clang version 22.1.2
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/sdk/llvm22/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-unknown-linux-gnu/15.2.0
Selected GCC installation: /usr/lib/gcc/x86_64-unknown-linux-gnu/15.2.0
Candidate multilib: .;@m64
Selected multilib: .;@m64

this warnings could be ignored and libdbgshim.so will be built, but in this case during launch debugger failed with:

dlopen() error: /home/viewizard/Desktop/projects/dncdbg/bin/libdbgshim.so: cannot enable executable stack as shared object requires: Invalid argument

I found that this build warning and debugger launch fail could be fixed by add one line .section .note.GNU-stack,"",@progbits in diagnostics/src/shared/pal/src/arch/amd64/debugbreak.S.

I am not really strong with asm, so, don't provide PR (probably other Linux asm .S files also should be fixed) could you please take a look?

@gbalykov

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions