From 82c6fd5344442d856fce325382c72d776eaa9440 Mon Sep 17 00:00:00 2001 From: Aleksi Hannula Date: Sat, 28 Feb 2026 14:40:05 +0200 Subject: [PATCH] pkgsi686Linux.pkgsMusl.gcc: Use libssp_nonshared from musl This may not have visible effects until #494106 is merged. This is because this build is blocked by the exact same issue in minimal-bootstrap gcc, which causes perl to fail on this specific platform. --- .../compilers/gcc/patches/default.nix | 1 + .../gcc/patches/libssp-noshared-musl32.patch | 31 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 pkgs/development/compilers/gcc/patches/libssp-noshared-musl32.patch diff --git a/pkgs/development/compilers/gcc/patches/default.nix b/pkgs/development/compilers/gcc/patches/default.nix index 914cbb170e1f..2e412802742e 100644 --- a/pkgs/development/compilers/gcc/patches/default.nix +++ b/pkgs/development/compilers/gcc/patches/default.nix @@ -252,3 +252,4 @@ optionals noSysDirs ( hash = "sha256-8I2G4430gkYoWgUued4unqhk8ZCajHf1dcivAeuLZ0E="; }) ] +++ optional (targetPlatform.isMusl && targetPlatform.isx86_32) ./libssp-noshared-musl32.patch diff --git a/pkgs/development/compilers/gcc/patches/libssp-noshared-musl32.patch b/pkgs/development/compilers/gcc/patches/libssp-noshared-musl32.patch new file mode 100644 index 000000000000..21e51a8250bb --- /dev/null +++ b/pkgs/development/compilers/gcc/patches/libssp-noshared-musl32.patch @@ -0,0 +1,31 @@ +From c557286adc46536fe033df400c50a880b672cfd6 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Timo=20Ter=C3=A4s?= +Date: Fri, 21 Aug 2020 07:03:00 +0000 +Subject: [PATCH] Alpine musl package provides libssp_nonshared.a. We link to + it unconditionally, as otherwise we get link failures if some objects are + -fstack-protector built and final link happens with -fno-stack-protector. + This seems to be the common case when bootstrapping gcc, the piepatches do + not seem to fully fix the crosstoolchain and bootstrap sequence wrt. + stack-protector flag usage. + +--- + gcc/gcc.cc | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/gcc/gcc.cc b/gcc/gcc.cc +index 7b0d3d2743b..e46e976a2e8 100644 +--- a/gcc/gcc.cc ++++ b/gcc/gcc.cc +@@ -1017,8 +1017,7 @@ proper position among the other output files. */ + + #ifndef LINK_SSP_SPEC + #ifdef TARGET_LIBC_PROVIDES_SSP +-#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \ +- "|fstack-protector-strong|fstack-protector-explicit:}" ++#define LINK_SSP_SPEC "-lssp_nonshared" + #else + #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \ + "|fstack-protector-strong|fstack-protector-explicit" \ +-- +2.50.1 +