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/sound/skl-tplg-interface.h b/libc/kernel/uapi/sound/skl-tplg-interface.h
index 387d168..6dd9655 100644
--- a/libc/kernel/uapi/sound/skl-tplg-interface.h
+++ b/libc/kernel/uapi/sound/skl-tplg-interface.h
@@ -111,7 +111,7 @@
__u32 param_id;
__u32 max;
char params[];
-} __packed;
+} __attribute__((__packed__));
enum skl_tkn_dir {
SKL_DIR_IN,
SKL_DIR_OUT
@@ -123,7 +123,7 @@
struct skl_dfw_v4_module_pin {
__u16 module_id;
__u16 instance_id;
-} __packed;
+} __attribute__((__packed__));
struct skl_dfw_v4_module_fmt {
__u32 channels;
__u32 freq;
@@ -133,21 +133,21 @@
__u32 interleaving_style;
__u32 sample_type;
__u32 ch_map;
-} __packed;
+} __attribute__((__packed__));
struct skl_dfw_v4_module_caps {
__u32 set_params : 2;
__u32 rsvd : 30;
__u32 param_id;
__u32 caps_size;
__u32 caps[HDA_SST_CFG_MAX];
-} __packed;
+} __attribute__((__packed__));
struct skl_dfw_v4_pipe {
__u8 pipe_id;
__u8 pipe_priority;
__u16 conn_type : 4;
__u16 rsvd : 4;
__u16 memory_pages : 8;
-} __packed;
+} __attribute__((__packed__));
struct skl_dfw_v4_module {
char uuid[SKL_UUID_STR_SZ];
__u16 module_id;
@@ -181,5 +181,5 @@
struct skl_dfw_v4_module_pin in_pin[MAX_IN_QUEUE];
struct skl_dfw_v4_module_pin out_pin[MAX_OUT_QUEUE];
struct skl_dfw_v4_module_caps caps;
-} __packed;
+} __attribute__((__packed__));
#endif