Use GCC runtime libraries with LLVM toolchain
Use the GCC runtime library from the prebuild Genode toolchain.
This commit is contained in:
parent
18e59cd590
commit
f463b467ce
|
@ -134,7 +134,6 @@ in nullPkgs // {
|
|||
inherit (stdenvAdapters) overrideCC;
|
||||
buildLlvmTools = buildPackages.llvmPackages_11.tools;
|
||||
targetLlvmLibraries = targetPackages.llvmPackages_11.libraries;
|
||||
inherit (final.genodePackages.genodeSources) genodeBase;
|
||||
} // stdenv.lib.optionalAttrs
|
||||
(stdenv.hostPlatform.isi686 && buildPackages.stdenv.cc.isGNU) {
|
||||
stdenv = gcc7Stdenv;
|
||||
|
|
|
@ -49,7 +49,7 @@ let
|
|||
|
||||
# Patch for standalone doc building
|
||||
sed -i '1s,^,find_package(Sphinx REQUIRED)\n,' docs/CMakeLists.txt
|
||||
'' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
|
||||
'' + stdenv.lib.optionalString (stdenv.hostPlatform.isMusl || stdenv.targetPlatform.isGenode) ''
|
||||
sed -i -e 's/lgcc_s/lgcc_eh/' lib/Driver/ToolChains/*.cpp
|
||||
'' + stdenv.lib.optionalString stdenv.hostPlatform.isDarwin ''
|
||||
substituteInPlace tools/extra/clangd/CMakeLists.txt \
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
diff --git a/lib/builtins/assembly.h b/lib/builtins/assembly.h
|
||||
index 3f5e59b2544..97d06d6ccd1 100644
|
||||
--- a/lib/builtins/assembly.h
|
||||
+++ b/lib/builtins/assembly.h
|
||||
@@ -45,7 +45,7 @@
|
||||
#define CONST_SECTION .section .rodata
|
||||
|
||||
#if defined(__GNU__) || defined(__FreeBSD__) || defined(__Fuchsia__) || \
|
||||
- defined(__linux__)
|
||||
+ defined(__linux__) || defined(__GENODE__)
|
||||
#define NO_EXEC_STACK_DIRECTIVE .section .note.GNU-stack,"",%progbits
|
||||
#else
|
||||
#define NO_EXEC_STACK_DIRECTIVE
|
|
@ -3,7 +3,7 @@
|
|||
, buildPackages
|
||||
, buildLlvmTools # tools, but from the previous stage, for cross
|
||||
, targetLlvmLibraries # libraries, but from the next stage, for cross
|
||||
, genodeBase ? null
|
||||
, genodePackages ? null
|
||||
}:
|
||||
|
||||
let
|
||||
|
@ -93,18 +93,26 @@ let
|
|||
|
||||
bintools = callPackage ./bintools.nix {};
|
||||
|
||||
lldClang = wrapCCWith rec {
|
||||
lldClang = if stdenv.targetPlatform.isGenode then
|
||||
wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
bintools = wrapBintoolsWith { inherit (tools) bintools; };
|
||||
extraBuildCommands = with genodePackages.genodeSources; ''
|
||||
echo "--gcc-toolchain=${toolchain.cc}" >> $out/nix-support/cc-cflags
|
||||
echo "--sysroot=${genodeBase}" >> $out/nix-support/cc-cflags
|
||||
echo "-I${genodeBase}/include" >> $out/nix-support/cc-cflags
|
||||
echo "-L ${genodeBase}" >> $out/nix-support/cc-cflags
|
||||
'';
|
||||
}
|
||||
else
|
||||
wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
libcxx = targetLlvmLibraries.libcxx;
|
||||
bintools = wrapBintoolsWith {
|
||||
inherit (tools) bintools;
|
||||
};
|
||||
extraPackages = [
|
||||
targetLlvmLibraries.libcxxabi
|
||||
targetLlvmLibraries.compiler-rt
|
||||
] ++ stdenv.lib.optionals (!stdenv.targetPlatform.isWasm) [
|
||||
targetLlvmLibraries.libunwind
|
||||
];
|
||||
bintools = wrapBintoolsWith { inherit (tools) bintools; };
|
||||
extraPackages =
|
||||
[ targetLlvmLibraries.libcxxabi targetLlvmLibraries.compiler-rt ]
|
||||
++ stdenv.lib.optionals (!stdenv.targetPlatform.isWasm)
|
||||
[ targetLlvmLibraries.libunwind ];
|
||||
extraBuildCommands = ''
|
||||
echo "-rtlib=compiler-rt -Wno-unused-command-line-argument" >> $out/nix-support/cc-cflags
|
||||
echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
|
||||
|
@ -112,10 +120,6 @@ let
|
|||
echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags
|
||||
'' + stdenv.lib.optionalString stdenv.targetPlatform.isWasm ''
|
||||
echo "-fno-exceptions" >> $out/nix-support/cc-cflags
|
||||
'' + stdenv.lib.optionalString stdenv.targetPlatform.isGenode ''
|
||||
echo "-I${genodeBase}/include" >> $out/nix-support/cc-cflags
|
||||
echo "--sysroot=${genodeBase}" >> $out/nix-support/cc-cflags
|
||||
echo "-L ${genodeBase}" >> $out/nix-support/cc-cflags
|
||||
'' + mkExtraBuildCommands cc;
|
||||
};
|
||||
|
||||
|
@ -132,11 +136,6 @@ let
|
|||
echo "-rtlib=compiler-rt" >> $out/nix-support/cc-cflags
|
||||
echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
|
||||
echo "-nostdlib++" >> $out/nix-support/cc-cflags
|
||||
'' + stdenv.lib.optionalString stdenv.targetPlatform.isGenode ''
|
||||
echo "-I${genodeBase}/include" >> $out/nix-support/cc-cflags
|
||||
echo "--sysroot=${genodeBase}" >> $out/nix-support/cc-cflags
|
||||
echo "-L${genodeBase}" >> $out/nix-support/cc-cflags
|
||||
echo "-noposix" >> $out/nix-support/cc-cflags
|
||||
'' + mkExtraBuildCommands cc;
|
||||
};
|
||||
|
||||
|
|
|
@ -14,11 +14,6 @@ stdenv.mkDerivation {
|
|||
mv llvm-* llvm
|
||||
'';
|
||||
|
||||
patches =
|
||||
stdenv.lib.optionals stdenv.targetPlatform.isGenode [
|
||||
./genode.patch ./genode-locale.patch
|
||||
];
|
||||
|
||||
preConfigure = lib.optionalString stdenv.hostPlatform.isMusl ''
|
||||
patchShebangs utils/cat_files.py
|
||||
'';
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
diff --git a/include/__config b/include/__config
|
||||
index 575147cead42..8f0bb7248113 100644
|
||||
--- a/include/__config
|
||||
+++ b/include/__config
|
||||
@@ -921,7 +921,7 @@ typedef unsigned int char32_t;
|
||||
|
||||
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
|
||||
// Most unix variants have catopen. These are the specific ones that don't.
|
||||
-# if !defined(__BIONIC__) && !defined(_NEWLIB_VERSION)
|
||||
+# if !defined(__BIONIC__) && !defined(_NEWLIB_VERSION) && !defined(__GENODE__)
|
||||
# define _LIBCPP_HAS_CATOPEN 1
|
||||
# endif
|
||||
#endif
|
||||
@@ -1130,6 +1130,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
|
||||
defined(__APPLE__) || \
|
||||
defined(__CloudABI__) || \
|
||||
defined(__sun__) || \
|
||||
+ defined(__GENODE__) || \
|
||||
(defined(__MINGW32__) && __has_include(<pthread.h>))
|
||||
# define _LIBCPP_HAS_THREAD_API_PTHREAD
|
||||
# elif defined(__Fuchsia__)
|
||||
diff --git a/utils/google-benchmark/src/internal_macros.h b/utils/google-benchmark/src/internal_macros.h
|
||||
index 5dbf4fd27521..4699c5ed9139 100644
|
||||
--- a/utils/google-benchmark/src/internal_macros.h
|
||||
+++ b/utils/google-benchmark/src/internal_macros.h
|
||||
@@ -70,6 +70,8 @@
|
||||
#define BENCHMARK_OS_FUCHSIA 1
|
||||
#elif defined (__SVR4) && defined (__sun)
|
||||
#define BENCHMARK_OS_SOLARIS 1
|
||||
+#elif defined(__GENODE__)
|
||||
+ #define BENCHMARK_OS_GENODE 1
|
||||
#endif
|
||||
|
||||
#if defined(__ANDROID__) && defined(__GLIBCXX__)
|
|
@ -33,8 +33,6 @@ stdenv.mkDerivation {
|
|||
patch -p1 -d libcxx -i ${../libcxx-0001-musl-hacks.patch}
|
||||
'' + stdenv.lib.optionalString stdenv.hostPlatform.isWasm ''
|
||||
patch -p1 -d llvm -i ${./libcxxabi-wasm.patch}
|
||||
'' + stdenv.lib.optionalString stdenv.targetPlatform.isGenode ''
|
||||
patch -p1 -d libcxx -i ${./libc++/genode.patch}
|
||||
'';
|
||||
|
||||
installPhase = if stdenv.isDarwin
|
||||
|
|
Loading…
Reference in New Issue