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/sof/fw.h b/libc/kernel/uapi/sound/sof/fw.h
index c36c2b9..97b7de3 100644
--- a/libc/kernel/uapi/sound/sof/fw.h
+++ b/libc/kernel/uapi/sound/sof/fw.h
@@ -46,7 +46,7 @@
enum snd_sof_fw_blk_type type;
__u32 size;
__u32 offset;
-} __packed;
+} __attribute__((__packed__));
enum snd_sof_fw_mod_type {
SOF_FW_BASE = 0,
SOF_FW_MODULE = 1,
@@ -55,11 +55,11 @@
enum snd_sof_fw_mod_type type;
__u32 size;
__u32 num_blocks;
-} __packed;
+} __attribute__((__packed__));
struct snd_sof_fw_header {
unsigned char sig[SND_SOF_FW_SIG_SIZE];
__u32 file_size;
__u32 num_modules;
__u32 abi;
-} __packed;
+} __attribute__((__packed__));
#endif
diff --git a/libc/kernel/uapi/sound/sof/header.h b/libc/kernel/uapi/sound/sof/header.h
index a1a13db..7514550 100644
--- a/libc/kernel/uapi/sound/sof/header.h
+++ b/libc/kernel/uapi/sound/sof/header.h
@@ -26,7 +26,7 @@
__u32 abi;
__u32 reserved[4];
__u32 data[];
-} __packed;
+} __attribute__((__packed__));
#define SOF_MANIFEST_DATA_TYPE_NHLT 1
struct sof_manifest_tlv {
__le32 type;