gcc: fix powerpc-linux cross compilers

This commit is contained in:
Marie Ramlow
2025-09-10 08:15:07 +02:00
committed by Alyssa Ross
parent 6ca2222c5e
commit 69cde4d543
@@ -16,7 +16,7 @@ let
# 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.
@@ -28,7 +28,7 @@ let
# 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
''
@@ -47,11 +47,14 @@ 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
''