aboutsummarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md3
-rw-r--r--patch-dkms-for-llvm-clang-support.patch25
2 files changed, 28 insertions, 0 deletions
diff --git a/README.md b/README.md
index 351dbabe9bc2..15111ccbc71b 100644
--- a/README.md
+++ b/README.md
@@ -128,6 +128,9 @@ See the project commit log for full version history and changes.
DKMS modules fail to build you'll want to re-build your kernel package to update your kernel headers, modules
should build successfully after.
+ See the included [patch-dkms-for-llvm-clang-support.patch](patch-dkms-for-llvm-clang-support.patch) if you'd like
+ to add support for Clang to DKMS on your machine.
+
- Building with `-O3` compiler optimization is supported, though the performance gain over `-O2 -march=native` or
Clang ThinLTO is slim.
diff --git a/patch-dkms-for-llvm-clang-support.patch b/patch-dkms-for-llvm-clang-support.patch
new file mode 100644
index 000000000000..02ae95d93b06
--- /dev/null
+++ b/patch-dkms-for-llvm-clang-support.patch
@@ -0,0 +1,25 @@
+--- a/dkms 2021-11-16 05:26:18.292805661 -0800
++++ b/dkms 2021-11-16 05:26:23.014733213 -0800
+@@ -571,6 +571,22 @@
+ make_command="${MAKE[$index]}"
+ done
+
++ ## https://github.com/dell/dkms/issues/124#issuecomment-960709722
++
++ # overkill LLVM tools specification:
++ clangopts=( "CC=clang" "LD=ld.lld" "AR=llvm-ar" "NM=llvm-nm" \
++ "RANLIB=llvm-ranlib" "STRIP=llvm-strip" "OBJCOPY=llvm-objcopy" \
++ "OBJDUMP=llvm-objdump" "READOBJ=llvm-readobj LLVM=1 LLVM_IAS=1")
++
++ if [[ -e $kernel_source_dir/vmlinux ]]; then
++ if readelf -p .comment $kernel_source_dir/vmlinux | grep -q clang; then
++ make_command="${clangopts[@]} ${make_command}"
++ #echo -n " (using llvm tools from $(which clang))" >&2
++ fi
++ fi
++
++ # see also: https://git.io/JXzyo
++
+ # Use the generic make and make clean commands if not specified
+ [[ ! $make_command ]] && make_command="make -C $kernel_source_dir M=$dkms_tree/$module/$module_version/build"
+ [[ ! $clean ]] && clean="make -C $kernel_source_dir M=$dkms_tree/$module/$module_version/build clean"