guix: move static-libc++ into CMAKE_EXE_LINKER_FLAGS flags
What changed, and why it matters
This commit is a build-system cleanup for Bitcoin Core's Guix reproducible-build scripts. It moves the '-static-libstdc++' linker flag from the general host linker flags into the CMake executable-only linker flags, so the static C++ standard library is linked only for executables and not accidentally applied elsewhere. There is no security-relevant change here.
No security action required. This is a normal build-system refactor.
Security signals we found
No strong security signals were identified.
Evidence from the diff
In contrib/guix/libexec/build.sh, the -static-libstdc++ flag is removed from HOST_LDFLAGS for Linux hosts and instead appended via a new CMAKE_EXE_LINKER_FLAGS variable passed to the cmake configuration step. This makes the intent explicit: the static C++ runtime should be linked only into executables, not into shared libraries or other build artifacts. The effective linker flags for Linux executables remain the same as before.
Changed components
contrib/guix/libexec/build.shInspect captured patch +8 / −2
diff --git a/contrib/guix/libexec/build.sh b/contrib/guix/libexec/build.sh
index 16e12d56..f972c892 100755
--- a/contrib/guix/libexec/build.sh
+++ b/contrib/guix/libexec/build.sh
@@ -225,10 +225,15 @@ esac
# LDFLAGS
case "$HOST" in
- *linux*) HOST_LDFLAGS="-Wl,--as-needed -Wl,--dynamic-linker=$glibc_dynamic_linker -static-libstdc++ -Wl,-O2" ;;
+ *linux*) HOST_LDFLAGS="-Wl,--as-needed -Wl,--dynamic-linker=$glibc_dynamic_linker -Wl,-O2" ;;
*mingw*) HOST_LDFLAGS="-Wl,--no-insert-timestamp" ;;
esac
+# EXE FLAGS
+case "$HOST" in
+ *linux*) CMAKE_EXE_LINKER_FLAGS="-DCMAKE_EXE_LINKER_FLAGS=${HOST_LDFLAGS} -static-libstdc++" ;;
+esac
+
mkdir -p "$DISTSRC"
(
cd "$DISTSRC"
@@ -243,7 +248,8 @@ mkdir -p "$DISTSRC"
--toolchain "${BASEPREFIX}/${HOST}/toolchain.cmake" \
-DWITH_CCACHE=OFF \
-Werror=dev \
- ${CONFIGFLAGS}
+ ${CONFIGFLAGS} \
+ "${CMAKE_EXE_LINKER_FLAGS}"
# Build Bitcoin Core
cmake --build build -j "$JOBS" ${V:+--verbose}
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.