mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-06-09 06:43:36 +00:00
gcc15: fix build on aarch64-darwin
This fixes the GCC 15.2.0 build on aarch64-darwin by addressing two issues
in the libgcc build process:
1. Update libgcc-darwin-detection.patch:
- Catch arm64-apple-darwin (which lacks a version number)
- Add t-darwin-libgccs1 to enable libgcc_s.1.dylib compatibility build
2. Added libgcc-darwin-fix-reexport.patch:
- Remove reexport of darwin-unwind.ver symbols in libgcc_s.1.dylib
- These symbols (___register_frame_info, etc.) don't exist in libgcc
on modern macOS as they come from libSystem
The original build failed with:
Undefined symbols for architecture arm64:
"___deregister_frame_info", referenced from:
-reexported_symbols_list command line option
...
This occurred because darwin-unwind.ver lists unwinder symbols that are
excluded from libgcc (via libgcc-libsystem.ver) on macOS 11+ where they
are provided by the system's libSystem.
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
--- a/libgcc/config.host
|
||||
+++ b/libgcc/config.host
|
||||
@@ -239,7 +239,7 @@ case ${host} in
|
||||
@@ -239,8 +239,8 @@ case ${host} in
|
||||
x86_64-*-darwin2[0-2]*)
|
||||
tmake_file="t-darwin-min-11 t-darwin-libgccs1 $tmake_file"
|
||||
;;
|
||||
- *-*-darwin2*)
|
||||
- tmake_file="t-darwin-min-11 $tmake_file"
|
||||
+ *-*-darwin2* | *-*-darwin)
|
||||
tmake_file="t-darwin-min-11 $tmake_file"
|
||||
+ tmake_file="t-darwin-min-11 t-darwin-libgccs1 $tmake_file"
|
||||
;;
|
||||
*-*-darwin1[89]*)
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/libgcc/config/t-slibgcc-darwin
|
||||
+++ b/libgcc/config/t-slibgcc-darwin
|
||||
@@ -139,8 +139,7 @@ libgcc_s.1.dylib: all-multi libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)
|
||||
$(CC) -arch $${arch} -nodefaultlibs -dynamiclib -nodefaultrpaths \
|
||||
-o libgcc_s.1$(SHLIB_EXT)_T_$${mlib} \
|
||||
-Wl,-reexport_library,libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} \
|
||||
-lSystem \
|
||||
- -Wl,-reexported_symbols_list,$(srcdir)/config/darwin-unwind.ver \
|
||||
-install_name $(SHLIB_RPATH)/libgcc_s.1.dylib \
|
||||
-compatibility_version 1 -current_version 1.1 ; \
|
||||
done
|
||||
@@ -160,13 +160,14 @@ optionals noSysDirs (
|
||||
|
||||
## Darwin
|
||||
|
||||
# Fixes detection of Darwin on x86_64-darwin. Otherwise, GCC uses a deployment target of 10.5, which crashes ld64.
|
||||
# Fixes detection of Darwin on x86_64-darwin and aarch64-darwin. Otherwise, GCC uses a deployment target of 10.5, which crashes ld64.
|
||||
++ optional (is14 && stdenv.hostPlatform.isDarwin) ../patches/14/libgcc-darwin-detection.patch
|
||||
++ optional (atLeast15 && stdenv.hostPlatform.isDarwin) ../patches/15/libgcc-darwin-detection.patch
|
||||
|
||||
# Fix libgcc_s.1.dylib build on Darwin 11+ by not reexporting unwind symbols that don't exist
|
||||
++ optional (
|
||||
is14 && stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64
|
||||
) ../patches/14/libgcc-darwin-detection.patch
|
||||
++ optional (
|
||||
atLeast15 && stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64
|
||||
) ../patches/15/libgcc-darwin-detection.patch
|
||||
atLeast15 && stdenv.hostPlatform.isDarwin
|
||||
) ../patches/15/libgcc-darwin-fix-reexport.patch
|
||||
|
||||
# Fix detection of bootstrap compiler Ada support (cctools as) on Nix Darwin
|
||||
++ optional (stdenv.hostPlatform.isDarwin && langAda) ./ada-cctools-as-detection-configure.patch
|
||||
|
||||
Reference in New Issue
Block a user