about summary refs log tree commit diff
path: root/pkgs/os-specific/darwin
diff options
context:
space:
mode:
authorWeijia Wang <9713184+wegank@users.noreply.github.com>2023-07-09 10:55:23 +0300
committerGitHub <noreply@github.com>2023-07-09 10:55:23 +0300
commitc5fd953de9a72b6f59b647658fc9ee132ed89b0b (patch)
tree93dcbcd9c6521360a42d0b3d2fda4f56825157da /pkgs/os-specific/darwin
parentff15181308fa6511fb1e677bb05cf9c67ffcf4a7 (diff)
parent6ebedaddb657e8d72b837b3398462866d5a86cc6 (diff)
Merge pull request #242316 from wegank/reckenrode-cctools-llvm-fix
cctools-llvm: match binutils targetPrefix definition
Diffstat (limited to 'pkgs/os-specific/darwin')
-rw-r--r--pkgs/os-specific/darwin/cctools/llvm.nix8
1 files changed, 5 insertions, 3 deletions
diff --git a/pkgs/os-specific/darwin/cctools/llvm.nix b/pkgs/os-specific/darwin/cctools/llvm.nix
index 290ded7920c1b..dcaca355af5e7 100644
--- a/pkgs/os-specific/darwin/cctools/llvm.nix
+++ b/pkgs/os-specific/darwin/cctools/llvm.nix
@@ -1,9 +1,11 @@
 # Create a cctools-compatible bintools that uses equivalent tools from LLVM in place of the ones
 # from cctools when possible.
 
-{ lib, stdenv, makeWrapper, cctools-port, llvmPackages, enableManpages ? true }:
+{ lib, stdenv, makeWrapper, cctools-port, llvmPackages, enableManpages ? stdenv.targetPlatform == stdenv.hostPlatform }:
 
 let
+  inherit (stdenv) targetPlatform hostPlatform;
+
   cctoolsVersion = lib.getVersion cctools-port;
   llvmVersion = llvmPackages.release_version;
 
@@ -52,7 +54,7 @@ let
   ++ lib.optional (!useLLVMOtool) "otool"
   ++ lib.optional (!useLLVMStrip) "strip";
 
-  inherit (stdenv.cc) targetPrefix;
+  targetPrefix = lib.optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-";
 
   linkManPages = pkg: source: target: lib.optionalString enableManpages ''
     sourcePath=${pkg}/share/man/man1/${source}.1.gz
@@ -81,7 +83,7 @@ stdenv.mkDerivation {
     makeWrapper "${lib.getBin llvmPackages.clang-unwrapped}/bin/clang" "$out/bin/${targetPrefix}as" \
       --add-flags "-x assembler -integrated-as -c"
 
-    ln -s "${lib.getBin llvmPackages.bintools-unwrapped}/bin/llvm-ar" "$out/bin/${targetPrefix}ar"
+    ln -s "${lib.getBin llvmPackages.bintools-unwrapped}/bin/${targetPrefix}llvm-ar" "$out/bin/${targetPrefix}ar"
     ${linkManPages llvmPackages.llvm-manpages "llvm-ar" "ar"}
 
     for tool in ${toString llvm_bins}; do