forked from mirrors/nixpkgs
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.
This commit is contained in:
parent
6f72e87e60
commit
3e0cb1ab7d
|
@ -40,8 +40,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
|
||||
|
@ -90,6 +88,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"
|
||||
|
|
|
@ -41,8 +41,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 (!haveLibc) [
|
||||
"-DCMAKE_C_FLAGS=-nodefaultlibs"
|
||||
] ++ lib.optionals (useLLVM || isNewDarwinBootstrap) [
|
||||
"-DCOMPILER_RT_BUILD_BUILTINS=ON"
|
||||
#https://stackoverflow.com/questions/53633705/cmake-the-c-compiler-is-not-able-to-compile-a-simple-test-program
|
||||
|
@ -75,6 +73,8 @@ stdenv.mkDerivation {
|
|||
|
||||
preConfigure = lib.optionalString stdenv.hostPlatform.isDarwin ''
|
||||
cmakeFlagsArray+=("-DCMAKE_LIPO=$(command -v ${stdenv.cc.targetPrefix}lipo)")
|
||||
'' + lib.optionalString (!haveLibc) ''
|
||||
cmakeFlagsArray+=("-DCMAKE_C_FLAGS=-nodefaultlibs -ffreestanding")
|
||||
'';
|
||||
|
||||
# TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks
|
||||
|
|
|
@ -42,8 +42,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
|
||||
|
@ -93,6 +91,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"
|
||||
|
|
|
@ -46,8 +46,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
|
||||
|
@ -100,6 +98,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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
@ -110,6 +108,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"
|
||||
|
|
|
@ -38,8 +38,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
|
||||
|
@ -84,6 +82,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"
|
||||
|
|
|
@ -38,8 +38,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
|
||||
|
@ -84,6 +82,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"
|
||||
|
|
|
@ -38,8 +38,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
|
||||
|
@ -87,6 +85,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"
|
||||
|
|
|
@ -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
|
||||
|
@ -71,6 +69,10 @@ stdenv.mkDerivation {
|
|||
"-DCOMPILER_RT_ENABLE_IOS=OFF"
|
||||
];
|
||||
|
||||
preConfigure = lib.optionalString (useLLVM && !haveLibc) ''
|
||||
cmakeFlagsArray+=(-DCMAKE_C_FLAGS="-nodefaultlibs -ffreestanding")
|
||||
'';
|
||||
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
patches = [
|
||||
|
|
Loading…
Reference in a new issue