3
0
Fork 0
forked from mirrors/nixpkgs

gcc12: fix building foreign toolchain on aarch64-darwin

It seems that the patchset we apply to get some fixes for aarch64-darwin
support [0] breaks in unexpected ways when compiling a foreign toolchain [1].
Luckily, according to the branch's author, the patchset isn't required
for merely using aarch64-darwin as the build system [2], so let's only apply
it when hostPlatform == aarch64-darwin to fix cross.

[0]: https://github.com/iains/gcc-12-branch
[1]: https://github.com/iains/gcc-12-branch/issues/18
[2]: https://github.com/iains/gcc-12-branch/issues/18#issuecomment-1435792834
This commit is contained in:
Winter 2023-02-18 20:41:24 -05:00
parent 6fcd1dcb0b
commit 3d0de0e8c8

View file

@ -64,7 +64,10 @@ let majorVersion = "12";
../gnat-cflags-11.patch
../gcc-12-gfortran-driving.patch
../ppc-musl.patch
] ++ optional (stdenv.isDarwin && stdenv.isAarch64) (fetchpatch {
]
# We only apply this patch when building a native toolchain for aarch64-darwin, as it breaks building
# a foreign one: https://github.com/iains/gcc-12-branch/issues/18
++ optional (stdenv.isDarwin && stdenv.isAarch64 && buildPlatform == hostPlatform && hostPlatform == targetPlatform) (fetchpatch {
name = "gcc-12-darwin-aarch64-support.patch";
url = "https://github.com/Homebrew/formula-patches/raw/1d184289/gcc/gcc-12.2.0-arm.diff";
sha256 = "sha256-omclLslGi/2yCV4pNBMaIpPDMW3tcz/RXdupbNbeOHA=";