mirror of
https://github.com/gentoo-mirror/guru.git
synced 2026-07-10 23:52:59 -04:00
Multiple issues fixed: - module was compiled against `uname -r` kernel, not eselect-ed one - released version requires a patch to compile with Clang - previous attempt to forward CC to fix Clang compilation was incorrect from every standpoint; e. g. it there is KERNEL_CC for that, etc. Removed it, as upstream now has proper support (backported via patch). Closes: https://bugs.gentoo.org/973282 Signed-off-by: Sv. Lockal <lockalsash@gmail.com>
33 lines
1.3 KiB
Diff
33 lines
1.3 KiB
Diff
Fix for configuration generator to support Clang-built kernels.
|
|
Partially backports https://github.com/amd/xdna-driver/commit/539d1ba5dc3a46338af694ec07b06dfe4c052dc5
|
|
--- a/src/driver/tools/configure_kernel.sh
|
|
+++ b/src/driver/tools/configure_kernel.sh
|
|
@@ -42,6 +42,16 @@ try_compile() {
|
|
tmpdir=$(mktemp -d /tmp/conftest-XXXXXX)
|
|
conftest_c="$tmpdir/conftest.c"
|
|
conftest_mk="$tmpdir/Makefile"
|
|
+ USE_LLVM=""
|
|
+ if [ -e /proc/config.gz ]; then
|
|
+ if zgrep -q "CONFIG_CC_IS_CLANG=y" /proc/config.gz 2>/dev/null; then
|
|
+ USE_LLVM="LLVM=1"
|
|
+ fi
|
|
+ elif [ -e "/boot/config-$KERNEL_VER" ]; then
|
|
+ if grep -q "CONFIG_CC_IS_CLANG=y" "/boot/config-$KERNEL_VER" 2>/dev/null; then
|
|
+ USE_LLVM="LLVM=1"
|
|
+ fi
|
|
+ fi
|
|
|
|
# Minimal Kbuild for an external module
|
|
cat > "$conftest_mk" <<EOF
|
|
@@ -58,8 +68,8 @@ EOF
|
|
# Append the actual test code from stdin
|
|
cat >> "$conftest_c"
|
|
|
|
- # Now build it like your real driver
|
|
- if make -s -C "$KERNEL_SRC" M="$tmpdir" modules >/dev/null 2>&1; then
|
|
+ # Now build it like your real driver ($USE_LLVM intentionally unquoted to avoid empty arg)
|
|
+ if make -s -C "$KERNEL_SRC" M="$tmpdir" modules $USE_LLVM >/dev/null 2>&1; then
|
|
echo "#define $macro 1" >> "$OUT"
|
|
echo ">>> + $macro: yes" >&2
|
|
else
|