Skip to content

Commit df5894f

Browse files
authored
Merge pull request #294 from hadogenes/build_clang_and_lld
Fix building with clang and lld
2 parents 85934f2 + ab65154 commit df5894f

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

dkms.in

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,10 +1036,21 @@ prepare_build()
10361036
$"Check $build_dir for more information."
10371037
done
10381038

1039-
if [[ -e $kernel_source_dir/.config ]]; then
1040-
cc=$(sed -n 's|^CONFIG_CC_VERSION_TEXT="\([^ ]*\) .*"|\1|p' $kernel_source_dir/.config)
1041-
if command -v "$cc" >/dev/null; then
1042-
export CC="$cc"
1039+
if [[ -e "${kernel_config}" ]]; then
1040+
if grep -q 'CONFIG_CC_IS_CLANG=y' "${kernel_config}"; then
1041+
local cc=clang
1042+
if command -v "$cc" >/dev/null; then
1043+
export CC="$cc"
1044+
export KERNEL_CC="$cc"
1045+
fi
1046+
fi
1047+
1048+
if grep -q 'CONFIG_LD_IS_LLD=y' "${kernel_config}"; then
1049+
local ld=ld.lld
1050+
if command -v "$ld" >/dev/null; then
1051+
export LD="$ld"
1052+
export KERNEL_LD="$ld"
1053+
fi
10431054
fi
10441055
fi
10451056

0 commit comments

Comments
 (0)