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.

Signed-off-by: Aqib Faruqui <aqi...@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


Reply via email to