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/asoc.h b/libc/kernel/uapi/sound/asoc.h
index eeb12b0..1940e5d 100644
--- a/libc/kernel/uapi/sound/asoc.h
+++ b/libc/kernel/uapi/sound/asoc.h
@@ -356,7 +356,7 @@
__le32 pcm_elems;
__le32 dai_link_elems;
struct snd_soc_tplg_private priv;
-} __packed;
+} __attribute__((__packed__));
struct snd_soc_tplg_stream_caps_v4 {
__le32 size;
char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
@@ -372,7 +372,7 @@
__le32 period_size_max;
__le32 buffer_size_min;
__le32 buffer_size_max;
-} __packed;
+} __attribute__((__packed__));
struct snd_soc_tplg_pcm_v4 {
__le32 size;
char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
@@ -385,11 +385,11 @@
struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX];
__le32 num_streams;
struct snd_soc_tplg_stream_caps_v4 caps[2];
-} __packed;
+} __attribute__((__packed__));
struct snd_soc_tplg_link_config_v4 {
__le32 size;
__le32 id;
struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX];
__le32 num_streams;
-} __packed;
+} __attribute__((__packed__));
#endif