Skip to content

Commit 1b8dc59

Browse files
committed
revert: remove -Wl,-z,noexecstack and -fno-trampolines (both break Fortran decode)
Analysis of CI failures confirmed that the WSJT-X Fortran code uses stack-based trampolines for internal procedure pointers at runtime. Both approaches broke FT8 decode with SIGSEGV: - -Wl,-z,noexecstack: prevents kernel from making stack executable, trampolines fail - -fno-trampolines: ignored by gfortran on aarch64 or not effective for this pattern The execstack issue only occurs on OrbStack (Apple Silicon virtualization which enforces strict NX). On real Linux servers (Ubuntu 22.04/24.04), the kernel allows executable stack and wsjtx-lib works correctly without modification. This reverts CMakeLists.txt to the v1.2.1 state. Version bumped to 1.2.4 to allow a clean publish superseding the broken 1.2.2/1.2.3 packages.
1 parent 090612b commit 1b8dc59

3 files changed

Lines changed: 4 additions & 16 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,6 @@ if(UNIX AND NOT APPLE)
3838
add_compile_options(-fPIC -fvisibility=hidden)
3939
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-stringop-overflow -Wno-deprecated-declarations")
4040
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-stringop-overflow -Wno-deprecated-declarations")
41-
# Disable stack-based trampolines in Fortran code.
42-
# Required together with -Wl,-z,noexecstack: modern kernels (OrbStack 6.17+) reject
43-
# dlopen of .so with PT_GNU_STACK RWE. -fno-trampolines tells gfortran to use
44-
# register-based (non-stack) trampolines for internal procedure pointers.
45-
# If this causes a compile error, the Fortran code has nested procedure arguments
46-
# that require restructuring. GCC 9+ on aarch64 supports this without libffi.
47-
add_compile_options($<$<COMPILE_LANGUAGE:Fortran>:-fno-trampolines>)
4841
elseif(APPLE)
4942
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -Wno-deprecated-declarations -Wno-unqualified-std-cast-call")
5043
elseif(WIN32 AND CMAKE_CXX_COMPILER_ID MATCHES "GNU")
@@ -298,10 +291,6 @@ elseif(UNIX)
298291
if(FFTW_HAS_THREADS)
299292
target_link_libraries(wsjtx_core PRIVATE fftw3f_threads)
300293
endif()
301-
# Prevent execstack: modern kernels (and OrbStack) reject dlopen of .so with PT_GNU_STACK RWE.
302-
# Safe because wsjtx_lib Fortran code has no nested internal procedures (no CONTAINS),
303-
# so gfortran never generates trampolines requiring executable stack.
304-
target_link_options(wsjtx_core PRIVATE -Wl,-z,noexecstack)
305294
elseif(WIN32)
306295
# Static-link ALL non-system dependencies so wsjtx_core.dll only depends
307296
# on Windows system DLLs (KERNEL32.dll, msvcrt.dll). This prevents DLL
@@ -427,9 +416,8 @@ foreach(cfg Debug Release RelWithDebInfo MinSizeRel)
427416
)
428417
endforeach()
429418

430-
# Linux RPATH for .node + prevent execstack
419+
# Linux RPATH for .node
431420
if(UNIX AND NOT APPLE)
432-
target_link_options(${PROJECT_NAME} PRIVATE -Wl,-z,noexecstack)
433421
set_target_properties(${PROJECT_NAME} PROPERTIES
434422
BUILD_RPATH "\$ORIGIN"
435423
INSTALL_RPATH "\$ORIGIN"

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "wsjtx-lib",
3-
"version": "1.2.3",
3+
"version": "1.2.4",
44
"description": "Node.js C++ extension for WSJTX digital radio protocol library",
55
"type": "module",
66
"main": "dist/src/index.js",

0 commit comments

Comments
 (0)