about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAdam Joseph <adam@westernsemico.com>2023-10-23 01:48:18 -0700
committerAdam Joseph <54836058+amjoseph-nixpkgs@users.noreply.github.com>2023-10-25 08:36:22 +0000
commit425cac96bf81ac536b844a57b669c9d8c0adbb55 (patch)
tree10f1f8434e77ca3806bdce18041a527c9e2ef6b7
parenta3ba0495452cd8e72735ebd4472838e96902a259 (diff)
gcc: create dummy crtstuff on S390 as well
This commit replicates the fix in
https://github.com/NixOS/nixpkgs/pull/258032 for S390 as well.

Co-authored-by: Artturi <Artturin@artturin.com>
-rw-r--r--pkgs/development/compilers/gcc/common/libgcc-buildstuff.nix7
-rw-r--r--pkgs/test/cross/default.nix1
2 files changed, 5 insertions, 3 deletions
diff --git a/pkgs/development/compilers/gcc/common/libgcc-buildstuff.nix b/pkgs/development/compilers/gcc/common/libgcc-buildstuff.nix
index fc88e61c6560e..239d60268007e 100644
--- a/pkgs/development/compilers/gcc/common/libgcc-buildstuff.nix
+++ b/pkgs/development/compilers/gcc/common/libgcc-buildstuff.nix
@@ -42,11 +42,12 @@ in
   #
   # No rule to make target '../../../gcc-xx.x.x/libgcc/config/loongarch/crti.S', needed by 'crti.o'.  Stop.
   #
-  # For LoongArch64, a hacky workaround is to simply touch them,
+  # For LoongArch64 and S390, a hacky workaround is to simply touch them,
   # as the platform forces .init_array support.
   #
   # https://www.openwall.com/lists/musl/2022/11/09/3
   #
-  + lib.optionalString stdenv.targetPlatform.isLoongArch64 ''
-  touch libgcc/config/loongarch/crt{i,n}.S
+  # 'parsed.cpu.family' won't be correct for every platform.
++ lib.optionalString (stdenv.targetPlatform.isLoongArch64 || stdenv.targetPlatform.isS390) ''
+  touch libgcc/config/${stdenv.targetPlatform.parsed.cpu.family}/crt{i,n}.S
 ''
diff --git a/pkgs/test/cross/default.nix b/pkgs/test/cross/default.nix
index ff83aedca1231..8daa03c562223 100644
--- a/pkgs/test/cross/default.nix
+++ b/pkgs/test/cross/default.nix
@@ -141,6 +141,7 @@ let
     pkgs.pkgsCross.m68k.stdenv
     pkgs.pkgsCross.aarch64-multiplatform.pkgsBuildTarget.gcc
     pkgs.pkgsCross.powernv.pkgsBuildTarget.gcc
+    pkgs.pkgsCross.s390.stdenv
     pkgs.pkgsCross.mips64el-linux-gnuabi64.stdenv
     pkgs.pkgsCross.mips64el-linux-gnuabin32.stdenv
     pkgs.pkgsCross.mingwW64.stdenv