diff options
Diffstat (limited to 'pkgs/development/compilers/gcc/common/libgcc-buildstuff.nix')
-rw-r--r-- | pkgs/development/compilers/gcc/common/libgcc-buildstuff.nix | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/pkgs/development/compilers/gcc/common/libgcc-buildstuff.nix b/pkgs/development/compilers/gcc/common/libgcc-buildstuff.nix index e7dc570a560..239d6026800 100644 --- a/pkgs/development/compilers/gcc/common/libgcc-buildstuff.nix +++ b/pkgs/development/compilers/gcc/common/libgcc-buildstuff.nix @@ -31,7 +31,23 @@ let # SHLIB_LC = lib.optionalString stdenv.targetPlatform.isPower "-mnewlib"; -in '' - echo 'libgcc.a: ${crtstuff-ofiles}' >> libgcc/Makefile.in - echo 'SHLIB_LC=${SHLIB_LC}' >> libgcc/Makefile.in - '' +in +'' + echo 'libgcc.a: ${crtstuff-ofiles}' >> libgcc/Makefile.in + echo 'SHLIB_LC=${SHLIB_LC}' >> libgcc/Makefile.in +'' + + # Meanwhile, crt{i,n}.S are not present on certain platforms + # (e.g. LoongArch64), resulting in the following error: + # + # No rule to make target '../../../gcc-xx.x.x/libgcc/config/loongarch/crti.S', needed by 'crti.o'. Stop. + # + # 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 + # + # '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 +'' |