Replace __packed with __attribute__((__packed__)) in uapi headers
Linux uapi headers use __packed as an abbreviation for
__attribute__((__packed__)). In the upstream kernel headers this
is defined in linux/compiler_attributes.h, but it is not defined
in the uapi headers. Bionic defines it in sys/cdefs.h, which will
almost always provide the needed definition, but there are uapi
headers that use __packed and do not include any system headers
that would include sys/cdefs.h. Musl's sys/cdefs.h does not
define __packed, which leads to linker errors when __packed is
treated as a variable name.
Replace __packed with __attribute__((__packed__)) when importing
uapi headers to break the dependency on sys/cdefs.h.
Test: m USE_HOST_MUSL=true on oriole-userdebug in internal master
Change-Id: I45f80f4e5aec868b80ce8eb9d757a3e08ae3e1a9
diff --git a/libc/kernel/uapi/linux/zorro.h b/libc/kernel/uapi/linux/zorro.h
index f8e47a1..86320aa 100644
--- a/libc/kernel/uapi/linux/zorro.h
+++ b/libc/kernel/uapi/linux/zorro.h
@@ -42,7 +42,7 @@
__u8 ln_Type;
__s8 ln_Pri;
__be32 ln_Name;
-} __packed;
+} __attribute__((__packed__));
struct ExpansionRom {
__u8 er_Type;
__u8 er_Product;
@@ -55,7 +55,7 @@
__u8 er_Reserved0d;
__u8 er_Reserved0e;
__u8 er_Reserved0f;
-} __packed;
+} __attribute__((__packed__));
#define ERT_TYPEMASK 0xc0
#define ERT_ZORROII 0xc0
#define ERT_ZORROIII 0x80
@@ -73,6 +73,6 @@
__be32 cd_Driver;
__be32 cd_NextCD;
__be32 cd_Unused[4];
-} __packed;
+} __attribute__((__packed__));
#define ZORRO_NUM_AUTO 16
#endif