Re: upgrade llvm19 broke drm-6.1 kmod

From: Benjamin Jacobs <freebsd_at_dev.thsi.be>
Date: Thu, 24 Oct 2024 19:28:31 UTC
On October 24, 2024 9:25:35 PM GMT+03:00, Michael Butler <imb@protected-networks.net> wrote:
>It seems there are some additional constraints about non-existent directories that now count as errors ..
>
>--- sync_file.o ---
>cc  -O2 -pipe -fno-strict-aliasing -DLINUXKPI_VERSION=60100 '-DKBUILD_MODNAME="dmabuf"' -DCONFIG_DRM_AMDGPU_CIK -DCONFIG_DRM_AMDGPU_SI -DCONFIG_DRM_AMD_DC -DCONFIG_DRM_AMD_DC_SI -DCONFIG_AMD_PMC -DCONFIG_DRM_I915_FORCE_PROBE='"*"' -DCONFIG_DRM_I915_REQUEST_TIMEOUT=20000 -DCONFIG_DRM_I915_CAPTURE_ERROR -DCONFIG_DRM_I915_USERFAULT_AUTOSUSPEND=250 -DCONFIG_DRM_I915_STOP_TIMEOUT=100 -DCONFIG_DRM_I915_PREEMPT_TIMEOUT=640 -DCONFIG_DRM_I915_HEARTBEAT_INTERVAL=2500 -DCONFIG_DRM_I915_TIMESLICE_DURATION=1 -DCONFIG_DRM_I915_MAX_REQUEST_BUSYWAIT=8000 -DCONFIG_DRM_I915_FENCE_TIMEOUT=10000 -DCONFIG_DRM_MIPI_DSI -DCONFIG_DRM_PANEL_ORIENTATION_QUIRKS -DCONFIG_APERTURE_HELPERS -DCONFIG_DRM_FBDEV_EMULATION -DCONFIG_DRM_FBDEV_OVERALLOC=100 -DCONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG -DCONFIG_BACKLIGHT_CLASS_DEVICE -DCONFIG_DEBUG_FS -DCONFIG_DMI -DCONFIG_FB -DCONFIG_MTRR -DCONFIG_PCI -DCONFIG_PM -DCONFIG_PM_SLEEP -DCONFIG_SMP -DCONFIG_SUSPEND -DCONFIG_ACPI -DCONFIG_ACPI_SLEEP -DCONFIG_X86 -DCONFIG_X86_PAT -DCONFIG_64BIT -DCONFIG_AS_MOVNTDQA -DCONFIG_COMPAT -DCONFIG_X86_64 -DCONFIG_DRM_AMD_DC_DCN -DCONFIG_DRM_AMD_DC_DCN3_0 -DCONFIG_DRM_AMD_DC_DCN3_01 -DCONFIG_DRM_AMD_DC_DCN3_02 -DCONFIG_DRM_AMD_DC_DCN3_1  -Werror -D_KERNEL -DKLD_MODULE -nostdinc -I/usr/ports/graphics/drm-61-kmod/work/drm-kmod-drm_v6.1.92_0/linuxkpi/gplv2/include -I/usr/ports/graphics/drm-61-kmod/work/drm-kmod-drm_v6.1.92_0/linuxkpi/bsd/include -I/usr/src/sys/compat/linuxkpi/common/include -I/usr/ports/graphics/drm-61-kmod/work/drm-kmod-drm_v6.1.92_0/linuxkpi/dummy/include -I/usr/src/sys/compat/linuxkpi/dummy/include -include /usr/ports/graphics/drm-61-kmod/work/drm-kmod-drm_v6.1.92_0/obj/usr/ports/graphics/drm-61-kmod/work/drm-kmod-drm_v6.1.92_0/dmabuf/opt_global.h -I. -I/usr/src/sys -I/usr/src/sys/contrib/ck/include -fno-common -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdebug-prefix-map=./machine=/usr/src/sys/amd64/include -fdebug-prefix-map=./x86=/usr/src/sys/x86/include -fdebug-prefix-map=./i386=/usr/src/sys/i386/include     -MD -MF.depend.sync_file.o -MTsync_file.o -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-qual -Wundef -Wno-pointer-sign -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas -Wswitch -Wno-error=tautological-compare -Wno-error=empty-body -Wno-error=parentheses-equality -Wno-error=unused-function -Wno-error=pointer-sign -Wno-error=shift-negative-value -Wno-address-of-packed-member -Wno-format-zero-length   -mno-aes -mno-avx  -std=gnu99 -c /usr/ports/graphics/drm-61-kmod/work/drm-kmod-drm_v6.1.92_0/drivers/dma-buf/sync_file.c -o sync_file.o
>--- dma-fence-chain.o ---
>cc: error: no such include directory: '/usr/ports/graphics/drm-61-kmod/work/drm-kmod-drm_v6.1.92_0/linuxkpi/dummy/include' [-Werror,-Wmissing-include-dirs]
>--- dma-fence.o ---
>cc: error: no such include directory: '/usr/ports/graphics/drm-61-kmod/work/drm-kmod-drm_v6.1.92_0/linuxkpi/dummy/include' [-Werror,-Wmissing-include-dirs]
>--- sync_file.o ---
>cc: error: no such include directory: '/usr/ports/graphics/drm-61-kmod/work/drm-kmod-drm_v6.1.92_0/linuxkpi/dummy/include' [-Werror,-Wmissing-include-dirs]
>--- dma-buf.o ---
>cc: error: no such include directory: '/usr/ports/graphics/drm-61-kmod/work/drm-kmod-drm_v6.1.92_0/linuxkpi/dummy/include' [-Werror,-Wmissing-include-dirs]
>--- dma-buf-kmod.o ---
>cc: error: no such include directory: '/usr/ports/graphics/drm-61-kmod/work/drm-kmod-drm_v6.1.92_0/linuxkpi/dummy/include' [-Werror,-Wmissing-include-dirs]
>--- dma-resv.o ---
>cc: error: no such include directory: '/usr/ports/graphics/drm-61-kmod/work/drm-kmod-drm_v6.1.92_0/linuxkpi/dummy/include' [-Werror,-Wmissing-include-dirs]
>--- dma-fence-unwrap.o ---
>cc: error: no such include directory: '/usr/ports/graphics/drm-61-kmod/work/drm-kmod-drm_v6.1.92_0/linuxkpi/dummy/include' [-Werror,-Wmissing-include-dirs]
>--- dma-fence-array.o ---
>cc: error: no such include directory: '/usr/ports/graphics/drm-61-kmod/work/drm-kmod-drm_v6.1.92_0/linuxkpi/dummy/include' [-Werror,-Wmissing-include-dirs]
>--- dma-resv.o ---
>*** [dma-resv.o] Error code 1
>
>make[1]: stopped making "all" in /usr/ports/graphics/drm-61-kmod/work/drm-kmod-drm_v6.1.92_0/dmabuf
>--- sync_file.o ---
>*** [sync_file.o] Error code 1
>
>make[1]: stopped making "all" in /usr/ports/graphics/drm-61-kmod/work/drm-kmod-drm_v6.1.92_0/dmabuf
>--- dma-fence-unwrap.o ---
>*** [dma-fence-unwrap.o] Error code 1
>
>

The following workaround did the trick for me. Works for drm-515 too and probably 510? (Sorry if the patch is mangled, sent with phone MUA)

diff --git a/graphics/drm-61-kmod/Makefile b/graphics/drm-61-kmod/Makefile
index 6db21111f255..d195829ac987 100644
--- a/graphics/drm-61-kmod/Makefile
+++ b/graphics/drm-61-kmod/Makefile
@@ -49,6 +49,9 @@ PLIST_SUB+= I915="@comment "

 MAKE_ENV+= MAKEOBJDIRPREFIX=${WRKSRC}/obj

+post-patch:
+ ${MKDIR} ${WRKSRC}/linuxkpi/dummy/include
+
 pre-build:
 ${MKDIR} ${WRKSRC}/obj
 (cd ${WRKSRC} ; ${SETENV} ${MAKE_ENV} ${MAKE_CMD} obj)