linux: un-simplify toolchain selection
This reverts commit 70cc251554.
This commit caused gcc to be pulled in as a target compiler for
pkgsLLVM.
Co-authored-by: Tristan Ross <tristan.ross@midstall.com>
This commit is contained in:
co-authored by
Tristan Ross
parent
a155990361
commit
e9b2edb491
@@ -525,7 +525,9 @@ let
|
|||||||
DRM_AMD_DC_DCN = lib.mkIf (with stdenv.hostPlatform; isx86 || isPower64) (
|
DRM_AMD_DC_DCN = lib.mkIf (with stdenv.hostPlatform; isx86 || isPower64) (
|
||||||
whenBetween "5.11" "6.4" yes
|
whenBetween "5.11" "6.4" yes
|
||||||
);
|
);
|
||||||
DRM_AMD_DC_FP = whenAtLeast "6.4" yes;
|
# Not available when using clang
|
||||||
|
# See: https://github.com/torvalds/linux/blob/172a9d94339cea832d89630b89d314e41d622bd8/drivers/gpu/drm/amd/display/Kconfig#L14
|
||||||
|
DRM_AMD_DC_FP = lib.mkIf (!stdenv.cc.isClang) (whenAtLeast "6.4" yes);
|
||||||
DRM_AMD_DC_HDCP = whenBetween "5.5" "6.4" yes;
|
DRM_AMD_DC_HDCP = whenBetween "5.5" "6.4" yes;
|
||||||
DRM_AMD_DC_SI = whenAtLeast "5.10" yes;
|
DRM_AMD_DC_SI = whenAtLeast "5.10" yes;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
stdenv,
|
||||||
|
buildPackages,
|
||||||
|
extraMakeFlags ? [ ],
|
||||||
|
}:
|
||||||
|
# Absolute paths for compilers avoid any PATH-clobbering issues.
|
||||||
|
[
|
||||||
|
#
|
||||||
|
# We use the unwrapped compiler, because the clang-wrapper doesn't like -target.
|
||||||
|
"CC=${lib.getExe stdenv.cc.cc}"
|
||||||
|
# The wrapper for ld.lld breaks linking the kernel. We use the unwrapped linker as workaround. See:
|
||||||
|
# https://github.com/NixOS/nixpkgs/issues/321667
|
||||||
|
"LD=${lib.getExe' stdenv.cc.bintools.bintools "${stdenv.cc.targetPrefix}ld"}"
|
||||||
|
"AR=${lib.getExe' stdenv.cc "${stdenv.cc.targetPrefix}ar"}"
|
||||||
|
"NM=${lib.getExe' stdenv.cc "${stdenv.cc.targetPrefix}nm"}"
|
||||||
|
"STRIP=${lib.getExe' stdenv.cc.bintools.bintools "${stdenv.cc.targetPrefix}strip"}"
|
||||||
|
"OBJCOPY=${lib.getExe' stdenv.cc "${stdenv.cc.targetPrefix}objcopy"}"
|
||||||
|
"OBJDUMP=${lib.getExe' stdenv.cc "${stdenv.cc.targetPrefix}objdump"}"
|
||||||
|
"READELF=${lib.getExe' stdenv.cc "${stdenv.cc.targetPrefix}readelf"}"
|
||||||
|
"HOSTCC=${lib.getExe' buildPackages.stdenv.cc "${buildPackages.stdenv.cc.targetPrefix}cc"}"
|
||||||
|
"HOSTCXX=${lib.getExe' buildPackages.stdenv.cc "${buildPackages.stdenv.cc.targetPrefix}c++"}"
|
||||||
|
"HOSTAR=${lib.getExe' buildPackages.stdenv.cc.bintools "${buildPackages.stdenv.cc.targetPrefix}ar"}"
|
||||||
|
"HOSTLD=${lib.getExe' buildPackages.stdenv.cc.bintools "${buildPackages.stdenv.cc.targetPrefix}ld"}"
|
||||||
|
"ARCH=${stdenv.hostPlatform.linuxArch}"
|
||||||
|
"CROSS_COMPILE=${stdenv.cc.targetPrefix}"
|
||||||
|
]
|
||||||
|
# Add the built in headers the kernel needs
|
||||||
|
++ lib.optionals (stdenv.cc.isClang) [
|
||||||
|
"CFLAGS_MODULE=-I${lib.getLib stdenv.cc.cc}/lib/clang/${lib.versions.major stdenv.cc.cc.version}/include"
|
||||||
|
"CFLAGS_KERNEL=-I${lib.getLib stdenv.cc.cc}/lib/clang/${lib.versions.major stdenv.cc.cc.version}/include"
|
||||||
|
]
|
||||||
|
++ (stdenv.hostPlatform.linux-kernel.makeFlags or [ ])
|
||||||
|
++ extraMakeFlags
|
||||||
@@ -191,7 +191,7 @@ let
|
|||||||
++ lib.optional (lib.versionAtLeast version "5.2") pahole
|
++ lib.optional (lib.versionAtLeast version "5.2") pahole
|
||||||
++ lib.optionals withRust [
|
++ lib.optionals withRust [
|
||||||
rust-bindgen
|
rust-bindgen
|
||||||
rustc
|
rustc.unwrapped
|
||||||
];
|
];
|
||||||
|
|
||||||
RUST_LIB_SRC = lib.optionalString withRust rustPlatform.rustLibSrc;
|
RUST_LIB_SRC = lib.optionalString withRust rustPlatform.rustLibSrc;
|
||||||
@@ -201,11 +201,14 @@ let
|
|||||||
kernelBaseConfig =
|
kernelBaseConfig =
|
||||||
if defconfig != null then defconfig else stdenv.hostPlatform.linux-kernel.baseConfig;
|
if defconfig != null then defconfig else stdenv.hostPlatform.linux-kernel.baseConfig;
|
||||||
|
|
||||||
makeFlags =
|
makeFlags = import ./common-flags.nix {
|
||||||
lib.optionals (
|
inherit
|
||||||
stdenv.hostPlatform.linux-kernel ? makeFlags
|
lib
|
||||||
) stdenv.hostPlatform.linux-kernel.makeFlags
|
stdenv
|
||||||
++ extraMakeFlags;
|
buildPackages
|
||||||
|
extraMakeFlags
|
||||||
|
;
|
||||||
|
};
|
||||||
|
|
||||||
postPatch = kernel.postPatch + ''
|
postPatch = kernel.postPatch + ''
|
||||||
# Patch kconfig to print "###" after every question so that
|
# Patch kconfig to print "###" after every question so that
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ lib.makeOverridable (
|
|||||||
++ optional (lib.versionAtLeast version "5.13") zstd
|
++ optional (lib.versionAtLeast version "5.13") zstd
|
||||||
++ optionals withRust [
|
++ optionals withRust [
|
||||||
rustc
|
rustc
|
||||||
rust-bindgen
|
rust-bindgen.unwrapped
|
||||||
];
|
];
|
||||||
|
|
||||||
in
|
in
|
||||||
@@ -230,7 +230,7 @@ lib.makeOverridable (
|
|||||||
]
|
]
|
||||||
++ optionals withRust [
|
++ optionals withRust [
|
||||||
rustc
|
rustc
|
||||||
rust-bindgen
|
rust-bindgen.unwrapped
|
||||||
];
|
];
|
||||||
|
|
||||||
RUST_LIB_SRC = lib.optionalString withRust rustPlatform.rustLibSrc;
|
RUST_LIB_SRC = lib.optionalString withRust rustPlatform.rustLibSrc;
|
||||||
@@ -531,20 +531,14 @@ lib.makeOverridable (
|
|||||||
// extraMeta;
|
// extraMeta;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Absolute paths for compilers avoid any PATH-clobbering issues.
|
commonMakeFlags = import ./common-flags.nix {
|
||||||
commonMakeFlags = [
|
inherit
|
||||||
"ARCH=${stdenv.hostPlatform.linuxArch}"
|
lib
|
||||||
"CROSS_COMPILE=${stdenv.cc.targetPrefix}"
|
stdenv
|
||||||
]
|
buildPackages
|
||||||
++ lib.optionals (stdenv.isx86_64 && stdenv.cc.bintools.isLLVM) [
|
extraMakeFlags
|
||||||
# The wrapper for ld.lld breaks linking the kernel. We use the
|
;
|
||||||
# unwrapped linker as workaround. See:
|
};
|
||||||
#
|
|
||||||
# https://github.com/NixOS/nixpkgs/issues/321667
|
|
||||||
"LD=${stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ld"
|
|
||||||
]
|
|
||||||
++ (stdenv.hostPlatform.linux-kernel.makeFlags or [ ])
|
|
||||||
++ extraMakeFlags;
|
|
||||||
in
|
in
|
||||||
|
|
||||||
stdenv.mkDerivation (
|
stdenv.mkDerivation (
|
||||||
|
|||||||
Reference in New Issue
Block a user