gcc: fix powerpc-linux cross compilers

Changed files
+13 -10
pkgs
development
compilers
+13 -10
pkgs/development/compilers/gcc/common/libgcc-buildstuff.nix
···
# glibc. At this early pre-glibc stage these files sometimes
# have different names.
crtstuff-ofiles =
-
if stdenv.targetPlatform.isPower then "ecrti.o ecrtn.o ncrti.o ncrtn.o" else "crti.o crtn.o";
+
if stdenv.targetPlatform.isPower64 then "ecrti.o ecrtn.o ncrti.o ncrtn.o" else "crti.o crtn.o";
# Normally, `SHLIB_LC` is set to `-lc`, which means that
# `libgcc_s.so` cannot be built until `libc.so` is available.
···
# gcc-built `{e,n}crt{n,i}.o` instead of failing to find the
# versions which have been repackaged in libc as `crt{n,i}.o`
#
-
SHLIB_LC = lib.optionalString stdenv.targetPlatform.isPower "-mnewlib";
+
SHLIB_LC = lib.optionalString stdenv.targetPlatform.isPower64 "-mnewlib";
in
''
···
# 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 || stdenv.targetPlatform.isAlpha
-
)
-
''
-
touch libgcc/config/${stdenv.targetPlatform.parsed.cpu.family}/crt{i,n}.S
-
''
+
+ (lib.optionalString
+
(
+
stdenv.targetPlatform.isLoongArch64 || stdenv.targetPlatform.isS390 || stdenv.targetPlatform.isAlpha
+
)
+
''
+
touch libgcc/config/${stdenv.targetPlatform.parsed.cpu.family}/crt{i,n}.S
+
''
+
)
+
+ lib.optionalString (stdenv.targetPlatform.isPower && !stdenv.targetPlatform.isPower64) ''
+
touch libgcc/config/rs6000/crt{i,n}.S
+
''