On Fri, Aug 29, 2025, Aqib Faruqui wrote:
Kernel UAPI headers use __packed but don't provide the definition in userspace builds.
Add a fallback definition matching the kernel's implementation. This follows the same pattern used by BPF and SGX selftests.
Ugh. No, this needs to be fixed in a central location, not splattered all over random subsystem selftests. My first choice would be to copy (and keep synchronize) all of the include/linux/compiler*.h headers to tools/include/linux/.
If for some reason that's not a viable option, we should yank the __packed and similar #defines out of tools/include/linux/compiler-gcc.h and place them in tools/include/linux/compiler.h. AFAICT, none of them are actually GCC-only.
Signed-off-by: Aqib Faruqui aqibaf@amazon.com
tools/testing/selftests/kvm/include/kvm_util.h | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/tools/testing/selftests/kvm/include/kvm_util.h b/tools/testing/selftests/kvm/include/kvm_util.h index 23a506d7e..7fae7f5e7 100644 --- a/tools/testing/selftests/kvm/include/kvm_util.h +++ b/tools/testing/selftests/kvm/include/kvm_util.h @@ -5,6 +5,10 @@ #ifndef SELFTEST_KVM_UTIL_H #define SELFTEST_KVM_UTIL_H +#ifndef __packed +#define __packed __attribute__((__packed__)) +#endif
#include "test_util.h"
#include <linux/compiler.h>
2.47.3