From ddd17201abbec8bf04e55164b995eb148ae94b48 Mon Sep 17 00:00:00 2001 From: Andrew Childs Date: Thu, 30 Jul 2020 00:32:34 +0900 Subject: [PATCH] compiler-rt: prevent platform sniffing on Darwin Exposed by the tbd stubs which contains fat libraries. The previously used proxy libraries were x86_64 only. --- pkgs/development/compilers/llvm/10/compiler-rt.nix | 5 +++++ pkgs/development/compilers/llvm/5/compiler-rt.nix | 5 +++++ pkgs/development/compilers/llvm/6/compiler-rt.nix | 5 +++++ pkgs/development/compilers/llvm/7/compiler-rt.nix | 5 +++++ pkgs/development/compilers/llvm/8/compiler-rt.nix | 5 +++++ pkgs/development/compilers/llvm/9/compiler-rt.nix | 5 +++++ 6 files changed, 30 insertions(+) diff --git a/pkgs/development/compilers/llvm/10/compiler-rt.nix b/pkgs/development/compilers/llvm/10/compiler-rt.nix index 47bbe808ac2..e6882cbabb8 100644 --- a/pkgs/development/compilers/llvm/10/compiler-rt.nix +++ b/pkgs/development/compilers/llvm/10/compiler-rt.nix @@ -41,6 +41,11 @@ stdenv.mkDerivation rec { "-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY" ] ++ stdenv.lib.optionals (bareMetal) [ "-DCOMPILER_RT_OS_DIR=baremetal" + ] ++ stdenv.lib.optionals (stdenv.hostPlatform.isDarwin) [ + # The compiler-rt build infrastructure sniffs supported platforms on Darwin + # and finds i386;x86_64;x86_64h. We only build for x86_64, so linking fails + # when it tries to use libc++ and libc++api for i386. + "-DDARWIN_osx_ARCHS=${stdenv.hostPlatform.parsed.cpu.name}" ]; outputs = [ "out" "dev" ]; diff --git a/pkgs/development/compilers/llvm/5/compiler-rt.nix b/pkgs/development/compilers/llvm/5/compiler-rt.nix index 32d6dd3d479..41f2b24b057 100644 --- a/pkgs/development/compilers/llvm/5/compiler-rt.nix +++ b/pkgs/development/compilers/llvm/5/compiler-rt.nix @@ -41,6 +41,11 @@ stdenv.mkDerivation { "-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY" ] ++ stdenv.lib.optionals (bareMetal) [ "-DCOMPILER_RT_OS_DIR=baremetal" + ] ++ stdenv.lib.optionals (stdenv.hostPlatform.isDarwin) [ + # The compiler-rt build infrastructure sniffs supported platforms on Darwin + # and finds i386;x86_64;x86_64h. We only build for x86_64, so linking fails + # when it tries to use libc++ and libc++api for i386. + "-DDARWIN_osx_ARCHS=${stdenv.hostPlatform.parsed.cpu.name}" ]; outputs = [ "out" "dev" ]; diff --git a/pkgs/development/compilers/llvm/6/compiler-rt.nix b/pkgs/development/compilers/llvm/6/compiler-rt.nix index 89f25cad2c5..8bd61f5d7f7 100644 --- a/pkgs/development/compilers/llvm/6/compiler-rt.nix +++ b/pkgs/development/compilers/llvm/6/compiler-rt.nix @@ -41,6 +41,11 @@ stdenv.mkDerivation { "-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY" ] ++ stdenv.lib.optionals (bareMetal) [ "-DCOMPILER_RT_OS_DIR=baremetal" + ] ++ stdenv.lib.optionals (stdenv.hostPlatform.isDarwin) [ + # The compiler-rt build infrastructure sniffs supported platforms on Darwin + # and finds i386;x86_64;x86_64h. We only build for x86_64, so linking fails + # when it tries to use libc++ and libc++api for i386. + "-DDARWIN_osx_ARCHS=${stdenv.hostPlatform.parsed.cpu.name}" ]; outputs = [ "out" "dev" ]; diff --git a/pkgs/development/compilers/llvm/7/compiler-rt.nix b/pkgs/development/compilers/llvm/7/compiler-rt.nix index 97a5d73f304..ec9b7e6e6ad 100644 --- a/pkgs/development/compilers/llvm/7/compiler-rt.nix +++ b/pkgs/development/compilers/llvm/7/compiler-rt.nix @@ -41,6 +41,11 @@ stdenv.mkDerivation { "-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY" ] ++ stdenv.lib.optionals (bareMetal) [ "-DCOMPILER_RT_OS_DIR=baremetal" + ] ++ stdenv.lib.optionals (stdenv.hostPlatform.isDarwin) [ + # The compiler-rt build infrastructure sniffs supported platforms on Darwin + # and finds i386;x86_64;x86_64h. We only build for x86_64, so linking fails + # when it tries to use libc++ and libc++api for i386. + "-DDARWIN_osx_ARCHS=${stdenv.hostPlatform.parsed.cpu.name}" ]; outputs = [ "out" "dev" ]; diff --git a/pkgs/development/compilers/llvm/8/compiler-rt.nix b/pkgs/development/compilers/llvm/8/compiler-rt.nix index a907d408655..3c6265c4fca 100644 --- a/pkgs/development/compilers/llvm/8/compiler-rt.nix +++ b/pkgs/development/compilers/llvm/8/compiler-rt.nix @@ -41,6 +41,11 @@ stdenv.mkDerivation { "-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY" ] ++ stdenv.lib.optionals (bareMetal) [ "-DCOMPILER_RT_OS_DIR=baremetal" + ] ++ stdenv.lib.optionals (stdenv.hostPlatform.isDarwin) [ + # The compiler-rt build infrastructure sniffs supported platforms on Darwin + # and finds i386;x86_64;x86_64h. We only build for x86_64, so linking fails + # when it tries to use libc++ and libc++api for i386. + "-DDARWIN_osx_ARCHS=${stdenv.hostPlatform.parsed.cpu.name}" ]; outputs = [ "out" "dev" ]; diff --git a/pkgs/development/compilers/llvm/9/compiler-rt.nix b/pkgs/development/compilers/llvm/9/compiler-rt.nix index 394f66ff7f1..13b0b522771 100644 --- a/pkgs/development/compilers/llvm/9/compiler-rt.nix +++ b/pkgs/development/compilers/llvm/9/compiler-rt.nix @@ -41,6 +41,11 @@ stdenv.mkDerivation rec { "-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY" ] ++ stdenv.lib.optionals (bareMetal) [ "-DCOMPILER_RT_OS_DIR=baremetal" + ] ++ stdenv.lib.optionals (stdenv.hostPlatform.isDarwin) [ + # The compiler-rt build infrastructure sniffs supported platforms on Darwin + # and finds i386;x86_64;x86_64h. We only build for x86_64, so linking fails + # when it tries to use libc++ and libc++api for i386. + "-DDARWIN_osx_ARCHS=${stdenv.hostPlatform.parsed.cpu.name}" ]; outputs = [ "out" "dev" ];