diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix index 4c8ab39165a4..00375db220fe 100644 --- a/pkgs/build-support/bintools-wrapper/default.nix +++ b/pkgs/build-support/bintools-wrapper/default.nix @@ -25,7 +25,9 @@ , nativeTools, noLibc ? false, nativeLibc, nativePrefix ? "" , propagateDoc ? bintools != null && bintools ? man , extraPackages ? [], extraBuildCommands ? "" -, isGNU ? bintools.isGNU or false, isLLVM ? bintools.isLLVM or false +, isGNU ? bintools.isGNU or false +, isLLVM ? bintools.isLLVM or false +, isCCTools ? bintools.isCCTools or false , buildPackages ? {} , targetPackages ? {} , useMacosReexportHack ? false @@ -139,6 +141,7 @@ stdenv.mkDerivation { local dst="$1" local wrapper="$2" export prog="$3" + export use_response_file_by_default=${if isCCTools then "1" else "0"} substituteAll "$wrapper" "$out/bin/$dst" chmod +x "$out/bin/$dst" } diff --git a/pkgs/build-support/bintools-wrapper/ld-wrapper.sh b/pkgs/build-support/bintools-wrapper/ld-wrapper.sh index 86a741602201..cb1160f9bbf7 100644 --- a/pkgs/build-support/bintools-wrapper/ld-wrapper.sh +++ b/pkgs/build-support/bintools-wrapper/ld-wrapper.sh @@ -250,10 +250,18 @@ fi PATH="$path_backup" # Old bash workaround, see above. -@prog@ \ - ${extraBefore+"${extraBefore[@]}"} \ - ${params+"${params[@]}"} \ - ${extraAfter+"${extraAfter[@]}"} + +if (( "${NIX_LD_USE_RESPONSE_FILE:-@use_response_file_by_default@}" >= 1 )); then + @prog@ @<(printf "%q\n" \ + ${extraBefore+"${extraBefore[@]}"} \ + ${params+"${params[@]}"} \ + ${extraAfter+"${extraAfter[@]}"}) +else + @prog@ \ + ${extraBefore+"${extraBefore[@]}"} \ + ${params+"${params[@]}"} \ + ${extraAfter+"${extraAfter[@]}"} +fi if [ -e "@out@/nix-support/post-link-hook" ]; then source @out@/nix-support/post-link-hook diff --git a/pkgs/os-specific/darwin/binutils/default.nix b/pkgs/os-specific/darwin/binutils/default.nix index 3b1a26368732..79418a6474d3 100644 --- a/pkgs/os-specific/darwin/binutils/default.nix +++ b/pkgs/os-specific/darwin/binutils/default.nix @@ -89,6 +89,7 @@ stdenv.mkDerivation { passthru = { inherit targetPrefix; + isCCTools = true; }; meta = { diff --git a/pkgs/os-specific/darwin/cctools/port.nix b/pkgs/os-specific/darwin/cctools/port.nix index 3c48c3ebc0c4..4d8079977513 100644 --- a/pkgs/os-specific/darwin/cctools/port.nix +++ b/pkgs/os-specific/darwin/cctools/port.nix @@ -3,6 +3,7 @@ , libuuid , libobjc ? null, maloader ? null , enableTapiSupport ? true, libtapi +, fetchpatch }: let @@ -42,6 +43,14 @@ stdenv.mkDerivation { patches = [ ./ld-ignore-rpath-link.patch ./ld-rpath-nonfinal.patch + (fetchpatch { + url = "https://github.com/tpoechtrager/cctools-port/commit/4a734070cd2838e49658464003de5b92271d8b9e.patch"; + hash = "sha256-72KaJyu7CHXxJJ1GNq/fz+kW1RslO3UaKI91LhBtiXA="; + }) + (fetchpatch { + url = "https://github.com/MercuryTechnologies/cctools-port/commit/025899b7b3593dedb0c681e689e57c0e7bbd9b80.patch"; + hash = "sha256-SWVUzFaJHH2fu9y8RcU3Nx/QKx60hPE5zFx0odYDeQs="; + }) ] ++ lib.optional stdenv.isDarwin ./darwin-no-memstream.patch;