WiP! llvm: 8 -> 11
This commit is contained in:
parent
8dd8a64db6
commit
dcfd794123
|
@ -63,6 +63,12 @@ in {
|
||||||
else
|
else
|
||||||
coreutils;
|
coreutils;
|
||||||
|
|
||||||
|
crossLibcStdenv = overrideCC stdenv
|
||||||
|
(if stdenv.hostPlatform.useLLVM or false then
|
||||||
|
buildPackages.llvmPackages_11.lldClangNoLibc
|
||||||
|
else
|
||||||
|
buildPackages.gccCrossStageStatic);
|
||||||
|
|
||||||
gdb = addPatches gdb [ ./gdb/genode.patch ];
|
gdb = addPatches gdb [ ./gdb/genode.patch ];
|
||||||
|
|
||||||
genodeLibcCross = callPackage ./libc { };
|
genodeLibcCross = callPackage ./libc { };
|
||||||
|
@ -96,12 +102,14 @@ in {
|
||||||
ncurses = null;
|
ncurses = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
llvmPackages_8 = callPackage ./llvm-8 ({
|
llvmPackages_11 = callPackage ./llvm-11 ({
|
||||||
inherit (stdenvAdapters) overrideCC;
|
inherit (stdenvAdapters) overrideCC;
|
||||||
inherit (final.genodePackages.genodeSources) genodeBase;
|
buildLlvmTools = buildPackages.llvmPackages_11.tools;
|
||||||
buildLlvmTools = buildPackages.llvmPackages_8.tools;
|
targetLlvmLibraries = targetPackages.llvmPackages_11.libraries;
|
||||||
targetLlvmLibraries = targetPackages.llvmPackages_8.libraries;
|
} // stdenv.lib.optionalAttrs
|
||||||
});
|
(stdenv.hostPlatform.isi686 && buildPackages.stdenv.cc.isGNU) {
|
||||||
|
stdenv = gcc7Stdenv;
|
||||||
|
});
|
||||||
|
|
||||||
openssl = overrideHostAttrs openssl (attrs: {
|
openssl = overrideHostAttrs openssl (attrs: {
|
||||||
outputs = [ "out" ]
|
outputs = [ "out" ]
|
||||||
|
|
|
@ -15,9 +15,19 @@ in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } ''
|
||||||
ln -s $prog $out/bin/${prefix}$(basename $prog)
|
ln -s $prog $out/bin/${prefix}$(basename $prog)
|
||||||
done
|
done
|
||||||
for prog in ${llvm}/bin/*; do
|
for prog in ${llvm}/bin/*; do
|
||||||
ln -s $prog $out/bin/${prefix}$(echo $(basename $prog) | sed -e "s|llvm-||")
|
|
||||||
ln -sf $prog $out/bin/${prefix}$(basename $prog)
|
ln -sf $prog $out/bin/${prefix}$(basename $prog)
|
||||||
done
|
done
|
||||||
rm -f $out/bin/${prefix}cat
|
|
||||||
|
ln -s ${llvm}/bin/llvm-ar $out/bin/${prefix}ar
|
||||||
|
ln -s ${llvm}/bin/llvm-as $out/bin/${prefix}as
|
||||||
|
ln -s ${llvm}/bin/llvm-dwp $out/bin/${prefix}dwp
|
||||||
|
ln -s ${llvm}/bin/llvm-nm $out/bin/${prefix}nm
|
||||||
|
ln -s ${llvm}/bin/llvm-objcopy $out/bin/${prefix}objcopy
|
||||||
|
ln -s ${llvm}/bin/llvm-objdump $out/bin/${prefix}objdump
|
||||||
|
ln -s ${llvm}/bin/llvm-ranlib $out/bin/${prefix}ranlib
|
||||||
|
ln -s ${llvm}/bin/llvm-readelf $out/bin/${prefix}readelf
|
||||||
|
ln -s ${llvm}/bin/llvm-size $out/bin/${prefix}size
|
||||||
|
ln -s ${llvm}/bin/llvm-strip $out/bin/${prefix}strip
|
||||||
|
|
||||||
ln -s ${lld}/bin/lld $out/bin/${prefix}ld
|
ln -s ${lld}/bin/lld $out/bin/${prefix}ld
|
||||||
''
|
''
|
|
@ -5,31 +5,32 @@
|
||||||
{ stdenv, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src, python
|
{ stdenv, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src, python
|
||||||
, fixDarwinDylibNames
|
, fixDarwinDylibNames
|
||||||
, enableManpages ? false
|
, enableManpages ? false
|
||||||
, enablePolly ? false # TODO: get this info from llvm (passthru?)
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
self = stdenv.mkDerivation ({
|
self = stdenv.mkDerivation ({
|
||||||
name = "clang-${version}";
|
pname = "clang";
|
||||||
|
inherit version;
|
||||||
|
|
||||||
src = fetch "cfe" "0ihnbdl058gvl2wdy45p5am55bq8ifx8m9mhcsgj9ax8yxlzvvvh";
|
src = fetch "clang" "02ajkij85966vd150iy246mv16dsaph1kfi0y8wnncp8w6nar5hg";
|
||||||
|
inherit clang-tools-extra_src;
|
||||||
|
|
||||||
unpackPhase = ''
|
unpackPhase = ''
|
||||||
unpackFile $src
|
unpackFile $src
|
||||||
mv cfe-${version}* clang
|
mv clang-${version}* clang
|
||||||
sourceRoot=$PWD/clang
|
sourceRoot=$PWD/clang
|
||||||
unpackFile ${clang-tools-extra_src}
|
unpackFile ${clang-tools-extra_src}
|
||||||
mv clang-tools-extra-* $sourceRoot/tools/extra
|
mv clang-tools-extra-* $sourceRoot/tools/extra
|
||||||
'';
|
'';
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake python ]
|
nativeBuildInputs = [ cmake python3 lld ]
|
||||||
++ stdenv.lib.optional enableManpages python.pkgs.sphinx;
|
++ stdenv.lib.optional enableManpages python3.pkgs.sphinx
|
||||||
|
++ stdenv.lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
|
||||||
|
|
||||||
buildInputs = [ libxml2 llvm ]
|
buildInputs = [ libxml2 llvm ];
|
||||||
++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
|
|
||||||
|
|
||||||
cmakeFlags = [
|
cmakeFlags = [
|
||||||
"-DCMAKE_CXX_FLAGS=-std=c++11"
|
"-DCMAKE_CXX_FLAGS=-std=c++14"
|
||||||
"-DCLANGD_BUILD_XPC=OFF"
|
"-DCLANGD_BUILD_XPC=OFF"
|
||||||
] ++ stdenv.lib.optionals enableManpages [
|
] ++ stdenv.lib.optionals enableManpages [
|
||||||
"-DCLANG_INCLUDE_DOCS=ON"
|
"-DCLANG_INCLUDE_DOCS=ON"
|
||||||
|
@ -37,22 +38,11 @@ let
|
||||||
"-DSPHINX_OUTPUT_MAN=ON"
|
"-DSPHINX_OUTPUT_MAN=ON"
|
||||||
"-DSPHINX_OUTPUT_HTML=OFF"
|
"-DSPHINX_OUTPUT_HTML=OFF"
|
||||||
"-DSPHINX_WARNINGS_AS_ERRORS=OFF"
|
"-DSPHINX_WARNINGS_AS_ERRORS=OFF"
|
||||||
] ++ stdenv.lib.optionals enablePolly [
|
|
||||||
"-DWITH_POLLY=ON"
|
|
||||||
"-DLINK_POLLY_INTO_TOOLS=ON"
|
|
||||||
];
|
];
|
||||||
|
|
||||||
patches = [
|
patches = [
|
||||||
./purity.patch
|
./purity.patch
|
||||||
./clang-xpc.patch
|
|
||||||
# Backport for -static-pie, which the latter touches, and which is nice in
|
|
||||||
# its own right.
|
|
||||||
./static-pie.patch
|
|
||||||
# Backport for the `--unwindlib=[libgcc|compiler-rt]` flag, which is
|
|
||||||
# needed for our bootstrapping to not interfere with C.
|
|
||||||
./unwindlib.patch
|
|
||||||
# https://reviews.llvm.org/D51899
|
# https://reviews.llvm.org/D51899
|
||||||
./compiler-rt-baremetal.patch
|
|
||||||
./genode.patch
|
./genode.patch
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -82,8 +72,10 @@ let
|
||||||
|
|
||||||
# Move libclang to 'lib' output
|
# Move libclang to 'lib' output
|
||||||
moveToOutput "lib/libclang.*" "$lib"
|
moveToOutput "lib/libclang.*" "$lib"
|
||||||
|
moveToOutput "lib/libclang-cpp.*" "$lib"
|
||||||
substituteInPlace $out/lib/cmake/clang/ClangTargets-release.cmake \
|
substituteInPlace $out/lib/cmake/clang/ClangTargets-release.cmake \
|
||||||
--replace "\''${_IMPORT_PREFIX}/lib/libclang." "$lib/lib/libclang."
|
--replace "\''${_IMPORT_PREFIX}/lib/libclang." "$lib/lib/libclang." \
|
||||||
|
--replace "\''${_IMPORT_PREFIX}/lib/libclang-cpp." "$lib/lib/libclang-cpp."
|
||||||
|
|
||||||
mkdir -p $python/bin $python/share/clang/
|
mkdir -p $python/bin $python/share/clang/
|
||||||
mv $out/bin/{git-clang-format,scan-view} $python/bin
|
mv $out/bin/{git-clang-format,scan-view} $python/bin
|
||||||
|
@ -99,18 +91,16 @@ let
|
||||||
passthru = {
|
passthru = {
|
||||||
isClang = true;
|
isClang = true;
|
||||||
inherit llvm;
|
inherit llvm;
|
||||||
} // stdenv.lib.optionalAttrs (stdenv.targetPlatform.isLinux || (stdenv.cc.isGNU && stdenv.cc.cc ? gcc)) {
|
|
||||||
gcc = if stdenv.cc.isGNU then stdenv.cc.cc else stdenv.cc.cc.gcc;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
description = "A c, c++, objective-c, and objective-c++ frontend for the llvm compiler";
|
description = "A c, c++, objective-c, and objective-c++ frontend for the llvm compiler";
|
||||||
homepage = http://llvm.org/;
|
homepage = "https://llvm.org/";
|
||||||
license = stdenv.lib.licenses.ncsa;
|
license = stdenv.lib.licenses.ncsa;
|
||||||
platforms = stdenv.lib.platforms.all;
|
platforms = stdenv.lib.platforms.all;
|
||||||
};
|
};
|
||||||
} // stdenv.lib.optionalAttrs enableManpages {
|
} // stdenv.lib.optionalAttrs enableManpages {
|
||||||
name = "clang-manpages-${version}";
|
pname = "clang-manpages";
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
make docs-clang-man
|
make docs-clang-man
|
|
@ -0,0 +1,635 @@
|
||||||
|
diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td
|
||||||
|
index 966cb907b..5bcd5093b 100644
|
||||||
|
--- a/include/clang/Driver/Options.td
|
||||||
|
+++ b/include/clang/Driver/Options.td
|
||||||
|
@@ -2709,6 +2709,7 @@ def nolibc : Flag<["-"], "nolibc">;
|
||||||
|
def nomultidefs : Flag<["-"], "nomultidefs">;
|
||||||
|
def nopie : Flag<["-"], "nopie">;
|
||||||
|
def no_pie : Flag<["-"], "no-pie">, Alias<nopie>;
|
||||||
|
+def noposix : Flag<["-"], "noposix">;
|
||||||
|
def noprebind : Flag<["-"], "noprebind">;
|
||||||
|
def noprofilelib : Flag<["-"], "noprofilelib">;
|
||||||
|
def noseglinkedit : Flag<["-"], "noseglinkedit">;
|
||||||
|
diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
|
||||||
|
index 965f27389..c800a77af 100644
|
||||||
|
--- a/lib/Basic/Targets.cpp
|
||||||
|
+++ b/lib/Basic/Targets.cpp
|
||||||
|
@@ -142,6 +142,8 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple,
|
||||||
|
return new FreeBSDTargetInfo<AArch64leTargetInfo>(Triple, Opts);
|
||||||
|
case llvm::Triple::Fuchsia:
|
||||||
|
return new FuchsiaTargetInfo<AArch64leTargetInfo>(Triple, Opts);
|
||||||
|
+ case llvm::Triple::Genode:
|
||||||
|
+ return new GenodeTargetInfo<AArch64leTargetInfo>(Triple, Opts);
|
||||||
|
case llvm::Triple::Linux:
|
||||||
|
return new LinuxTargetInfo<AArch64leTargetInfo>(Triple, Opts);
|
||||||
|
case llvm::Triple::NetBSD:
|
||||||
|
@@ -166,6 +168,8 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple,
|
||||||
|
return new FreeBSDTargetInfo<AArch64beTargetInfo>(Triple, Opts);
|
||||||
|
case llvm::Triple::Fuchsia:
|
||||||
|
return new FuchsiaTargetInfo<AArch64beTargetInfo>(Triple, Opts);
|
||||||
|
+ case llvm::Triple::Genode:
|
||||||
|
+ return new GenodeTargetInfo<AArch64beTargetInfo>(Triple, Opts);
|
||||||
|
case llvm::Triple::Linux:
|
||||||
|
return new LinuxTargetInfo<AArch64beTargetInfo>(Triple, Opts);
|
||||||
|
case llvm::Triple::NetBSD:
|
||||||
|
@@ -186,6 +190,8 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple,
|
||||||
|
return new LinuxTargetInfo<ARMleTargetInfo>(Triple, Opts);
|
||||||
|
case llvm::Triple::FreeBSD:
|
||||||
|
return new FreeBSDTargetInfo<ARMleTargetInfo>(Triple, Opts);
|
||||||
|
+ case llvm::Triple::Genode:
|
||||||
|
+ return new GenodeTargetInfo<ARMleTargetInfo>(Triple, Opts);
|
||||||
|
case llvm::Triple::NetBSD:
|
||||||
|
return new NetBSDTargetInfo<ARMleTargetInfo>(Triple, Opts);
|
||||||
|
case llvm::Triple::OpenBSD:
|
||||||
|
@@ -485,6 +491,8 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple,
|
||||||
|
return new FreeBSDTargetInfo<X86_32TargetInfo>(Triple, Opts);
|
||||||
|
case llvm::Triple::Fuchsia:
|
||||||
|
return new FuchsiaTargetInfo<X86_32TargetInfo>(Triple, Opts);
|
||||||
|
+ case llvm::Triple::Genode:
|
||||||
|
+ return new GenodeI386TargetInfo(Triple, Opts);
|
||||||
|
case llvm::Triple::KFreeBSD:
|
||||||
|
return new KFreeBSDTargetInfo<X86_32TargetInfo>(Triple, Opts);
|
||||||
|
case llvm::Triple::Minix:
|
||||||
|
@@ -544,6 +552,8 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple,
|
||||||
|
return new FreeBSDTargetInfo<X86_64TargetInfo>(Triple, Opts);
|
||||||
|
case llvm::Triple::Fuchsia:
|
||||||
|
return new FuchsiaTargetInfo<X86_64TargetInfo>(Triple, Opts);
|
||||||
|
+ case llvm::Triple::Genode:
|
||||||
|
+ return new GenodeTargetInfo<X86_64TargetInfo>(Triple, Opts);
|
||||||
|
case llvm::Triple::KFreeBSD:
|
||||||
|
return new KFreeBSDTargetInfo<X86_64TargetInfo>(Triple, Opts);
|
||||||
|
case llvm::Triple::Solaris:
|
||||||
|
@@ -561,6 +571,8 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple,
|
||||||
|
}
|
||||||
|
case llvm::Triple::Haiku:
|
||||||
|
return new HaikuTargetInfo<X86_64TargetInfo>(Triple, Opts);
|
||||||
|
+ case llvm::Triple::Genode:
|
||||||
|
+ return new GenodeTargetInfo<X86_64TargetInfo>(Triple, Opts);
|
||||||
|
case llvm::Triple::NaCl:
|
||||||
|
return new NaClTargetInfo<X86_64TargetInfo>(Triple, Opts);
|
||||||
|
case llvm::Triple::PS4:
|
||||||
|
diff --git a/lib/Basic/Targets/AArch64.cpp b/lib/Basic/Targets/AArch64.cpp
|
||||||
|
index 25c02cb88..8b9a62286 100644
|
||||||
|
--- a/lib/Basic/Targets/AArch64.cpp
|
||||||
|
+++ b/lib/Basic/Targets/AArch64.cpp
|
||||||
|
@@ -43,7 +43,7 @@ const Builtin::Info AArch64TargetInfo::BuiltinInfo[] = {
|
||||||
|
AArch64TargetInfo::AArch64TargetInfo(const llvm::Triple &Triple,
|
||||||
|
const TargetOptions &Opts)
|
||||||
|
: TargetInfo(Triple), ABI("aapcs") {
|
||||||
|
- if (getTriple().isOSOpenBSD()) {
|
||||||
|
+ if (getTriple().isOSOpenBSD() || getTriple().isOSGenode()) {
|
||||||
|
Int64Type = SignedLongLong;
|
||||||
|
IntMaxType = SignedLongLong;
|
||||||
|
} else {
|
||||||
|
diff --git a/lib/Basic/Targets/ARM.cpp b/lib/Basic/Targets/ARM.cpp
|
||||||
|
index 21cfe0107..b02ef0aa0 100644
|
||||||
|
--- a/lib/Basic/Targets/ARM.cpp
|
||||||
|
+++ b/lib/Basic/Targets/ARM.cpp
|
||||||
|
@@ -238,18 +238,19 @@ ARMTargetInfo::ARMTargetInfo(const llvm::Triple &Triple,
|
||||||
|
HW_FP(0) {
|
||||||
|
bool IsOpenBSD = Triple.isOSOpenBSD();
|
||||||
|
bool IsNetBSD = Triple.isOSNetBSD();
|
||||||
|
+ bool IsGenode = Triple.isOSGenode();
|
||||||
|
|
||||||
|
// FIXME: the isOSBinFormatMachO is a workaround for identifying a Darwin-like
|
||||||
|
// environment where size_t is `unsigned long` rather than `unsigned int`
|
||||||
|
|
||||||
|
PtrDiffType = IntPtrType =
|
||||||
|
(Triple.isOSDarwin() || Triple.isOSBinFormatMachO() || IsOpenBSD ||
|
||||||
|
- IsNetBSD)
|
||||||
|
+ IsNetBSD || IsGenode)
|
||||||
|
? SignedLong
|
||||||
|
: SignedInt;
|
||||||
|
|
||||||
|
SizeType = (Triple.isOSDarwin() || Triple.isOSBinFormatMachO() || IsOpenBSD ||
|
||||||
|
- IsNetBSD)
|
||||||
|
+ IsNetBSD || IsGenode)
|
||||||
|
? UnsignedLong
|
||||||
|
: UnsignedInt;
|
||||||
|
|
||||||
|
diff --git a/lib/Basic/Targets/OSTargets.h b/lib/Basic/Targets/OSTargets.h
|
||||||
|
index 2a9e4f91d..ad562e604 100644
|
||||||
|
--- a/lib/Basic/Targets/OSTargets.h
|
||||||
|
+++ b/lib/Basic/Targets/OSTargets.h
|
||||||
|
@@ -286,6 +286,39 @@ public:
|
||||||
|
: OSTargetInfo<Target>(Triple, Opts) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
+// Genode Target
|
||||||
|
+template <typename Target>
|
||||||
|
+class LLVM_LIBRARY_VISIBILITY GenodeTargetInfo : public OSTargetInfo<Target> {
|
||||||
|
+protected:
|
||||||
|
+ void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple,
|
||||||
|
+ MacroBuilder &Builder) const override {
|
||||||
|
+ Builder.defineMacro("__GENODE__");
|
||||||
|
+ DefineStd(Builder, "unix", Opts);
|
||||||
|
+ Builder.defineMacro("__ELF__");
|
||||||
|
+ if (Opts.POSIXThreads)
|
||||||
|
+ Builder.defineMacro("_REENTRANT");
|
||||||
|
+ if (this->HasFloat128)
|
||||||
|
+ Builder.defineMacro("__FLOAT128__");
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+public:
|
||||||
|
+ GenodeTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
|
||||||
|
+ : OSTargetInfo<Target>(Triple, Opts) {
|
||||||
|
+ this->IntMaxType = TargetInfo::SignedLongLong;
|
||||||
|
+ this->Int64Type = TargetInfo::SignedLongLong;
|
||||||
|
+ this->SizeType = TargetInfo::UnsignedLong;
|
||||||
|
+ this->TLSSupported = false;
|
||||||
|
+ switch (Triple.getArch()) {
|
||||||
|
+ default:
|
||||||
|
+ break;
|
||||||
|
+ case llvm::Triple::x86:
|
||||||
|
+ case llvm::Triple::x86_64:
|
||||||
|
+ this->HasFloat128 = true;
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
// Haiku Target
|
||||||
|
template <typename Target>
|
||||||
|
class LLVM_LIBRARY_VISIBILITY HaikuTargetInfo : public OSTargetInfo<Target> {
|
||||||
|
@@ -820,6 +853,26 @@ public:
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
+// Genode Target
|
||||||
|
+template <typename Target>
|
||||||
|
+class LLVM_LIBRARY_VISIBILITY GenodeTargetInfo : public OSTargetInfo<Target> {
|
||||||
|
+protected:
|
||||||
|
+ void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple,
|
||||||
|
+ MacroBuilder &Builder) const override {
|
||||||
|
+ Builder.defineMacro("__GENODE__");
|
||||||
|
+ Builder.defineMacro("__ELF__");
|
||||||
|
+ // Required by the libc++ locale support.
|
||||||
|
+ if (Opts.CPlusPlus)
|
||||||
|
+ Builder.defineMacro("_GNU_SOURCE");
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+public:
|
||||||
|
+ GenodeTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
|
||||||
|
+ : OSTargetInfo<Target>(Triple, Opts) {
|
||||||
|
+ this->MCountName = "__mcount";
|
||||||
|
+ }
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
// WebAssembly target
|
||||||
|
template <typename Target>
|
||||||
|
class LLVM_LIBRARY_VISIBILITY WebAssemblyOSTargetInfo
|
||||||
|
diff --git a/lib/Basic/Targets/X86.h b/lib/Basic/Targets/X86.h
|
||||||
|
index 72a01d251..6c5c0065c 100644
|
||||||
|
--- a/lib/Basic/Targets/X86.h
|
||||||
|
+++ b/lib/Basic/Targets/X86.h
|
||||||
|
@@ -447,6 +447,17 @@ public:
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
+class LLVM_LIBRARY_VISIBILITY GenodeI386TargetInfo
|
||||||
|
+ : public GenodeTargetInfo<X86_32TargetInfo> {
|
||||||
|
+public:
|
||||||
|
+ GenodeI386TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
|
||||||
|
+ : GenodeTargetInfo<X86_32TargetInfo>(Triple, Opts) {
|
||||||
|
+ SizeType = UnsignedLong;
|
||||||
|
+ IntPtrType = SignedLong;
|
||||||
|
+ PtrDiffType = SignedLong;
|
||||||
|
+ }
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
class LLVM_LIBRARY_VISIBILITY DarwinI386TargetInfo
|
||||||
|
: public DarwinTargetInfo<X86_32TargetInfo> {
|
||||||
|
public:
|
||||||
|
diff --git a/lib/Driver/CMakeLists.txt b/lib/Driver/CMakeLists.txt
|
||||||
|
index 9463ca5c1..5ae757f99 100644
|
||||||
|
--- a/lib/Driver/CMakeLists.txt
|
||||||
|
+++ b/lib/Driver/CMakeLists.txt
|
||||||
|
@@ -49,6 +49,7 @@ add_clang_library(clangDriver
|
||||||
|
ToolChains/Flang.cpp
|
||||||
|
ToolChains/FreeBSD.cpp
|
||||||
|
ToolChains/Fuchsia.cpp
|
||||||
|
+ ToolChains/Genode.cpp
|
||||||
|
ToolChains/Gnu.cpp
|
||||||
|
ToolChains/Haiku.cpp
|
||||||
|
ToolChains/HIP.cpp
|
||||||
|
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp
|
||||||
|
index ece8222dc..25dcea94c 100644
|
||||||
|
--- a/lib/Driver/Driver.cpp
|
||||||
|
+++ b/lib/Driver/Driver.cpp
|
||||||
|
@@ -22,6 +22,7 @@
|
||||||
|
#include "ToolChains/DragonFly.h"
|
||||||
|
#include "ToolChains/FreeBSD.h"
|
||||||
|
#include "ToolChains/Fuchsia.h"
|
||||||
|
+#include "ToolChains/Genode.h"
|
||||||
|
#include "ToolChains/Gnu.h"
|
||||||
|
#include "ToolChains/HIP.h"
|
||||||
|
#include "ToolChains/Haiku.h"
|
||||||
|
@@ -4919,6 +4920,9 @@ const ToolChain &Driver::getToolChain(const ArgList &Args,
|
||||||
|
case llvm::Triple::FreeBSD:
|
||||||
|
TC = std::make_unique<toolchains::FreeBSD>(*this, Target, Args);
|
||||||
|
break;
|
||||||
|
+ case llvm::Triple::Genode:
|
||||||
|
+ TC = std::make_unique<toolchains::Genode>(*this, Target, Args);
|
||||||
|
+ break;
|
||||||
|
case llvm::Triple::Minix:
|
||||||
|
TC = std::make_unique<toolchains::Minix>(*this, Target, Args);
|
||||||
|
break;
|
||||||
|
@@ -4951,6 +4955,9 @@ const ToolChain &Driver::getToolChain(const ArgList &Args,
|
||||||
|
case llvm::Triple::Solaris:
|
||||||
|
TC = std::make_unique<toolchains::Solaris>(*this, Target, Args);
|
||||||
|
break;
|
||||||
|
+ case llvm::Triple::Genode:
|
||||||
|
+ TC = llvm::make_unique<toolchains::Genode>(*this, Target, Args);
|
||||||
|
+ break;
|
||||||
|
case llvm::Triple::AMDHSA:
|
||||||
|
TC = std::make_unique<toolchains::ROCMToolChain>(*this, Target, Args);
|
||||||
|
break;
|
||||||
|
diff --git a/lib/Driver/SanitizerArgs.cpp b/lib/Driver/SanitizerArgs.cpp
|
||||||
|
index bcc9ffc7f..7d02b3766 100644
|
||||||
|
--- a/lib/Driver/SanitizerArgs.cpp
|
||||||
|
+++ b/lib/Driver/SanitizerArgs.cpp
|
||||||
|
@@ -764,7 +764,7 @@ SanitizerArgs::SanitizerArgs(const ToolChain &TC,
|
||||||
|
ImplicitCfiRuntime = TC.getTriple().isAndroid();
|
||||||
|
|
||||||
|
if (AllAddedKinds & SanitizerKind::Address) {
|
||||||
|
- NeedPIE |= TC.getTriple().isOSFuchsia();
|
||||||
|
+ NeedPIE |= TC.getTriple().isOSFuchsia() | TC.getTriple().isOSGenode();
|
||||||
|
if (Arg *A =
|
||||||
|
Args.getLastArg(options::OPT_fsanitize_address_field_padding)) {
|
||||||
|
StringRef S = A->getValue();
|
||||||
|
diff --git a/lib/Driver/ToolChains/Arch/AArch64.cpp b/lib/Driver/ToolChains/Arch/AArch64.cpp
|
||||||
|
index dd4545d6c..22ec56518 100644
|
||||||
|
--- a/lib/Driver/ToolChains/Arch/AArch64.cpp
|
||||||
|
+++ b/lib/Driver/ToolChains/Arch/AArch64.cpp
|
||||||
|
@@ -373,7 +373,7 @@ fp16_fml_fallthrough:
|
||||||
|
options::OPT_munaligned_access)) {
|
||||||
|
if (A->getOption().matches(options::OPT_mno_unaligned_access))
|
||||||
|
Features.push_back("+strict-align");
|
||||||
|
- } else if (Triple.isOSOpenBSD())
|
||||||
|
+ } else if (Triple.isOSOpenBSD() || Triple.isOSGenode())
|
||||||
|
Features.push_back("+strict-align");
|
||||||
|
|
||||||
|
if (Args.hasArg(options::OPT_ffixed_x1))
|
||||||
|
diff --git a/lib/Driver/ToolChains/Arch/ARM.cpp b/lib/Driver/ToolChains/Arch/ARM.cpp
|
||||||
|
index afe896b4a..f93dd30be 100644
|
||||||
|
--- a/lib/Driver/ToolChains/Arch/ARM.cpp
|
||||||
|
+++ b/lib/Driver/ToolChains/Arch/ARM.cpp
|
||||||
|
@@ -587,7 +587,7 @@ fp16_fml_fallthrough:
|
||||||
|
if (VersionNum < 6 ||
|
||||||
|
Triple.getSubArch() == llvm::Triple::SubArchType::ARMSubArch_v6m)
|
||||||
|
Features.push_back("+strict-align");
|
||||||
|
- } else if (Triple.isOSLinux() || Triple.isOSNaCl()) {
|
||||||
|
+ } else if (Triple.isOSLinux() || Triple.isOSNaCl() || Triple.isOSGenode()) {
|
||||||
|
if (VersionNum < 7)
|
||||||
|
Features.push_back("+strict-align");
|
||||||
|
} else
|
||||||
|
diff --git a/lib/Driver/ToolChains/Clang.cpp b/lib/Driver/ToolChains/Clang.cpp
|
||||||
|
index af4bcf951..c96b192c7 100644
|
||||||
|
--- a/lib/Driver/ToolChains/Clang.cpp
|
||||||
|
+++ b/lib/Driver/ToolChains/Clang.cpp
|
||||||
|
@@ -538,7 +538,7 @@ static bool useFramePointerForTargetByDefault(const ArgList &Args,
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (Triple.isOSNetBSD()) {
|
||||||
|
+ if (Triple.isOSNetBSD() || Triple.isOSGenode()) {
|
||||||
|
return !areOptimizationsEnabled(Args);
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/lib/Driver/ToolChains/Genode.cpp b/lib/Driver/ToolChains/Genode.cpp
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000..b22f52b2f
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/lib/Driver/ToolChains/Genode.cpp
|
||||||
|
@@ -0,0 +1,216 @@
|
||||||
|
+//===--- Genode.h - Genode ToolChain Implementations ------------*- C++ -*-===//
|
||||||
|
+//
|
||||||
|
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
+// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
+//
|
||||||
|
+//===----------------------------------------------------------------------===//
|
||||||
|
+
|
||||||
|
+#include "Genode.h"
|
||||||
|
+#include "CommonArgs.h"
|
||||||
|
+#include "InputInfo.h"
|
||||||
|
+#include "clang/Driver/Compilation.h"
|
||||||
|
+#include "clang/Driver/Driver.h"
|
||||||
|
+#include "clang/Driver/Options.h"
|
||||||
|
+#include "llvm/Option/ArgList.h"
|
||||||
|
+
|
||||||
|
+using namespace clang::driver;
|
||||||
|
+using namespace clang::driver::toolchains;
|
||||||
|
+using namespace clang::driver::tools;
|
||||||
|
+using namespace clang;
|
||||||
|
+using namespace llvm::opt;
|
||||||
|
+
|
||||||
|
+void genode::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
|
||||||
|
+ const InputInfo &Output,
|
||||||
|
+ const InputInfoList &Inputs,
|
||||||
|
+ const ArgList &Args,
|
||||||
|
+ const char *LinkingOutput) const {
|
||||||
|
+ Args.ClaimAllArgs(options::OPT_mcmodel_EQ);
|
||||||
|
+ Args.ClaimAllArgs(options::OPT_mtune_EQ);
|
||||||
|
+
|
||||||
|
+ gnutools::Assembler::ConstructJob(C, JA, Output, Inputs, Args, LinkingOutput);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void genode::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
||||||
|
+ const InputInfo &Output,
|
||||||
|
+ const InputInfoList &Inputs,
|
||||||
|
+ const ArgList &Args,
|
||||||
|
+ const char *LinkingOutput) const {
|
||||||
|
+ const toolchains::Genode &ToolChain =
|
||||||
|
+ static_cast<const toolchains::Genode &>(getToolChain());
|
||||||
|
+ const Driver &D = ToolChain.getDriver();
|
||||||
|
+ const llvm::Triple::ArchType Arch = ToolChain.getArch();
|
||||||
|
+ ArgStringList CmdArgs;
|
||||||
|
+
|
||||||
|
+ if (!D.SysRoot.empty())
|
||||||
|
+ CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
|
||||||
|
+
|
||||||
|
+ // Explicitly set the linker emulation for platforms that might not
|
||||||
|
+ // be the default emulation for the linker.
|
||||||
|
+ switch (Arch) {
|
||||||
|
+ case llvm::Triple::x86:
|
||||||
|
+ CmdArgs.push_back("-melf_i386");
|
||||||
|
+ break;
|
||||||
|
+ case llvm::Triple::x86_64:
|
||||||
|
+ CmdArgs.push_back("-melf_x86_64");
|
||||||
|
+ break;
|
||||||
|
+ case llvm::Triple::riscv32:
|
||||||
|
+ CmdArgs.push_back("-melf32lriscv");
|
||||||
|
+ break;
|
||||||
|
+ case llvm::Triple::riscv64:
|
||||||
|
+ CmdArgs.push_back("-melf64lriscv");
|
||||||
|
+ break;
|
||||||
|
+ default:
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ CmdArgs.push_back("--eh-frame-hdr");
|
||||||
|
+ CmdArgs.push_back("--gc-sections");
|
||||||
|
+ CmdArgs.push_back("-zmax-page-size=0x1000");
|
||||||
|
+
|
||||||
|
+ CmdArgs.push_back("-Ttext=0x01000000");
|
||||||
|
+
|
||||||
|
+ Args.AddAllArgs(CmdArgs, options::OPT_L);
|
||||||
|
+ ToolChain.AddFilePathLibArgs(Args, CmdArgs);
|
||||||
|
+ Args.AddAllArgs(CmdArgs, options::OPT_T_Group);
|
||||||
|
+ Args.AddAllArgs(CmdArgs, options::OPT_e);
|
||||||
|
+ Args.AddAllArgs(CmdArgs, options::OPT_s);
|
||||||
|
+ Args.AddAllArgs(CmdArgs, options::OPT_t);
|
||||||
|
+ Args.AddAllArgs(CmdArgs, options::OPT_Z_Flag);
|
||||||
|
+
|
||||||
|
+ if (Args.hasArg(options::OPT_static)) {
|
||||||
|
+ CmdArgs.push_back("-Bstatic");
|
||||||
|
+ } else {
|
||||||
|
+ if (Args.hasArg(options::OPT_shared)) {
|
||||||
|
+ CmdArgs.push_back(Args.MakeArgString("-shared"));
|
||||||
|
+ CmdArgs.push_back(Args.MakeArgString("-T" + D.SysRoot + "/ld/genode_rel.ld"));
|
||||||
|
+ } else {
|
||||||
|
+ CmdArgs.push_back(Args.MakeArgString("-T" + D.SysRoot + "/ld/genode_dyn.ld"));
|
||||||
|
+ CmdArgs.push_back(Args.MakeArgString("--dynamic-list=" + D.SysRoot + "/ld/genode_dyn.dl"));
|
||||||
|
+ CmdArgs.push_back("--dynamic-linker=ld.lib.so");
|
||||||
|
+ }
|
||||||
|
+ if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
|
||||||
|
+ CmdArgs.push_back("-l:ld.lib.so");
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (Output.isFilename()) {
|
||||||
|
+ CmdArgs.push_back("-o");
|
||||||
|
+ CmdArgs.push_back(Output.getFilename());
|
||||||
|
+ } else {
|
||||||
|
+ assert(Output.isNothing() && "Invalid output.");
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
|
||||||
|
+
|
||||||
|
+ if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs, options::OPT_noposix)) {
|
||||||
|
+ AddRunTimeLibs(ToolChain, D, CmdArgs, Args);
|
||||||
|
+
|
||||||
|
+ CmdArgs.push_back("-lc");
|
||||||
|
+ if (!Args.hasArg(options::OPT_shared)) {
|
||||||
|
+ CmdArgs.push_back("-lposix");
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
|
||||||
|
+ C.addCommand(llvm::make_unique<Command>(JA, *this, Exec, CmdArgs, Inputs));
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+Genode::Genode(const Driver &D, const llvm::Triple &Triple,
|
||||||
|
+ const ArgList &Args)
|
||||||
|
+ : Generic_ELF(D, Triple, Args) {
|
||||||
|
+
|
||||||
|
+ std::vector<std::string> GenodeExtraTriples;
|
||||||
|
+ switch (Triple.getArch()) {
|
||||||
|
+ case llvm::Triple::arm:
|
||||||
|
+ GenodeExtraTriples.push_back("arm-none-eabi");
|
||||||
|
+ break;
|
||||||
|
+ case llvm::Triple::aarch64:
|
||||||
|
+ GenodeExtraTriples.push_back("aarch64-none-elf");
|
||||||
|
+ break;
|
||||||
|
+ case llvm::Triple::x86:
|
||||||
|
+ case llvm::Triple::x86_64:
|
||||||
|
+ GenodeExtraTriples.push_back("x86_64-pc-elf");
|
||||||
|
+ break;
|
||||||
|
+ case llvm::Triple::riscv64:
|
||||||
|
+ GenodeExtraTriples.push_back("riscv64-unknown-elf");
|
||||||
|
+ break;
|
||||||
|
+ default:
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ GCCInstallation.init(Triple, Args, GenodeExtraTriples);
|
||||||
|
+
|
||||||
|
+ const std::string MultiarchTriple = getMultiarchTriple(D, Triple, /*SysRoot*/ "");
|
||||||
|
+ if (GCCInstallation.isValid() &&
|
||||||
|
+ (Triple.getArch() == llvm::Triple::x86_64 ||
|
||||||
|
+ Triple.getArch() == llvm::Triple::x86)) {
|
||||||
|
+
|
||||||
|
+ path_list MultilibPaths;
|
||||||
|
+ Generic_GCC::AddMultilibPaths(D, /*SysRoot*/ "", "lib",
|
||||||
|
+ MultiarchTriple, MultilibPaths);
|
||||||
|
+
|
||||||
|
+ auto Suffix = GCCInstallation.getMultilib().gccSuffix();
|
||||||
|
+ for (auto path: MultilibPaths)
|
||||||
|
+ addPathIfExists(D, path + Suffix, getFilePaths());
|
||||||
|
+ } else {
|
||||||
|
+ Generic_GCC::AddMultilibPaths(D, /*SysRoot*/ "", "lib",
|
||||||
|
+ MultiarchTriple, getFilePaths());
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ ToolChain::path_list &PPaths = getProgramPaths();
|
||||||
|
+
|
||||||
|
+ Generic_GCC::PushPPaths(PPaths);
|
||||||
|
+
|
||||||
|
+#ifdef ENABLE_LINKER_BUILD_ID
|
||||||
|
+ ExtraOpts.push_back("--build-id");
|
||||||
|
+#endif
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+bool Genode::isPICDefault() const {
|
||||||
|
+ switch (getTriple().getArch()) {
|
||||||
|
+ case llvm::Triple::aarch64:
|
||||||
|
+ case llvm::Triple::x86_64:
|
||||||
|
+ return true;
|
||||||
|
+ default:
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+Genode::addLibStdCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
|
||||||
|
+ llvm::opt::ArgStringList &CC1Args) const {
|
||||||
|
+ // Try generic GCC detection first.
|
||||||
|
+ if (Generic_GCC::addGCCLibStdCxxIncludePaths(DriverArgs, CC1Args))
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ if (!GCCInstallation.isValid())
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ StringRef LibDir = GCCInstallation.getParentLibPath();
|
||||||
|
+ StringRef TripleStr = GCCInstallation.getTriple().str();
|
||||||
|
+ const Multilib &Multilib = GCCInstallation.getMultilib();
|
||||||
|
+ const GCCVersion &Version = GCCInstallation.getVersion();
|
||||||
|
+
|
||||||
|
+ const std::string IncludePath = {
|
||||||
|
+ LibDir.str() + "/../" + TripleStr.str() + "/include/c++/" + Version.Text,
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ addLibStdCXXIncludePaths(IncludePath, /*Suffix*/ "", TripleStr,
|
||||||
|
+ /*GCCMultiarchTriple*/ "",
|
||||||
|
+ /*TargetMultiarchTriple*/ "",
|
||||||
|
+ Multilib.includeSuffix(), DriverArgs, CC1Args);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void Genode::addExtraOpts(llvm::opt::ArgStringList &CmdArgs) const {
|
||||||
|
+ for (const auto &Opt : ExtraOpts)
|
||||||
|
+ CmdArgs.push_back(Opt.c_str());
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+Tool *Genode::buildAssembler() const {
|
||||||
|
+ return new tools::genode::Assembler(*this);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+Tool *Genode::buildLinker() const {
|
||||||
|
+ return new tools::genode::Linker(*this);
|
||||||
|
+}
|
||||||
|
diff --git a/lib/Driver/ToolChains/Genode.h b/lib/Driver/ToolChains/Genode.h
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000..f7fbbff4b
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/lib/Driver/ToolChains/Genode.h
|
||||||
|
@@ -0,0 +1,83 @@
|
||||||
|
+//===--- Genode.h - Genode ToolChain Implementations ------------*- C++ -*-===//
|
||||||
|
+//
|
||||||
|
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
+// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
+//
|
||||||
|
+//===----------------------------------------------------------------------===//
|
||||||
|
+
|
||||||
|
+#ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_GENODE_H
|
||||||
|
+#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_GENODE_H
|
||||||
|
+
|
||||||
|
+#include "Gnu.h"
|
||||||
|
+#include "clang/Driver/Tool.h"
|
||||||
|
+#include "clang/Driver/ToolChain.h"
|
||||||
|
+
|
||||||
|
+namespace clang {
|
||||||
|
+namespace driver {
|
||||||
|
+namespace tools {
|
||||||
|
+namespace genode {
|
||||||
|
+class LLVM_LIBRARY_VISIBILITY Assembler : public gnutools::Assembler {
|
||||||
|
+public:
|
||||||
|
+ Assembler(const ToolChain &TC) : gnutools::Assembler(TC) {}
|
||||||
|
+
|
||||||
|
+ void ConstructJob(Compilation &C, const JobAction &JA,
|
||||||
|
+ const InputInfo &Output, const InputInfoList &Inputs,
|
||||||
|
+ const llvm::opt::ArgList &TCArgs,
|
||||||
|
+ const char *LinkingOutput) const override;
|
||||||
|
+};
|
||||||
|
+class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
|
||||||
|
+public:
|
||||||
|
+ Linker(const ToolChain &TC) : Tool("genode::Linker", "linker", TC) {}
|
||||||
|
+
|
||||||
|
+ bool hasIntegratedCPP() const override { return false; }
|
||||||
|
+ bool isLinkJob() const override { return true; }
|
||||||
|
+
|
||||||
|
+ void ConstructJob(Compilation &C, const JobAction &JA,
|
||||||
|
+ const InputInfo &Output, const InputInfoList &Inputs,
|
||||||
|
+ const llvm::opt::ArgList &TCArgs,
|
||||||
|
+ const char *LinkingOutput) const override;
|
||||||
|
+};
|
||||||
|
+} // end namespace genode
|
||||||
|
+} // end namespace tools
|
||||||
|
+
|
||||||
|
+namespace toolchains {
|
||||||
|
+
|
||||||
|
+class LLVM_LIBRARY_VISIBILITY Genode : public Generic_ELF {
|
||||||
|
+public:
|
||||||
|
+ Genode(const Driver &D, const llvm::Triple &Triple,
|
||||||
|
+ const llvm::opt::ArgList &Args);
|
||||||
|
+
|
||||||
|
+ bool IsMathErrnoDefault() const override { return false; }
|
||||||
|
+ bool HasNativeLLVMSupport() const override { return false; }
|
||||||
|
+ bool isPICDefault() const override;
|
||||||
|
+ bool isPIEDefault() const override { return false; }
|
||||||
|
+ bool isPICDefaultForced() const override { return false; }
|
||||||
|
+ bool IsIntegratedAssemblerDefault() const override { return false; }
|
||||||
|
+
|
||||||
|
+ void
|
||||||
|
+ addLibStdCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
|
||||||
|
+ llvm::opt::ArgStringList &CC1Args) const final;
|
||||||
|
+
|
||||||
|
+ bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override {
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ void addExtraOpts(llvm::opt::ArgStringList &CmdArgs) const override;
|
||||||
|
+
|
||||||
|
+ const char *getDefaultLinker() const override {
|
||||||
|
+ return "ld";
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ std::vector<std::string> ExtraOpts;
|
||||||
|
+
|
||||||
|
+protected:
|
||||||
|
+ Tool *buildAssembler() const override;
|
||||||
|
+ Tool *buildLinker() const override;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+} // end namespace toolchains
|
||||||
|
+} // end namespace driver
|
||||||
|
+} // end namespace clang
|
||||||
|
+
|
||||||
|
+#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_GENODE_H
|
||||||
|
diff --git a/lib/Frontend/InitHeaderSearch.cpp b/lib/Frontend/InitHeaderSearch.cpp
|
||||||
|
index bc31445d6..364942eff 100644
|
||||||
|
--- a/lib/Frontend/InitHeaderSearch.cpp
|
||||||
|
+++ b/lib/Frontend/InitHeaderSearch.cpp
|
||||||
|
@@ -229,6 +229,7 @@ void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple,
|
||||||
|
case llvm::Triple::PS4:
|
||||||
|
case llvm::Triple::ELFIAMCU:
|
||||||
|
case llvm::Triple::Fuchsia:
|
||||||
|
+ case llvm::Triple::Genode:
|
||||||
|
break;
|
||||||
|
case llvm::Triple::Win32:
|
||||||
|
if (triple.getEnvironment() != llvm::Triple::Cygnus)
|
||||||
|
@@ -338,6 +339,7 @@ void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple,
|
||||||
|
case llvm::Triple::NaCl:
|
||||||
|
case llvm::Triple::ELFIAMCU:
|
||||||
|
case llvm::Triple::Fuchsia:
|
||||||
|
+ case llvm::Triple::Genode:
|
||||||
|
break;
|
||||||
|
case llvm::Triple::PS4: {
|
||||||
|
// <isysroot> gets prepended later in AddPath().
|
||||||
|
diff --git a/test/Driver/genode.c b/test/Driver/genode.c
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000..e69de29bb
|
||||||
|
diff --git a/test/Driver/genode.cpp b/test/Driver/genode.cpp
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000..e69de29bb
|
|
@ -11,20 +11,18 @@ diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp
|
||||||
index fe3c0191bb..c6a482bece 100644
|
index fe3c0191bb..c6a482bece 100644
|
||||||
--- a/lib/Driver/ToolChains/Gnu.cpp
|
--- a/lib/Driver/ToolChains/Gnu.cpp
|
||||||
+++ b/lib/Driver/ToolChains/Gnu.cpp
|
+++ b/lib/Driver/ToolChains/Gnu.cpp
|
||||||
@@ -494,13 +494,6 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
@@ -487,12 +487,6 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
||||||
if (!Args.hasArg(options::OPT_static)) {
|
if (!IsStatic) {
|
||||||
if (Args.hasArg(options::OPT_rdynamic))
|
if (Args.hasArg(options::OPT_rdynamic))
|
||||||
CmdArgs.push_back("-export-dynamic");
|
CmdArgs.push_back("-export-dynamic");
|
||||||
-
|
-
|
||||||
- if (!Args.hasArg(options::OPT_shared)) {
|
- if (!Args.hasArg(options::OPT_shared) && !IsStaticPIE) {
|
||||||
- const std::string Loader =
|
|
||||||
- D.DyldPrefix + ToolChain.getDynamicLinker(Args);
|
|
||||||
- CmdArgs.push_back("-dynamic-linker");
|
- CmdArgs.push_back("-dynamic-linker");
|
||||||
- CmdArgs.push_back(Args.MakeArgString(Loader));
|
- CmdArgs.push_back(Args.MakeArgString(Twine(D.DyldPrefix) +
|
||||||
|
- ToolChain.getDynamicLinker(Args)));
|
||||||
- }
|
- }
|
||||||
}
|
}
|
||||||
|
|
||||||
CmdArgs.push_back("-o");
|
CmdArgs.push_back("-o");
|
||||||
--
|
--
|
||||||
2.11.0
|
2.11.0
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
diff --git a/lib/builtins/assembly.h b/lib/builtins/assembly.h
|
diff --git a/lib/builtins/assembly.h b/lib/builtins/assembly.h
|
||||||
index 3f5e59b2544..97d06d6ccd1 100644
|
index f437cb87f..6406320aa 100644
|
||||||
--- a/lib/builtins/assembly.h
|
--- a/lib/builtins/assembly.h
|
||||||
+++ b/lib/builtins/assembly.h
|
+++ b/lib/builtins/assembly.h
|
||||||
@@ -45,7 +45,7 @@
|
@@ -43,7 +43,7 @@
|
||||||
#define CONST_SECTION .section .rodata
|
#define CONST_SECTION .section .rodata
|
||||||
|
|
||||||
#if defined(__GNU__) || defined(__FreeBSD__) || defined(__Fuchsia__) || \
|
#if defined(__GNU__) || defined(__FreeBSD__) || defined(__Fuchsia__) || \
|
|
@ -2,37 +2,50 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: MIT
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
{ stdenv, version, fetch, cmake, python, llvm, libcxxabi }:
|
{ stdenv, version, fetch, cmake, python3, llvm, libcxxabi }:
|
||||||
stdenv.mkDerivation {
|
|
||||||
|
let
|
||||||
|
|
||||||
|
useLLVM = stdenv.hostPlatform.useLLVM or false;
|
||||||
|
bareMetal = stdenv.hostPlatform.parsed.kernel.name == "none";
|
||||||
|
inherit (stdenv.hostPlatform) isMusl;
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
pname = "compiler-rt";
|
pname = "compiler-rt";
|
||||||
inherit version;
|
inherit version;
|
||||||
src = fetch "compiler-rt" "0dqqf8f930l8gag4d9qjgn1n0pj0nbv2anviqqhdi1rkhas8z0hi";
|
src = fetch pname "0d5j5l8phwqjjscmk8rmqn0i2i0abl537gdbkagl8fjpzy1gyjip";
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake python llvm ];
|
nativeBuildInputs = [ cmake python3 llvm ];
|
||||||
buildInputs = stdenv.lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
|
buildInputs = stdenv.lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
|
||||||
|
|
||||||
|
NIX_CFLAGS_COMPILE = [
|
||||||
|
"-DSCUDO_DEFAULT_OPTIONS=DeleteSizeMismatch=0:DeallocationTypeMismatch=0"
|
||||||
|
];
|
||||||
|
|
||||||
cmakeFlags = [
|
cmakeFlags = [
|
||||||
"-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON"
|
"-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON"
|
||||||
"-DCMAKE_C_COMPILER_TARGET=${stdenv.hostPlatform.config}"
|
"-DCMAKE_C_COMPILER_TARGET=${stdenv.hostPlatform.config}"
|
||||||
"-DCMAKE_ASM_COMPILER_TARGET=${stdenv.hostPlatform.config}"
|
"-DCMAKE_ASM_COMPILER_TARGET=${stdenv.hostPlatform.config}"
|
||||||
] ++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
] ++ stdenv.lib.optionals (stdenv.isDarwin) [
|
||||||
"-DCMAKE_C_FLAGS=-nodefaultlibs"
|
"-DDARWIN_macosx_OVERRIDE_SDK_VERSION=ON"
|
||||||
"-DCMAKE_CXX_COMPILER_WORKS=ON"
|
] ++ stdenv.lib.optionals (useLLVM || bareMetal || isMusl) [
|
||||||
"-DCOMPILER_RT_BUILD_SANITIZERS=OFF"
|
"-DCOMPILER_RT_BUILD_SANITIZERS=OFF"
|
||||||
"-DCOMPILER_RT_BUILD_XRAY=OFF"
|
"-DCOMPILER_RT_BUILD_XRAY=OFF"
|
||||||
"-DCOMPILER_RT_BUILD_LIBFUZZER=OFF"
|
"-DCOMPILER_RT_BUILD_LIBFUZZER=OFF"
|
||||||
"-DCOMPILER_RT_BUILD_PROFILE=OFF"
|
"-DCOMPILER_RT_BUILD_PROFILE=OFF"
|
||||||
|
] ++ stdenv.lib.optionals (useLLVM || bareMetal) [
|
||||||
|
"-DCMAKE_C_COMPILER_WORKS=ON"
|
||||||
|
"-DCMAKE_CXX_COMPILER_WORKS=ON"
|
||||||
"-DCOMPILER_RT_BAREMETAL_BUILD=ON"
|
"-DCOMPILER_RT_BAREMETAL_BUILD=ON"
|
||||||
|
"-DCMAKE_SIZEOF_VOID_P=${toString (stdenv.hostPlatform.parsed.cpu.bits / 8)}"
|
||||||
|
] ++ stdenv.lib.optionals (useLLVM) [
|
||||||
|
"-DCOMPILER_RT_BUILD_BUILTINS=ON"
|
||||||
|
"-DCMAKE_C_FLAGS=-nodefaultlibs"
|
||||||
#https://stackoverflow.com/questions/53633705/cmake-the-c-compiler-is-not-able-to-compile-a-simple-test-program
|
#https://stackoverflow.com/questions/53633705/cmake-the-c-compiler-is-not-able-to-compile-a-simple-test-program
|
||||||
"-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY"
|
"-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY"
|
||||||
"-DCMAKE_SIZEOF_VOID_P=${toString (stdenv.hostPlatform.parsed.cpu.bits / 8)}"
|
] ++ stdenv.lib.optionals (bareMetal) [
|
||||||
] ++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [
|
|
||||||
"-DCOMPILER_RT_BUILD_SANITIZERS=OFF"
|
|
||||||
"-DCOMPILER_RT_BUILD_XRAY=OFF"
|
|
||||||
"-DCOMPILER_RT_BUILD_LIBFUZZER=OFF"
|
|
||||||
"-DCOMPILER_RT_BUILD_PROFILE=OFF"
|
|
||||||
] ++ stdenv.lib.optionals (stdenv.hostPlatform.parsed.kernel.name == "none") [
|
|
||||||
"-DCOMPILER_RT_BAREMETAL_BUILD=ON"
|
|
||||||
"-DCOMPILER_RT_OS_DIR=baremetal"
|
"-DCOMPILER_RT_OS_DIR=baremetal"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -40,19 +53,25 @@ stdenv.mkDerivation {
|
||||||
|
|
||||||
patches = [
|
patches = [
|
||||||
./compiler-rt-codesign.patch # Revert compiler-rt commit that makes codesign mandatory
|
./compiler-rt-codesign.patch # Revert compiler-rt commit that makes codesign mandatory
|
||||||
./compiler-rt-genode.patch
|
./compiler-rt-X86-support-extension.patch # Add support for i486 i586 i686 by reusing i386 config
|
||||||
]# ++ stdenv.lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch
|
]# ++ stdenv.lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch
|
||||||
++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) ./crtbegin-and-end.patch;
|
++ stdenv.lib.optional stdenv.hostPlatform.isAarch32 ./compiler-rt-armv7l.patch;
|
||||||
|
|
||||||
|
|
||||||
# TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks
|
# TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks
|
||||||
# to get it, but they're unfree. Since LLVM is rather central to the stdenv, we patch out TSAN support so that Hydra
|
# to get it, but they're unfree. Since LLVM is rather central to the stdenv, we patch out TSAN support so that Hydra
|
||||||
# can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd
|
# can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd
|
||||||
# get no binary cache for the entire platform. If you really find yourself wanting the TSAN, make this controllable by
|
# get no binary cache for the entire platform. If you really find yourself wanting the TSAN, make this controllable by
|
||||||
# a flag and turn the flag off during the stdenv build.
|
# a flag and turn the flag off during the stdenv build.
|
||||||
postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
|
postPatch = stdenv.lib.optionalString (!stdenv.isDarwin) ''
|
||||||
|
substituteInPlace cmake/builtin-config-ix.cmake \
|
||||||
|
--replace 'set(X86 i386)' 'set(X86 i386 i486 i586 i686)'
|
||||||
|
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
||||||
|
substituteInPlace cmake/builtin-config-ix.cmake \
|
||||||
|
--replace 'set(ARM64 arm64 arm64e)' 'set(ARM64)'
|
||||||
substituteInPlace cmake/config-ix.cmake \
|
substituteInPlace cmake/config-ix.cmake \
|
||||||
--replace 'set(COMPILER_RT_HAS_TSAN TRUE)' 'set(COMPILER_RT_HAS_TSAN FALSE)'
|
--replace 'set(COMPILER_RT_HAS_TSAN TRUE)' 'set(COMPILER_RT_HAS_TSAN FALSE)'
|
||||||
'' + stdenv.lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
|
'' + stdenv.lib.optionalString (useLLVM) ''
|
||||||
substituteInPlace lib/builtins/int_util.c \
|
substituteInPlace lib/builtins/int_util.c \
|
||||||
--replace "#include <stdlib.h>" ""
|
--replace "#include <stdlib.h>" ""
|
||||||
substituteInPlace lib/builtins/clear_cache.c \
|
substituteInPlace lib/builtins/clear_cache.c \
|
||||||
|
@ -64,7 +83,7 @@ stdenv.mkDerivation {
|
||||||
# Hack around weird upsream RPATH bug
|
# Hack around weird upsream RPATH bug
|
||||||
postInstall = stdenv.lib.optionalString (stdenv.hostPlatform.isDarwin || stdenv.hostPlatform.isWasm) ''
|
postInstall = stdenv.lib.optionalString (stdenv.hostPlatform.isDarwin || stdenv.hostPlatform.isWasm) ''
|
||||||
ln -s "$out/lib"/*/* "$out/lib"
|
ln -s "$out/lib"/*/* "$out/lib"
|
||||||
'' + stdenv.lib.optionalString (stdenv.hostPlatform.useLLVM or false) ''
|
'' + stdenv.lib.optionalString (useLLVM) ''
|
||||||
ln -s $out/lib/*/clang_rt.crtbegin-*.o $out/lib/crtbegin.o
|
ln -s $out/lib/*/clang_rt.crtbegin-*.o $out/lib/crtbegin.o
|
||||||
ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.o
|
ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.o
|
||||||
ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/crtbeginS.o
|
ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/crtbeginS.o
|
|
@ -2,67 +2,73 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: MIT
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
{ lowPrio, newScope, pkgs, stdenv, cmake, libstdcxxHook
|
{ lowPrio, newScope, pkgs, stdenv, cmake, gccForLibs
|
||||||
, libxml2, python, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
|
, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
|
||||||
|
, buildPackages
|
||||||
, buildLlvmTools # tools, but from the previous stage, for cross
|
, buildLlvmTools # tools, but from the previous stage, for cross
|
||||||
, targetLlvmLibraries # libraries, but from the next stage, for cross
|
, targetLlvmLibraries # libraries, but from the next stage, for cross
|
||||||
, genodeBase
|
, genodeBase
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
release_version = "8.0.1";
|
release_version = "11.0.0";
|
||||||
version = release_version; # differentiating these is important for rc's
|
version = release_version; # differentiating these (variables) is important for RCs
|
||||||
|
targetConfig = stdenv.targetPlatform.config;
|
||||||
|
|
||||||
fetch = name: sha256: fetchurl {
|
fetch = name: sha256: fetchurl {
|
||||||
url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-${release_version}/${name}-${version}.src.tar.xz";
|
url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-${release_version}/${name}-${version}.src.tar.xz";
|
||||||
inherit sha256;
|
inherit sha256;
|
||||||
};
|
};
|
||||||
|
|
||||||
clang-tools-extra_src = fetch "clang-tools-extra" "1qf3097bc5ia8p6cpmbx985rjr3yaah5s8fc0nv7pw742yv7jw8q";
|
clang-tools-extra_src = fetch "clang-tools-extra" "02bcwwn54661madhq4nxc069s7p7pj5gpqi8ww50w3anbpviilzy";
|
||||||
|
|
||||||
tools = stdenv.lib.makeExtensible (tools: let
|
tools = stdenv.lib.makeExtensible (tools: let
|
||||||
callPackage = newScope (tools // { inherit stdenv cmake libxml2 python isl release_version version fetch; });
|
callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
|
||||||
mkExtraBuildCommands = cc: ''
|
mkExtraBuildCommands = cc: ''
|
||||||
rsrc="$out/resource-root"
|
rsrc="$out/resource-root"
|
||||||
mkdir "$rsrc"
|
mkdir "$rsrc"
|
||||||
ln -s "${cc}/lib/clang/${release_version}/include" "$rsrc"
|
ln -s "${cc}/lib/clang/${release_version}/include" "$rsrc"
|
||||||
ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
|
ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
|
||||||
|
ln -s "${targetLlvmLibraries.compiler-rt.out}/share" "$rsrc/share"
|
||||||
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
|
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
|
||||||
'' + stdenv.lib.optionalString (stdenv.targetPlatform.isLinux && tools.clang-unwrapped ? gcc && !(stdenv.targetPlatform.useLLVM or false)) ''
|
'' + stdenv.lib.optionalString (stdenv.targetPlatform.isLinux && !(stdenv.targetPlatform.useLLVM or false)) ''
|
||||||
echo "--gcc-toolchain=${tools.clang-unwrapped.gcc}" >> $out/nix-support/cc-cflags
|
echo "--gcc-toolchain=${gccForLibs}" >> $out/nix-support/cc-cflags
|
||||||
'';
|
'';
|
||||||
in {
|
in {
|
||||||
|
|
||||||
llvm = callPackage ./llvm.nix { };
|
llvm = callPackage ./llvm.nix { };
|
||||||
llvm-polly = callPackage ./llvm.nix { enablePolly = true; };
|
|
||||||
|
|
||||||
clang-unwrapped = callPackage ./clang {
|
clang-unwrapped = callPackage ./clang {
|
||||||
|
inherit (tools) lld;
|
||||||
inherit clang-tools-extra_src;
|
inherit clang-tools-extra_src;
|
||||||
};
|
};
|
||||||
clang-polly-unwrapped = callPackage ./clang {
|
|
||||||
inherit clang-tools-extra_src;
|
|
||||||
llvm = tools.llvm-polly;
|
|
||||||
enablePolly = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
llvm-manpages = lowPrio (tools.llvm.override {
|
# disabled until recommonmark supports sphinx 3
|
||||||
enableManpages = true;
|
#Llvm-manpages = lowPrio (tools.llvm.override {
|
||||||
python = pkgs.python; # don't use python-boot
|
# enableManpages = true;
|
||||||
});
|
# python3 = pkgs.python3; # don't use python-boot
|
||||||
|
#});
|
||||||
|
|
||||||
clang-manpages = lowPrio (tools.clang-unwrapped.override {
|
clang-manpages = lowPrio (tools.clang-unwrapped.override {
|
||||||
enableManpages = true;
|
enableManpages = true;
|
||||||
python = pkgs.python; # don't use python-boot
|
python3 = pkgs.python3; # don't use python-boot
|
||||||
});
|
});
|
||||||
|
|
||||||
|
# disabled until recommonmark supports sphinx 3
|
||||||
|
# lldb-manpages = lowPrio (tools.lldb.override {
|
||||||
|
# enableManpages = true;
|
||||||
|
# python3 = pkgs.python3; # don't use python-boot
|
||||||
|
# });
|
||||||
|
|
||||||
libclang = tools.clang-unwrapped.lib;
|
libclang = tools.clang-unwrapped.lib;
|
||||||
|
|
||||||
clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
|
clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
|
||||||
|
|
||||||
libstdcxxClang = wrapCCWith rec {
|
libstdcxxClang = wrapCCWith rec {
|
||||||
cc = tools.clang-unwrapped;
|
cc = tools.clang-unwrapped;
|
||||||
|
# libstdcxx is taken from gcc in an ad-hoc way in cc-wrapper.
|
||||||
|
libcxx = null;
|
||||||
extraPackages = [
|
extraPackages = [
|
||||||
libstdcxxHook
|
|
||||||
targetLlvmLibraries.compiler-rt
|
targetLlvmLibraries.compiler-rt
|
||||||
];
|
];
|
||||||
extraBuildCommands = mkExtraBuildCommands cc;
|
extraBuildCommands = mkExtraBuildCommands cc;
|
||||||
|
@ -72,14 +78,13 @@ let
|
||||||
cc = tools.clang-unwrapped;
|
cc = tools.clang-unwrapped;
|
||||||
libcxx = targetLlvmLibraries.libcxx;
|
libcxx = targetLlvmLibraries.libcxx;
|
||||||
extraPackages = [
|
extraPackages = [
|
||||||
targetLlvmLibraries.libcxx
|
|
||||||
targetLlvmLibraries.libcxxabi
|
targetLlvmLibraries.libcxxabi
|
||||||
targetLlvmLibraries.compiler-rt
|
targetLlvmLibraries.compiler-rt
|
||||||
];
|
];
|
||||||
extraBuildCommands = mkExtraBuildCommands cc;
|
extraBuildCommands = mkExtraBuildCommands cc;
|
||||||
};
|
};
|
||||||
|
|
||||||
lld = callPackage ./lld {};
|
lld = callPackage ./lld.nix {};
|
||||||
|
|
||||||
lldb = callPackage ./lldb.nix {};
|
lldb = callPackage ./lldb.nix {};
|
||||||
|
|
||||||
|
@ -99,14 +104,12 @@ let
|
||||||
inherit (tools) bintools;
|
inherit (tools) bintools;
|
||||||
};
|
};
|
||||||
extraPackages = [
|
extraPackages = [
|
||||||
targetLlvmLibraries.libcxx
|
|
||||||
targetLlvmLibraries.libcxxabi
|
targetLlvmLibraries.libcxxabi
|
||||||
targetLlvmLibraries.compiler-rt
|
targetLlvmLibraries.compiler-rt
|
||||||
] ++ stdenv.lib.optionals (!stdenv.targetPlatform.isWasm) [
|
] ++ stdenv.lib.optionals (!stdenv.targetPlatform.isWasm) [
|
||||||
targetLlvmLibraries.libunwind
|
targetLlvmLibraries.libunwind
|
||||||
];
|
];
|
||||||
extraBuildCommands = ''
|
extraBuildCommands = ''
|
||||||
echo "-target ${stdenv.targetPlatform.config}" >> $out/nix-support/cc-cflags
|
|
||||||
echo "-rtlib=compiler-rt -Wno-unused-command-line-argument" >> $out/nix-support/cc-cflags
|
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
|
echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
|
||||||
'' + stdenv.lib.optionalString (!stdenv.targetPlatform.isWasm) ''
|
'' + stdenv.lib.optionalString (!stdenv.targetPlatform.isWasm) ''
|
||||||
|
@ -131,7 +134,6 @@ let
|
||||||
targetLlvmLibraries.compiler-rt
|
targetLlvmLibraries.compiler-rt
|
||||||
];
|
];
|
||||||
extraBuildCommands = ''
|
extraBuildCommands = ''
|
||||||
echo "-target ${stdenv.targetPlatform.config}" >> $out/nix-support/cc-cflags
|
|
||||||
echo "-rtlib=compiler-rt" >> $out/nix-support/cc-cflags
|
echo "-rtlib=compiler-rt" >> $out/nix-support/cc-cflags
|
||||||
echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
|
echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
|
||||||
echo "-nostdlib++" >> $out/nix-support/cc-cflags
|
echo "-nostdlib++" >> $out/nix-support/cc-cflags
|
||||||
|
@ -153,7 +155,6 @@ let
|
||||||
targetLlvmLibraries.compiler-rt
|
targetLlvmLibraries.compiler-rt
|
||||||
];
|
];
|
||||||
extraBuildCommands = ''
|
extraBuildCommands = ''
|
||||||
echo "-target ${stdenv.targetPlatform.config}" >> $out/nix-support/cc-cflags
|
|
||||||
echo "-rtlib=compiler-rt" >> $out/nix-support/cc-cflags
|
echo "-rtlib=compiler-rt" >> $out/nix-support/cc-cflags
|
||||||
echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
|
echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
|
||||||
'' + mkExtraBuildCommands cc;
|
'' + mkExtraBuildCommands cc;
|
||||||
|
@ -169,7 +170,6 @@ let
|
||||||
extraPackages = [ ];
|
extraPackages = [ ];
|
||||||
extraBuildCommands = ''
|
extraBuildCommands = ''
|
||||||
echo "-nostartfiles" >> $out/nix-support/cc-cflags
|
echo "-nostartfiles" >> $out/nix-support/cc-cflags
|
||||||
echo "-target ${stdenv.targetPlatform.config}" >> $out/nix-support/cc-cflags
|
|
||||||
'' + stdenv.lib.optionalString stdenv.targetPlatform.isGenode ''
|
'' + stdenv.lib.optionalString stdenv.targetPlatform.isGenode ''
|
||||||
echo "--sysroot=${genodeBase}" >> $out/nix-support/cc-cflags
|
echo "--sysroot=${genodeBase}" >> $out/nix-support/cc-cflags
|
||||||
'';
|
'';
|
||||||
|
@ -178,7 +178,7 @@ let
|
||||||
});
|
});
|
||||||
|
|
||||||
libraries = stdenv.lib.makeExtensible (libraries: let
|
libraries = stdenv.lib.makeExtensible (libraries: let
|
||||||
callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python isl release_version version fetch; });
|
callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
|
||||||
in {
|
in {
|
||||||
|
|
||||||
compiler-rt = callPackage ./compiler-rt.nix ({} //
|
compiler-rt = callPackage ./compiler-rt.nix ({} //
|
|
@ -0,0 +1,56 @@
|
||||||
|
# SPDX-FileCopyrightText: 2003-2020 Nixpkgs/NixOS contributors
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
{ lib, stdenv, fetch, cmake, python3, libcxxabi, llvm, fixDarwinDylibNames, version
|
||||||
|
, enableShared ? true }:
|
||||||
|
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
pname = "libc++";
|
||||||
|
inherit version;
|
||||||
|
|
||||||
|
src = fetch "libcxx" "0ylbkcd38zrrz9xmkq9na3d9s8d96hc286dwfwd73wi205lyc7kc";
|
||||||
|
|
||||||
|
postUnpack = ''
|
||||||
|
unpackFile ${libcxxabi.src}
|
||||||
|
mv libcxxabi-* libcxxabi
|
||||||
|
unpackFile ${llvm.src}
|
||||||
|
mv llvm-* llvm
|
||||||
|
'';
|
||||||
|
|
||||||
|
patches = with stdenv.hostPlatform; []
|
||||||
|
++ stdenv.lib.optional isMusl ../../libcxx-0001-musl-hacks.patch
|
||||||
|
++ stdenv.lib.optional isGenode ./genode.patch;
|
||||||
|
|
||||||
|
preConfigure = lib.optionalString stdenv.hostPlatform.isMusl ''
|
||||||
|
patchShebangs utils/cat_files.py
|
||||||
|
'';
|
||||||
|
|
||||||
|
nativeBuildInputs = [ cmake python3 ]
|
||||||
|
++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
|
||||||
|
|
||||||
|
buildInputs = [ libcxxabi ];
|
||||||
|
|
||||||
|
cmakeFlags = [
|
||||||
|
"-DLIBCXX_CXX_ABI=libcxxabi"
|
||||||
|
] ++ stdenv.lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1"
|
||||||
|
++ stdenv.lib.optional (stdenv.hostPlatform.useLLVM or false) "-DLIBCXX_USE_COMPILER_RT=ON"
|
||||||
|
++ stdenv.lib.optional stdenv.hostPlatform.isWasm [
|
||||||
|
"-DLIBCXX_ENABLE_THREADS=OFF"
|
||||||
|
"-DLIBCXX_ENABLE_FILESYSTEM=OFF"
|
||||||
|
"-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
|
||||||
|
] ++ stdenv.lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF";
|
||||||
|
|
||||||
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
|
passthru = {
|
||||||
|
isLLVM = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
homepage = "https://libcxx.llvm.org/";
|
||||||
|
description = "A new implementation of the C++ standard library, targeting C++11";
|
||||||
|
license = with stdenv.lib.licenses; [ ncsa mit ];
|
||||||
|
platforms = stdenv.lib.platforms.all;
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
diff --git a/utils/google-benchmark/src/internal_macros.h b/utils/google-benchmark/src/internal_macros.h
|
||||||
|
index 5dbf4fd27..4699c5ed9 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__)
|
|
@ -5,14 +5,11 @@
|
||||||
{ stdenv, cmake, fetch, libcxx, libunwind, llvm, version
|
{ stdenv, cmake, fetch, libcxx, libunwind, llvm, version
|
||||||
, enableShared ? true }:
|
, enableShared ? true }:
|
||||||
|
|
||||||
let
|
|
||||||
enableShared' = enableShared -> !stdenv.hostPlatform.isGenode;
|
|
||||||
in
|
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
pname = "libc++abi";
|
pname = "libc++abi";
|
||||||
inherit version;
|
inherit version;
|
||||||
|
|
||||||
src = fetch "libcxxabi" "1vznz8n1z1h8af0ga451m98lc2hjnv4fyzl71napsvjhvk4g6nxp";
|
src = fetch "libcxxabi" "05ac7rkjbla03bc0lf92f901dfjgxdvp8cr9fpn59a5p4x27ssaq";
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake ];
|
nativeBuildInputs = [ cmake ];
|
||||||
buildInputs = stdenv.lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isGenode && !stdenv.hostPlatform.isWasm) libunwind;
|
buildInputs = stdenv.lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isGenode && !stdenv.hostPlatform.isWasm) libunwind;
|
||||||
|
@ -23,31 +20,25 @@ stdenv.mkDerivation {
|
||||||
] ++ stdenv.lib.optionals stdenv.hostPlatform.isWasm [
|
] ++ stdenv.lib.optionals stdenv.hostPlatform.isWasm [
|
||||||
"-DLIBCXXABI_ENABLE_THREADS=OFF"
|
"-DLIBCXXABI_ENABLE_THREADS=OFF"
|
||||||
"-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF"
|
"-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF"
|
||||||
] ++ stdenv.lib.optionals (!enableShared') [
|
] ++ stdenv.lib.optionals (!enableShared) [
|
||||||
"-DLIBCXXABI_ENABLE_SHARED=OFF"
|
"-DLIBCXXABI_ENABLE_SHARED=OFF"
|
||||||
] ++ stdenv.lib.optionals stdenv.hostPlatform.isGenode [
|
|
||||||
"-DCMAKE_C_FLAGS=-nodefaultlibs"
|
|
||||||
"-DLIBCXXABI_ENABLE_THREADS=OFF"
|
|
||||||
"-DLIBCXXABI_BAREMETAL=ON"
|
|
||||||
"-DLIBCXXABI_ENABLE_STATIC_UNWINDER=ON"
|
|
||||||
];
|
|
||||||
|
|
||||||
patches = [
|
|
||||||
./libcxxabi-no-threads.patch
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
patches = [ ./libcxxabi-no-threads.patch ];
|
||||||
|
|
||||||
postUnpack = ''
|
postUnpack = ''
|
||||||
unpackFile ${libcxx.src}
|
unpackFile ${libcxx.src}
|
||||||
|
mv libcxx-* libcxx
|
||||||
unpackFile ${llvm.src}
|
unpackFile ${llvm.src}
|
||||||
cmakeFlags+=" -DLLVM_PATH=$PWD/$(ls -d llvm-*) -DLIBCXXABI_LIBCXX_PATH=$PWD/$(ls -d libcxx-*)"
|
mv llvm-* llvm
|
||||||
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
||||||
export TRIPLE=x86_64-apple-darwin
|
export TRIPLE=x86_64-apple-darwin
|
||||||
'' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
|
'' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
|
||||||
patch -p1 -d $(ls -d libcxx-*) -i ${../libcxx-0001-musl-hacks.patch}
|
patch -p1 -d libcxx -i ${../libcxx-0001-musl-hacks.patch}
|
||||||
'' + stdenv.lib.optionalString stdenv.targetPlatform.isGenode ''
|
'' + stdenv.lib.optionalString stdenv.targetPlatform.isGenode ''
|
||||||
patch -p1 -d $(ls -d llvm-*) -i ${./llvm-genode.patch}
|
patch -p1 -d $(ls -d llvm-*) -i ${./llvm-genode.patch}
|
||||||
'' + stdenv.lib.optionalString stdenv.hostPlatform.isWasm ''
|
'' + stdenv.lib.optionalString stdenv.hostPlatform.isWasm ''
|
||||||
patch -p1 -d $(ls -d llvm-*) -i ${./libcxxabi-wasm.patch}
|
patch -p1 -d llvm -i ${./libcxxabi-wasm.patch}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase = if stdenv.isDarwin
|
installPhase = if stdenv.isDarwin
|
||||||
|
@ -56,7 +47,7 @@ stdenv.mkDerivation {
|
||||||
# this should be done in CMake, but having trouble figuring out
|
# this should be done in CMake, but having trouble figuring out
|
||||||
# the magic combination of necessary CMake variables
|
# the magic combination of necessary CMake variables
|
||||||
# if you fancy a try, take a look at
|
# if you fancy a try, take a look at
|
||||||
# http://www.cmake.org/Wiki/CMake_RPATH_handling
|
# https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling
|
||||||
install_name_tool -id $out/$file $file
|
install_name_tool -id $out/$file $file
|
||||||
done
|
done
|
||||||
make install
|
make install
|
||||||
|
@ -66,15 +57,15 @@ stdenv.mkDerivation {
|
||||||
else ''
|
else ''
|
||||||
install -d -m 755 $out/include $out/lib
|
install -d -m 755 $out/include $out/lib
|
||||||
install -m 644 lib/libc++abi.a $out/lib
|
install -m 644 lib/libc++abi.a $out/lib
|
||||||
install -m 644 ../include/*.h $out/include
|
install -m 644 ../include/cxxabi.h $out/include
|
||||||
'' + stdenv.lib.optionalString enableShared' ''
|
'' + stdenv.lib.optionalString enableShared ''
|
||||||
install -m 644 lib/libc++abi.so.1.0 $out/lib
|
install -m 644 lib/libc++abi.so.1.0 $out/lib
|
||||||
ln -s libc++abi.so.1.0 $out/lib/libc++abi.so
|
ln -s libc++abi.so.1.0 $out/lib/libc++abi.so
|
||||||
ln -s libc++abi.so.1.0 $out/lib/libc++abi.so.1
|
ln -s libc++abi.so.1.0 $out/lib/libc++abi.so.1
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
homepage = http://libcxxabi.llvm.org/;
|
homepage = "https://libcxxabi.llvm.org/";
|
||||||
description = "A new implementation of low level support for a standard C++ library";
|
description = "A new implementation of low level support for a standard C++ library";
|
||||||
license = with stdenv.lib.licenses; [ ncsa mit ];
|
license = with stdenv.lib.licenses; [ ncsa mit ];
|
||||||
maintainers = with stdenv.lib.maintainers; [ vlstill ];
|
maintainers = with stdenv.lib.maintainers; [ vlstill ];
|
|
@ -0,0 +1,13 @@
|
||||||
|
diff --git a/src/assembly.h b/src/assembly.h
|
||||||
|
index 4cf179e13..2c0e11d27 100644
|
||||||
|
--- a/src/assembly.h
|
||||||
|
+++ b/src/assembly.h
|
||||||
|
@@ -87,7 +87,7 @@
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#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
|
|
@ -0,0 +1,20 @@
|
||||||
|
# SPDX-FileCopyrightText: 2003-2020 Nixpkgs/NixOS contributors
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
{ stdenv, version, fetch, cmake, fetchpatch, enableShared ? true }:
|
||||||
|
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
pname = "libunwind";
|
||||||
|
inherit version;
|
||||||
|
|
||||||
|
src = fetch pname "0bwjd2xf51r2apn8p0f9shb6nc8hnqzq1n9gggjvyjmi6cf02mc4";
|
||||||
|
|
||||||
|
nativeBuildInputs = [ cmake ];
|
||||||
|
|
||||||
|
patches = [ ./libunwind-genode.patch ];
|
||||||
|
|
||||||
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
|
cmakeFlags = stdenv.lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF";
|
||||||
|
}
|
|
@ -10,11 +10,11 @@
|
||||||
, version
|
, version
|
||||||
}:
|
}:
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation rec {
|
||||||
pname = "lld";
|
pname = "lld";
|
||||||
inherit version;
|
inherit version;
|
||||||
|
|
||||||
src = fetch "lld" "121xhxrlvwy3k5nf6p1wv31whxlb635ssfkci8z93mwv4ja1xflz";
|
src = fetch pname "077xyh7sij6mhp4dc4kdcmp9whrpz332fa12rwxnzp3wgd5bxrzg";
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake ];
|
nativeBuildInputs = [ cmake ];
|
||||||
buildInputs = [ llvm libxml2 ];
|
buildInputs = [ llvm libxml2 ];
|
||||||
|
@ -32,7 +32,7 @@ stdenv.mkDerivation {
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
description = "The LLVM Linker";
|
description = "The LLVM Linker";
|
||||||
homepage = http://lld.llvm.org/;
|
homepage = "https://lld.llvm.org/";
|
||||||
license = stdenv.lib.licenses.ncsa;
|
license = stdenv.lib.licenses.ncsa;
|
||||||
platforms = stdenv.lib.platforms.all;
|
platforms = stdenv.lib.platforms.all;
|
||||||
};
|
};
|
|
@ -0,0 +1,68 @@
|
||||||
|
diff --git a/ELF/Driver.cpp b/ELF/Driver.cpp
|
||||||
|
index 4637a3b30..11c12f032 100644
|
||||||
|
--- a/ELF/Driver.cpp
|
||||||
|
+++ b/ELF/Driver.cpp
|
||||||
|
@@ -254,12 +254,7 @@ void LinkerDriver::addFile(StringRef path, bool withLOption) {
|
||||||
|
// file has a DT_SONAME or not because we haven't parsed it yet.
|
||||||
|
// Here, we set the default soname for the file because we might
|
||||||
|
// need it later.
|
||||||
|
- //
|
||||||
|
- // If a file was specified by -lfoo, the directory part is not
|
||||||
|
- // significant, as a user did not specify it. This behavior is
|
||||||
|
- // compatible with GNU.
|
||||||
|
- files.push_back(
|
||||||
|
- make<SharedFile>(mbref, withLOption ? path::filename(path) : path));
|
||||||
|
+ files.push_back(make<SharedFile>(MBRef, Path));
|
||||||
|
return;
|
||||||
|
case file_magic::bitcode:
|
||||||
|
case file_magic::elf_relocatable:
|
||||||
|
diff --git a/ELF/DriverUtils.cpp b/ELF/DriverUtils.cpp
|
||||||
|
index e33b07c0c..ece0e7343 100644
|
||||||
|
--- a/ELF/DriverUtils.cpp
|
||||||
|
+++ b/ELF/DriverUtils.cpp
|
||||||
|
@@ -205,14 +205,16 @@ std::string elf::createResponseFile(const opt::InputArgList &args) {
|
||||||
|
// Find a file by concatenating given paths. If a resulting path
|
||||||
|
// starts with "=", the character is replaced with a --sysroot value.
|
||||||
|
static Optional<std::string> findFile(StringRef path1, const Twine &path2) {
|
||||||
|
- SmallString<128> s;
|
||||||
|
+ SmallString<256> s;
|
||||||
|
if (path1.startswith("="))
|
||||||
|
path::append(s, config->sysroot, path1.substr(1), path2);
|
||||||
|
else
|
||||||
|
path::append(s, path1, path2);
|
||||||
|
|
||||||
|
- if (fs::exists(s))
|
||||||
|
- return std::string(s);
|
||||||
|
+ SmallString<256> RealPath;
|
||||||
|
+ fs::real_path(s, RealPath);
|
||||||
|
+ if (fs::exists(RealPath))
|
||||||
|
+ return RealPath.str().str();
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -228,10 +230,21 @@ Optional<std::string> elf::findFromSearchPaths(StringRef path) {
|
||||||
|
Optional<std::string> elf::searchLibraryBaseName(StringRef name) {
|
||||||
|
for (StringRef dir : config->searchPaths) {
|
||||||
|
if (!config->isStatic)
|
||||||
|
- if (Optional<std::string> s = findFile(dir, "lib" + name + ".so"))
|
||||||
|
- return s;
|
||||||
|
- if (Optional<std::string> s = findFile(dir, "lib" + name + ".a"))
|
||||||
|
- return s;
|
||||||
|
+ if (Name.size() == 1) {
|
||||||
|
+ if (Optional<std::string> S = findFile(dir, "lib" + Name + ".lib.so"))
|
||||||
|
+ return S;
|
||||||
|
+ if (Optional<std::string> S = findFile(dir, "lib" + Name + ".so"))
|
||||||
|
+ return S;
|
||||||
|
+ } else {
|
||||||
|
+ if (Optional<std::string> S = findFile(dir, Name + ".lib.so"))
|
||||||
|
+ return S;
|
||||||
|
+ if (Optional<std::string> S = findFile(Dir, "lib" + Name + ".so"))
|
||||||
|
+ return S;
|
||||||
|
+ }
|
||||||
|
+ if (Optional<std::string> S = findFile(dir, Name + ".lib.a"))
|
||||||
|
+ return S;
|
||||||
|
+ if (Optional<std::string> S = findFile(dir, "lib" + Name + ".a"))
|
||||||
|
+ return S;
|
||||||
|
}
|
||||||
|
return None;
|
||||||
|
}
|
|
@ -0,0 +1,105 @@
|
||||||
|
# SPDX-FileCopyrightText: 2003-2020 Nixpkgs/NixOS contributors
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
{ stdenv
|
||||||
|
, fetch
|
||||||
|
, cmake
|
||||||
|
, zlib
|
||||||
|
, ncurses
|
||||||
|
, swig
|
||||||
|
, which
|
||||||
|
, libedit
|
||||||
|
, libxml2
|
||||||
|
, llvm
|
||||||
|
, clang-unwrapped
|
||||||
|
, python3
|
||||||
|
, version
|
||||||
|
, darwin
|
||||||
|
, lit
|
||||||
|
, enableManpages ? false
|
||||||
|
}:
|
||||||
|
|
||||||
|
stdenv.mkDerivation (rec {
|
||||||
|
pname = "lldb";
|
||||||
|
inherit version;
|
||||||
|
|
||||||
|
src = fetch pname "0wic9lyb2la9bkzdc13szkm4f793w1mddp50xvh237iraygw0w45";
|
||||||
|
|
||||||
|
patches = [ ./lldb-procfs.patch ];
|
||||||
|
|
||||||
|
nativeBuildInputs = [ cmake python3 which swig lit ]
|
||||||
|
++ stdenv.lib.optionals enableManpages [ python3.pkgs.sphinx python3.pkgs.recommonmark ];
|
||||||
|
|
||||||
|
buildInputs = [
|
||||||
|
ncurses
|
||||||
|
zlib
|
||||||
|
libedit
|
||||||
|
libxml2
|
||||||
|
llvm
|
||||||
|
]
|
||||||
|
++ stdenv.lib.optionals stdenv.isDarwin [
|
||||||
|
darwin.libobjc
|
||||||
|
darwin.apple_sdk.libs.xpc
|
||||||
|
darwin.apple_sdk.frameworks.Foundation
|
||||||
|
darwin.bootstrap_cmds
|
||||||
|
darwin.apple_sdk.frameworks.Carbon
|
||||||
|
darwin.apple_sdk.frameworks.Cocoa
|
||||||
|
];
|
||||||
|
|
||||||
|
hardeningDisable = [ "format" ];
|
||||||
|
|
||||||
|
cmakeFlags = [
|
||||||
|
"-DLLVM_ENABLE_RTTI=OFF"
|
||||||
|
"-DClang_DIR=${clang-unwrapped}/lib/cmake"
|
||||||
|
"-DLLVM_EXTERNAL_LIT=${lit}/bin/lit"
|
||||||
|
] ++ stdenv.lib.optionals stdenv.isDarwin [
|
||||||
|
"-DLLDB_USE_SYSTEM_DEBUGSERVER=ON"
|
||||||
|
] ++ stdenv.lib.optionals (!stdenv.isDarwin) [
|
||||||
|
"-DLLDB_CODESIGN_IDENTITY=" # codesigning makes nondeterministic
|
||||||
|
] ++ stdenv.lib.optionals enableManpages [
|
||||||
|
"-DLLVM_ENABLE_SPHINX=ON"
|
||||||
|
"-DSPHINX_OUTPUT_MAN=ON"
|
||||||
|
"-DSPHINX_OUTPUT_HTML=OFF"
|
||||||
|
];
|
||||||
|
|
||||||
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
|
postInstall = ''
|
||||||
|
# Editor support
|
||||||
|
# vscode:
|
||||||
|
install -D ../tools/lldb-vscode/package.json $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/package.json
|
||||||
|
mkdir -p $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/bin
|
||||||
|
ln -s $out/bin/lldb-vscode $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/bin
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = with stdenv.lib; {
|
||||||
|
description = "A next-generation high-performance debugger";
|
||||||
|
homepage = "https://lldb.llvm.org";
|
||||||
|
license = licenses.ncsa;
|
||||||
|
platforms = platforms.all;
|
||||||
|
};
|
||||||
|
} // stdenv.lib.optionalAttrs enableManpages {
|
||||||
|
pname = "lldb-manpages";
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
make docs-lldb-man
|
||||||
|
'';
|
||||||
|
|
||||||
|
propagatedBuildInputs = [];
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
# manually install lldb man page
|
||||||
|
mkdir -p $out/share/man/man1
|
||||||
|
install docs/man/lldb.1 -t $out/share/man/man1/
|
||||||
|
'';
|
||||||
|
|
||||||
|
postPatch = null;
|
||||||
|
postInstall = null;
|
||||||
|
|
||||||
|
outputs = [ "out" ];
|
||||||
|
|
||||||
|
doCheck = false;
|
||||||
|
|
||||||
|
meta.description = "man pages for LLDB ${version}";
|
||||||
|
})
|
|
@ -1,8 +1,8 @@
|
||||||
diff --git a/cmake/modules/HandleLLVMOptions.cmake b/cmake/modules/HandleLLVMOptions.cmake
|
diff --git a/cmake/modules/HandleLLVMOptions.cmake b/cmake/modules/HandleLLVMOptions.cmake
|
||||||
index 49db3088bbc..32ffed3cb2e 100644
|
index 5ef22eb49..f40625c7e 100644
|
||||||
--- a/cmake/modules/HandleLLVMOptions.cmake
|
--- a/cmake/modules/HandleLLVMOptions.cmake
|
||||||
+++ b/cmake/modules/HandleLLVMOptions.cmake
|
+++ b/cmake/modules/HandleLLVMOptions.cmake
|
||||||
@@ -107,7 +107,7 @@ if(WIN32)
|
@@ -132,7 +132,7 @@ if(WIN32)
|
||||||
set(LLVM_ON_UNIX 0)
|
set(LLVM_ON_UNIX 0)
|
||||||
endif(CYGWIN)
|
endif(CYGWIN)
|
||||||
else(WIN32)
|
else(WIN32)
|
||||||
|
@ -11,7 +11,7 @@ index 49db3088bbc..32ffed3cb2e 100644
|
||||||
set(LLVM_ON_WIN32 0)
|
set(LLVM_ON_WIN32 0)
|
||||||
set(LLVM_ON_UNIX 1)
|
set(LLVM_ON_UNIX 1)
|
||||||
if(APPLE OR ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
|
if(APPLE OR ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
|
||||||
@@ -115,9 +115,9 @@ else(WIN32)
|
@@ -140,9 +140,9 @@ else(WIN32)
|
||||||
else()
|
else()
|
||||||
set(LLVM_HAVE_LINK_VERSION_SCRIPT 1)
|
set(LLVM_HAVE_LINK_VERSION_SCRIPT 1)
|
||||||
endif()
|
endif()
|
||||||
|
@ -24,10 +24,10 @@ index 49db3088bbc..32ffed3cb2e 100644
|
||||||
|
|
||||||
set(EXEEXT ${CMAKE_EXECUTABLE_SUFFIX})
|
set(EXEEXT ${CMAKE_EXECUTABLE_SUFFIX})
|
||||||
diff --git a/include/llvm/ADT/Triple.h b/include/llvm/ADT/Triple.h
|
diff --git a/include/llvm/ADT/Triple.h b/include/llvm/ADT/Triple.h
|
||||||
index e06a68e2731..7da3d5d29bc 100644
|
index 6bad18f19..c354f80ad 100644
|
||||||
--- a/include/llvm/ADT/Triple.h
|
--- a/include/llvm/ADT/Triple.h
|
||||||
+++ b/include/llvm/ADT/Triple.h
|
+++ b/include/llvm/ADT/Triple.h
|
||||||
@@ -159,6 +159,7 @@ public:
|
@@ -166,6 +166,7 @@ public:
|
||||||
DragonFly,
|
DragonFly,
|
||||||
FreeBSD,
|
FreeBSD,
|
||||||
Fuchsia,
|
Fuchsia,
|
||||||
|
@ -35,7 +35,7 @@ index e06a68e2731..7da3d5d29bc 100644
|
||||||
IOS,
|
IOS,
|
||||||
KFreeBSD,
|
KFreeBSD,
|
||||||
Linux,
|
Linux,
|
||||||
@@ -498,6 +499,8 @@ public:
|
@@ -502,6 +503,8 @@ public:
|
||||||
|
|
||||||
bool isOSDragonFly() const { return getOS() == Triple::DragonFly; }
|
bool isOSDragonFly() const { return getOS() == Triple::DragonFly; }
|
||||||
|
|
||||||
|
@ -44,8 +44,20 @@ index e06a68e2731..7da3d5d29bc 100644
|
||||||
bool isOSSolaris() const {
|
bool isOSSolaris() const {
|
||||||
return getOS() == Triple::Solaris;
|
return getOS() == Triple::Solaris;
|
||||||
}
|
}
|
||||||
|
@@ -586,6 +589,11 @@ public:
|
||||||
|
return getOS() == Triple::KFreeBSD;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ /// Tests whether the OS is Genode.
|
||||||
|
+ bool isOSGenode() const {
|
||||||
|
+ return getOS() == Triple::Genode;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
/// Tests whether the OS is Hurd.
|
||||||
|
bool isOSHurd() const {
|
||||||
|
return getOS() == Triple::Hurd;
|
||||||
diff --git a/include/llvm/BinaryFormat/ELF.h b/include/llvm/BinaryFormat/ELF.h
|
diff --git a/include/llvm/BinaryFormat/ELF.h b/include/llvm/BinaryFormat/ELF.h
|
||||||
index ce35d127d43..d7a589057db 100644
|
index bdcf10fd1..46ed8e56c 100644
|
||||||
--- a/include/llvm/BinaryFormat/ELF.h
|
--- a/include/llvm/BinaryFormat/ELF.h
|
||||||
+++ b/include/llvm/BinaryFormat/ELF.h
|
+++ b/include/llvm/BinaryFormat/ELF.h
|
||||||
@@ -348,6 +348,7 @@ enum {
|
@@ -348,6 +348,7 @@ enum {
|
||||||
|
@ -57,7 +69,7 @@ index ce35d127d43..d7a589057db 100644
|
||||||
ELFOSABI_AMDGPU_HSA = 64, // AMD HSA runtime
|
ELFOSABI_AMDGPU_HSA = 64, // AMD HSA runtime
|
||||||
ELFOSABI_AMDGPU_PAL = 65, // AMD PAL runtime
|
ELFOSABI_AMDGPU_PAL = 65, // AMD PAL runtime
|
||||||
diff --git a/include/llvm/MC/MCELFObjectWriter.h b/include/llvm/MC/MCELFObjectWriter.h
|
diff --git a/include/llvm/MC/MCELFObjectWriter.h b/include/llvm/MC/MCELFObjectWriter.h
|
||||||
index f226d6a45a5..91efe079d20 100644
|
index 8f78b99d3..7a1d1981f 100644
|
||||||
--- a/include/llvm/MC/MCELFObjectWriter.h
|
--- a/include/llvm/MC/MCELFObjectWriter.h
|
||||||
+++ b/include/llvm/MC/MCELFObjectWriter.h
|
+++ b/include/llvm/MC/MCELFObjectWriter.h
|
||||||
@@ -74,6 +74,8 @@ public:
|
@@ -74,6 +74,8 @@ public:
|
||||||
|
@ -70,10 +82,10 @@ index f226d6a45a5..91efe079d20 100644
|
||||||
return ELF::ELFOSABI_STANDALONE;
|
return ELF::ELFOSABI_STANDALONE;
|
||||||
case Triple::PS4:
|
case Triple::PS4:
|
||||||
diff --git a/lib/ObjectYAML/ELFYAML.cpp b/lib/ObjectYAML/ELFYAML.cpp
|
diff --git a/lib/ObjectYAML/ELFYAML.cpp b/lib/ObjectYAML/ELFYAML.cpp
|
||||||
index 215d6bdd091..0d3f5eaf032 100644
|
index 2353b34f1..e93f53c40 100644
|
||||||
--- a/lib/ObjectYAML/ELFYAML.cpp
|
--- a/lib/ObjectYAML/ELFYAML.cpp
|
||||||
+++ b/lib/ObjectYAML/ELFYAML.cpp
|
+++ b/lib/ObjectYAML/ELFYAML.cpp
|
||||||
@@ -260,6 +260,7 @@ void ScalarEnumerationTraits<ELFYAML::ELF_ELFOSABI>::enumeration(
|
@@ -268,6 +268,7 @@ void ScalarEnumerationTraits<ELFYAML::ELF_ELFOSABI>::enumeration(
|
||||||
ECase(ELFOSABI_AROS);
|
ECase(ELFOSABI_AROS);
|
||||||
ECase(ELFOSABI_FENIXOS);
|
ECase(ELFOSABI_FENIXOS);
|
||||||
ECase(ELFOSABI_CLOUDABI);
|
ECase(ELFOSABI_CLOUDABI);
|
||||||
|
@ -82,18 +94,18 @@ index 215d6bdd091..0d3f5eaf032 100644
|
||||||
ECase(ELFOSABI_AMDGPU_PAL);
|
ECase(ELFOSABI_AMDGPU_PAL);
|
||||||
ECase(ELFOSABI_AMDGPU_MESA3D);
|
ECase(ELFOSABI_AMDGPU_MESA3D);
|
||||||
diff --git a/lib/Support/Triple.cpp b/lib/Support/Triple.cpp
|
diff --git a/lib/Support/Triple.cpp b/lib/Support/Triple.cpp
|
||||||
index 26d9327f620..1866b07ac68 100644
|
index fec1985cc..1f3e4f07f 100644
|
||||||
--- a/lib/Support/Triple.cpp
|
--- a/lib/Support/Triple.cpp
|
||||||
+++ b/lib/Support/Triple.cpp
|
+++ b/lib/Support/Triple.cpp
|
||||||
@@ -181,6 +181,7 @@ StringRef Triple::getOSTypeName(OSType Kind) {
|
@@ -197,6 +197,7 @@ StringRef Triple::getOSTypeName(OSType Kind) {
|
||||||
case DragonFly: return "dragonfly";
|
case Emscripten: return "emscripten";
|
||||||
case FreeBSD: return "freebsd";
|
case FreeBSD: return "freebsd";
|
||||||
case Fuchsia: return "fuchsia";
|
case Fuchsia: return "fuchsia";
|
||||||
+ case Genode: return "genode";
|
+ case Genode: return "genode";
|
||||||
case IOS: return "ios";
|
case Haiku: return "haiku";
|
||||||
case KFreeBSD: return "kfreebsd";
|
case HermitCore: return "hermit";
|
||||||
case Linux: return "linux";
|
case Hurd: return "hurd";
|
||||||
@@ -478,6 +479,7 @@ static Triple::OSType parseOS(StringRef OSName) {
|
@@ -494,6 +495,7 @@ static Triple::OSType parseOS(StringRef OSName) {
|
||||||
.StartsWith("dragonfly", Triple::DragonFly)
|
.StartsWith("dragonfly", Triple::DragonFly)
|
||||||
.StartsWith("freebsd", Triple::FreeBSD)
|
.StartsWith("freebsd", Triple::FreeBSD)
|
||||||
.StartsWith("fuchsia", Triple::Fuchsia)
|
.StartsWith("fuchsia", Triple::Fuchsia)
|
||||||
|
@ -102,10 +114,10 @@ index 26d9327f620..1866b07ac68 100644
|
||||||
.StartsWith("kfreebsd", Triple::KFreeBSD)
|
.StartsWith("kfreebsd", Triple::KFreeBSD)
|
||||||
.StartsWith("linux", Triple::Linux)
|
.StartsWith("linux", Triple::Linux)
|
||||||
diff --git a/tools/llvm-readobj/ELFDumper.cpp b/tools/llvm-readobj/ELFDumper.cpp
|
diff --git a/tools/llvm-readobj/ELFDumper.cpp b/tools/llvm-readobj/ELFDumper.cpp
|
||||||
index 93254717e92..3d96ff9332a 100644
|
index 15076f1f8..b0636e7eb 100644
|
||||||
--- a/tools/llvm-readobj/ELFDumper.cpp
|
--- a/tools/llvm-readobj/ELFDumper.cpp
|
||||||
+++ b/tools/llvm-readobj/ELFDumper.cpp
|
+++ b/tools/llvm-readobj/ELFDumper.cpp
|
||||||
@@ -911,6 +911,7 @@ static const EnumEntry<unsigned> ElfOSABI[] = {
|
@@ -1334,6 +1334,7 @@ static const EnumEntry<unsigned> ElfOSABI[] = {
|
||||||
{"AROS", "AROS", ELF::ELFOSABI_AROS},
|
{"AROS", "AROS", ELF::ELFOSABI_AROS},
|
||||||
{"FenixOS", "FenixOS", ELF::ELFOSABI_FENIXOS},
|
{"FenixOS", "FenixOS", ELF::ELFOSABI_FENIXOS},
|
||||||
{"CloudABI", "CloudABI", ELF::ELFOSABI_CLOUDABI},
|
{"CloudABI", "CloudABI", ELF::ELFOSABI_CLOUDABI},
|
||||||
|
@ -114,10 +126,10 @@ index 93254717e92..3d96ff9332a 100644
|
||||||
};
|
};
|
||||||
|
|
||||||
diff --git a/unittests/ADT/TripleTest.cpp b/unittests/ADT/TripleTest.cpp
|
diff --git a/unittests/ADT/TripleTest.cpp b/unittests/ADT/TripleTest.cpp
|
||||||
index bc7f9321caa..5d6a56d7723 100644
|
index dc7a28c72..eb62772c1 100644
|
||||||
--- a/unittests/ADT/TripleTest.cpp
|
--- a/unittests/ADT/TripleTest.cpp
|
||||||
+++ b/unittests/ADT/TripleTest.cpp
|
+++ b/unittests/ADT/TripleTest.cpp
|
||||||
@@ -241,6 +241,12 @@ TEST(TripleTest, ParsedIDs) {
|
@@ -248,6 +248,12 @@ TEST(TripleTest, ParsedIDs) {
|
||||||
EXPECT_EQ(Triple::Fuchsia, T.getOS());
|
EXPECT_EQ(Triple::Fuchsia, T.getOS());
|
||||||
EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
|
EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
|
||||||
|
|
||||||
|
@ -131,7 +143,7 @@ index bc7f9321caa..5d6a56d7723 100644
|
||||||
EXPECT_EQ(Triple::x86_64, T.getArch());
|
EXPECT_EQ(Triple::x86_64, T.getArch());
|
||||||
EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
|
EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
|
||||||
diff --git a/utils/benchmark/src/internal_macros.h b/utils/benchmark/src/internal_macros.h
|
diff --git a/utils/benchmark/src/internal_macros.h b/utils/benchmark/src/internal_macros.h
|
||||||
index f2d54bfcbd9..e20f891d435 100644
|
index f2d54bfcb..e20f891d4 100644
|
||||||
--- a/utils/benchmark/src/internal_macros.h
|
--- a/utils/benchmark/src/internal_macros.h
|
||||||
+++ b/utils/benchmark/src/internal_macros.h
|
+++ b/utils/benchmark/src/internal_macros.h
|
||||||
@@ -65,6 +65,8 @@
|
@@ -65,6 +65,8 @@
|
||||||
|
@ -144,11 +156,11 @@ index f2d54bfcbd9..e20f891d435 100644
|
||||||
|
|
||||||
#if !__has_feature(cxx_exceptions) && !defined(__cpp_exceptions) \
|
#if !__has_feature(cxx_exceptions) && !defined(__cpp_exceptions) \
|
||||||
diff --git a/utils/gn/secondary/clang/lib/Driver/BUILD.gn b/utils/gn/secondary/clang/lib/Driver/BUILD.gn
|
diff --git a/utils/gn/secondary/clang/lib/Driver/BUILD.gn b/utils/gn/secondary/clang/lib/Driver/BUILD.gn
|
||||||
index 1f07a6272d8..74eefe63b01 100644
|
index 04d483a12..e487a9a9a 100644
|
||||||
--- a/utils/gn/secondary/clang/lib/Driver/BUILD.gn
|
--- a/utils/gn/secondary/clang/lib/Driver/BUILD.gn
|
||||||
+++ b/utils/gn/secondary/clang/lib/Driver/BUILD.gn
|
+++ b/utils/gn/secondary/clang/lib/Driver/BUILD.gn
|
||||||
@@ -62,6 +62,7 @@ static_library("Driver") {
|
@@ -66,6 +66,7 @@ static_library("Driver") {
|
||||||
"ToolChains/DragonFly.cpp",
|
"ToolChains/Flang.cpp",
|
||||||
"ToolChains/FreeBSD.cpp",
|
"ToolChains/FreeBSD.cpp",
|
||||||
"ToolChains/Fuchsia.cpp",
|
"ToolChains/Fuchsia.cpp",
|
||||||
+ "ToolChains/Genode.cpp",
|
+ "ToolChains/Genode.cpp",
|
|
@ -5,7 +5,7 @@
|
||||||
{ stdenv
|
{ stdenv
|
||||||
, fetch
|
, fetch
|
||||||
, cmake
|
, cmake
|
||||||
, python
|
, python3
|
||||||
, libffi
|
, libffi
|
||||||
, libbfd
|
, libbfd
|
||||||
, libpfm
|
, libpfm
|
||||||
|
@ -20,6 +20,7 @@
|
||||||
, enableSharedLibraries ? true
|
, enableSharedLibraries ? true
|
||||||
, enablePFM ? !(stdenv.isDarwin
|
, enablePFM ? !(stdenv.isDarwin
|
||||||
|| stdenv.isAarch64 # broken for Ampere eMAG 8180 (c2.large.arm on Packet) #56245
|
|| stdenv.isAarch64 # broken for Ampere eMAG 8180 (c2.large.arm on Packet) #56245
|
||||||
|
|| stdenv.isAarch32 # broken for the armv7l builder
|
||||||
)
|
)
|
||||||
, enablePolly ? false
|
, enablePolly ? false
|
||||||
}:
|
}:
|
||||||
|
@ -31,11 +32,12 @@ let
|
||||||
shortVersion = with stdenv.lib;
|
shortVersion = with stdenv.lib;
|
||||||
concatStringsSep "." (take 1 (splitString "." release_version));
|
concatStringsSep "." (take 1 (splitString "." release_version));
|
||||||
|
|
||||||
in stdenv.mkDerivation ({
|
in stdenv.mkDerivation (rec {
|
||||||
name = "llvm-${version}";
|
pname = "llvm";
|
||||||
|
inherit version;
|
||||||
|
|
||||||
src = fetch "llvm" "1rvm5gqp5v8hfn17kqws3zhk94w4kxndal12bqa0y57p09nply24";
|
src = fetch pname "0s94lwil98w7zb7cjrbnxli0z7gklb312pkw74xs1d6zk346hgwi";
|
||||||
polly_src = fetch "polly" "1lfjdz3ilj5xmjxvicd8f5ykybks67ry2pdb777352r3mzlgg8g8";
|
polly_src = fetch "polly" "0h442ivcslr3dv3q3g1nw5avh77f8cxsp6zild1hgspj266xpynw";
|
||||||
|
|
||||||
unpackPhase = ''
|
unpackPhase = ''
|
||||||
unpackFile $src
|
unpackFile $src
|
||||||
|
@ -49,8 +51,8 @@ in stdenv.mkDerivation ({
|
||||||
outputs = [ "out" "python" ]
|
outputs = [ "out" "python" ]
|
||||||
++ optional enableSharedLibraries "lib";
|
++ optional enableSharedLibraries "lib";
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake python ]
|
nativeBuildInputs = [ cmake python3 ]
|
||||||
++ optionals enableManpages [ python.pkgs.sphinx python.pkgs.recommonmark ];
|
++ optionals enableManpages [ python3.pkgs.sphinx python3.pkgs.recommonmark ];
|
||||||
|
|
||||||
buildInputs = [ libxml2 libffi ]
|
buildInputs = [ libxml2 libffi ]
|
||||||
++ optional enablePFM libpfm; # exegesis
|
++ optional enablePFM libpfm; # exegesis
|
||||||
|
@ -62,7 +64,7 @@ in stdenv.mkDerivation ({
|
||||||
postPatch = optionalString stdenv.isDarwin ''
|
postPatch = optionalString stdenv.isDarwin ''
|
||||||
substituteInPlace cmake/modules/AddLLVM.cmake \
|
substituteInPlace cmake/modules/AddLLVM.cmake \
|
||||||
--replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir)" \
|
--replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir)" \
|
||||||
--replace 'set(_install_rpath "@loader_path/../lib" ''${extra_libdir})' ""
|
--replace 'set(_install_rpath "@loader_path/../lib''${LLVM_LIBDIR_SUFFIX}" ''${extra_libdir})' ""
|
||||||
''
|
''
|
||||||
# Patch llvm-config to return correct library path based on --link-{shared,static}.
|
# Patch llvm-config to return correct library path based on --link-{shared,static}.
|
||||||
+ optionalString (enableSharedLibraries) ''
|
+ optionalString (enableSharedLibraries) ''
|
||||||
|
@ -80,6 +82,15 @@ in stdenv.mkDerivation ({
|
||||||
rm unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp
|
rm unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp
|
||||||
# valgrind unhappy with musl or glibc, but fails w/musl only
|
# valgrind unhappy with musl or glibc, but fails w/musl only
|
||||||
rm test/CodeGen/AArch64/wineh4.mir
|
rm test/CodeGen/AArch64/wineh4.mir
|
||||||
|
'' + optionalString stdenv.hostPlatform.isAarch32 ''
|
||||||
|
# skip failing X86 test cases on 32-bit ARM
|
||||||
|
rm test/DebugInfo/X86/convert-debugloc.ll
|
||||||
|
rm test/DebugInfo/X86/convert-inlined.ll
|
||||||
|
rm test/DebugInfo/X86/convert-linked.ll
|
||||||
|
rm test/tools/dsymutil/X86/op-convert.test
|
||||||
|
'' + optionalString (stdenv.hostPlatform.system == "armv6l-linux") ''
|
||||||
|
# Seems to require certain floating point hardware (NEON?)
|
||||||
|
rm test/ExecutionEngine/frem.ll
|
||||||
'' + ''
|
'' + ''
|
||||||
patchShebangs test/BugPoint/compile-custom.ll.py
|
patchShebangs test/BugPoint/compile-custom.ll.py
|
||||||
'';
|
'';
|
||||||
|
@ -90,6 +101,9 @@ in stdenv.mkDerivation ({
|
||||||
ln -sv $PWD/lib $out
|
ln -sv $PWD/lib $out
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
# E.g. mesa.drivers use the build-id as a cache key (see #93946):
|
||||||
|
LDFLAGS = optionalString (enableSharedLibraries && !stdenv.isDarwin) "-Wl,--build-id=sha1";
|
||||||
|
|
||||||
cmakeFlags = with stdenv; [
|
cmakeFlags = with stdenv; [
|
||||||
"-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
|
"-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
|
||||||
"-DLLVM_INSTALL_UTILS=ON" # Needed by rustc
|
"-DLLVM_INSTALL_UTILS=ON" # Needed by rustc
|
||||||
|
@ -109,12 +123,12 @@ in stdenv.mkDerivation ({
|
||||||
"-DSPHINX_WARNINGS_AS_ERRORS=OFF"
|
"-DSPHINX_WARNINGS_AS_ERRORS=OFF"
|
||||||
] ++ optionals (!isDarwin) [
|
] ++ optionals (!isDarwin) [
|
||||||
"-DLLVM_BINUTILS_INCDIR=${libbfd.dev}/include"
|
"-DLLVM_BINUTILS_INCDIR=${libbfd.dev}/include"
|
||||||
] ++ optionals (isDarwin) [
|
] ++ optionals isDarwin [
|
||||||
"-DLLVM_ENABLE_LIBCXX=ON"
|
"-DLLVM_ENABLE_LIBCXX=ON"
|
||||||
"-DCAN_TARGET_i386=false"
|
"-DCAN_TARGET_i386=false"
|
||||||
] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
||||||
"-DCMAKE_CROSSCOMPILING=True"
|
"-DCMAKE_CROSSCOMPILING=True"
|
||||||
"-DLLVM_TABLEGEN=${buildPackages.llvm_7}/bin/llvm-tblgen"
|
"-DLLVM_TABLEGEN=${buildPackages.llvm_10}/bin/llvm-tblgen"
|
||||||
];
|
];
|
||||||
|
|
||||||
postBuild = ''
|
postBuild = ''
|
||||||
|
@ -122,7 +136,7 @@ in stdenv.mkDerivation ({
|
||||||
'';
|
'';
|
||||||
|
|
||||||
preCheck = ''
|
preCheck = ''
|
||||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/lib
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}$PWD/lib
|
||||||
'';
|
'';
|
||||||
|
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
|
@ -132,6 +146,8 @@ in stdenv.mkDerivation ({
|
||||||
+ optionalString enableSharedLibraries ''
|
+ optionalString enableSharedLibraries ''
|
||||||
moveToOutput "lib/libLLVM-*" "$lib"
|
moveToOutput "lib/libLLVM-*" "$lib"
|
||||||
moveToOutput "lib/libLLVM${stdenv.hostPlatform.extensions.sharedLibrary}" "$lib"
|
moveToOutput "lib/libLLVM${stdenv.hostPlatform.extensions.sharedLibrary}" "$lib"
|
||||||
|
''
|
||||||
|
+ optionalString (enableSharedLibraries && (!stdenv.isDarwin)) ''
|
||||||
substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
|
substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
|
||||||
--replace "\''${_IMPORT_PREFIX}/lib/libLLVM-" "$lib/lib/libLLVM-"
|
--replace "\''${_IMPORT_PREFIX}/lib/libLLVM-" "$lib/lib/libLLVM-"
|
||||||
''
|
''
|
||||||
|
@ -148,15 +164,16 @@ in stdenv.mkDerivation ({
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
|
requiredSystemFeatures = [ "big-parallel" ];
|
||||||
meta = {
|
meta = {
|
||||||
description = "Collection of modular and reusable compiler and toolchain technologies";
|
description = "Collection of modular and reusable compiler and toolchain technologies";
|
||||||
homepage = http://llvm.org/;
|
homepage = "https://llvm.org/";
|
||||||
license = stdenv.lib.licenses.ncsa;
|
license = stdenv.lib.licenses.ncsa;
|
||||||
maintainers = with stdenv.lib.maintainers; [ lovek323 raskin dtzWill ];
|
maintainers = with stdenv.lib.maintainers; [ lovek323 raskin dtzWill primeos ];
|
||||||
platforms = stdenv.lib.platforms.all;
|
platforms = stdenv.lib.platforms.all;
|
||||||
};
|
};
|
||||||
} // stdenv.lib.optionalAttrs enableManpages {
|
} // stdenv.lib.optionalAttrs enableManpages {
|
||||||
name = "llvm-manpages-${version}";
|
pname = "llvm-manpages";
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
make docs-llvm-man
|
make docs-llvm-man
|
|
@ -10,11 +10,11 @@
|
||||||
, version
|
, version
|
||||||
}:
|
}:
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation rec {
|
||||||
pname = "openmp";
|
pname = "openmp";
|
||||||
inherit version;
|
inherit version;
|
||||||
|
|
||||||
src = fetch "openmp" "0b3jlxhqbpyd1nqkpxjfggm5d9va5qpyf7d4i5y7n4a1mlydv19y";
|
src = fetch pname "0k389d0g9zlfyzh1kpb3i5jdawzpn0hrdxzbjinpvdv7rbw4sw1d";
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake perl ];
|
nativeBuildInputs = [ cmake perl ];
|
||||||
buildInputs = [ llvm ];
|
buildInputs = [ llvm ];
|
||||||
|
@ -23,7 +23,7 @@ stdenv.mkDerivation {
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
description = "Components required to build an executable OpenMP program";
|
description = "Components required to build an executable OpenMP program";
|
||||||
homepage = http://openmp.llvm.org/;
|
homepage = "https://openmp.llvm.org/";
|
||||||
license = stdenv.lib.licenses.mit;
|
license = stdenv.lib.licenses.mit;
|
||||||
platforms = stdenv.lib.platforms.all;
|
platforms = stdenv.lib.platforms.all;
|
||||||
};
|
};
|
|
@ -1,375 +0,0 @@
|
||||||
diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td
|
|
||||||
index d02d9744d..b57a7cb05 100644
|
|
||||||
--- a/include/clang/Driver/Options.td
|
|
||||||
+++ b/include/clang/Driver/Options.td
|
|
||||||
@@ -2452,6 +2452,7 @@ def nolibc : Flag<["-"], "nolibc">;
|
|
||||||
def nomultidefs : Flag<["-"], "nomultidefs">;
|
|
||||||
def nopie : Flag<["-"], "nopie">;
|
|
||||||
def no_pie : Flag<["-"], "no-pie">, Alias<nopie>;
|
|
||||||
+def noposix : Flag<["-"], "noposix">;
|
|
||||||
def noprebind : Flag<["-"], "noprebind">;
|
|
||||||
def noseglinkedit : Flag<["-"], "noseglinkedit">;
|
|
||||||
def nostartfiles : Flag<["-"], "nostartfiles">;
|
|
||||||
diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
|
|
||||||
index 3c139d724..89d6df3f5 100644
|
|
||||||
--- a/lib/Basic/Targets.cpp
|
|
||||||
+++ b/lib/Basic/Targets.cpp
|
|
||||||
@@ -147,6 +147,8 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple,
|
|
||||||
return new FreeBSDTargetInfo<AArch64leTargetInfo>(Triple, Opts);
|
|
||||||
case llvm::Triple::Fuchsia:
|
|
||||||
return new FuchsiaTargetInfo<AArch64leTargetInfo>(Triple, Opts);
|
|
||||||
+ case llvm::Triple::Genode:
|
|
||||||
+ return new GenodeTargetInfo<AArch64leTargetInfo>(Triple, Opts);
|
|
||||||
case llvm::Triple::Linux:
|
|
||||||
return new LinuxTargetInfo<AArch64leTargetInfo>(Triple, Opts);
|
|
||||||
case llvm::Triple::NetBSD:
|
|
||||||
@@ -171,6 +173,8 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple,
|
|
||||||
return new FreeBSDTargetInfo<AArch64beTargetInfo>(Triple, Opts);
|
|
||||||
case llvm::Triple::Fuchsia:
|
|
||||||
return new FuchsiaTargetInfo<AArch64beTargetInfo>(Triple, Opts);
|
|
||||||
+ case llvm::Triple::Genode:
|
|
||||||
+ return new GenodeTargetInfo<AArch64beTargetInfo>(Triple, Opts);
|
|
||||||
case llvm::Triple::Linux:
|
|
||||||
return new LinuxTargetInfo<AArch64beTargetInfo>(Triple, Opts);
|
|
||||||
case llvm::Triple::NetBSD:
|
|
||||||
@@ -528,6 +532,8 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple,
|
|
||||||
return new FreeBSDTargetInfo<X86_64TargetInfo>(Triple, Opts);
|
|
||||||
case llvm::Triple::Fuchsia:
|
|
||||||
return new FuchsiaTargetInfo<X86_64TargetInfo>(Triple, Opts);
|
|
||||||
+ case llvm::Triple::Genode:
|
|
||||||
+ return new GenodeTargetInfo<X86_64TargetInfo>(Triple, Opts);
|
|
||||||
case llvm::Triple::KFreeBSD:
|
|
||||||
return new KFreeBSDTargetInfo<X86_64TargetInfo>(Triple, Opts);
|
|
||||||
case llvm::Triple::Solaris:
|
|
||||||
diff --git a/lib/Basic/Targets/OSTargets.h b/lib/Basic/Targets/OSTargets.h
|
|
||||||
index 09867d82c..f67151a13 100644
|
|
||||||
--- a/lib/Basic/Targets/OSTargets.h
|
|
||||||
+++ b/lib/Basic/Targets/OSTargets.h
|
|
||||||
@@ -760,6 +760,26 @@ public:
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
+// Genode Target
|
|
||||||
+template <typename Target>
|
|
||||||
+class LLVM_LIBRARY_VISIBILITY GenodeTargetInfo : public OSTargetInfo<Target> {
|
|
||||||
+protected:
|
|
||||||
+ void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple,
|
|
||||||
+ MacroBuilder &Builder) const override {
|
|
||||||
+ Builder.defineMacro("__GENODE__");
|
|
||||||
+ Builder.defineMacro("__ELF__");
|
|
||||||
+ // Required by the libc++ locale support.
|
|
||||||
+ if (Opts.CPlusPlus)
|
|
||||||
+ Builder.defineMacro("_GNU_SOURCE");
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+public:
|
|
||||||
+ GenodeTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
|
|
||||||
+ : OSTargetInfo<Target>(Triple, Opts) {
|
|
||||||
+ this->MCountName = "__mcount";
|
|
||||||
+ }
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
// WebAssembly target
|
|
||||||
template <typename Target>
|
|
||||||
class LLVM_LIBRARY_VISIBILITY WebAssemblyOSTargetInfo
|
|
||||||
diff --git a/lib/Driver/CMakeLists.txt b/lib/Driver/CMakeLists.txt
|
|
||||||
index 4793a1f90..4691b898e 100644
|
|
||||||
--- a/lib/Driver/CMakeLists.txt
|
|
||||||
+++ b/lib/Driver/CMakeLists.txt
|
|
||||||
@@ -44,6 +44,7 @@ add_clang_library(clangDriver
|
|
||||||
ToolChains/DragonFly.cpp
|
|
||||||
ToolChains/FreeBSD.cpp
|
|
||||||
ToolChains/Fuchsia.cpp
|
|
||||||
+ ToolChains/Genode.cpp
|
|
||||||
ToolChains/Gnu.cpp
|
|
||||||
ToolChains/Haiku.cpp
|
|
||||||
ToolChains/HIP.cpp
|
|
||||||
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp
|
|
||||||
index a784e218f..881b78abc 100644
|
|
||||||
--- a/lib/Driver/Driver.cpp
|
|
||||||
+++ b/lib/Driver/Driver.cpp
|
|
||||||
@@ -22,6 +22,7 @@
|
|
||||||
#include "ToolChains/DragonFly.h"
|
|
||||||
#include "ToolChains/FreeBSD.h"
|
|
||||||
#include "ToolChains/Fuchsia.h"
|
|
||||||
+#include "ToolChains/Genode.h"
|
|
||||||
#include "ToolChains/Gnu.h"
|
|
||||||
#include "ToolChains/HIP.h"
|
|
||||||
#include "ToolChains/Haiku.h"
|
|
||||||
@@ -4570,6 +4571,9 @@ const ToolChain &Driver::getToolChain(const ArgList &Args,
|
|
||||||
case llvm::Triple::Solaris:
|
|
||||||
TC = llvm::make_unique<toolchains::Solaris>(*this, Target, Args);
|
|
||||||
break;
|
|
||||||
+ case llvm::Triple::Genode:
|
|
||||||
+ TC = llvm::make_unique<toolchains::Genode>(*this, Target, Args);
|
|
||||||
+ break;
|
|
||||||
case llvm::Triple::AMDHSA:
|
|
||||||
TC = llvm::make_unique<toolchains::AMDGPUToolChain>(*this, Target, Args);
|
|
||||||
break;
|
|
||||||
diff --git a/lib/Driver/SanitizerArgs.cpp b/lib/Driver/SanitizerArgs.cpp
|
|
||||||
index 1a46073aa..72b6f7389 100644
|
|
||||||
--- a/lib/Driver/SanitizerArgs.cpp
|
|
||||||
+++ b/lib/Driver/SanitizerArgs.cpp
|
|
||||||
@@ -693,7 +693,7 @@ SanitizerArgs::SanitizerArgs(const ToolChain &TC,
|
|
||||||
ImplicitCfiRuntime = TC.getTriple().isAndroid();
|
|
||||||
|
|
||||||
if (AllAddedKinds & Address) {
|
|
||||||
- NeedPIE |= TC.getTriple().isOSFuchsia();
|
|
||||||
+ NeedPIE |= TC.getTriple().isOSFuchsia() | TC.getTriple().isOSGenode();
|
|
||||||
if (Arg *A =
|
|
||||||
Args.getLastArg(options::OPT_fsanitize_address_field_padding)) {
|
|
||||||
StringRef S = A->getValue();
|
|
||||||
diff --git a/lib/Driver/ToolChains/Genode.cpp b/lib/Driver/ToolChains/Genode.cpp
|
|
||||||
new file mode 100644
|
|
||||||
index 000000000..488863cb4
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/lib/Driver/ToolChains/Genode.cpp
|
|
||||||
@@ -0,0 +1,147 @@
|
|
||||||
+//===--- Genode.cpp - Genode ToolChain Implementations ----------*- C++ -*-===//
|
|
||||||
+//
|
|
||||||
+// The LLVM Compiler Infrastructure
|
|
||||||
+//
|
|
||||||
+// This file is distributed under the University of Illinois Open Source
|
|
||||||
+// License. See LICENSE.TXT for details.
|
|
||||||
+//
|
|
||||||
+//===----------------------------------------------------------------------===//
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+#include "Genode.h"
|
|
||||||
+#include "InputInfo.h"
|
|
||||||
+#include "CommonArgs.h"
|
|
||||||
+#include "clang/Driver/Compilation.h"
|
|
||||||
+#include "clang/Driver/Driver.h"
|
|
||||||
+#include "clang/Driver/Options.h"
|
|
||||||
+#include "llvm/ADT/SmallString.h"
|
|
||||||
+#include "llvm/Option/ArgList.h"
|
|
||||||
+#include "llvm/Support/Path.h"
|
|
||||||
+
|
|
||||||
+using namespace clang::driver;
|
|
||||||
+using namespace clang::driver::tools;
|
|
||||||
+using namespace clang::driver::toolchains;
|
|
||||||
+using namespace clang;
|
|
||||||
+using namespace llvm::opt;
|
|
||||||
+
|
|
||||||
+void genode::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
|
||||||
+ const InputInfo &Output,
|
|
||||||
+ const InputInfoList &Inputs,
|
|
||||||
+ const llvm::opt::ArgList &Args,
|
|
||||||
+ const char *LinkingOutput) const {
|
|
||||||
+ const toolchains::Genode &ToolChain =
|
|
||||||
+ static_cast<const toolchains::Genode &>(getToolChain());
|
|
||||||
+ const Driver &D = ToolChain.getDriver();
|
|
||||||
+ const llvm::Triple::ArchType Arch = ToolChain.getArch();
|
|
||||||
+ ArgStringList CmdArgs;
|
|
||||||
+
|
|
||||||
+ if (!D.SysRoot.empty())
|
|
||||||
+ CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
|
|
||||||
+
|
|
||||||
+ // Explicitly set the linker emulation for platforms that might not
|
|
||||||
+ // be the default emulation for the linker.
|
|
||||||
+ switch (Arch) {
|
|
||||||
+ case llvm::Triple::x86:
|
|
||||||
+ CmdArgs.push_back("-melf_i386");
|
|
||||||
+ break;
|
|
||||||
+ case llvm::Triple::x86_64:
|
|
||||||
+ CmdArgs.push_back("-melf_x86_64");
|
|
||||||
+ break;
|
|
||||||
+ case llvm::Triple::riscv32:
|
|
||||||
+ CmdArgs.push_back("-melf32lriscv");
|
|
||||||
+ break;
|
|
||||||
+ case llvm::Triple::riscv64:
|
|
||||||
+ CmdArgs.push_back("-melf64lriscv");
|
|
||||||
+ break;
|
|
||||||
+ default:
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ CmdArgs.push_back("--eh-frame-hdr");
|
|
||||||
+ CmdArgs.push_back("--gc-sections");
|
|
||||||
+ CmdArgs.push_back("-zmax-page-size=0x1000");
|
|
||||||
+
|
|
||||||
+ CmdArgs.push_back("-Ttext=0x01000000");
|
|
||||||
+
|
|
||||||
+ Args.AddAllArgs(CmdArgs, options::OPT_L);
|
|
||||||
+ ToolChain.AddFilePathLibArgs(Args, CmdArgs);
|
|
||||||
+ Args.AddAllArgs(CmdArgs, options::OPT_T_Group);
|
|
||||||
+ Args.AddAllArgs(CmdArgs, options::OPT_e);
|
|
||||||
+ Args.AddAllArgs(CmdArgs, options::OPT_s);
|
|
||||||
+ Args.AddAllArgs(CmdArgs, options::OPT_t);
|
|
||||||
+ Args.AddAllArgs(CmdArgs, options::OPT_Z_Flag);
|
|
||||||
+
|
|
||||||
+ if (Args.hasArg(options::OPT_static)) {
|
|
||||||
+ CmdArgs.push_back("-Bstatic");
|
|
||||||
+ } else {
|
|
||||||
+ if (Args.hasArg(options::OPT_shared)) {
|
|
||||||
+ CmdArgs.push_back(Args.MakeArgString("-shared"));
|
|
||||||
+ CmdArgs.push_back(Args.MakeArgString("-T" + D.SysRoot + "/ld/genode_rel.ld"));
|
|
||||||
+ } else {
|
|
||||||
+ CmdArgs.push_back(Args.MakeArgString("-T" + D.SysRoot + "/ld/genode_dyn.ld"));
|
|
||||||
+ CmdArgs.push_back(Args.MakeArgString("--dynamic-list=" + D.SysRoot + "/ld/genode_dyn.dl"));
|
|
||||||
+ CmdArgs.push_back("--dynamic-linker=ld.lib.so");
|
|
||||||
+ }
|
|
||||||
+ if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
|
|
||||||
+ CmdArgs.push_back("-l:ld.lib.so");
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (Output.isFilename()) {
|
|
||||||
+ CmdArgs.push_back("-o");
|
|
||||||
+ CmdArgs.push_back(Output.getFilename());
|
|
||||||
+ } else {
|
|
||||||
+ assert(Output.isNothing() && "Invalid output.");
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
|
|
||||||
+
|
|
||||||
+ AddRunTimeLibs(ToolChain, D, CmdArgs, Args);
|
|
||||||
+
|
|
||||||
+ if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs, options::OPT_noposix)) {
|
|
||||||
+ CmdArgs.push_back("-lc");
|
|
||||||
+ if (!Args.hasArg(options::OPT_shared)) {
|
|
||||||
+ CmdArgs.push_back("-lposix");
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
|
|
||||||
+ C.addCommand(llvm::make_unique<Command>(JA, *this, Exec, CmdArgs, Inputs));
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+Genode::Genode(const Driver &D, const llvm::Triple &Triple,
|
|
||||||
+ const llvm::opt::ArgList &Args)
|
|
||||||
+ : Generic_ELF(D, Triple, Args) {
|
|
||||||
+ SmallString<128> P(getDriver().Dir);
|
|
||||||
+ llvm::sys::path::append(P, "..", getTriple().str(), "lib");
|
|
||||||
+ getFilePaths().push_back(P.str());
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+void Genode::addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
|
|
||||||
+ llvm::opt::ArgStringList &CC1Args) const {
|
|
||||||
+ SmallString<128> P(getDriver().Dir);
|
|
||||||
+ llvm::sys::path::append(P, "..", getTriple().str(), "include/c++/v1");
|
|
||||||
+ addSystemInclude(DriverArgs, CC1Args, P.str());
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+bool Genode::isPIEDefault() const {
|
|
||||||
+ switch (getTriple().getArch()) {
|
|
||||||
+ case llvm::Triple::aarch64:
|
|
||||||
+ case llvm::Triple::x86_64:
|
|
||||||
+ return true;
|
|
||||||
+ default:
|
|
||||||
+ return false;
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+SanitizerMask Genode::getSupportedSanitizers() const {
|
|
||||||
+ return Generic_ELF::getSupportedSanitizers();
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+SanitizerMask Genode::getDefaultSanitizers() const {
|
|
||||||
+ return Generic_ELF::getDefaultSanitizers();
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+Tool *Genode::buildLinker() const {
|
|
||||||
+ return new tools::genode::Linker(*this);
|
|
||||||
+}
|
|
||||||
diff --git a/lib/Driver/ToolChains/Genode.h b/lib/Driver/ToolChains/Genode.h
|
|
||||||
new file mode 100644
|
|
||||||
index 000000000..144f4f99a
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/lib/Driver/ToolChains/Genode.h
|
|
||||||
@@ -0,0 +1,69 @@
|
|
||||||
+//===----- Genode.h - Genode ToolChain Implementations ----------*- C++ -*-===//
|
|
||||||
+//
|
|
||||||
+// The LLVM Compiler Infrastructure
|
|
||||||
+//
|
|
||||||
+// This file is distributed under the University of Illinois Open Source
|
|
||||||
+// License. See LICENSE.TXT for details.
|
|
||||||
+//
|
|
||||||
+//===----------------------------------------------------------------------===//
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+#ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_GENODE_H
|
|
||||||
+#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_GENODE_H
|
|
||||||
+
|
|
||||||
+#include "Gnu.h"
|
|
||||||
+#include "clang/Driver/Tool.h"
|
|
||||||
+#include "clang/Driver/ToolChain.h"
|
|
||||||
+
|
|
||||||
+namespace clang {
|
|
||||||
+namespace driver {
|
|
||||||
+namespace tools {
|
|
||||||
+
|
|
||||||
+//// genode -- Directly call GNU Binutils linker
|
|
||||||
+namespace genode {
|
|
||||||
+class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool {
|
|
||||||
+public:
|
|
||||||
+ Linker(const ToolChain &TC) : GnuTool("genode::Linker", "linker", TC) {}
|
|
||||||
+
|
|
||||||
+ bool hasIntegratedCPP() const override { return false; }
|
|
||||||
+ bool isLinkJob() const override { return true; }
|
|
||||||
+
|
|
||||||
+ void ConstructJob(Compilation &C, const JobAction &JA,
|
|
||||||
+ const InputInfo &Output, const InputInfoList &Inputss,
|
|
||||||
+ const llvm::opt::ArgList &Args,
|
|
||||||
+ const char *LinkingOutput) const override;
|
|
||||||
+};
|
|
||||||
+} // end namespace genode
|
|
||||||
+} // end namespace tools
|
|
||||||
+
|
|
||||||
+namespace toolchains {
|
|
||||||
+
|
|
||||||
+class LLVM_LIBRARY_VISIBILITY Genode : public Generic_ELF {
|
|
||||||
+public:
|
|
||||||
+ Genode(const Driver &D, const llvm::Triple &Triple,
|
|
||||||
+ const llvm::opt::ArgList &Args);
|
|
||||||
+ bool HasNativeLLVMSupport() const override { return true; }
|
|
||||||
+
|
|
||||||
+ bool IsMathErrnoDefault() const override { return true; }
|
|
||||||
+
|
|
||||||
+ CXXStdlibType
|
|
||||||
+ GetCXXStdlibType(const llvm::opt::ArgList &Args) const override {
|
|
||||||
+ return ToolChain::CST_Libcxx;
|
|
||||||
+ }
|
|
||||||
+ void addLibCxxIncludePaths(
|
|
||||||
+ const llvm::opt::ArgList &DriverArgs,
|
|
||||||
+ llvm::opt::ArgStringList &CC1Args) const override;
|
|
||||||
+
|
|
||||||
+ bool isPIEDefault() const override;
|
|
||||||
+ SanitizerMask getSupportedSanitizers() const override;
|
|
||||||
+ SanitizerMask getDefaultSanitizers() const override;
|
|
||||||
+
|
|
||||||
+protected:
|
|
||||||
+ Tool *buildLinker() const override;
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+} // end namespace toolchains
|
|
||||||
+} // end namespace driver
|
|
||||||
+} // end namespace clang
|
|
||||||
+
|
|
||||||
+#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_GENODE_H
|
|
||||||
diff --git a/lib/Frontend/InitHeaderSearch.cpp b/lib/Frontend/InitHeaderSearch.cpp
|
|
||||||
index 67842b5dc..26a2c65fe 100644
|
|
||||||
--- a/lib/Frontend/InitHeaderSearch.cpp
|
|
||||||
+++ b/lib/Frontend/InitHeaderSearch.cpp
|
|
||||||
@@ -221,6 +221,7 @@ void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple,
|
|
||||||
case llvm::Triple::PS4:
|
|
||||||
case llvm::Triple::ELFIAMCU:
|
|
||||||
case llvm::Triple::Fuchsia:
|
|
||||||
+ case llvm::Triple::Genode:
|
|
||||||
break;
|
|
||||||
case llvm::Triple::Win32:
|
|
||||||
if (triple.getEnvironment() != llvm::Triple::Cygnus)
|
|
||||||
@@ -329,6 +330,7 @@ void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple,
|
|
||||||
case llvm::Triple::NaCl:
|
|
||||||
case llvm::Triple::ELFIAMCU:
|
|
||||||
case llvm::Triple::Fuchsia:
|
|
||||||
+ case llvm::Triple::Genode:
|
|
||||||
break;
|
|
||||||
case llvm::Triple::PS4: {
|
|
||||||
// <isysroot> gets prepended later in AddPath().
|
|
||||||
diff --git a/test/Driver/genode.c b/test/Driver/genode.c
|
|
||||||
new file mode 100644
|
|
||||||
index 000000000..e69de29bb
|
|
||||||
diff --git a/test/Driver/genode.cpp b/test/Driver/genode.cpp
|
|
||||||
new file mode 100644
|
|
||||||
index 000000000..e69de29bb
|
|
|
@ -1,498 +0,0 @@
|
||||||
diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp
|
|
||||||
index 3c139d72479..89d6df3f5b4 100644
|
|
||||||
--- a/clang/lib/Basic/Targets.cpp
|
|
||||||
+++ b/clang/lib/Basic/Targets.cpp
|
|
||||||
@@ -147,6 +147,8 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple,
|
|
||||||
return new FreeBSDTargetInfo<AArch64leTargetInfo>(Triple, Opts);
|
|
||||||
case llvm::Triple::Fuchsia:
|
|
||||||
return new FuchsiaTargetInfo<AArch64leTargetInfo>(Triple, Opts);
|
|
||||||
+ case llvm::Triple::Genode:
|
|
||||||
+ return new GenodeTargetInfo<AArch64leTargetInfo>(Triple, Opts);
|
|
||||||
case llvm::Triple::Linux:
|
|
||||||
return new LinuxTargetInfo<AArch64leTargetInfo>(Triple, Opts);
|
|
||||||
case llvm::Triple::NetBSD:
|
|
||||||
@@ -171,6 +173,8 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple,
|
|
||||||
return new FreeBSDTargetInfo<AArch64beTargetInfo>(Triple, Opts);
|
|
||||||
case llvm::Triple::Fuchsia:
|
|
||||||
return new FuchsiaTargetInfo<AArch64beTargetInfo>(Triple, Opts);
|
|
||||||
+ case llvm::Triple::Genode:
|
|
||||||
+ return new GenodeTargetInfo<AArch64beTargetInfo>(Triple, Opts);
|
|
||||||
case llvm::Triple::Linux:
|
|
||||||
return new LinuxTargetInfo<AArch64beTargetInfo>(Triple, Opts);
|
|
||||||
case llvm::Triple::NetBSD:
|
|
||||||
@@ -528,6 +532,8 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple,
|
|
||||||
return new FreeBSDTargetInfo<X86_64TargetInfo>(Triple, Opts);
|
|
||||||
case llvm::Triple::Fuchsia:
|
|
||||||
return new FuchsiaTargetInfo<X86_64TargetInfo>(Triple, Opts);
|
|
||||||
+ case llvm::Triple::Genode:
|
|
||||||
+ return new GenodeTargetInfo<X86_64TargetInfo>(Triple, Opts);
|
|
||||||
case llvm::Triple::KFreeBSD:
|
|
||||||
return new KFreeBSDTargetInfo<X86_64TargetInfo>(Triple, Opts);
|
|
||||||
case llvm::Triple::Solaris:
|
|
||||||
diff --git a/clang/lib/Basic/Targets/OSTargets.h b/clang/lib/Basic/Targets/OSTargets.h
|
|
||||||
index 09867d82c38..f67151a13e8 100644
|
|
||||||
--- a/clang/lib/Basic/Targets/OSTargets.h
|
|
||||||
+++ b/clang/lib/Basic/Targets/OSTargets.h
|
|
||||||
@@ -760,6 +760,26 @@ public:
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
+// Genode Target
|
|
||||||
+template <typename Target>
|
|
||||||
+class LLVM_LIBRARY_VISIBILITY GenodeTargetInfo : public OSTargetInfo<Target> {
|
|
||||||
+protected:
|
|
||||||
+ void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple,
|
|
||||||
+ MacroBuilder &Builder) const override {
|
|
||||||
+ Builder.defineMacro("__GENODE__");
|
|
||||||
+ Builder.defineMacro("__ELF__");
|
|
||||||
+ // Required by the libc++ locale support.
|
|
||||||
+ if (Opts.CPlusPlus)
|
|
||||||
+ Builder.defineMacro("_GNU_SOURCE");
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+public:
|
|
||||||
+ GenodeTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
|
|
||||||
+ : OSTargetInfo<Target>(Triple, Opts) {
|
|
||||||
+ this->MCountName = "__mcount";
|
|
||||||
+ }
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
// WebAssembly target
|
|
||||||
template <typename Target>
|
|
||||||
class LLVM_LIBRARY_VISIBILITY WebAssemblyOSTargetInfo
|
|
||||||
diff --git a/clang/lib/Driver/CMakeLists.txt b/clang/lib/Driver/CMakeLists.txt
|
|
||||||
index 4793a1f90b2..4691b898eb2 100644
|
|
||||||
--- a/clang/lib/Driver/CMakeLists.txt
|
|
||||||
+++ b/clang/lib/Driver/CMakeLists.txt
|
|
||||||
@@ -44,6 +44,7 @@ add_clang_library(clangDriver
|
|
||||||
ToolChains/DragonFly.cpp
|
|
||||||
ToolChains/FreeBSD.cpp
|
|
||||||
ToolChains/Fuchsia.cpp
|
|
||||||
+ ToolChains/Genode.cpp
|
|
||||||
ToolChains/Gnu.cpp
|
|
||||||
ToolChains/Haiku.cpp
|
|
||||||
ToolChains/HIP.cpp
|
|
||||||
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
|
|
||||||
index a784e218f13..881b78abc4d 100644
|
|
||||||
--- a/clang/lib/Driver/Driver.cpp
|
|
||||||
+++ b/clang/lib/Driver/Driver.cpp
|
|
||||||
@@ -22,6 +22,7 @@
|
|
||||||
#include "ToolChains/DragonFly.h"
|
|
||||||
#include "ToolChains/FreeBSD.h"
|
|
||||||
#include "ToolChains/Fuchsia.h"
|
|
||||||
+#include "ToolChains/Genode.h"
|
|
||||||
#include "ToolChains/Gnu.h"
|
|
||||||
#include "ToolChains/HIP.h"
|
|
||||||
#include "ToolChains/Haiku.h"
|
|
||||||
@@ -4570,6 +4571,9 @@ const ToolChain &Driver::getToolChain(const ArgList &Args,
|
|
||||||
case llvm::Triple::Solaris:
|
|
||||||
TC = llvm::make_unique<toolchains::Solaris>(*this, Target, Args);
|
|
||||||
break;
|
|
||||||
+ case llvm::Triple::Genode:
|
|
||||||
+ TC = llvm::make_unique<toolchains::Genode>(*this, Target, Args);
|
|
||||||
+ break;
|
|
||||||
case llvm::Triple::AMDHSA:
|
|
||||||
TC = llvm::make_unique<toolchains::AMDGPUToolChain>(*this, Target, Args);
|
|
||||||
break;
|
|
||||||
diff --git a/clang/lib/Driver/SanitizerArgs.cpp b/clang/lib/Driver/SanitizerArgs.cpp
|
|
||||||
index 1a46073aaa3..72b6f7389a3 100644
|
|
||||||
--- a/clang/lib/Driver/SanitizerArgs.cpp
|
|
||||||
+++ b/clang/lib/Driver/SanitizerArgs.cpp
|
|
||||||
@@ -693,7 +693,7 @@ SanitizerArgs::SanitizerArgs(const ToolChain &TC,
|
|
||||||
ImplicitCfiRuntime = TC.getTriple().isAndroid();
|
|
||||||
|
|
||||||
if (AllAddedKinds & Address) {
|
|
||||||
- NeedPIE |= TC.getTriple().isOSFuchsia();
|
|
||||||
+ NeedPIE |= TC.getTriple().isOSFuchsia() | TC.getTriple().isOSGenode();
|
|
||||||
if (Arg *A =
|
|
||||||
Args.getLastArg(options::OPT_fsanitize_address_field_padding)) {
|
|
||||||
StringRef S = A->getValue();
|
|
||||||
diff --git a/clang/lib/Driver/ToolChains/Genode.cpp b/clang/lib/Driver/ToolChains/Genode.cpp
|
|
||||||
new file mode 100644
|
|
||||||
index 00000000000..52ed73ae0b4
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/clang/lib/Driver/ToolChains/Genode.cpp
|
|
||||||
@@ -0,0 +1,86 @@
|
|
||||||
+//===--- Genode.cpp - CloudABI ToolChain Implementations --------*- C++ -*-===//
|
|
||||||
+//
|
|
||||||
+// The LLVM Compiler Infrastructure
|
|
||||||
+//
|
|
||||||
+// This file is distributed under the University of Illinois Open Source
|
|
||||||
+// License. See LICENSE.TXT for details.
|
|
||||||
+//
|
|
||||||
+//===----------------------------------------------------------------------===//
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+#include "Genode.h"
|
|
||||||
+#include "InputInfo.h"
|
|
||||||
+#include "CommonArgs.h"
|
|
||||||
+#include "clang/Driver/Compilation.h"
|
|
||||||
+#include "clang/Driver/Driver.h"
|
|
||||||
+#include "clang/Driver/Options.h"
|
|
||||||
+#include "llvm/ADT/SmallString.h"
|
|
||||||
+#include "llvm/Option/ArgList.h"
|
|
||||||
+#include "llvm/Support/Path.h"
|
|
||||||
+
|
|
||||||
+using namespace clang::driver;
|
|
||||||
+using namespace clang::driver::tools;
|
|
||||||
+using namespace clang::driver::toolchains;
|
|
||||||
+using namespace clang;
|
|
||||||
+using namespace llvm::opt;
|
|
||||||
+
|
|
||||||
+void genode::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
|
||||||
+ const InputInfo &Output,
|
|
||||||
+ const InputInfoList &Inputs,
|
|
||||||
+ const llvm::opt::ArgList &Args,
|
|
||||||
+ const char *LinkingOutput) const {
|
|
||||||
+ const ToolChain &ToolChain = getToolChain();
|
|
||||||
+ const Driver &D = ToolChain.getDriver();
|
|
||||||
+ ArgStringList CmdArgs;
|
|
||||||
+
|
|
||||||
+ if (Output.isFilename()) {
|
|
||||||
+ CmdArgs.push_back("-o");
|
|
||||||
+ CmdArgs.push_back(Output.getFilename());
|
|
||||||
+ } else {
|
|
||||||
+ assert(Output.isNothing() && "Invalid output.");
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
|
|
||||||
+
|
|
||||||
+ const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
|
|
||||||
+ C.addCommand(llvm::make_unique<Command>(JA, *this, Exec, CmdArgs, Inputs));
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+Genode::Genode(const Driver &D, const llvm::Triple &Triple,
|
|
||||||
+ const llvm::opt::ArgList &Args)
|
|
||||||
+ : Generic_ELF(D, Triple, Args) {
|
|
||||||
+ SmallString<128> P(getDriver().Dir);
|
|
||||||
+ llvm::sys::path::append(P, "..", getTriple().str(), "lib");
|
|
||||||
+ getFilePaths().push_back(P.str());
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+void Genode::addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
|
|
||||||
+ llvm::opt::ArgStringList &CC1Args) const {
|
|
||||||
+ SmallString<128> P(getDriver().Dir);
|
|
||||||
+ llvm::sys::path::append(P, "..", getTriple().str(), "include/c++/v1");
|
|
||||||
+ addSystemInclude(DriverArgs, CC1Args, P.str());
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+bool Genode::isPIEDefault() const {
|
|
||||||
+ switch (getTriple().getArch()) {
|
|
||||||
+ case llvm::Triple::aarch64:
|
|
||||||
+ case llvm::Triple::x86_64:
|
|
||||||
+ return true;
|
|
||||||
+ default:
|
|
||||||
+ return false;
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+SanitizerMask Genode::getSupportedSanitizers() const {
|
|
||||||
+ SanitizerMask Res = Generic_ELF::getSupportedSanitizers();
|
|
||||||
+ Res |= SanitizerKind::SafeStack;
|
|
||||||
+ return Res;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+SanitizerMask Genode::getDefaultSanitizers() const {
|
|
||||||
+ return SanitizerKind::SafeStack;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+Tool *Genode::buildLinker() const {
|
|
||||||
+ return new tools::genode::Linker(*this);
|
|
||||||
+}
|
|
||||||
diff --git a/clang/lib/Driver/ToolChains/Genode.h b/clang/lib/Driver/ToolChains/Genode.h
|
|
||||||
new file mode 100644
|
|
||||||
index 00000000000..971efb04ef9
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/clang/lib/Driver/ToolChains/Genode.h
|
|
||||||
@@ -0,0 +1,69 @@
|
|
||||||
+//===----- Genode.h - CloudABI ToolChain Implementations --------*- C++ -*-===//
|
|
||||||
+//
|
|
||||||
+// The LLVM Compiler Infrastructure
|
|
||||||
+//
|
|
||||||
+// This file is distributed under the University of Illinois Open Source
|
|
||||||
+// License. See LICENSE.TXT for details.
|
|
||||||
+//
|
|
||||||
+//===----------------------------------------------------------------------===//
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+#ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_GENODE_H
|
|
||||||
+#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_GENODE_H
|
|
||||||
+
|
|
||||||
+#include "Gnu.h"
|
|
||||||
+#include "clang/Driver/Tool.h"
|
|
||||||
+#include "clang/Driver/ToolChain.h"
|
|
||||||
+
|
|
||||||
+namespace clang {
|
|
||||||
+namespace driver {
|
|
||||||
+namespace tools {
|
|
||||||
+
|
|
||||||
+//// genode -- Directly call GNU Binutils linker
|
|
||||||
+namespace genode {
|
|
||||||
+class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool {
|
|
||||||
+public:
|
|
||||||
+ Linker(const ToolChain &TC) : GnuTool("genode::Linker", "linker", TC) {}
|
|
||||||
+
|
|
||||||
+ bool hasIntegratedCPP() const override { return false; }
|
|
||||||
+ bool isLinkJob() const override { return true; }
|
|
||||||
+
|
|
||||||
+ void ConstructJob(Compilation &C, const JobAction &JA,
|
|
||||||
+ const InputInfo &Output, const InputInfoList &Inputss,
|
|
||||||
+ const llvm::opt::ArgList &Args,
|
|
||||||
+ const char *LinkingOutput) const override;
|
|
||||||
+};
|
|
||||||
+} // end namespace genode
|
|
||||||
+} // end namespace tools
|
|
||||||
+
|
|
||||||
+namespace toolchains {
|
|
||||||
+
|
|
||||||
+class LLVM_LIBRARY_VISIBILITY Genode : public Generic_ELF {
|
|
||||||
+public:
|
|
||||||
+ Genode(const Driver &D, const llvm::Triple &Triple,
|
|
||||||
+ const llvm::opt::ArgList &Args);
|
|
||||||
+ bool HasNativeLLVMSupport() const override { return true; }
|
|
||||||
+
|
|
||||||
+ bool IsMathErrnoDefault() const override { return true; }
|
|
||||||
+
|
|
||||||
+ CXXStdlibType
|
|
||||||
+ GetCXXStdlibType(const llvm::opt::ArgList &Args) const override {
|
|
||||||
+ return ToolChain::CST_Libcxx;
|
|
||||||
+ }
|
|
||||||
+ void addLibCxxIncludePaths(
|
|
||||||
+ const llvm::opt::ArgList &DriverArgs,
|
|
||||||
+ llvm::opt::ArgStringList &CC1Args) const override;
|
|
||||||
+
|
|
||||||
+ bool isPIEDefault() const override;
|
|
||||||
+ SanitizerMask getSupportedSanitizers() const override;
|
|
||||||
+ SanitizerMask getDefaultSanitizers() const override;
|
|
||||||
+
|
|
||||||
+protected:
|
|
||||||
+ Tool *buildLinker() const override;
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+} // end namespace toolchains
|
|
||||||
+} // end namespace driver
|
|
||||||
+} // end namespace clang
|
|
||||||
+
|
|
||||||
+#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_GENODE_H
|
|
||||||
diff --git a/clang/lib/Frontend/InitHeaderSearch.cpp b/clang/lib/Frontend/InitHeaderSearch.cpp
|
|
||||||
index 67842b5dca2..26a2c65fec2 100644
|
|
||||||
--- a/clang/lib/Frontend/InitHeaderSearch.cpp
|
|
||||||
+++ b/clang/lib/Frontend/InitHeaderSearch.cpp
|
|
||||||
@@ -221,6 +221,7 @@ void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple,
|
|
||||||
case llvm::Triple::PS4:
|
|
||||||
case llvm::Triple::ELFIAMCU:
|
|
||||||
case llvm::Triple::Fuchsia:
|
|
||||||
+ case llvm::Triple::Genode:
|
|
||||||
break;
|
|
||||||
case llvm::Triple::Win32:
|
|
||||||
if (triple.getEnvironment() != llvm::Triple::Cygnus)
|
|
||||||
@@ -329,6 +330,7 @@ void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple,
|
|
||||||
case llvm::Triple::NaCl:
|
|
||||||
case llvm::Triple::ELFIAMCU:
|
|
||||||
case llvm::Triple::Fuchsia:
|
|
||||||
+ case llvm::Triple::Genode:
|
|
||||||
break;
|
|
||||||
case llvm::Triple::PS4: {
|
|
||||||
// <isysroot> gets prepended later in AddPath().
|
|
||||||
diff --git a/clang/test/Driver/genode.c b/clang/test/Driver/genode.c
|
|
||||||
new file mode 100644
|
|
||||||
index 00000000000..e69de29bb2d
|
|
||||||
diff --git a/clang/test/Driver/genode.cpp b/clang/test/Driver/genode.cpp
|
|
||||||
new file mode 100644
|
|
||||||
index 00000000000..e69de29bb2d
|
|
||||||
diff --git a/compiler-rt/lib/builtins/assembly.h b/compiler-rt/lib/builtins/assembly.h
|
|
||||||
index 3f5e59b2544..97d06d6ccd1 100644
|
|
||||||
--- a/compiler-rt/lib/builtins/assembly.h
|
|
||||||
+++ b/compiler-rt/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
|
|
||||||
diff --git a/libcxx/utils/google-benchmark/src/internal_macros.h b/libcxx/utils/google-benchmark/src/internal_macros.h
|
|
||||||
index 5dbf4fd2752..4699c5ed913 100644
|
|
||||||
--- a/libcxx/utils/google-benchmark/src/internal_macros.h
|
|
||||||
+++ b/libcxx/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__)
|
|
||||||
diff --git a/libunwind/src/assembly.h b/libunwind/src/assembly.h
|
|
||||||
index 0b7d24389a4..84cb7bf2f8b 100644
|
|
||||||
--- a/libunwind/src/assembly.h
|
|
||||||
+++ b/libunwind/src/assembly.h
|
|
||||||
@@ -71,7 +71,7 @@
|
|
||||||
#define HIDDEN_SYMBOL(name) .hidden name
|
|
||||||
|
|
||||||
#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
|
|
||||||
diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
|
|
||||||
index 49db3088bbc..32ffed3cb2e 100644
|
|
||||||
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
|
|
||||||
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
|
|
||||||
@@ -107,7 +107,7 @@ if(WIN32)
|
|
||||||
set(LLVM_ON_UNIX 0)
|
|
||||||
endif(CYGWIN)
|
|
||||||
else(WIN32)
|
|
||||||
- if(FUCHSIA OR UNIX)
|
|
||||||
+ if(FUCHSIA OR GENODE OR UNIX)
|
|
||||||
set(LLVM_ON_WIN32 0)
|
|
||||||
set(LLVM_ON_UNIX 1)
|
|
||||||
if(APPLE OR ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
|
|
||||||
@@ -115,9 +115,9 @@ else(WIN32)
|
|
||||||
else()
|
|
||||||
set(LLVM_HAVE_LINK_VERSION_SCRIPT 1)
|
|
||||||
endif()
|
|
||||||
- else(FUCHSIA OR UNIX)
|
|
||||||
+ else(FUCHSIA OR GENODE OR UNIX)
|
|
||||||
MESSAGE(SEND_ERROR "Unable to determine platform")
|
|
||||||
- endif(FUCHSIA OR UNIX)
|
|
||||||
+ endif(FUCHSIA OR GENODE OR UNIX)
|
|
||||||
endif(WIN32)
|
|
||||||
|
|
||||||
set(EXEEXT ${CMAKE_EXECUTABLE_SUFFIX})
|
|
||||||
diff --git a/llvm/include/llvm/ADT/Triple.h b/llvm/include/llvm/ADT/Triple.h
|
|
||||||
index e06a68e2731..7da3d5d29bc 100644
|
|
||||||
--- a/llvm/include/llvm/ADT/Triple.h
|
|
||||||
+++ b/llvm/include/llvm/ADT/Triple.h
|
|
||||||
@@ -159,6 +159,7 @@ public:
|
|
||||||
DragonFly,
|
|
||||||
FreeBSD,
|
|
||||||
Fuchsia,
|
|
||||||
+ Genode,
|
|
||||||
IOS,
|
|
||||||
KFreeBSD,
|
|
||||||
Linux,
|
|
||||||
@@ -498,6 +499,8 @@ public:
|
|
||||||
|
|
||||||
bool isOSDragonFly() const { return getOS() == Triple::DragonFly; }
|
|
||||||
|
|
||||||
+ bool isOSGenode() const { return getOS() == Triple::Genode; }
|
|
||||||
+
|
|
||||||
bool isOSSolaris() const {
|
|
||||||
return getOS() == Triple::Solaris;
|
|
||||||
}
|
|
||||||
diff --git a/llvm/include/llvm/BinaryFormat/ELF.h b/llvm/include/llvm/BinaryFormat/ELF.h
|
|
||||||
index ce35d127d43..d7a589057db 100644
|
|
||||||
--- a/llvm/include/llvm/BinaryFormat/ELF.h
|
|
||||||
+++ b/llvm/include/llvm/BinaryFormat/ELF.h
|
|
||||||
@@ -348,6 +348,7 @@ enum {
|
|
||||||
ELFOSABI_AROS = 15, // AROS
|
|
||||||
ELFOSABI_FENIXOS = 16, // FenixOS
|
|
||||||
ELFOSABI_CLOUDABI = 17, // Nuxi CloudABI
|
|
||||||
+ ELFOSABI_GENODE = 18, // Genode
|
|
||||||
ELFOSABI_FIRST_ARCH = 64, // First architecture-specific OS ABI
|
|
||||||
ELFOSABI_AMDGPU_HSA = 64, // AMD HSA runtime
|
|
||||||
ELFOSABI_AMDGPU_PAL = 65, // AMD PAL runtime
|
|
||||||
diff --git a/llvm/include/llvm/MC/MCELFObjectWriter.h b/llvm/include/llvm/MC/MCELFObjectWriter.h
|
|
||||||
index f226d6a45a5..91efe079d20 100644
|
|
||||||
--- a/llvm/include/llvm/MC/MCELFObjectWriter.h
|
|
||||||
+++ b/llvm/include/llvm/MC/MCELFObjectWriter.h
|
|
||||||
@@ -74,6 +74,8 @@ public:
|
|
||||||
switch (OSType) {
|
|
||||||
case Triple::CloudABI:
|
|
||||||
return ELF::ELFOSABI_CLOUDABI;
|
|
||||||
+ case Triple::Genode:
|
|
||||||
+ return ELF::ELFOSABI_GENODE;
|
|
||||||
case Triple::HermitCore:
|
|
||||||
return ELF::ELFOSABI_STANDALONE;
|
|
||||||
case Triple::PS4:
|
|
||||||
diff --git a/llvm/lib/ObjectYAML/ELFYAML.cpp b/llvm/lib/ObjectYAML/ELFYAML.cpp
|
|
||||||
index 215d6bdd091..0d3f5eaf032 100644
|
|
||||||
--- a/llvm/lib/ObjectYAML/ELFYAML.cpp
|
|
||||||
+++ b/llvm/lib/ObjectYAML/ELFYAML.cpp
|
|
||||||
@@ -260,6 +260,7 @@ void ScalarEnumerationTraits<ELFYAML::ELF_ELFOSABI>::enumeration(
|
|
||||||
ECase(ELFOSABI_AROS);
|
|
||||||
ECase(ELFOSABI_FENIXOS);
|
|
||||||
ECase(ELFOSABI_CLOUDABI);
|
|
||||||
+ ECase(ELFOSABI_GENODE);
|
|
||||||
ECase(ELFOSABI_AMDGPU_HSA);
|
|
||||||
ECase(ELFOSABI_AMDGPU_PAL);
|
|
||||||
ECase(ELFOSABI_AMDGPU_MESA3D);
|
|
||||||
diff --git a/llvm/lib/Support/Triple.cpp b/llvm/lib/Support/Triple.cpp
|
|
||||||
index 26d9327f620..1866b07ac68 100644
|
|
||||||
--- a/llvm/lib/Support/Triple.cpp
|
|
||||||
+++ b/llvm/lib/Support/Triple.cpp
|
|
||||||
@@ -181,6 +181,7 @@ StringRef Triple::getOSTypeName(OSType Kind) {
|
|
||||||
case DragonFly: return "dragonfly";
|
|
||||||
case FreeBSD: return "freebsd";
|
|
||||||
case Fuchsia: return "fuchsia";
|
|
||||||
+ case Genode: return "genode";
|
|
||||||
case IOS: return "ios";
|
|
||||||
case KFreeBSD: return "kfreebsd";
|
|
||||||
case Linux: return "linux";
|
|
||||||
@@ -478,6 +479,7 @@ static Triple::OSType parseOS(StringRef OSName) {
|
|
||||||
.StartsWith("dragonfly", Triple::DragonFly)
|
|
||||||
.StartsWith("freebsd", Triple::FreeBSD)
|
|
||||||
.StartsWith("fuchsia", Triple::Fuchsia)
|
|
||||||
+ .StartsWith("genode", Triple::Genode)
|
|
||||||
.StartsWith("ios", Triple::IOS)
|
|
||||||
.StartsWith("kfreebsd", Triple::KFreeBSD)
|
|
||||||
.StartsWith("linux", Triple::Linux)
|
|
||||||
diff --git a/llvm/tools/llvm-readobj/ELFDumper.cpp b/llvm/tools/llvm-readobj/ELFDumper.cpp
|
|
||||||
index 93254717e92..3d96ff9332a 100644
|
|
||||||
--- a/llvm/tools/llvm-readobj/ELFDumper.cpp
|
|
||||||
+++ b/llvm/tools/llvm-readobj/ELFDumper.cpp
|
|
||||||
@@ -911,6 +911,7 @@ static const EnumEntry<unsigned> ElfOSABI[] = {
|
|
||||||
{"AROS", "AROS", ELF::ELFOSABI_AROS},
|
|
||||||
{"FenixOS", "FenixOS", ELF::ELFOSABI_FENIXOS},
|
|
||||||
{"CloudABI", "CloudABI", ELF::ELFOSABI_CLOUDABI},
|
|
||||||
+ {"Genode", "Genode", ELF::ELFOSABI_GENODE},
|
|
||||||
{"Standalone", "Standalone App", ELF::ELFOSABI_STANDALONE}
|
|
||||||
};
|
|
||||||
|
|
||||||
diff --git a/llvm/unittests/ADT/TripleTest.cpp b/llvm/unittests/ADT/TripleTest.cpp
|
|
||||||
index bc7f9321caa..5d6a56d7723 100644
|
|
||||||
--- a/llvm/unittests/ADT/TripleTest.cpp
|
|
||||||
+++ b/llvm/unittests/ADT/TripleTest.cpp
|
|
||||||
@@ -241,6 +241,12 @@ TEST(TripleTest, ParsedIDs) {
|
|
||||||
EXPECT_EQ(Triple::Fuchsia, T.getOS());
|
|
||||||
EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
|
|
||||||
|
|
||||||
+ T = Triple("x86_64-unknown-genode");
|
|
||||||
+ EXPECT_EQ(Triple::x86_64, T.getArch());
|
|
||||||
+ EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
|
|
||||||
+ EXPECT_EQ(Triple::Genode, T.getOS());
|
|
||||||
+ EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
|
|
||||||
+
|
|
||||||
T = Triple("x86_64-unknown-hermit");
|
|
||||||
EXPECT_EQ(Triple::x86_64, T.getArch());
|
|
||||||
EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
|
|
||||||
diff --git a/llvm/utils/benchmark/src/internal_macros.h b/llvm/utils/benchmark/src/internal_macros.h
|
|
||||||
index f2d54bfcbd9..e20f891d435 100644
|
|
||||||
--- a/llvm/utils/benchmark/src/internal_macros.h
|
|
||||||
+++ b/llvm/utils/benchmark/src/internal_macros.h
|
|
||||||
@@ -65,6 +65,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 !__has_feature(cxx_exceptions) && !defined(__cpp_exceptions) \
|
|
||||||
diff --git a/llvm/utils/gn/secondary/clang/lib/Driver/BUILD.gn b/llvm/utils/gn/secondary/clang/lib/Driver/BUILD.gn
|
|
||||||
index 1f07a6272d8..74eefe63b01 100644
|
|
||||||
--- a/llvm/utils/gn/secondary/clang/lib/Driver/BUILD.gn
|
|
||||||
+++ b/llvm/utils/gn/secondary/clang/lib/Driver/BUILD.gn
|
|
||||||
@@ -62,6 +62,7 @@ static_library("Driver") {
|
|
||||||
"ToolChains/DragonFly.cpp",
|
|
||||||
"ToolChains/FreeBSD.cpp",
|
|
||||||
"ToolChains/Fuchsia.cpp",
|
|
||||||
+ "ToolChains/Genode.cpp",
|
|
||||||
"ToolChains/Gnu.cpp",
|
|
||||||
"ToolChains/HIP.cpp",
|
|
||||||
"ToolChains/Haiku.cpp",
|
|
|
@ -1,70 +0,0 @@
|
||||||
# SPDX-FileCopyrightText: 2003-2020 Nixpkgs/NixOS contributors
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
{ lib, stdenv, fetch, cmake, python, libcxxabi, fixDarwinDylibNames, version
|
|
||||||
, enableShared ? true }:
|
|
||||||
|
|
||||||
let
|
|
||||||
enableShared' = if enableShared then !stdenv.hostPlatform.isGenode else false;
|
|
||||||
in
|
|
||||||
stdenv.mkDerivation rec {
|
|
||||||
pname = "libc++";
|
|
||||||
inherit version;
|
|
||||||
|
|
||||||
src = fetch "libcxx" "0y4vc9z36c1zlq15cnibdzxnc1xi5glbc6klnm8a41q3db4541kz";
|
|
||||||
|
|
||||||
postUnpack = ''
|
|
||||||
unpackFile ${libcxxabi.src}
|
|
||||||
export LIBCXXABI_INCLUDE_DIR="$PWD/$(ls -d libcxxabi-${version}*)/include"
|
|
||||||
'';
|
|
||||||
|
|
||||||
patches = with stdenv.hostPlatform; []
|
|
||||||
++ stdenv.lib.optional isMusl ../../libcxx-0001-musl-hacks.patch
|
|
||||||
++ stdenv.lib.optional isGenode ./genode.patch;
|
|
||||||
|
|
||||||
prePatch = ''
|
|
||||||
substituteInPlace lib/CMakeLists.txt --replace "/usr/lib/libc++" "\''${LIBCXX_LIBCXXABI_LIB_PATH}/libc++"
|
|
||||||
'';
|
|
||||||
|
|
||||||
preConfigure = ''
|
|
||||||
# Get headers from the cxxabi source so we can see private headers not installed by the cxxabi package
|
|
||||||
cmakeFlagsArray=($cmakeFlagsArray -DLIBCXX_CXX_ABI_INCLUDE_PATHS="$LIBCXXABI_INCLUDE_DIR")
|
|
||||||
'' + lib.optionalString stdenv.hostPlatform.isMusl ''
|
|
||||||
patchShebangs utils/cat_files.py
|
|
||||||
'';
|
|
||||||
nativeBuildInputs = [ cmake ]
|
|
||||||
++ stdenv.lib.optional (with stdenv.hostPlatform; (isMusl || isWasi || isGenode)) python;
|
|
||||||
|
|
||||||
buildInputs = [ libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
|
|
||||||
|
|
||||||
cmakeFlags = [
|
|
||||||
"-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib"
|
|
||||||
"-DLIBCXX_LIBCPPABI_VERSION=2"
|
|
||||||
"-DLIBCXX_CXX_ABI=libcxxabi"
|
|
||||||
] ++ stdenv.lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1"
|
|
||||||
++ stdenv.lib.optional (stdenv.hostPlatform.useLLVM or false) "-DLIBCXX_USE_COMPILER_RT=ON"
|
|
||||||
++ stdenv.lib.optional stdenv.hostPlatform.isGenode
|
|
||||||
"-DLIBCXX_ENABLE_THREADS=OFF"
|
|
||||||
++ stdenv.lib.optional stdenv.hostPlatform.isWasm [
|
|
||||||
"-DLIBCXX_ENABLE_THREADS=OFF"
|
|
||||||
"-DLIBCXX_ENABLE_FILESYSTEM=OFF"
|
|
||||||
"-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
|
|
||||||
] ++ stdenv.lib.optional (!enableShared') "-DLIBCXX_ENABLE_SHARED=OFF";
|
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
|
||||||
|
|
||||||
linkCxxAbi = stdenv.isLinux;
|
|
||||||
|
|
||||||
setupHooks = [
|
|
||||||
./role.bash
|
|
||||||
./setup-hook.sh
|
|
||||||
];
|
|
||||||
|
|
||||||
meta = {
|
|
||||||
homepage = http://libcxx.llvm.org/;
|
|
||||||
description = "A new implementation of the C++ standard library, targeting C++11";
|
|
||||||
license = with stdenv.lib.licenses; [ ncsa mit ];
|
|
||||||
platforms = stdenv.lib.platforms.all;
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,74 +0,0 @@
|
||||||
diff --git a/include/locale b/include/locale
|
|
||||||
index 2043892fa2d..6e5c285a7c9 100644
|
|
||||||
--- a/include/locale
|
|
||||||
+++ b/include/locale
|
|
||||||
@@ -737,7 +737,7 @@ __num_get_signed_integral(const char* __a, const char* __a_end,
|
|
||||||
typename remove_reference<decltype(errno)>::type __save_errno = errno;
|
|
||||||
errno = 0;
|
|
||||||
char *__p2;
|
|
||||||
- long long __ll = strtoll_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
|
|
||||||
+ long long __ll = strtoll(__a, &__p2, __base);
|
|
||||||
typename remove_reference<decltype(errno)>::type __current_errno = errno;
|
|
||||||
if (__current_errno == 0)
|
|
||||||
errno = __save_errno;
|
|
||||||
@@ -777,7 +777,7 @@ __num_get_unsigned_integral(const char* __a, const char* __a_end,
|
|
||||||
typename remove_reference<decltype(errno)>::type __save_errno = errno;
|
|
||||||
errno = 0;
|
|
||||||
char *__p2;
|
|
||||||
- unsigned long long __ll = strtoull_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
|
|
||||||
+ unsigned long long __ll = strtoull(__a, &__p2, __base);
|
|
||||||
typename remove_reference<decltype(errno)>::type __current_errno = errno;
|
|
||||||
if (__current_errno == 0)
|
|
||||||
errno = __save_errno;
|
|
||||||
@@ -806,19 +806,19 @@ _Tp __do_strtod(const char* __a, char** __p2);
|
|
||||||
template <>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
float __do_strtod<float>(const char* __a, char** __p2) {
|
|
||||||
- return strtof_l(__a, __p2, _LIBCPP_GET_C_LOCALE);
|
|
||||||
+ return strtof(__a, __p2);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
double __do_strtod<double>(const char* __a, char** __p2) {
|
|
||||||
- return strtod_l(__a, __p2, _LIBCPP_GET_C_LOCALE);
|
|
||||||
+ return strtod(__a, __p2);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <>
|
|
||||||
inline _LIBCPP_INLINE_VISIBILITY
|
|
||||||
long double __do_strtod<long double>(const char* __a, char** __p2) {
|
|
||||||
- return strtold_l(__a, __p2, _LIBCPP_GET_C_LOCALE);
|
|
||||||
+ return strtold(__a, __p2);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class _Tp>
|
|
||||||
@@ -1197,13 +1197,13 @@ __num_put<_CharT>::__widen_and_group_float(char* __nb, char* __np, char* __ne,
|
|
||||||
*__oe++ = __ct.widen(*__nf++);
|
|
||||||
*__oe++ = __ct.widen(*__nf++);
|
|
||||||
for (__ns = __nf; __ns < __ne; ++__ns)
|
|
||||||
- if (!isxdigit_l(*__ns, _LIBCPP_GET_C_LOCALE))
|
|
||||||
+ if (!isxdigit(*__ns))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (__ns = __nf; __ns < __ne; ++__ns)
|
|
||||||
- if (!isdigit_l(*__ns, _LIBCPP_GET_C_LOCALE))
|
|
||||||
+ if (!isdigit(*__ns))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (__grouping.empty())
|
|
||||||
diff --git a/utils/google-benchmark/src/internal_macros.h b/utils/google-benchmark/src/internal_macros.h
|
|
||||||
index 5dbf4fd2752..4699c5ed913 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__)
|
|
|
@ -1,29 +0,0 @@
|
||||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
||||||
index 3d06073cfe7..076d8c383ac 100644
|
|
||||||
--- a/CMakeLists.txt
|
|
||||||
+++ b/CMakeLists.txt
|
|
||||||
@@ -333,6 +333,11 @@ if (WIN32 AND LIBUNWIND_ENABLE_STATIC AND NOT LIBUNWIND_ENABLE_SHARED)
|
|
||||||
add_definitions(-D_LIBUNWIND_DISABLE_VISIBILITY_ANNOTATIONS)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
+if (LIBUNWIND_IS_BAREMETAL)
|
|
||||||
+ add_definitions(-D_LIBUNWIND_IS_BAREMETAL)
|
|
||||||
+ add_definitions(-D_LIBUNWIND_SUPPORT_DWARF_UNWIND)
|
|
||||||
+endif()
|
|
||||||
+
|
|
||||||
#===============================================================================
|
|
||||||
# Setup Source Code
|
|
||||||
#===============================================================================
|
|
||||||
diff --git a/src/assembly.h b/src/assembly.h
|
|
||||||
index 0b7d24389a4..84cb7bf2f8b 100644
|
|
||||||
--- a/src/assembly.h
|
|
||||||
+++ b/src/assembly.h
|
|
||||||
@@ -71,7 +71,7 @@
|
|
||||||
#define HIDDEN_SYMBOL(name) .hidden name
|
|
||||||
|
|
||||||
#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
|
|
|
@ -1,41 +0,0 @@
|
||||||
# SPDX-FileCopyrightText: 2003-2020 Nixpkgs/NixOS contributors
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
{ stdenv, version, fetch, cmake, fetchpatch
|
|
||||||
, enableShared ? true
|
|
||||||
, isBaremetal ? false }:
|
|
||||||
|
|
||||||
let
|
|
||||||
enableShared' = if stdenv.targetPlatform ? isGenode then
|
|
||||||
!stdenv.targetPlatform.isGenode
|
|
||||||
else
|
|
||||||
false;
|
|
||||||
in
|
|
||||||
stdenv.mkDerivation {
|
|
||||||
pname = "libunwind";
|
|
||||||
inherit version;
|
|
||||||
|
|
||||||
src = fetch "libunwind" "0vhgcgzsb33l83qaikrkj87ypqb48mi607rccczccwiiv8ficw0q";
|
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake ];
|
|
||||||
|
|
||||||
patches = [
|
|
||||||
(fetchpatch {
|
|
||||||
url = "https://github.com/llvm-mirror/libunwind/commit/34a45c630d4c79af403661d267db42fbe7de1178.patch";
|
|
||||||
sha256 = "0n0pv6jvcky8pn3srhrf9x5kbnd0d2kia9xlx2g590f5q0bgwfhv";
|
|
||||||
})
|
|
||||||
(fetchpatch {
|
|
||||||
url = "https://github.com/llvm-mirror/libunwind/commit/e050272d2eb57eb4e56a37b429a61df2ebb8aa3e.patch";
|
|
||||||
sha256 = "1sxyx5xnax8k713jjcxgq3jq3cpnxygs2rcdf5vfja0f2k9jzldl";
|
|
||||||
})
|
|
||||||
] ++ stdenv.lib.optionals stdenv.hostPlatform.isGenode [
|
|
||||||
./libunwind-genode.patch
|
|
||||||
];
|
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
|
||||||
|
|
||||||
cmakeFlags = [ ]
|
|
||||||
++ stdenv.lib.optional (!enableShared') "-DLIBUNWIND_ENABLE_SHARED=OFF"
|
|
||||||
++ stdenv.lib.optional isBaremetal "-DLIBUNWIND_IS_BAREMETAL=ON";
|
|
||||||
}
|
|
|
@ -1,64 +0,0 @@
|
||||||
diff --git a/ELF/Driver.cpp b/ELF/Driver.cpp
|
|
||||||
index bce9d944a..cf42193f9 100644
|
|
||||||
--- a/ELF/Driver.cpp
|
|
||||||
+++ b/ELF/Driver.cpp
|
|
||||||
@@ -235,12 +235,8 @@ void LinkerDriver::addFile(StringRef Path, bool WithLOption) {
|
|
||||||
// file has a DT_SONAME or not because we haven't parsed it yet.
|
|
||||||
// Here, we set the default soname for the file because we might
|
|
||||||
// need it later.
|
|
||||||
- //
|
|
||||||
- // If a file was specified by -lfoo, the directory part is not
|
|
||||||
- // significant, as a user did not specify it. This behavior is
|
|
||||||
- // compatible with GNU.
|
|
||||||
Files.push_back(
|
|
||||||
- createSharedFile(MBRef, WithLOption ? path::filename(Path) : Path));
|
|
||||||
+ createSharedFile(MBRef, Path));
|
|
||||||
return;
|
|
||||||
case file_magic::bitcode:
|
|
||||||
case file_magic::elf_relocatable:
|
|
||||||
diff --git a/ELF/DriverUtils.cpp b/ELF/DriverUtils.cpp
|
|
||||||
index e51d02e38..259ea8053 100644
|
|
||||||
--- a/ELF/DriverUtils.cpp
|
|
||||||
+++ b/ELF/DriverUtils.cpp
|
|
||||||
@@ -194,14 +194,16 @@ std::string elf::createResponseFile(const opt::InputArgList &Args) {
|
|
||||||
// Find a file by concatenating given paths. If a resulting path
|
|
||||||
// starts with "=", the character is replaced with a --sysroot value.
|
|
||||||
static Optional<std::string> findFile(StringRef Path1, const Twine &Path2) {
|
|
||||||
- SmallString<128> S;
|
|
||||||
+ SmallString<256> S;
|
|
||||||
if (Path1.startswith("="))
|
|
||||||
path::append(S, Config->Sysroot, Path1.substr(1), Path2);
|
|
||||||
else
|
|
||||||
path::append(S, Path1, Path2);
|
|
||||||
|
|
||||||
- if (fs::exists(S))
|
|
||||||
- return S.str().str();
|
|
||||||
+ SmallString<256> RealPath;
|
|
||||||
+ fs::real_path(S, RealPath);
|
|
||||||
+ if (fs::exists(RealPath))
|
|
||||||
+ return RealPath.str().str();
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -220,8 +222,19 @@ Optional<std::string> elf::searchLibrary(StringRef Name) {
|
|
||||||
|
|
||||||
for (StringRef Dir : Config->SearchPaths) {
|
|
||||||
if (!Config->Static)
|
|
||||||
- if (Optional<std::string> S = findFile(Dir, "lib" + Name + ".so"))
|
|
||||||
- return S;
|
|
||||||
+ if (Name.size() == 1) {
|
|
||||||
+ if (Optional<std::string> S = findFile(Dir, "lib" + Name + ".lib.so"))
|
|
||||||
+ return S;
|
|
||||||
+ if (Optional<std::string> S = findFile(Dir, "lib" + Name + ".so"))
|
|
||||||
+ return S;
|
|
||||||
+ } else {
|
|
||||||
+ if (Optional<std::string> S = findFile(Dir, Name + ".lib.so"))
|
|
||||||
+ return S;
|
|
||||||
+ if (Optional<std::string> S = findFile(Dir, "lib" + Name + ".so"))
|
|
||||||
+ return S;
|
|
||||||
+ }
|
|
||||||
+ if (Optional<std::string> S = findFile(Dir, Name + ".lib.a"))
|
|
||||||
+ return S;
|
|
||||||
if (Optional<std::string> S = findFile(Dir, "lib" + Name + ".a"))
|
|
||||||
return S;
|
|
||||||
}
|
|
|
@ -1,65 +0,0 @@
|
||||||
# SPDX-FileCopyrightText: 2003-2020 Nixpkgs/NixOS contributors
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
{ stdenv
|
|
||||||
, fetch
|
|
||||||
, cmake
|
|
||||||
, zlib
|
|
||||||
, ncurses
|
|
||||||
, swig
|
|
||||||
, which
|
|
||||||
, libedit
|
|
||||||
, libxml2
|
|
||||||
, llvm
|
|
||||||
, clang-unwrapped
|
|
||||||
, python
|
|
||||||
, version
|
|
||||||
, darwin
|
|
||||||
}:
|
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
|
||||||
pname = "lldb";
|
|
||||||
inherit version;
|
|
||||||
|
|
||||||
src = fetch "lldb" "1mriw4adrwm6kzabrjr7yqmdiylxd6glf6samd80dp8idnm9p9z8";
|
|
||||||
|
|
||||||
postPatch = ''
|
|
||||||
# Fix up various paths that assume llvm and clang are installed in the same place
|
|
||||||
sed -i 's,".*ClangConfig.cmake","${clang-unwrapped}/lib/cmake/clang/ClangConfig.cmake",' \
|
|
||||||
cmake/modules/LLDBStandalone.cmake
|
|
||||||
sed -i 's,".*tools/clang/include","${clang-unwrapped}/include",' \
|
|
||||||
cmake/modules/LLDBStandalone.cmake
|
|
||||||
sed -i 's,"$.LLVM_LIBRARY_DIR.",${llvm}/lib ${clang-unwrapped}/lib,' \
|
|
||||||
cmake/modules/LLDBStandalone.cmake
|
|
||||||
'';
|
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake python which swig ];
|
|
||||||
buildInputs = [ ncurses zlib libedit libxml2 llvm ]
|
|
||||||
++ stdenv.lib.optionals stdenv.isDarwin [ darwin.libobjc darwin.apple_sdk.libs.xpc darwin.apple_sdk.frameworks.Foundation darwin.bootstrap_cmds darwin.apple_sdk.frameworks.Carbon darwin.apple_sdk.frameworks.Cocoa ];
|
|
||||||
|
|
||||||
CXXFLAGS = "-fno-rtti";
|
|
||||||
hardeningDisable = [ "format" ];
|
|
||||||
|
|
||||||
cmakeFlags = [
|
|
||||||
"-DLLDB_CODESIGN_IDENTITY=" # codesigning makes nondeterministic
|
|
||||||
];
|
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
|
||||||
|
|
||||||
postInstall = ''
|
|
||||||
mkdir -p $out/share/man/man1
|
|
||||||
cp ../docs/lldb.1 $out/share/man/man1/
|
|
||||||
|
|
||||||
install -D ../tools/lldb-vscode/package.json $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/package.json
|
|
||||||
mkdir $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/bin
|
|
||||||
ln -s $out/bin/lldb-vscode $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/bin
|
|
||||||
'';
|
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
|
||||||
description = "A next-generation high-performance debugger";
|
|
||||||
homepage = http://llvm.org/;
|
|
||||||
license = licenses.ncsa;
|
|
||||||
platforms = platforms.all;
|
|
||||||
};
|
|
||||||
}
|
|
Loading…
Reference in New Issue