llvmPackages_11.compiler-rt: fix build on x86_64-darwin

Amendment to changes in 56fcbcd1543188fcc855df7e79fee0a8df259681.

Co-authored-by: John Ericson <John.Ericson@Obsidian.Systems>

authored by

Andrew Childs
John Ericson
and committed by
Jonathan Ringer
2987d66d 84afb3a1

+11 -11
+6 -6
pkgs/development/compilers/llvm/11/compiler-rt/default.nix
··· 3 3 let 4 4 5 5 useLLVM = stdenv.hostPlatform.useLLVM or false; 6 - isDarwin = stdenv.hostPlatform.isDarwin; 6 + isNewDarwinBootstrap = stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64; 7 7 bareMetal = stdenv.hostPlatform.parsed.kernel.name == "none"; 8 8 haveLibc = stdenv.cc.libc != null; 9 9 inherit (stdenv.hostPlatform) isMusl; ··· 25 25 "-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON" 26 26 "-DCMAKE_C_COMPILER_TARGET=${stdenv.hostPlatform.config}" 27 27 "-DCMAKE_ASM_COMPILER_TARGET=${stdenv.hostPlatform.config}" 28 - ] ++ lib.optionals (useLLVM || isDarwin || bareMetal || isMusl) [ 28 + ] ++ lib.optionals (useLLVM || bareMetal || isMusl || isNewDarwinBootstrap) [ 29 29 "-DCOMPILER_RT_BUILD_SANITIZERS=OFF" 30 30 "-DCOMPILER_RT_BUILD_XRAY=OFF" 31 31 "-DCOMPILER_RT_BUILD_LIBFUZZER=OFF" 32 32 "-DCOMPILER_RT_BUILD_PROFILE=OFF" 33 - ] ++ lib.optionals ((useLLVM || isDarwin || bareMetal) && !haveLibc) [ 33 + ] ++ lib.optionals (!haveLibc || bareMetal) [ 34 34 "-DCMAKE_C_COMPILER_WORKS=ON" 35 35 "-DCMAKE_CXX_COMPILER_WORKS=ON" 36 36 "-DCOMPILER_RT_BAREMETAL_BUILD=ON" 37 37 "-DCMAKE_SIZEOF_VOID_P=${toString (stdenv.hostPlatform.parsed.cpu.bits / 8)}" 38 - ] ++ lib.optionals ((useLLVM || isDarwin) && !haveLibc) [ 38 + ] ++ lib.optionals (!haveLibc) [ 39 39 "-DCMAKE_C_FLAGS=-nodefaultlibs" 40 - ] ++ lib.optionals (useLLVM || isDarwin) [ 40 + ] ++ lib.optionals (useLLVM || isNewDarwinBootstrap) [ 41 41 "-DCOMPILER_RT_BUILD_BUILTINS=ON" 42 42 #https://stackoverflow.com/questions/53633705/cmake-the-c-compiler-is-not-able-to-compile-a-simple-test-program 43 43 "-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY" ··· 62 62 ++ lib.optional stdenv.hostPlatform.isAarch32 ./armv7l.patch; 63 63 64 64 65 - preConfigure = lib.optionalString isDarwin '' 65 + preConfigure = lib.optionalString stdenv.hostPlatform.isDarwin '' 66 66 cmakeFlagsArray+=("-DCMAKE_LIPO=$(command -v ${stdenv.cc.targetPrefix}lipo)") 67 67 ''; 68 68
+5 -5
pkgs/development/compilers/llvm/11/default.nix
··· 213 213 214 214 compiler-rt-libc = callPackage ./compiler-rt { 215 215 inherit llvm_meta; 216 - stdenv = if (stdenv.hostPlatform.useLLVM or false) || stdenv.hostPlatform.isDarwin 216 + stdenv = if (stdenv.hostPlatform.useLLVM or false) || (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) 217 217 then overrideCC stdenv buildLlvmTools.clangNoCompilerRtWithLibc 218 218 else stdenv; 219 219 }; 220 220 221 221 compiler-rt-no-libc = callPackage ./compiler-rt { 222 222 inherit llvm_meta; 223 - stdenv = if (stdenv.hostPlatform.useLLVM or false) || stdenv.hostPlatform.isDarwin 223 + stdenv = if (stdenv.hostPlatform.useLLVM or false) || (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) 224 224 then overrideCC stdenv buildLlvmTools.clangNoCompilerRt 225 225 else stdenv; 226 226 }; ··· 236 236 237 237 libcxx = callPackage ./libcxx { 238 238 inherit llvm_meta; 239 - stdenv = if (stdenv.hostPlatform.useLLVM or false) || stdenv.hostPlatform.isDarwin 239 + stdenv = if (stdenv.hostPlatform.useLLVM or false) || (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) 240 240 then overrideCC stdenv buildLlvmTools.clangNoLibcxx 241 241 else stdenv; 242 242 }; 243 243 244 244 libcxxabi = callPackage ./libcxxabi { 245 245 inherit llvm_meta; 246 - stdenv = if (stdenv.hostPlatform.useLLVM or false) || stdenv.hostPlatform.isDarwin 246 + stdenv = if (stdenv.hostPlatform.useLLVM or false) || (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) 247 247 then overrideCC stdenv buildLlvmTools.clangNoLibcxx 248 248 else stdenv; 249 249 }; 250 250 251 251 libunwind = callPackage ./libunwind { 252 252 inherit llvm_meta; 253 - stdenv = if (stdenv.hostPlatform.useLLVM or false) || stdenv.hostPlatform.isDarwin 253 + stdenv = if (stdenv.hostPlatform.useLLVM or false) || (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) 254 254 then overrideCC stdenv buildLlvmTools.clangNoLibcxx 255 255 else stdenv; 256 256 };