From e83a99c192802f12e4e8727e245c8e99214391df Mon Sep 17 00:00:00 2001 From: ferreo Date: Mon, 18 Nov 2024 15:09:44 +0000 Subject: [PATCH] clang --- .github/build-nest-v3 | 2 +- patches/0001-dkms-clang.patch | 50 +++++++++++++++++++++++++++++++++++ patches/series | 1 + scripts/build.sh | 2 +- scripts/config.sh | 3 ++- 5 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 patches/0001-dkms-clang.patch diff --git a/.github/build-nest-v3 b/.github/build-nest-v3 index d8263ee..56a6051 100644 --- a/.github/build-nest-v3 +++ b/.github/build-nest-v3 @@ -1 +1 @@ -2 \ No newline at end of file +1 \ No newline at end of file diff --git a/patches/0001-dkms-clang.patch b/patches/0001-dkms-clang.patch new file mode 100644 index 0000000..cb2d961 --- /dev/null +++ b/patches/0001-dkms-clang.patch @@ -0,0 +1,50 @@ +From 1e5a4a3f9c67c5abea53df6881192c8c5f43765c Mon Sep 17 00:00:00 2001 +From: Eric Naim +Date: Sat, 21 Sep 2024 23:46:05 +0800 +Subject: [PATCH] Remove some Werror CFLAGS to increase compatibility with some + DKMS modules in clang-built kernels + +Signed-off-by: Eric Naim +--- + scripts/Makefile.clang | 2 -- + scripts/Makefile.extrawarn | 4 ---- + 2 files changed, 6 deletions(-) + +diff --git a/scripts/Makefile.clang b/scripts/Makefile.clang +index 6c23c6af797f..59b2e19416af 100644 +--- a/scripts/Makefile.clang ++++ b/scripts/Makefile.clang +@@ -31,9 +31,7 @@ endif + # certain optimization flags it knows it has not implemented. + # Make it behave more like gcc by erroring when these flags are encountered + # so they can be implemented or wrapped in cc-option. +-CLANG_FLAGS += -Werror=unknown-warning-option + CLANG_FLAGS += -Werror=ignored-optimization-argument + CLANG_FLAGS += -Werror=option-ignored +-CLANG_FLAGS += -Werror=unused-command-line-argument + KBUILD_CPPFLAGS += $(CLANG_FLAGS) + export CLANG_FLAGS +diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn +index 1d13cecc7cc7..ec97275c8852 100644 +--- a/scripts/Makefile.extrawarn ++++ b/scripts/Makefile.extrawarn +@@ -12,7 +12,6 @@ KBUILD_CFLAGS += -Wundef + KBUILD_CFLAGS += -Werror=implicit-function-declaration + KBUILD_CFLAGS += -Werror=implicit-int + KBUILD_CFLAGS += -Werror=return-type +-KBUILD_CFLAGS += -Werror=strict-prototypes + KBUILD_CFLAGS += -Wno-format-security + KBUILD_CFLAGS += -Wno-trigraphs + KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,) +@@ -68,9 +67,6 @@ KBUILD_CFLAGS += $(KBUILD_CFLAGS-y) $(CONFIG_CC_IMPLICIT_FALLTHROUGH) + # Prohibit date/time macros, which would make the build non-deterministic + KBUILD_CFLAGS += -Werror=date-time + +-# enforce correct pointer usage +-KBUILD_CFLAGS += $(call cc-option,-Werror=incompatible-pointer-types) +- + # Require designated initializers for all marked structures + KBUILD_CFLAGS += $(call cc-option,-Werror=designated-init) + +-- +2.46.1 diff --git a/patches/series b/patches/series index 3c3392d..172030f 100644 --- a/patches/series +++ b/patches/series @@ -1,4 +1,5 @@ 0001-cachyos-base-all.patch +0001-dkms-clang.patch 0002-bore-cachy.patch 0003-lazy.patch 0004-zerofanstop1.patch diff --git a/scripts/build.sh b/scripts/build.sh index e8132f9..2af8a2b 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -2,4 +2,4 @@ echo "Pika Kernel - Building" -make -j`nproc` bindeb-pkg LOCALVERSION=-pikaos KDEB_PKGVERSION=$(make kernelversion)-101pika1 +make CC=clang LD=ld.lld LLVM=1 LLVM_IAS=1 -j`nproc` bindeb-pkg LOCALVERSION=-pikaos KDEB_PKGVERSION=$(make kernelversion)-101pika1 diff --git a/scripts/config.sh b/scripts/config.sh index 0817a2e..1ec0fe1 100755 --- a/scripts/config.sh +++ b/scripts/config.sh @@ -9,10 +9,11 @@ scripts/config -k -e CONFIG_GENERIC_CPU3 scripts/config -e CACHY scripts/config -e SCHED_BORE +scripts/config -e LTO -e LTO_CLANG -e ARCH_SUPPORTS_LTO_CLANG -e ARCH_SUPPORTS_LTO_CLANG_THIN -e HAS_LTO_CLANG -e LTO_CLANG_THIN -d LTO_NONE -e HAVE_GCC_PLUGINS + scripts/config -e HZ_1000 --set-val HZ 1000 scripts/config -d HZ_PERIODIC -d NO_HZ_IDLE -d CONTEXT_TRACKING_FORCE -e NO_HZ_FULL_NODEF -e NO_HZ_FULL -e NO_HZ -e NO_HZ_COMMON -e CONTEXT_TRACKING scripts/config -e PREEMPT_BUILD -d PREEMPT_NONE -d PREEMPT_VOLUNTARY -e PREEMPT -e PREEMPT_COUNT -e PREEMPTION -e PREEMPT_DYNAMIC - scripts/config -d CC_OPTIMIZE_FOR_PERFORMANCE \ -e CC_OPTIMIZE_FOR_PERFORMANCE_O3