treewide: All the linker to be chosen independently
This will begin the process of breaking up the `useLLVM` monolith. That is good in general, but I hope will be good for NetBSD and Darwin in particular. Co-authored-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
parent
e3a1c149d2
commit
18c38f8aee
|
@ -41,6 +41,19 @@ rec {
|
||||||
else if final.isNetBSD then "nblibc"
|
else if final.isNetBSD then "nblibc"
|
||||||
# TODO(@Ericson2314) think more about other operating systems
|
# TODO(@Ericson2314) think more about other operating systems
|
||||||
else "native/impure";
|
else "native/impure";
|
||||||
|
# Choose what linker we wish to use by default. Someday we might also
|
||||||
|
# choose the C compiler, runtime library, C++ standard library, etc. in
|
||||||
|
# this way, nice and orthogonally, and deprecate `useLLVM`. But due to
|
||||||
|
# the monolithic GCC build we cannot actually make those choices
|
||||||
|
# independently, so we are just doing `linker` and keeping `useLLVM` for
|
||||||
|
# now.
|
||||||
|
linker =
|
||||||
|
/**/ if final.useLLVM or false then "lld"
|
||||||
|
else if final.isDarwin then "cctools"
|
||||||
|
# "bfd" and "gold" both come from GNU binutils. The existance of Gold
|
||||||
|
# is why we use the more obscure "bfd" and not "binutils" for this
|
||||||
|
# choice.
|
||||||
|
else "bfd";
|
||||||
extensions = {
|
extensions = {
|
||||||
sharedLibrary =
|
sharedLibrary =
|
||||||
/**/ if final.isDarwin then ".dylib"
|
/**/ if final.isDarwin then ".dylib"
|
||||||
|
|
|
@ -137,7 +137,7 @@ let
|
||||||
ninja pkg-config
|
ninja pkg-config
|
||||||
python2WithPackages perl nodejs
|
python2WithPackages perl nodejs
|
||||||
gnutar which
|
gnutar which
|
||||||
llvmPackages.lldClang.bintools
|
llvmPackages.bintools
|
||||||
] ++ lib.optionals (chromiumVersionAtLeast "92") [
|
] ++ lib.optionals (chromiumVersionAtLeast "92") [
|
||||||
python3WithPackages
|
python3WithPackages
|
||||||
];
|
];
|
||||||
|
|
|
@ -98,16 +98,22 @@ let
|
||||||
# clang LTO on Darwin is broken so the stdenv is not being changed.
|
# clang LTO on Darwin is broken so the stdenv is not being changed.
|
||||||
# Target the LLVM version that rustc -Vv reports it is built with for LTO.
|
# Target the LLVM version that rustc -Vv reports it is built with for LTO.
|
||||||
# rustPackages_1_45 -> LLVM 10, rustPackages -> LLVM 11
|
# rustPackages_1_45 -> LLVM 10, rustPackages -> LLVM 11
|
||||||
llvmPackages = if stdenv.isDarwin
|
llvmPackages0 =
|
||||||
then buildPackages.llvmPackages
|
/**/ if stdenv.isDarwin
|
||||||
else if lib.versionAtLeast rustc.llvm.version "11"
|
then buildPackages.llvmPackages
|
||||||
then buildPackages.llvmPackages_11
|
else if lib.versionAtLeast rustc.llvm.version "11"
|
||||||
else buildPackages.llvmPackages_10;
|
then buildPackages.llvmPackages_11
|
||||||
|
else buildPackages.llvmPackages_10;
|
||||||
|
# Force the use of lld and other llvm tools for LTO
|
||||||
|
llvmPackages = llvmPackages0.override {
|
||||||
|
bootBintoolsNoLibc = null;
|
||||||
|
bootBintools = null;
|
||||||
|
};
|
||||||
|
|
||||||
# When LTO for Darwin is fixed, the following will need updating as lld
|
# When LTO for Darwin is fixed, the following will need updating as lld
|
||||||
# doesn't work on it. For now it is fine since ltoSupport implies no Darwin.
|
# doesn't work on it. For now it is fine since ltoSupport implies no Darwin.
|
||||||
buildStdenv = if ltoSupport
|
buildStdenv = if ltoSupport
|
||||||
then overrideCC stdenv llvmPackages.lldClang
|
then overrideCC stdenv llvmPackages.clangUseLLVM
|
||||||
else stdenv;
|
else stdenv;
|
||||||
|
|
||||||
nss_pkg = if lib.versionOlder ffversion "83" then nss_3_53 else nss;
|
nss_pkg = if lib.versionOlder ffversion "83" then nss_3_53 else nss;
|
||||||
|
|
|
@ -64,6 +64,7 @@ let
|
||||||
|
|
||||||
useGccForLibs = isClang
|
useGccForLibs = isClang
|
||||||
&& libcxx == null
|
&& libcxx == null
|
||||||
|
&& !stdenv.targetPlatform.isDarwin
|
||||||
&& !(stdenv.targetPlatform.useLLVM or false)
|
&& !(stdenv.targetPlatform.useLLVM or false)
|
||||||
&& !(stdenv.targetPlatform.useAndroidPrebuilt or false)
|
&& !(stdenv.targetPlatform.useAndroidPrebuilt or false)
|
||||||
&& !(stdenv.targetPlatform.isiOS or false)
|
&& !(stdenv.targetPlatform.isiOS or false)
|
||||||
|
|
|
@ -3,6 +3,17 @@
|
||||||
, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
|
, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
|
||||||
, 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
|
||||||
|
# This is the default binutils, but with *this* version of LLD rather
|
||||||
|
# than the default LLVM verion's, if LLD is the choice. We use these for
|
||||||
|
# the `useLLVM` bootstrapping below.
|
||||||
|
, bootBintoolsNoLibc ?
|
||||||
|
if stdenv.targetPlatform.linker == "lld"
|
||||||
|
then null
|
||||||
|
else pkgs.bintoolsNoLibc
|
||||||
|
, bootBintools ?
|
||||||
|
if stdenv.targetPlatform.linker == "lld"
|
||||||
|
then null
|
||||||
|
else pkgs.bintools
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
@ -36,6 +47,15 @@ let
|
||||||
ln -s "${targetLlvmLibraries.compiler-rt.out}/share" "$rsrc/share"
|
ln -s "${targetLlvmLibraries.compiler-rt.out}/share" "$rsrc/share"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
bintoolsNoLibc' =
|
||||||
|
if bootBintoolsNoLibc == null
|
||||||
|
then tools.bintoolsNoLibc
|
||||||
|
else bootBintoolsNoLibc;
|
||||||
|
bintools' =
|
||||||
|
if bootBintools == null
|
||||||
|
then tools.bintools
|
||||||
|
else bootBintools;
|
||||||
|
|
||||||
in {
|
in {
|
||||||
|
|
||||||
libllvm = callPackage ./llvm {
|
libllvm = callPackage ./llvm {
|
||||||
|
@ -117,10 +137,10 @@ let
|
||||||
bintools = tools.bintools-unwrapped;
|
bintools = tools.bintools-unwrapped;
|
||||||
};
|
};
|
||||||
|
|
||||||
lldClang = wrapCCWith rec {
|
clangUseLLVM = wrapCCWith rec {
|
||||||
cc = tools.clang-unwrapped;
|
cc = tools.clang-unwrapped;
|
||||||
libcxx = targetLlvmLibraries.libcxx;
|
libcxx = targetLlvmLibraries.libcxx;
|
||||||
inherit (tools) bintools;
|
bintools = bintools';
|
||||||
extraPackages = [
|
extraPackages = [
|
||||||
targetLlvmLibraries.libcxxabi
|
targetLlvmLibraries.libcxxabi
|
||||||
targetLlvmLibraries.compiler-rt
|
targetLlvmLibraries.compiler-rt
|
||||||
|
@ -139,10 +159,10 @@ let
|
||||||
'' + mkExtraBuildCommands cc;
|
'' + mkExtraBuildCommands cc;
|
||||||
};
|
};
|
||||||
|
|
||||||
lldClangNoLibcxx = wrapCCWith rec {
|
clangNoLibcxx = wrapCCWith rec {
|
||||||
cc = tools.clang-unwrapped;
|
cc = tools.clang-unwrapped;
|
||||||
libcxx = null;
|
libcxx = null;
|
||||||
inherit (tools) bintools;
|
bintools = bintools';
|
||||||
extraPackages = [
|
extraPackages = [
|
||||||
targetLlvmLibraries.compiler-rt
|
targetLlvmLibraries.compiler-rt
|
||||||
];
|
];
|
||||||
|
@ -153,10 +173,10 @@ let
|
||||||
'' + mkExtraBuildCommands cc;
|
'' + mkExtraBuildCommands cc;
|
||||||
};
|
};
|
||||||
|
|
||||||
lldClangNoLibc = wrapCCWith rec {
|
clangNoLibc = wrapCCWith rec {
|
||||||
cc = tools.clang-unwrapped;
|
cc = tools.clang-unwrapped;
|
||||||
libcxx = null;
|
libcxx = null;
|
||||||
bintools = tools.bintoolsNoLibc;
|
bintools = bintoolsNoLibc';
|
||||||
extraPackages = [
|
extraPackages = [
|
||||||
targetLlvmLibraries.compiler-rt
|
targetLlvmLibraries.compiler-rt
|
||||||
];
|
];
|
||||||
|
@ -166,20 +186,20 @@ let
|
||||||
'' + mkExtraBuildCommands cc;
|
'' + mkExtraBuildCommands cc;
|
||||||
};
|
};
|
||||||
|
|
||||||
lldClangNoCompilerRt = wrapCCWith rec {
|
clangNoCompilerRt = wrapCCWith rec {
|
||||||
cc = tools.clang-unwrapped;
|
cc = tools.clang-unwrapped;
|
||||||
libcxx = null;
|
libcxx = null;
|
||||||
bintools = tools.bintoolsNoLibc;
|
bintools = bintoolsNoLibc';
|
||||||
extraPackages = [ ];
|
extraPackages = [ ];
|
||||||
extraBuildCommands = ''
|
extraBuildCommands = ''
|
||||||
echo "-nostartfiles" >> $out/nix-support/cc-cflags
|
echo "-nostartfiles" >> $out/nix-support/cc-cflags
|
||||||
'' + mkExtraBuildCommands0 cc;
|
'' + mkExtraBuildCommands0 cc;
|
||||||
};
|
};
|
||||||
|
|
||||||
lldClangNoCompilerRtWithLibc = wrapCCWith rec {
|
clangNoCompilerRtWithLibc = wrapCCWith rec {
|
||||||
cc = tools.clang-unwrapped;
|
cc = tools.clang-unwrapped;
|
||||||
libcxx = null;
|
libcxx = null;
|
||||||
inherit (tools) bintools;
|
bintools = bintools';
|
||||||
extraPackages = [ ];
|
extraPackages = [ ];
|
||||||
extraBuildCommands = mkExtraBuildCommands0 cc;
|
extraBuildCommands = mkExtraBuildCommands0 cc;
|
||||||
};
|
};
|
||||||
|
@ -193,14 +213,14 @@ let
|
||||||
compiler-rt-libc = callPackage ./compiler-rt {
|
compiler-rt-libc = callPackage ./compiler-rt {
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||||
then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRtWithLibc
|
then overrideCC stdenv buildLlvmTools.clangNoCompilerRtWithLibc
|
||||||
else stdenv;
|
else stdenv;
|
||||||
};
|
};
|
||||||
|
|
||||||
compiler-rt-no-libc = callPackage ./compiler-rt {
|
compiler-rt-no-libc = callPackage ./compiler-rt {
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||||
then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt
|
then overrideCC stdenv buildLlvmTools.clangNoCompilerRt
|
||||||
else stdenv;
|
else stdenv;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -216,21 +236,21 @@ let
|
||||||
libcxx = callPackage ./libcxx {
|
libcxx = callPackage ./libcxx {
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||||
then overrideCC stdenv buildLlvmTools.lldClangNoLibcxx
|
then overrideCC stdenv buildLlvmTools.clangNoLibcxx
|
||||||
else stdenv;
|
else stdenv;
|
||||||
};
|
};
|
||||||
|
|
||||||
libcxxabi = callPackage ./libcxxabi {
|
libcxxabi = callPackage ./libcxxabi {
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||||
then overrideCC stdenv buildLlvmTools.lldClangNoLibcxx
|
then overrideCC stdenv buildLlvmTools.clangNoLibcxx
|
||||||
else stdenv;
|
else stdenv;
|
||||||
};
|
};
|
||||||
|
|
||||||
libunwind = callPackage ./libunwind {
|
libunwind = callPackage ./libunwind {
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||||
then overrideCC stdenv buildLlvmTools.lldClangNoLibcxx
|
then overrideCC stdenv buildLlvmTools.clangNoLibcxx
|
||||||
else stdenv;
|
else stdenv;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,17 @@
|
||||||
, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
|
, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
|
||||||
, 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
|
||||||
|
# This is the default binutils, but with *this* version of LLD rather
|
||||||
|
# than the default LLVM verion's, if LLD is the choice. We use these for
|
||||||
|
# the `useLLVM` bootstrapping below.
|
||||||
|
, bootBintoolsNoLibc ?
|
||||||
|
if stdenv.targetPlatform.linker == "lld"
|
||||||
|
then null
|
||||||
|
else pkgs.bintoolsNoLibc
|
||||||
|
, bootBintools ?
|
||||||
|
if stdenv.targetPlatform.linker == "lld"
|
||||||
|
then null
|
||||||
|
else pkgs.bintools
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
@ -38,6 +49,15 @@ let
|
||||||
ln -s "${targetLlvmLibraries.compiler-rt.out}/share" "$rsrc/share"
|
ln -s "${targetLlvmLibraries.compiler-rt.out}/share" "$rsrc/share"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
bintoolsNoLibc' =
|
||||||
|
if bootBintoolsNoLibc == null
|
||||||
|
then tools.bintoolsNoLibc
|
||||||
|
else bootBintoolsNoLibc;
|
||||||
|
bintools' =
|
||||||
|
if bootBintools == null
|
||||||
|
then tools.bintools
|
||||||
|
else bootBintools;
|
||||||
|
|
||||||
in {
|
in {
|
||||||
|
|
||||||
libllvm = callPackage ./llvm {
|
libllvm = callPackage ./llvm {
|
||||||
|
@ -118,10 +138,10 @@ let
|
||||||
bintools = tools.bintools-unwrapped;
|
bintools = tools.bintools-unwrapped;
|
||||||
};
|
};
|
||||||
|
|
||||||
lldClang = wrapCCWith rec {
|
clangUseLLVM = wrapCCWith rec {
|
||||||
cc = tools.clang-unwrapped;
|
cc = tools.clang-unwrapped;
|
||||||
libcxx = targetLlvmLibraries.libcxx;
|
libcxx = targetLlvmLibraries.libcxx;
|
||||||
inherit (tools) bintools;
|
bintools = bintools';
|
||||||
extraPackages = [
|
extraPackages = [
|
||||||
targetLlvmLibraries.libcxxabi
|
targetLlvmLibraries.libcxxabi
|
||||||
targetLlvmLibraries.compiler-rt
|
targetLlvmLibraries.compiler-rt
|
||||||
|
@ -140,10 +160,10 @@ let
|
||||||
'' + mkExtraBuildCommands cc;
|
'' + mkExtraBuildCommands cc;
|
||||||
};
|
};
|
||||||
|
|
||||||
lldClangNoLibcxx = wrapCCWith rec {
|
clangNoLibcxx = wrapCCWith rec {
|
||||||
cc = tools.clang-unwrapped;
|
cc = tools.clang-unwrapped;
|
||||||
libcxx = null;
|
libcxx = null;
|
||||||
inherit (tools) bintools;
|
bintools = bintools';
|
||||||
extraPackages = [
|
extraPackages = [
|
||||||
targetLlvmLibraries.compiler-rt
|
targetLlvmLibraries.compiler-rt
|
||||||
];
|
];
|
||||||
|
@ -154,10 +174,10 @@ let
|
||||||
'' + mkExtraBuildCommands cc;
|
'' + mkExtraBuildCommands cc;
|
||||||
};
|
};
|
||||||
|
|
||||||
lldClangNoLibc = wrapCCWith rec {
|
clangNoLibc = wrapCCWith rec {
|
||||||
cc = tools.clang-unwrapped;
|
cc = tools.clang-unwrapped;
|
||||||
libcxx = null;
|
libcxx = null;
|
||||||
bintools = tools.bintoolsNoLibc;
|
bintools = bintoolsNoLibc';
|
||||||
extraPackages = [
|
extraPackages = [
|
||||||
targetLlvmLibraries.compiler-rt
|
targetLlvmLibraries.compiler-rt
|
||||||
];
|
];
|
||||||
|
@ -167,20 +187,20 @@ let
|
||||||
'' + mkExtraBuildCommands cc;
|
'' + mkExtraBuildCommands cc;
|
||||||
};
|
};
|
||||||
|
|
||||||
lldClangNoCompilerRt = wrapCCWith rec {
|
clangNoCompilerRt = wrapCCWith rec {
|
||||||
cc = tools.clang-unwrapped;
|
cc = tools.clang-unwrapped;
|
||||||
libcxx = null;
|
libcxx = null;
|
||||||
bintools = tools.bintoolsNoLibc;
|
bintools = bintoolsNoLibc';
|
||||||
extraPackages = [ ];
|
extraPackages = [ ];
|
||||||
extraBuildCommands = ''
|
extraBuildCommands = ''
|
||||||
echo "-nostartfiles" >> $out/nix-support/cc-cflags
|
echo "-nostartfiles" >> $out/nix-support/cc-cflags
|
||||||
'' + mkExtraBuildCommands0 cc;
|
'' + mkExtraBuildCommands0 cc;
|
||||||
};
|
};
|
||||||
|
|
||||||
lldClangNoCompilerRtWithLibc = wrapCCWith rec {
|
clangNoCompilerRtWithLibc = wrapCCWith rec {
|
||||||
cc = tools.clang-unwrapped;
|
cc = tools.clang-unwrapped;
|
||||||
libcxx = null;
|
libcxx = null;
|
||||||
inherit (tools) bintools;
|
bintools = bintools';
|
||||||
extraPackages = [ ];
|
extraPackages = [ ];
|
||||||
extraBuildCommands = mkExtraBuildCommands0 cc;
|
extraBuildCommands = mkExtraBuildCommands0 cc;
|
||||||
};
|
};
|
||||||
|
@ -194,14 +214,14 @@ let
|
||||||
compiler-rt-libc = callPackage ./compiler-rt {
|
compiler-rt-libc = callPackage ./compiler-rt {
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||||
then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRtWithLibc
|
then overrideCC stdenv buildLlvmTools.clangNoCompilerRtWithLibc
|
||||||
else stdenv;
|
else stdenv;
|
||||||
};
|
};
|
||||||
|
|
||||||
compiler-rt-no-libc = callPackage ./compiler-rt {
|
compiler-rt-no-libc = callPackage ./compiler-rt {
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||||
then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt
|
then overrideCC stdenv buildLlvmTools.clangNoCompilerRt
|
||||||
else stdenv;
|
else stdenv;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -217,21 +237,21 @@ let
|
||||||
libcxx = callPackage ./libcxx {
|
libcxx = callPackage ./libcxx {
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||||
then overrideCC stdenv buildLlvmTools.lldClangNoLibcxx
|
then overrideCC stdenv buildLlvmTools.clangNoLibcxx
|
||||||
else stdenv;
|
else stdenv;
|
||||||
};
|
};
|
||||||
|
|
||||||
libcxxabi = callPackage ./libcxxabi {
|
libcxxabi = callPackage ./libcxxabi {
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||||
then overrideCC stdenv buildLlvmTools.lldClangNoLibcxx
|
then overrideCC stdenv buildLlvmTools.clangNoLibcxx
|
||||||
else stdenv;
|
else stdenv;
|
||||||
};
|
};
|
||||||
|
|
||||||
libunwind = callPackage ./libunwind {
|
libunwind = callPackage ./libunwind {
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||||
then overrideCC stdenv buildLlvmTools.lldClangNoLibcxx
|
then overrideCC stdenv buildLlvmTools.clangNoLibcxx
|
||||||
else stdenv;
|
else stdenv;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,17 @@
|
||||||
, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
|
, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
|
||||||
, 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
|
||||||
|
# This is the default binutils, but with *this* version of LLD rather
|
||||||
|
# than the default LLVM verion's, if LLD is the choice. We use these for
|
||||||
|
# the `useLLVM` bootstrapping below.
|
||||||
|
, bootBintoolsNoLibc ?
|
||||||
|
if stdenv.targetPlatform.linker == "lld"
|
||||||
|
then null
|
||||||
|
else pkgs.bintoolsNoLibc
|
||||||
|
, bootBintools ?
|
||||||
|
if stdenv.targetPlatform.linker == "lld"
|
||||||
|
then null
|
||||||
|
else pkgs.bintools
|
||||||
, darwin
|
, darwin
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
@ -39,6 +50,15 @@ let
|
||||||
ln -s "${targetLlvmLibraries.compiler-rt.out}/share" "$rsrc/share"
|
ln -s "${targetLlvmLibraries.compiler-rt.out}/share" "$rsrc/share"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
bintoolsNoLibc' =
|
||||||
|
if bootBintoolsNoLibc == null
|
||||||
|
then tools.bintoolsNoLibc
|
||||||
|
else bootBintoolsNoLibc;
|
||||||
|
bintools' =
|
||||||
|
if bootBintools == null
|
||||||
|
then tools.bintools
|
||||||
|
else bootBintools;
|
||||||
|
|
||||||
in {
|
in {
|
||||||
|
|
||||||
libllvm = callPackage ./llvm {
|
libllvm = callPackage ./llvm {
|
||||||
|
@ -124,10 +144,10 @@ let
|
||||||
bintools = tools.bintools-unwrapped;
|
bintools = tools.bintools-unwrapped;
|
||||||
};
|
};
|
||||||
|
|
||||||
lldClang = wrapCCWith rec {
|
clangUseLLVM = wrapCCWith rec {
|
||||||
cc = tools.clang-unwrapped;
|
cc = tools.clang-unwrapped;
|
||||||
libcxx = targetLlvmLibraries.libcxx;
|
libcxx = targetLlvmLibraries.libcxx;
|
||||||
inherit (tools) bintools;
|
bintools = bintools';
|
||||||
extraPackages = [
|
extraPackages = [
|
||||||
targetLlvmLibraries.libcxxabi
|
targetLlvmLibraries.libcxxabi
|
||||||
targetLlvmLibraries.compiler-rt
|
targetLlvmLibraries.compiler-rt
|
||||||
|
@ -146,10 +166,10 @@ let
|
||||||
'' + mkExtraBuildCommands cc;
|
'' + mkExtraBuildCommands cc;
|
||||||
};
|
};
|
||||||
|
|
||||||
lldClangNoLibcxx = wrapCCWith rec {
|
clangNoLibcxx = wrapCCWith rec {
|
||||||
cc = tools.clang-unwrapped;
|
cc = tools.clang-unwrapped;
|
||||||
libcxx = null;
|
libcxx = null;
|
||||||
inherit (tools) bintools;
|
bintools = bintools';
|
||||||
extraPackages = [
|
extraPackages = [
|
||||||
targetLlvmLibraries.compiler-rt
|
targetLlvmLibraries.compiler-rt
|
||||||
];
|
];
|
||||||
|
@ -160,10 +180,10 @@ let
|
||||||
'' + mkExtraBuildCommands cc;
|
'' + mkExtraBuildCommands cc;
|
||||||
};
|
};
|
||||||
|
|
||||||
lldClangNoLibc = wrapCCWith rec {
|
clangNoLibc = wrapCCWith rec {
|
||||||
cc = tools.clang-unwrapped;
|
cc = tools.clang-unwrapped;
|
||||||
libcxx = null;
|
libcxx = null;
|
||||||
bintools = tools.bintoolsNoLibc;
|
bintools = bintoolsNoLibc';
|
||||||
extraPackages = [
|
extraPackages = [
|
||||||
targetLlvmLibraries.compiler-rt
|
targetLlvmLibraries.compiler-rt
|
||||||
];
|
];
|
||||||
|
@ -173,20 +193,20 @@ let
|
||||||
'' + mkExtraBuildCommands cc;
|
'' + mkExtraBuildCommands cc;
|
||||||
};
|
};
|
||||||
|
|
||||||
lldClangNoCompilerRt = wrapCCWith rec {
|
clangNoCompilerRt = wrapCCWith rec {
|
||||||
cc = tools.clang-unwrapped;
|
cc = tools.clang-unwrapped;
|
||||||
libcxx = null;
|
libcxx = null;
|
||||||
bintools = tools.bintoolsNoLibc;
|
bintools = bintoolsNoLibc';
|
||||||
extraPackages = [ ];
|
extraPackages = [ ];
|
||||||
extraBuildCommands = ''
|
extraBuildCommands = ''
|
||||||
echo "-nostartfiles" >> $out/nix-support/cc-cflags
|
echo "-nostartfiles" >> $out/nix-support/cc-cflags
|
||||||
'' + mkExtraBuildCommands0 cc;
|
'' + mkExtraBuildCommands0 cc;
|
||||||
};
|
};
|
||||||
|
|
||||||
lldClangNoCompilerRtWithLibc = wrapCCWith rec {
|
clangNoCompilerRtWithLibc = wrapCCWith rec {
|
||||||
cc = tools.clang-unwrapped;
|
cc = tools.clang-unwrapped;
|
||||||
libcxx = null;
|
libcxx = null;
|
||||||
inherit (tools) bintools;
|
bintools = bintools';
|
||||||
extraPackages = [ ];
|
extraPackages = [ ];
|
||||||
extraBuildCommands = mkExtraBuildCommands0 cc;
|
extraBuildCommands = mkExtraBuildCommands0 cc;
|
||||||
};
|
};
|
||||||
|
@ -200,14 +220,14 @@ let
|
||||||
compiler-rt-libc = callPackage ./compiler-rt {
|
compiler-rt-libc = callPackage ./compiler-rt {
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||||
then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRtWithLibc
|
then overrideCC stdenv buildLlvmTools.clangNoCompilerRtWithLibc
|
||||||
else stdenv;
|
else stdenv;
|
||||||
};
|
};
|
||||||
|
|
||||||
compiler-rt-no-libc = callPackage ./compiler-rt {
|
compiler-rt-no-libc = callPackage ./compiler-rt {
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||||
then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt
|
then overrideCC stdenv buildLlvmTools.clangNoCompilerRt
|
||||||
else stdenv;
|
else stdenv;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -223,14 +243,14 @@ let
|
||||||
libcxx = callPackage ./libcxx {
|
libcxx = callPackage ./libcxx {
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||||
then overrideCC stdenv buildLlvmTools.lldClangNoLibcxx
|
then overrideCC stdenv buildLlvmTools.clangNoLibcxx
|
||||||
else stdenv;
|
else stdenv;
|
||||||
};
|
};
|
||||||
|
|
||||||
libcxxabi = callPackage ./libcxxabi {
|
libcxxabi = callPackage ./libcxxabi {
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||||
then overrideCC stdenv buildLlvmTools.lldClangNoLibcxx
|
then overrideCC stdenv buildLlvmTools.clangNoLibcxx
|
||||||
else stdenv;
|
else stdenv;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -238,7 +258,7 @@ let
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
inherit (buildLlvmTools) llvm;
|
inherit (buildLlvmTools) llvm;
|
||||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||||
then overrideCC stdenv buildLlvmTools.lldClangNoLibcxx
|
then overrideCC stdenv buildLlvmTools.clangNoLibcxx
|
||||||
else stdenv;
|
else stdenv;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,17 @@
|
||||||
, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
|
, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
|
||||||
, 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
|
||||||
|
# This is the default binutils, but with *this* version of LLD rather
|
||||||
|
# than the default LLVM verion's, if LLD is the choice. We use these for
|
||||||
|
# the `useLLVM` bootstrapping below.
|
||||||
|
, bootBintoolsNoLibc ?
|
||||||
|
if stdenv.targetPlatform.linker == "lld"
|
||||||
|
then null
|
||||||
|
else pkgs.bintoolsNoLibc
|
||||||
|
, bootBintools ?
|
||||||
|
if stdenv.targetPlatform.linker == "lld"
|
||||||
|
then null
|
||||||
|
else pkgs.bintools
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
@ -35,6 +46,15 @@ let
|
||||||
ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
|
ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
bintoolsNoLibc' =
|
||||||
|
if bootBintoolsNoLibc == null
|
||||||
|
then tools.bintoolsNoLibc
|
||||||
|
else bootBintoolsNoLibc;
|
||||||
|
bintools' =
|
||||||
|
if bootBintools == null
|
||||||
|
then tools.bintools
|
||||||
|
else bootBintools;
|
||||||
|
|
||||||
in {
|
in {
|
||||||
|
|
||||||
libllvm = callPackage ./llvm {
|
libllvm = callPackage ./llvm {
|
||||||
|
@ -123,10 +143,10 @@ let
|
||||||
bintools = tools.bintools-unwrapped;
|
bintools = tools.bintools-unwrapped;
|
||||||
};
|
};
|
||||||
|
|
||||||
lldClang = wrapCCWith rec {
|
clangUseLLVM = wrapCCWith rec {
|
||||||
cc = tools.clang-unwrapped;
|
cc = tools.clang-unwrapped;
|
||||||
libcxx = targetLlvmLibraries.libcxx;
|
libcxx = targetLlvmLibraries.libcxx;
|
||||||
inherit (tools) bintools;
|
bintools = bintools';
|
||||||
extraPackages = [
|
extraPackages = [
|
||||||
targetLlvmLibraries.libcxxabi
|
targetLlvmLibraries.libcxxabi
|
||||||
targetLlvmLibraries.compiler-rt
|
targetLlvmLibraries.compiler-rt
|
||||||
|
@ -145,10 +165,10 @@ let
|
||||||
'' + mkExtraBuildCommands cc;
|
'' + mkExtraBuildCommands cc;
|
||||||
};
|
};
|
||||||
|
|
||||||
lldClangNoLibcxx = wrapCCWith rec {
|
clangNoLibcxx = wrapCCWith rec {
|
||||||
cc = tools.clang-unwrapped;
|
cc = tools.clang-unwrapped;
|
||||||
libcxx = null;
|
libcxx = null;
|
||||||
inherit (tools) bintools;
|
bintools = bintools';
|
||||||
extraPackages = [
|
extraPackages = [
|
||||||
targetLlvmLibraries.compiler-rt
|
targetLlvmLibraries.compiler-rt
|
||||||
];
|
];
|
||||||
|
@ -159,10 +179,10 @@ let
|
||||||
'' + mkExtraBuildCommands cc;
|
'' + mkExtraBuildCommands cc;
|
||||||
};
|
};
|
||||||
|
|
||||||
lldClangNoLibc = wrapCCWith rec {
|
clangNoLibc = wrapCCWith rec {
|
||||||
cc = tools.clang-unwrapped;
|
cc = tools.clang-unwrapped;
|
||||||
libcxx = null;
|
libcxx = null;
|
||||||
bintools = tools.bintoolsNoLibc;
|
bintools = bintoolsNoLibc';
|
||||||
extraPackages = [
|
extraPackages = [
|
||||||
targetLlvmLibraries.compiler-rt
|
targetLlvmLibraries.compiler-rt
|
||||||
];
|
];
|
||||||
|
@ -172,20 +192,20 @@ let
|
||||||
'' + mkExtraBuildCommands cc;
|
'' + mkExtraBuildCommands cc;
|
||||||
};
|
};
|
||||||
|
|
||||||
lldClangNoCompilerRt = wrapCCWith rec {
|
clangNoCompilerRt = wrapCCWith rec {
|
||||||
cc = tools.clang-unwrapped;
|
cc = tools.clang-unwrapped;
|
||||||
libcxx = null;
|
libcxx = null;
|
||||||
bintools = tools.bintoolsNoLibc;
|
bintools = bintoolsNoLibc';
|
||||||
extraPackages = [ ];
|
extraPackages = [ ];
|
||||||
extraBuildCommands = ''
|
extraBuildCommands = ''
|
||||||
echo "-nostartfiles" >> $out/nix-support/cc-cflags
|
echo "-nostartfiles" >> $out/nix-support/cc-cflags
|
||||||
'' + mkExtraBuildCommands0 cc;
|
'' + mkExtraBuildCommands0 cc;
|
||||||
};
|
};
|
||||||
|
|
||||||
lldClangNoCompilerRtWithLibc = wrapCCWith rec {
|
clangNoCompilerRtWithLibc = wrapCCWith rec {
|
||||||
cc = tools.clang-unwrapped;
|
cc = tools.clang-unwrapped;
|
||||||
libcxx = null;
|
libcxx = null;
|
||||||
inherit (tools) bintools;
|
bintools = bintools';
|
||||||
extraPackages = [ ];
|
extraPackages = [ ];
|
||||||
extraBuildCommands = mkExtraBuildCommands0 cc;
|
extraBuildCommands = mkExtraBuildCommands0 cc;
|
||||||
};
|
};
|
||||||
|
@ -199,19 +219,20 @@ let
|
||||||
compiler-rt-libc = callPackage ./compiler-rt {
|
compiler-rt-libc = callPackage ./compiler-rt {
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||||
then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRtWithLibc
|
then overrideCC stdenv buildLlvmTools.clangNoCompilerRtWithLibc
|
||||||
else stdenv;
|
else stdenv;
|
||||||
};
|
};
|
||||||
|
|
||||||
compiler-rt-no-libc = callPackage ./compiler-rt {
|
compiler-rt-no-libc = callPackage ./compiler-rt {
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||||
then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt
|
then overrideCC stdenv buildLlvmTools.clangNoCompilerRt
|
||||||
else stdenv;
|
else stdenv;
|
||||||
};
|
};
|
||||||
|
|
||||||
# N.B. condition is safe because without useLLVM both are the same.
|
# N.B. condition is safe because without useLLVM both are the same.
|
||||||
compiler-rt = if stdenv.hostPlatform.isAndroid
|
compiler-rt =
|
||||||
|
if stdenv.hostPlatform.isAndroid || (stdenv.hostPlatform != stdenv.buildPlatform && stdenv.hostPlatform.isDarwin)
|
||||||
then libraries.compiler-rt-libc
|
then libraries.compiler-rt-libc
|
||||||
else libraries.compiler-rt-no-libc;
|
else libraries.compiler-rt-no-libc;
|
||||||
|
|
||||||
|
@ -222,14 +243,14 @@ let
|
||||||
libcxx = callPackage ./libcxx {
|
libcxx = callPackage ./libcxx {
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||||
then overrideCC stdenv buildLlvmTools.lldClangNoLibcxx
|
then overrideCC stdenv buildLlvmTools.clangNoLibcxx
|
||||||
else stdenv;
|
else stdenv;
|
||||||
};
|
};
|
||||||
|
|
||||||
libcxxabi = callPackage ./libcxxabi {
|
libcxxabi = callPackage ./libcxxabi {
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||||
then overrideCC stdenv buildLlvmTools.lldClangNoLibcxx
|
then overrideCC stdenv buildLlvmTools.clangNoLibcxx
|
||||||
else stdenv;
|
else stdenv;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -237,7 +258,7 @@ let
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
inherit (buildLlvmTools) llvm;
|
inherit (buildLlvmTools) llvm;
|
||||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||||
then overrideCC stdenv buildLlvmTools.lldClangNoLibcxx
|
then overrideCC stdenv buildLlvmTools.clangNoLibcxx
|
||||||
else stdenv;
|
else stdenv;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,17 @@
|
||||||
, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
|
, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
|
||||||
, 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
|
||||||
|
# This is the default binutils, but with *this* version of LLD rather
|
||||||
|
# than the default LLVM verion's, if LLD is the choice. We use these for
|
||||||
|
# the `useLLVM` bootstrapping below.
|
||||||
|
, bootBintoolsNoLibc ?
|
||||||
|
if stdenv.targetPlatform.linker == "lld"
|
||||||
|
then null
|
||||||
|
else pkgs.bintoolsNoLibc
|
||||||
|
, bootBintools ?
|
||||||
|
if stdenv.targetPlatform.linker == "lld"
|
||||||
|
then null
|
||||||
|
else pkgs.bintools
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
@ -35,6 +46,15 @@ let
|
||||||
ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
|
ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
bintoolsNoLibc' =
|
||||||
|
if bootBintoolsNoLibc == null
|
||||||
|
then tools.bintoolsNoLibc
|
||||||
|
else bootBintoolsNoLibc;
|
||||||
|
bintools' =
|
||||||
|
if bootBintools == null
|
||||||
|
then tools.bintools
|
||||||
|
else bootBintools;
|
||||||
|
|
||||||
in {
|
in {
|
||||||
|
|
||||||
libllvm = callPackage ./llvm {
|
libllvm = callPackage ./llvm {
|
||||||
|
@ -124,10 +144,10 @@ let
|
||||||
bintools = tools.bintools-unwrapped;
|
bintools = tools.bintools-unwrapped;
|
||||||
};
|
};
|
||||||
|
|
||||||
lldClang = wrapCCWith rec {
|
clangUseLLVM = wrapCCWith rec {
|
||||||
cc = tools.clang-unwrapped;
|
cc = tools.clang-unwrapped;
|
||||||
libcxx = targetLlvmLibraries.libcxx;
|
libcxx = targetLlvmLibraries.libcxx;
|
||||||
inherit (tools) bintools;
|
bintools = bintools';
|
||||||
extraPackages = [
|
extraPackages = [
|
||||||
targetLlvmLibraries.libcxxabi
|
targetLlvmLibraries.libcxxabi
|
||||||
targetLlvmLibraries.compiler-rt
|
targetLlvmLibraries.compiler-rt
|
||||||
|
@ -146,10 +166,10 @@ let
|
||||||
'' + mkExtraBuildCommands cc;
|
'' + mkExtraBuildCommands cc;
|
||||||
};
|
};
|
||||||
|
|
||||||
lldClangNoLibcxx = wrapCCWith rec {
|
clangNoLibcxx = wrapCCWith rec {
|
||||||
cc = tools.clang-unwrapped;
|
cc = tools.clang-unwrapped;
|
||||||
libcxx = null;
|
libcxx = null;
|
||||||
inherit (tools) bintools;
|
bintools = bintools';
|
||||||
extraPackages = [
|
extraPackages = [
|
||||||
targetLlvmLibraries.compiler-rt
|
targetLlvmLibraries.compiler-rt
|
||||||
];
|
];
|
||||||
|
@ -160,10 +180,10 @@ let
|
||||||
'' + mkExtraBuildCommands cc;
|
'' + mkExtraBuildCommands cc;
|
||||||
};
|
};
|
||||||
|
|
||||||
lldClangNoLibc = wrapCCWith rec {
|
clangNoLibc = wrapCCWith rec {
|
||||||
cc = tools.clang-unwrapped;
|
cc = tools.clang-unwrapped;
|
||||||
libcxx = null;
|
libcxx = null;
|
||||||
bintools = tools.bintoolsNoLibc;
|
bintools = bintoolsNoLibc';
|
||||||
extraPackages = [
|
extraPackages = [
|
||||||
targetLlvmLibraries.compiler-rt
|
targetLlvmLibraries.compiler-rt
|
||||||
];
|
];
|
||||||
|
@ -173,20 +193,20 @@ let
|
||||||
'' + mkExtraBuildCommands cc;
|
'' + mkExtraBuildCommands cc;
|
||||||
};
|
};
|
||||||
|
|
||||||
lldClangNoCompilerRt = wrapCCWith rec {
|
clangNoCompilerRt = wrapCCWith rec {
|
||||||
cc = tools.clang-unwrapped;
|
cc = tools.clang-unwrapped;
|
||||||
libcxx = null;
|
libcxx = null;
|
||||||
bintools = tools.bintoolsNoLibc;
|
bintools = bintoolsNoLibc';
|
||||||
extraPackages = [ ];
|
extraPackages = [ ];
|
||||||
extraBuildCommands = ''
|
extraBuildCommands = ''
|
||||||
echo "-nostartfiles" >> $out/nix-support/cc-cflags
|
echo "-nostartfiles" >> $out/nix-support/cc-cflags
|
||||||
'' + mkExtraBuildCommands0 cc;
|
'' + mkExtraBuildCommands0 cc;
|
||||||
};
|
};
|
||||||
|
|
||||||
lldClangNoCompilerRtWithLibc = wrapCCWith rec {
|
clangNoCompilerRtWithLibc = wrapCCWith rec {
|
||||||
cc = tools.clang-unwrapped;
|
cc = tools.clang-unwrapped;
|
||||||
libcxx = null;
|
libcxx = null;
|
||||||
inherit (tools) bintools;
|
bintools = bintools';
|
||||||
extraPackages = [ ];
|
extraPackages = [ ];
|
||||||
extraBuildCommands = mkExtraBuildCommands0 cc;
|
extraBuildCommands = mkExtraBuildCommands0 cc;
|
||||||
};
|
};
|
||||||
|
@ -200,14 +220,14 @@ let
|
||||||
compiler-rt-libc = callPackage ./compiler-rt {
|
compiler-rt-libc = callPackage ./compiler-rt {
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||||
then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRtWithLibc
|
then overrideCC stdenv buildLlvmTools.clangNoCompilerRtWithLibc
|
||||||
else stdenv;
|
else stdenv;
|
||||||
};
|
};
|
||||||
|
|
||||||
compiler-rt-no-libc = callPackage ./compiler-rt {
|
compiler-rt-no-libc = callPackage ./compiler-rt {
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||||
then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt
|
then overrideCC stdenv buildLlvmTools.clangNoCompilerRt
|
||||||
else stdenv;
|
else stdenv;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -223,21 +243,21 @@ let
|
||||||
libcxx = callPackage ./libcxx {
|
libcxx = callPackage ./libcxx {
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||||
then overrideCC stdenv buildLlvmTools.lldClangNoLibcxx
|
then overrideCC stdenv buildLlvmTools.clangNoLibcxx
|
||||||
else stdenv;
|
else stdenv;
|
||||||
};
|
};
|
||||||
|
|
||||||
libcxxabi = callPackage ./libcxxabi {
|
libcxxabi = callPackage ./libcxxabi {
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||||
then overrideCC stdenv buildLlvmTools.lldClangNoLibcxx
|
then overrideCC stdenv buildLlvmTools.clangNoLibcxx
|
||||||
else stdenv;
|
else stdenv;
|
||||||
};
|
};
|
||||||
|
|
||||||
libunwind = callPackage ./libunwind {
|
libunwind = callPackage ./libunwind {
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||||
then overrideCC stdenv buildLlvmTools.lldClangNoLibcxx
|
then overrideCC stdenv buildLlvmTools.clangNoLibcxx
|
||||||
else stdenv;
|
else stdenv;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,17 @@
|
||||||
, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
|
, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
|
||||||
, 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
|
||||||
|
# This is the default binutils, but with *this* version of LLD rather
|
||||||
|
# than the default LLVM verion's, if LLD is the choice. We use these for
|
||||||
|
# the `useLLVM` bootstrapping below.
|
||||||
|
, bootBintoolsNoLibc ?
|
||||||
|
if stdenv.targetPlatform.linker == "lld"
|
||||||
|
then null
|
||||||
|
else pkgs.bintoolsNoLibc
|
||||||
|
, bootBintools ?
|
||||||
|
if stdenv.targetPlatform.linker == "lld"
|
||||||
|
then null
|
||||||
|
else pkgs.bintools
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
@ -35,6 +46,15 @@ let
|
||||||
ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
|
ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
bintoolsNoLibc' =
|
||||||
|
if bootBintoolsNoLibc == null
|
||||||
|
then tools.bintoolsNoLibc
|
||||||
|
else bootBintoolsNoLibc;
|
||||||
|
bintools' =
|
||||||
|
if bootBintools == null
|
||||||
|
then tools.bintools
|
||||||
|
else bootBintools;
|
||||||
|
|
||||||
in {
|
in {
|
||||||
|
|
||||||
libllvm = callPackage ./llvm {
|
libllvm = callPackage ./llvm {
|
||||||
|
@ -124,10 +144,10 @@ let
|
||||||
bintools = tools.bintools-unwrapped;
|
bintools = tools.bintools-unwrapped;
|
||||||
};
|
};
|
||||||
|
|
||||||
lldClang = wrapCCWith rec {
|
clangUseLLVM = wrapCCWith rec {
|
||||||
cc = tools.clang-unwrapped;
|
cc = tools.clang-unwrapped;
|
||||||
libcxx = targetLlvmLibraries.libcxx;
|
libcxx = targetLlvmLibraries.libcxx;
|
||||||
inherit (tools) bintools;
|
bintools = bintools';
|
||||||
extraPackages = [
|
extraPackages = [
|
||||||
targetLlvmLibraries.libcxxabi
|
targetLlvmLibraries.libcxxabi
|
||||||
targetLlvmLibraries.compiler-rt
|
targetLlvmLibraries.compiler-rt
|
||||||
|
@ -146,10 +166,10 @@ let
|
||||||
'' + mkExtraBuildCommands cc;
|
'' + mkExtraBuildCommands cc;
|
||||||
};
|
};
|
||||||
|
|
||||||
lldClangNoLibcxx = wrapCCWith rec {
|
clangNoLibcxx = wrapCCWith rec {
|
||||||
cc = tools.clang-unwrapped;
|
cc = tools.clang-unwrapped;
|
||||||
libcxx = null;
|
libcxx = null;
|
||||||
inherit (tools) bintools;
|
bintools = bintools';
|
||||||
extraPackages = [
|
extraPackages = [
|
||||||
targetLlvmLibraries.compiler-rt
|
targetLlvmLibraries.compiler-rt
|
||||||
];
|
];
|
||||||
|
@ -160,10 +180,10 @@ let
|
||||||
'' + mkExtraBuildCommands cc;
|
'' + mkExtraBuildCommands cc;
|
||||||
};
|
};
|
||||||
|
|
||||||
lldClangNoLibc = wrapCCWith rec {
|
clangNoLibc = wrapCCWith rec {
|
||||||
cc = tools.clang-unwrapped;
|
cc = tools.clang-unwrapped;
|
||||||
libcxx = null;
|
libcxx = null;
|
||||||
bintools = tools.bintoolsNoLibc;
|
bintools = bintoolsNoLibc';
|
||||||
extraPackages = [
|
extraPackages = [
|
||||||
targetLlvmLibraries.compiler-rt
|
targetLlvmLibraries.compiler-rt
|
||||||
];
|
];
|
||||||
|
@ -173,20 +193,20 @@ let
|
||||||
'' + mkExtraBuildCommands cc;
|
'' + mkExtraBuildCommands cc;
|
||||||
};
|
};
|
||||||
|
|
||||||
lldClangNoCompilerRt = wrapCCWith rec {
|
clangNoCompilerRt = wrapCCWith rec {
|
||||||
cc = tools.clang-unwrapped;
|
cc = tools.clang-unwrapped;
|
||||||
libcxx = null;
|
libcxx = null;
|
||||||
bintools = tools.bintoolsNoLibc;
|
bintools = bintoolsNoLibc';
|
||||||
extraPackages = [ ];
|
extraPackages = [ ];
|
||||||
extraBuildCommands = ''
|
extraBuildCommands = ''
|
||||||
echo "-nostartfiles" >> $out/nix-support/cc-cflags
|
echo "-nostartfiles" >> $out/nix-support/cc-cflags
|
||||||
'' + mkExtraBuildCommands0 cc;
|
'' + mkExtraBuildCommands0 cc;
|
||||||
};
|
};
|
||||||
|
|
||||||
lldClangNoCompilerRtWithLibc = wrapCCWith rec {
|
clangNoCompilerRtWithLibc = wrapCCWith rec {
|
||||||
cc = tools.clang-unwrapped;
|
cc = tools.clang-unwrapped;
|
||||||
libcxx = null;
|
libcxx = null;
|
||||||
inherit (tools) bintools;
|
bintools = bintools';
|
||||||
extraPackages = [ ];
|
extraPackages = [ ];
|
||||||
extraBuildCommands = mkExtraBuildCommands0 cc;
|
extraBuildCommands = mkExtraBuildCommands0 cc;
|
||||||
};
|
};
|
||||||
|
@ -200,14 +220,14 @@ let
|
||||||
compiler-rt-libc = callPackage ./compiler-rt {
|
compiler-rt-libc = callPackage ./compiler-rt {
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||||
then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRtWithLibc
|
then overrideCC stdenv buildLlvmTools.clangNoCompilerRtWithLibc
|
||||||
else stdenv;
|
else stdenv;
|
||||||
};
|
};
|
||||||
|
|
||||||
compiler-rt-no-libc = callPackage ./compiler-rt {
|
compiler-rt-no-libc = callPackage ./compiler-rt {
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||||
then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt
|
then overrideCC stdenv buildLlvmTools.clangNoCompilerRt
|
||||||
else stdenv;
|
else stdenv;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -223,21 +243,21 @@ let
|
||||||
libcxx = callPackage ./libcxx {
|
libcxx = callPackage ./libcxx {
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||||
then overrideCC stdenv buildLlvmTools.lldClangNoLibcxx
|
then overrideCC stdenv buildLlvmTools.clangNoLibcxx
|
||||||
else stdenv;
|
else stdenv;
|
||||||
};
|
};
|
||||||
|
|
||||||
libcxxabi = callPackage ./libcxxabi {
|
libcxxabi = callPackage ./libcxxabi {
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||||
then overrideCC stdenv buildLlvmTools.lldClangNoLibcxx
|
then overrideCC stdenv buildLlvmTools.clangNoLibcxx
|
||||||
else stdenv;
|
else stdenv;
|
||||||
};
|
};
|
||||||
|
|
||||||
libunwind = callPackage ./libunwind {
|
libunwind = callPackage ./libunwind {
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||||
then overrideCC stdenv buildLlvmTools.lldClangNoLibcxx
|
then overrideCC stdenv buildLlvmTools.clangNoLibcxx
|
||||||
else stdenv;
|
else stdenv;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ lib.makeScope newScope (self: with self; {
|
||||||
|
|
||||||
crossThreadsStdenv = overrideCC crossLibcStdenv
|
crossThreadsStdenv = overrideCC crossLibcStdenv
|
||||||
(if stdenv.hostPlatform.useLLVM or false
|
(if stdenv.hostPlatform.useLLVM or false
|
||||||
then buildPackages.llvmPackages_8.lldClangNoLibcxx
|
then buildPackages.llvmPackages_8.clangNoLibcxx
|
||||||
else buildPackages.gccCrossStageStatic.override (old: {
|
else buildPackages.gccCrossStageStatic.override (old: {
|
||||||
bintools = old.bintools.override {
|
bintools = old.bintools.override {
|
||||||
libc = libcCross;
|
libc = libcCross;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ lib, stdenv, fetchFromGitHub, fetchpatch, cmake, libtool, lldClang, ninja
|
{ lib, stdenv, fetchFromGitHub, fetchpatch, cmake, libtool, llvm-bintools, ninja
|
||||||
, boost, brotli, capnproto, cctz, clang-unwrapped, double-conversion
|
, boost, brotli, capnproto, cctz, clang-unwrapped, double-conversion
|
||||||
, icu, jemalloc, libcpuid, libxml2, lld, llvm, lz4, libmysqlclient, openssl, perl
|
, icu, jemalloc, libcpuid, libxml2, lld, llvm, lz4, libmysqlclient, openssl, perl
|
||||||
, poco, protobuf, python3, rapidjson, re2, rdkafka, readline, sparsehash, unixODBC
|
, poco, protobuf, python3, rapidjson, re2, rdkafka, readline, sparsehash, unixODBC
|
||||||
|
@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
|
||||||
sha256 = "0c87k0xqwj9sc3xy2f3ngfszgjiz4rzd787bdg6fxp94w1adjhny";
|
sha256 = "0c87k0xqwj9sc3xy2f3ngfszgjiz4rzd787bdg6fxp94w1adjhny";
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake libtool lldClang.bintools ninja ];
|
nativeBuildInputs = [ cmake libtool llvm-bintools ninja ];
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
boost brotli capnproto cctz clang-unwrapped double-conversion
|
boost brotli capnproto cctz clang-unwrapped double-conversion
|
||||||
icu jemalloc libcpuid libxml2 lld llvm lz4 libmysqlclient openssl perl
|
icu jemalloc libcpuid libxml2 lld llvm lz4 libmysqlclient openssl perl
|
||||||
|
|
|
@ -66,7 +66,7 @@ in lib.init bootStages ++ [
|
||||||
else if crossSystem.isDarwin
|
else if crossSystem.isDarwin
|
||||||
then buildPackages.llvmPackages.clang
|
then buildPackages.llvmPackages.clang
|
||||||
else if crossSystem.useLLVM or false
|
else if crossSystem.useLLVM or false
|
||||||
then buildPackages.llvmPackages.lldClang
|
then buildPackages.llvmPackages.clangUseLLVM
|
||||||
else buildPackages.gcc;
|
else buildPackages.gcc;
|
||||||
|
|
||||||
extraNativeBuildInputs = old.extraNativeBuildInputs
|
extraNativeBuildInputs = old.extraNativeBuildInputs
|
||||||
|
|
|
@ -48,7 +48,22 @@ in
|
||||||
lib.mapNullable (rs: rs ++ [ bintools ]) (stdenv.allowedRequisites or null);
|
lib.mapNullable (rs: rs ++ [ bintools ]) (stdenv.allowedRequisites or null);
|
||||||
};
|
};
|
||||||
|
|
||||||
stdenvNoLibs = mkStdenvNoLibs stdenv;
|
stdenvNoLibs =
|
||||||
|
if stdenv.hostPlatform != stdenv.buildPlatform && (stdenv.hostPlatform.isDarwin || stdenv.hostPlatform.isDarwin.useLLVM or false)
|
||||||
|
then
|
||||||
|
# We cannot touch binutils or cc themselves, because that will cause
|
||||||
|
# infinite recursion. So instead, we just choose a libc based on the
|
||||||
|
# current platform. That means we won't respect whatever compiler was
|
||||||
|
# passed in with the stdenv stage argument.
|
||||||
|
#
|
||||||
|
# TODO It would be much better to pass the `stdenvNoCC` and *unwrapped*
|
||||||
|
# cc, bintools, compiler-rt equivalent, etc. and create all final stdenvs
|
||||||
|
# as part of the stage. Then we would never be tempted to override a
|
||||||
|
# later thing to to create an earlier thing (leading to infinite
|
||||||
|
# recursion) and we also would still respect the stage arguments choices
|
||||||
|
# for these things.
|
||||||
|
overrideCC stdenv buildPackages.llvmPackages.clangNoCompilerRt
|
||||||
|
else mkStdenvNoLibs stdenv;
|
||||||
|
|
||||||
gccStdenvNoLibs = mkStdenvNoLibs gccStdenv;
|
gccStdenvNoLibs = mkStdenvNoLibs gccStdenv;
|
||||||
clangStdenvNoLibs = mkStdenvNoLibs clangStdenv;
|
clangStdenvNoLibs = mkStdenvNoLibs clangStdenv;
|
||||||
|
@ -10451,8 +10466,8 @@ in
|
||||||
gccCrossLibcStdenv = overrideCC stdenv buildPackages.gccCrossStageStatic;
|
gccCrossLibcStdenv = overrideCC stdenv buildPackages.gccCrossStageStatic;
|
||||||
|
|
||||||
crossLibcStdenv =
|
crossLibcStdenv =
|
||||||
if stdenv.hostPlatform.useLLVM or false
|
if stdenv.hostPlatform.useLLVM or false || stdenv.hostPlatform.isDarwin
|
||||||
then overrideCC stdenv buildPackages.llvmPackages.lldClangNoLibc
|
then overrideCC stdenv buildPackages.llvmPackages.clangNoLibc
|
||||||
else gccCrossLibcStdenv;
|
else gccCrossLibcStdenv;
|
||||||
|
|
||||||
# The GCC used to build libc for the target platform. Normal gccs will be
|
# The GCC used to build libc for the target platform. Normal gccs will be
|
||||||
|
@ -12630,6 +12645,37 @@ in
|
||||||
libc = preLibcCrossHeaders;
|
libc = preLibcCrossHeaders;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Here we select the default bintools implementations to be used. Note when
|
||||||
|
# cross compiling these are used not for this stage but the *next* stage.
|
||||||
|
# That is why we choose using this stage's target platform / next stage's
|
||||||
|
# host platform.
|
||||||
|
#
|
||||||
|
# Because this is the *next* stages choice, it's a bit non-modular to put
|
||||||
|
# here. In theory, bootstraping is supposed to not be a chain but at tree,
|
||||||
|
# where each stage supports many "successor" stages, like multiple possible
|
||||||
|
# futures. We don't have a better alternative, but with this downside in
|
||||||
|
# mind, please be judicious when using this attribute. E.g. for building
|
||||||
|
# things in *this* stage you should use probably `stdenv.cc.bintools` (from a
|
||||||
|
# default or alternate `stdenv`), at build time, and try not to "force" a
|
||||||
|
# specific bintools at runtime at all.
|
||||||
|
#
|
||||||
|
# In other words, try to only use this in wrappers, and only use those
|
||||||
|
# wrappers from the next stage.
|
||||||
|
bintools-unwrapped = let
|
||||||
|
inherit (stdenv.targetPlatform) linker;
|
||||||
|
in if linker == "lld" then llvmPackages.bintools-unwrapped
|
||||||
|
else if linker == "cctools" then darwin.binutils-unwrapped
|
||||||
|
else if linker == "bfd" then binutils-unwrapped
|
||||||
|
else if linker == "gold" then binutils-unwrapped
|
||||||
|
else null;
|
||||||
|
bintoolsNoLibc = wrapBintoolsWith {
|
||||||
|
bintools = bintools-unwrapped;
|
||||||
|
libc = preLibcCrossHeaders;
|
||||||
|
};
|
||||||
|
bintools = wrapBintoolsWith {
|
||||||
|
bintools = bintools-unwrapped;
|
||||||
|
};
|
||||||
|
|
||||||
bison = callPackage ../development/tools/parsing/bison { };
|
bison = callPackage ../development/tools/parsing/bison { };
|
||||||
|
|
||||||
# Ruby fails to build with current bison
|
# Ruby fails to build with current bison
|
||||||
|
@ -14765,8 +14811,8 @@ in
|
||||||
# These are used when buiding compiler-rt / libgcc, prior to building libc.
|
# These are used when buiding compiler-rt / libgcc, prior to building libc.
|
||||||
preLibcCrossHeaders = let
|
preLibcCrossHeaders = let
|
||||||
inherit (stdenv.targetPlatform) libc;
|
inherit (stdenv.targetPlatform) libc;
|
||||||
in if libc == "msvcrt" then targetPackages.windows.mingw_w64_headers
|
in if libc == "msvcrt" then targetPackages.windows.mingw_w64_headers or windows.mingw_w64_headers
|
||||||
else if libc == "nblibc" then targetPackages.netbsdCross.headers
|
else if libc == "nblibc" then targetPackages.netbsdCross.headers or netbsdCross.headers
|
||||||
else null;
|
else null;
|
||||||
|
|
||||||
# We can choose:
|
# We can choose:
|
||||||
|
@ -18702,7 +18748,8 @@ in
|
||||||
|
|
||||||
clickhouse = callPackage ../servers/clickhouse {
|
clickhouse = callPackage ../servers/clickhouse {
|
||||||
# upstream requires llvm10 as of v20.11.4.13
|
# upstream requires llvm10 as of v20.11.4.13
|
||||||
inherit (llvmPackages_10) clang-unwrapped lld lldClang llvm;
|
inherit (llvmPackages_10) clang-unwrapped lld llvm;
|
||||||
|
llvm-bintools = llvmPackages_10.bintools;
|
||||||
};
|
};
|
||||||
|
|
||||||
clickhouse-cli = with python3Packages; toPythonApplication clickhouse-cli;
|
clickhouse-cli = with python3Packages; toPythonApplication clickhouse-cli;
|
||||||
|
|
Loading…
Reference in a new issue