recompile workstation kernel with llvm18
This commit is contained in:
parent
4d4db407a9
commit
3462392e58
@ -3,15 +3,15 @@
|
|||||||
boot.kernelPackages = lib.mkForce pkgs.linuxPackages_lqx_clang;
|
boot.kernelPackages = lib.mkForce pkgs.linuxPackages_lqx_clang;
|
||||||
|
|
||||||
nixpkgs.overlays = let
|
nixpkgs.overlays = let
|
||||||
inherit (pkgs) overrideCC ccacheWrapper addAttrsToDerivation;
|
inherit (pkgs) overrideCC ccacheWrapper addAttrsToDerivation pkgsBuildHost pkgsBuildBuild;
|
||||||
|
|
||||||
llvmPackages = "llvmPackages_17";
|
llvmPackages = "llvmPackages_18";
|
||||||
noBintools = { bootBintools = null; bootBintoolsNoLibc = null; };
|
noBintools = { bootBintools = null; bootBintoolsNoLibc = null; };
|
||||||
mkLLVMPlatform = platform: platform // { useLLVM = true; };
|
mkLLVMPlatform = platform: platform // { useLLVM = true; };
|
||||||
|
|
||||||
# Get llvmPackages for host and build platforms, disabling bootBintools
|
# Get llvmPackages for host and build platforms, disabling bootBintools
|
||||||
hostLLVM = pkgs.pkgsBuildHost.${llvmPackages}.override noBintools;
|
hostLLVM = pkgsBuildHost.${llvmPackages}.override noBintools;
|
||||||
# buildLLVM = pkgs.pkgsBuildBuild.${llvmPackages}.override noBintools; # unused
|
# buildLLVM = pkgsBuildBuild.${llvmPackages}.override noBintools; # unused
|
||||||
|
|
||||||
# Get LLVM stdenv with clang
|
# Get LLVM stdenv with clang
|
||||||
stdenvClangUseLLVM = overrideCC hostLLVM.stdenv hostLLVM.clangUseLLVM;
|
stdenvClangUseLLVM = overrideCC hostLLVM.stdenv hostLLVM.clangUseLLVM;
|
||||||
@ -34,6 +34,9 @@
|
|||||||
} stdenvCcacheLLVM;
|
} stdenvCcacheLLVM;
|
||||||
in [
|
in [
|
||||||
(final: prev: {
|
(final: prev: {
|
||||||
|
# debug
|
||||||
|
inherit stdenvLLVM stdenvCcacheLLVM stdenvPlatformLLVM;
|
||||||
|
|
||||||
linuxPackages_lqx_clang = prev.linuxPackages_lqx.extend (lpfinal: lpprev: {
|
linuxPackages_lqx_clang = prev.linuxPackages_lqx.extend (lpfinal: lpprev: {
|
||||||
kernel = (lpprev.kernel.override {
|
kernel = (lpprev.kernel.override {
|
||||||
buildPackages = final.buildPackages // { stdenv = stdenvLLVM; };
|
buildPackages = final.buildPackages // { stdenv = stdenvLLVM; };
|
||||||
@ -47,6 +50,10 @@
|
|||||||
name = "no-dynamic-linker";
|
name = "no-dynamic-linker";
|
||||||
patch = ./no-dynamic-linker.patch;
|
patch = ./no-dynamic-linker.patch;
|
||||||
};
|
};
|
||||||
|
fix-znver-clang18 = {
|
||||||
|
name = "fix-znver-clang18.patch";
|
||||||
|
patch = ./fix-znver-clang18.patch;
|
||||||
|
};
|
||||||
in {
|
in {
|
||||||
inherit version;
|
inherit version;
|
||||||
modDirVersion = lib.versions.pad 3 "${version}-${suffix}";
|
modDirVersion = lib.versions.pad 3 "${version}-${suffix}";
|
||||||
@ -57,7 +64,7 @@
|
|||||||
inherit hash;
|
inherit hash;
|
||||||
};
|
};
|
||||||
extraMakeFlags = [ "LLVM=1" "LLVM_IAS=1" ];
|
extraMakeFlags = [ "LLVM=1" "LLVM_IAS=1" ];
|
||||||
kernelPatches = [ no-dynamic-linker-patch ] ++ lpprev.kernel.kernelPatches;
|
kernelPatches = [ no-dynamic-linker-patch fix-znver-clang18 ] ++ lpprev.kernel.kernelPatches;
|
||||||
structuredExtraConfig = with lib.kernel;
|
structuredExtraConfig = with lib.kernel;
|
||||||
lpprev.kernel.structuredExtraConfig //
|
lpprev.kernel.structuredExtraConfig //
|
||||||
builtins.mapAttrs (_: v: lib.mkForce v) {
|
builtins.mapAttrs (_: v: lib.mkForce v) {
|
||||||
|
17
machines/AMD-Workstation/kernel/fix-znver-clang18.patch
Normal file
17
machines/AMD-Workstation/kernel/fix-znver-clang18.patch
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
diff --git a/net/ipv6/Makefile b/net/ipv6/Makefile
|
||||||
|
index d283c59df4c1..3840ded8c34a 100644
|
||||||
|
--- a/net/ipv6/Makefile
|
||||||
|
+++ b/net/ipv6/Makefile
|
||||||
|
@@ -3,6 +3,14 @@
|
||||||
|
# Makefile for the Linux TCP/IP (INET6) layer.
|
||||||
|
#
|
||||||
|
|
||||||
|
+# temporary workaround for clang/lld-18 with -march/-mtune=znver*
|
||||||
|
+# clangbuiltlinux issue 1987
|
||||||
|
+ifeq ($(call test-ge, $(CONFIG_CLANG_VERSION), 180000),y)
|
||||||
|
+badparms = -march=znver1 -mtune=znver1
|
||||||
|
+KBUILD_CFLAGS := $(filter-out $(badparams), $(KBUILD_CFLAGS))
|
||||||
|
+KBUILD_CFLAGS += -march=x86-64-v3
|
||||||
|
+endif
|
||||||
|
+
|
||||||
|
obj-$(CONFIG_IPV6) += ipv6.o
|
Loading…
x
Reference in New Issue
Block a user