Loading pkgs/os-specific/darwin/apple-source-releases/libffi/package.nix 0 → 100644 +113 −0 Original line number Diff line number Diff line { lib, autoreconfHook, dejagnu, mkAppleDerivation, stdenv, testers, texinfo, # test suite depends on dejagnu which cannot be used during bootstrapping # dejagnu also requires tcl which can't be built statically at the moment doCheck ? !(stdenv.hostPlatform.isStatic), }: mkAppleDerivation (finalAttrs: { releaseName = "libffi"; outputs = [ "out" "dev" "man" "info" ]; patches = [ # Clang 18 requires that no non-private symbols by defined after cfi_startproc. Apply the upstream libffi fix. ./patches/llvm-18-compatibility.patch ]; # Make sure libffi is using the trampolines dylib in this package not the system one. postPatch = '' substituteInPlace src/closures.c --replace-fail /usr/lib "$out/lib" ''; enableParallelBuilding = true; nativeBuildInputs = [ autoreconfHook texinfo ]; configurePlatforms = [ "build" "host" ]; configureFlags = [ "--with-gcc-arch=generic" # no detection of -march= or -mtune= "--enable-pax_emutramp" ]; # Make sure aarch64-darwin is using the trampoline dylib. postConfigure = lib.optionalString stdenv.hostPlatform.isAarch64 '' echo '#define FFI_TRAMPOLINE_WHOLE_DYLIB 1' >> aarch64-apple-darwin/fficonfig.h ''; postBuild = lib.optionalString stdenv.hostPlatform.isAarch64 '' $CC src/aarch64/trampoline.S -dynamiclib -o libffi-trampolines.dylib \ -Iinclude -Iaarch64-apple-darwin -Iaarch64-apple-darwin/include \ -install_name "$out/lib/libffi-trampoline.dylib" -Wl,-compatibility_version,1 -Wl,-current_version,1 ''; postInstall = # The Darwin SDK puts the headers in `include/ffi`. Add a symlink for compatibility. '' ln -s "$dev/include" "$dev/include/ffi" '' # Install the trampoline dylib since it is build manually. + lib.optionalString stdenv.hostPlatform.isAarch64 '' cp libffi-trampolines.dylib "$out/lib/libffi-trampolines.dylib" ''; preCheck = '' # The tests use -O0 which is not compatible with -D_FORTIFY_SOURCE. NIX_HARDENING_ENABLE=''${NIX_HARDENING_ENABLE/fortify3/} NIX_HARDENING_ENABLE=''${NIX_HARDENING_ENABLE/fortify/} ''; dontStrip = stdenv.hostPlatform != stdenv.buildPlatform; # Don't run the native `strip' when cross-compiling. inherit doCheck; nativeCheckInputs = [ dejagnu ]; passthru = { tests = { pkg-config = testers.hasPkgConfigModules { package = finalAttrs.finalPackage; }; }; }; meta = { description = "Foreign function call interface library"; longDescription = '' The libffi library provides a portable, high level programming interface to various calling conventions. This allows a programmer to call any function specified by a call interface description at run-time. FFI stands for Foreign Function Interface. A foreign function interface is the popular name for the interface that allows code written in one language to call code written in another language. The libffi library really only provides the lowest, machine dependent layer of a fully featured foreign function interface. A layer must exist above libffi that handles type conversions for values passed between the two languages. ''; homepage = "https://github.com/apple-oss-distributions/libffi/"; license = lib.licenses.mit; pkgConfigModules = [ "libffi" ]; }; }) pkgs/os-specific/darwin/apple-source-releases/libffi/patches/llvm-18-compatibility.patch 0 → 100644 +34 −0 Original line number Diff line number Diff line diff --git a/src/aarch64/sysv.S b/src/aarch64/sysv.S index eeaf3f8..329889c 100644 --- a/src/aarch64/sysv.S +++ b/src/aarch64/sysv.S @@ -76,8 +76,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ x5 closure */ - cfi_startproc CNAME(ffi_call_SYSV): + cfi_startproc /* Sign the lr with x1 since that is where it will be stored */ SIGN_LR_WITH_REG(x1) @@ -268,8 +268,8 @@ CNAME(ffi_closure_SYSV_V): #endif .align 4 - cfi_startproc CNAME(ffi_closure_SYSV): + cfi_startproc SIGN_LR stp x29, x30, [sp, #-ffi_closure_SYSV_FS]! cfi_adjust_cfa_offset (ffi_closure_SYSV_FS) @@ -500,8 +500,8 @@ CNAME(ffi_go_closure_SYSV_V): #endif .align 4 - cfi_startproc CNAME(ffi_go_closure_SYSV): + cfi_startproc stp x29, x30, [sp, #-ffi_closure_SYSV_FS]! cfi_adjust_cfa_offset (ffi_closure_SYSV_FS) cfi_rel_offset (x29, 0) pkgs/os-specific/darwin/apple-source-releases/versions.json +4 −0 Original line number Diff line number Diff line Loading @@ -51,6 +51,10 @@ "hash": "sha256-/79jS//IBZiQBumGA60lKDmddQCzl/r8QnviD6lGXNg=", "version": "448.0.3" }, "libffi": { "hash": "sha256-tQJdKCz2OIwVtorHQapq9Xs2e1Ac96lGEzIWUXmsasY=", "version": "35" }, "libiconv": { "hash": "sha256-4I70hci8SUQ5QERbImP3htjYCGXdZZ0a6RM7ggUnVa4=", "version": "107" Loading Loading
pkgs/os-specific/darwin/apple-source-releases/libffi/package.nix 0 → 100644 +113 −0 Original line number Diff line number Diff line { lib, autoreconfHook, dejagnu, mkAppleDerivation, stdenv, testers, texinfo, # test suite depends on dejagnu which cannot be used during bootstrapping # dejagnu also requires tcl which can't be built statically at the moment doCheck ? !(stdenv.hostPlatform.isStatic), }: mkAppleDerivation (finalAttrs: { releaseName = "libffi"; outputs = [ "out" "dev" "man" "info" ]; patches = [ # Clang 18 requires that no non-private symbols by defined after cfi_startproc. Apply the upstream libffi fix. ./patches/llvm-18-compatibility.patch ]; # Make sure libffi is using the trampolines dylib in this package not the system one. postPatch = '' substituteInPlace src/closures.c --replace-fail /usr/lib "$out/lib" ''; enableParallelBuilding = true; nativeBuildInputs = [ autoreconfHook texinfo ]; configurePlatforms = [ "build" "host" ]; configureFlags = [ "--with-gcc-arch=generic" # no detection of -march= or -mtune= "--enable-pax_emutramp" ]; # Make sure aarch64-darwin is using the trampoline dylib. postConfigure = lib.optionalString stdenv.hostPlatform.isAarch64 '' echo '#define FFI_TRAMPOLINE_WHOLE_DYLIB 1' >> aarch64-apple-darwin/fficonfig.h ''; postBuild = lib.optionalString stdenv.hostPlatform.isAarch64 '' $CC src/aarch64/trampoline.S -dynamiclib -o libffi-trampolines.dylib \ -Iinclude -Iaarch64-apple-darwin -Iaarch64-apple-darwin/include \ -install_name "$out/lib/libffi-trampoline.dylib" -Wl,-compatibility_version,1 -Wl,-current_version,1 ''; postInstall = # The Darwin SDK puts the headers in `include/ffi`. Add a symlink for compatibility. '' ln -s "$dev/include" "$dev/include/ffi" '' # Install the trampoline dylib since it is build manually. + lib.optionalString stdenv.hostPlatform.isAarch64 '' cp libffi-trampolines.dylib "$out/lib/libffi-trampolines.dylib" ''; preCheck = '' # The tests use -O0 which is not compatible with -D_FORTIFY_SOURCE. NIX_HARDENING_ENABLE=''${NIX_HARDENING_ENABLE/fortify3/} NIX_HARDENING_ENABLE=''${NIX_HARDENING_ENABLE/fortify/} ''; dontStrip = stdenv.hostPlatform != stdenv.buildPlatform; # Don't run the native `strip' when cross-compiling. inherit doCheck; nativeCheckInputs = [ dejagnu ]; passthru = { tests = { pkg-config = testers.hasPkgConfigModules { package = finalAttrs.finalPackage; }; }; }; meta = { description = "Foreign function call interface library"; longDescription = '' The libffi library provides a portable, high level programming interface to various calling conventions. This allows a programmer to call any function specified by a call interface description at run-time. FFI stands for Foreign Function Interface. A foreign function interface is the popular name for the interface that allows code written in one language to call code written in another language. The libffi library really only provides the lowest, machine dependent layer of a fully featured foreign function interface. A layer must exist above libffi that handles type conversions for values passed between the two languages. ''; homepage = "https://github.com/apple-oss-distributions/libffi/"; license = lib.licenses.mit; pkgConfigModules = [ "libffi" ]; }; })
pkgs/os-specific/darwin/apple-source-releases/libffi/patches/llvm-18-compatibility.patch 0 → 100644 +34 −0 Original line number Diff line number Diff line diff --git a/src/aarch64/sysv.S b/src/aarch64/sysv.S index eeaf3f8..329889c 100644 --- a/src/aarch64/sysv.S +++ b/src/aarch64/sysv.S @@ -76,8 +76,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ x5 closure */ - cfi_startproc CNAME(ffi_call_SYSV): + cfi_startproc /* Sign the lr with x1 since that is where it will be stored */ SIGN_LR_WITH_REG(x1) @@ -268,8 +268,8 @@ CNAME(ffi_closure_SYSV_V): #endif .align 4 - cfi_startproc CNAME(ffi_closure_SYSV): + cfi_startproc SIGN_LR stp x29, x30, [sp, #-ffi_closure_SYSV_FS]! cfi_adjust_cfa_offset (ffi_closure_SYSV_FS) @@ -500,8 +500,8 @@ CNAME(ffi_go_closure_SYSV_V): #endif .align 4 - cfi_startproc CNAME(ffi_go_closure_SYSV): + cfi_startproc stp x29, x30, [sp, #-ffi_closure_SYSV_FS]! cfi_adjust_cfa_offset (ffi_closure_SYSV_FS) cfi_rel_offset (x29, 0)
pkgs/os-specific/darwin/apple-source-releases/versions.json +4 −0 Original line number Diff line number Diff line Loading @@ -51,6 +51,10 @@ "hash": "sha256-/79jS//IBZiQBumGA60lKDmddQCzl/r8QnviD6lGXNg=", "version": "448.0.3" }, "libffi": { "hash": "sha256-tQJdKCz2OIwVtorHQapq9Xs2e1Ac96lGEzIWUXmsasY=", "version": "35" }, "libiconv": { "hash": "sha256-4I70hci8SUQ5QERbImP3htjYCGXdZZ0a6RM7ggUnVa4=", "version": "107" Loading