From 16a90832cd52dc2a6aa30cb15a128babddd095c9 Mon Sep 17 00:00:00 2001 From: Daiderd Jordan Date: Wed, 9 Nov 2016 20:01:54 +0100 Subject: [PATCH] darwin.Libsystem: export _mach_init_routine --- .../Libsystem/default.nix | 18 +++++++++++------- .../Libsystem/system_symbols | 1 + 2 files changed, 12 insertions(+), 7 deletions(-) create mode 100644 pkgs/os-specific/darwin/apple-source-releases/Libsystem/system_symbols diff --git a/pkgs/os-specific/darwin/apple-source-releases/Libsystem/default.nix b/pkgs/os-specific/darwin/apple-source-releases/Libsystem/default.nix index aac213bb8047..92c54d9b679e 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/Libsystem/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/Libsystem/default.nix @@ -56,9 +56,8 @@ appleDerivation rec { # The startup object files cp ${Csu}/lib/* $out/lib - # Narrowly speaking, these would work if we re-exported libsystem_c and libsystem_kernel, - # but we also need to run the original central libsystem constructor (which initializes - # a ton of crap for its consitutent libraries) so we link against the central library here. + # We can't re-exported libsystem_c and libsystem_kernel directly, + # so we link against the central library here. mkdir -p $out/lib/system ld -macosx_version_min 10.7 -arch x86_64 -dylib \ -o $out/lib/system/libsystem_c.dylib \ @@ -70,8 +69,14 @@ appleDerivation rec { /usr/lib/libSystem.dylib \ -reexported_symbols_list ${./system_kernel_symbols} - libs=$(otool -arch x86_64 -L /usr/lib/libSystem.dylib | tail -n +3 | awk '{ print $1 }') + # The umbrella libSystem also exports some symbols, + # but we don't want to pull in everything from the other libraries. + ld -macosx_version_min 10.7 -arch x86_64 -dylib \ + -o $out/lib/libSystem_internal.dylib \ + /usr/lib/libSystem.dylib \ + -reexported_symbols_list ${./system_symbols} + libs=$(otool -arch x86_64 -L /usr/lib/libSystem.dylib | tail -n +3 | awk '{ print $1 }') for i in $libs; do if [ "$i" != "/usr/lib/system/libsystem_kernel.dylib" ] && [ "$i" != "/usr/lib/system/libsystem_c.dylib" ]; then @@ -79,14 +84,13 @@ appleDerivation rec { fi done - ld -macosx_version_min 10.7 \ - -arch x86_64 \ - -dylib \ + ld -macosx_version_min 10.7 -arch x86_64 -dylib \ -o $out/lib/libSystem.B.dylib \ -compatibility_version 1.0 \ -current_version 1226.10.1 \ -reexport_library $out/lib/system/libsystem_c.dylib \ -reexport_library $out/lib/system/libsystem_kernel.dylib \ + -reexport_library $out/lib/libSystem_internal.dylib \ $args ln -s libSystem.B.dylib $out/lib/libSystem.dylib diff --git a/pkgs/os-specific/darwin/apple-source-releases/Libsystem/system_symbols b/pkgs/os-specific/darwin/apple-source-releases/Libsystem/system_symbols new file mode 100644 index 000000000000..75a00acac493 --- /dev/null +++ b/pkgs/os-specific/darwin/apple-source-releases/Libsystem/system_symbols @@ -0,0 +1 @@ +_mach_init_routine