diff options
author | Alyssa Ross <hi@alyssa.is> | 2023-04-26 12:53:36 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2023-04-28 10:01:22 +0000 |
commit | 3e0cb1ab7d27ee531915948c751c612c850e77a5 (patch) | |
tree | 2f1fb820d0c2267ef7d2d94acc8ebb1df5f569ae /pkgs/development/compilers/llvm/14 | |
parent | 6f72e87e60c1fd284c77c86aac2c033251b58a8c (diff) |
compiler-rt: use -ffreestanding when no libc
This fixes building for x86_64-windows with no libc (for UEFI). Otherwise, it would try to include a malloc header.
Diffstat (limited to 'pkgs/development/compilers/llvm/14')
-rw-r--r-- | pkgs/development/compilers/llvm/14/compiler-rt/default.nix | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/pkgs/development/compilers/llvm/14/compiler-rt/default.nix b/pkgs/development/compilers/llvm/14/compiler-rt/default.nix index 021eba5a7b63f..98ee8135b8fa0 100644 --- a/pkgs/development/compilers/llvm/14/compiler-rt/default.nix +++ b/pkgs/development/compilers/llvm/14/compiler-rt/default.nix @@ -54,8 +54,6 @@ stdenv.mkDerivation { "-DCMAKE_CXX_COMPILER_WORKS=ON" "-DCOMPILER_RT_BAREMETAL_BUILD=ON" "-DCMAKE_SIZEOF_VOID_P=${toString (stdenv.hostPlatform.parsed.cpu.bits / 8)}" - ] ++ lib.optionals (useLLVM && !haveLibc) [ - "-DCMAKE_C_FLAGS=-nodefaultlibs" ] ++ lib.optionals (useLLVM) [ "-DCOMPILER_RT_BUILD_BUILTINS=ON" #https://stackoverflow.com/questions/53633705/cmake-the-c-compiler-is-not-able-to-compile-a-simple-test-program @@ -109,6 +107,10 @@ stdenv.mkDerivation { --replace "#include <assert.h>" "" ''; + preConfigure = lib.optionalString (useLLVM && !haveLibc) '' + cmakeFlagsArray+=(-DCMAKE_C_FLAGS="-nodefaultlibs -ffreestanding") + ''; + # Hack around weird upsream RPATH bug postInstall = lib.optionalString (stdenv.hostPlatform.isDarwin || stdenv.hostPlatform.isWasm) '' ln -s "$out/lib"/*/* "$out/lib" |