Linux kbuild/kconfig development
 help / color / mirror / Atom feed
* [PATCH] kbuild: uapi: Avoid testing certain headers on ARCH=arm with CC=clang
@ 2026-01-11  0:52 Nathan Chancellor
  2026-01-11 10:29 ` Arnd Bergmann
  0 siblings, 1 reply; 3+ messages in thread
From: Nathan Chancellor @ 2026-01-11  0:52 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier, Thomas Weißschuh,
	Arnd Bergmann
  Cc: Nick Desaulniers, Bill Wendling, Justin Stitt, linux-kbuild, llvm,
	patches

After commit e3970d77ec50 ("kbuild: uapi: drop dependency on
CC_CAN_LINK"), which enables compile testing of UAPI headers in more
circumstances due to dropping the dependency on CONFIG_CC_CAN_LINK,
there are new instances of -Wunaligned-access when building with clang
targeting ARCH=arm in a few headers:

  In file included from <built-in>:1:
  ./usr/include/linux/hyperv.h:361:2: error: field  within 'struct hv_kvp_exchg_msg_value' is less aligned than 'union hv_kvp_exchg_msg_value::(anonymous at ./usr/include/linux/hyperv.h:361:2)' and is usually due to 'struct hv_kvp_exchg_msg_value' being packed, which can lead to unaligned accesses [-Werror,-Wunaligned-access]
    361 |         union {
        |         ^
  1 error generated.

  In file included from <built-in>:1:
  In file included from ./usr/include/linux/vboxguest.h:14:
  usr/include/linux/vbox_vmmdev_types.h:239:4: error: field u within 'struct vmmdev_hgcm_function_parameter32' is less aligned than 'union (unnamed union at usr/include/linux/vbox_vmmdev_types.h:223:2)' and is usually due to 'struct vmmdev_hgcm_function_parameter32' being packed, which can lead to unaligned accesses [-Werror,-Wunaligned-access]
    239 |         } u;
        |           ^
  usr/include/linux/vbox_vmmdev_types.h:254:6: error: field u within 'struct vmmdev_hgcm_function_parameter64::(unnamed at usr/include/linux/vbox_vmmdev_types.h:249:3)' is less aligned than 'union (unnamed union at usr/include/linux/vbox_vmmdev_types.h:251:4)' and is usually due to 'struct vmmdev_hgcm_function_parameter64::(unnamed at usr/include/linux/vbox_vmmdev_types.h:249:3)' being packed, which can lead to unaligned accesses [-Werror,-Wunaligned-access]
    254 |                         } u;
        |                           ^
  2 errors generated.

These warnings are now fatal after commit 3788d69db18d ("kbuild: uapi:
fail header test on compiler warnings"). -Wunaligned-access is only
enabled at W=1 for the rest of the kernel because of numerous instances
of it.

To keep the build working while the root cause of the warnings is
investigated and resolved, disable testing these header files for
ARCH=arm when building with clang. This should be a minimal loss of
coverage; if the issue pointed out by this warning existed in the wild,
it should have been noticed in real testing at this point since some of
these structures have been around for many years. It is likely the case
that since these structures are for specialized applications, they have
never been used on an ARM platform that does not support unaligned
access.

Fixes: e3970d77ec50 ("kbuild: uapi: drop dependency on CC_CAN_LINK")
Link: https://github.com/ClangBuiltLinux/linux/issues/1576
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 usr/include/Makefile | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/usr/include/Makefile b/usr/include/Makefile
index 6d86a53c6f0a..d23a0c0363bd 100644
--- a/usr/include/Makefile
+++ b/usr/include/Makefile
@@ -52,6 +52,12 @@ ifeq ($(SRCARCH),arc)
 no-header-test += linux/bpf_perf_event.h
 endif
 
+ifeq ($(SRCARCH)_$(CONFIG_CC_IS_CLANG),arm_y)
+no-header-test += linux/hyperv.h
+no-header-test += linux/vboxguest.h
+no-header-test += linux/vbox_vmmdev_types.h
+endif
+
 ifeq ($(SRCARCH),openrisc)
 no-header-test += linux/bpf_perf_event.h
 endif

---
base-commit: e3970d77ec504e54c3f91a48b2125775c16ba4c0
change-id: 20260110-uapi-test-disable-headers-arm-clang-unaligned-access-a2e104a20a1e

Best regards,
--  
Nathan Chancellor <nathan@kernel.org>


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-01-12 22:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-11  0:52 [PATCH] kbuild: uapi: Avoid testing certain headers on ARCH=arm with CC=clang Nathan Chancellor
2026-01-11 10:29 ` Arnd Bergmann
2026-01-12 22:53   ` Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox