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/if_pppox.h b/libc/kernel/uapi/linux/if_pppox.h
index b6c076b..2acafdf 100644
--- a/libc/kernel/uapi/linux/if_pppox.h
+++ b/libc/kernel/uapi/linux/if_pppox.h
@@ -51,27 +51,27 @@
struct pppoe_addr pppoe;
struct pptp_addr pptp;
} sa_addr;
-} __packed;
+} __attribute__((__packed__));
struct sockaddr_pppol2tp {
__kernel_sa_family_t sa_family;
unsigned int sa_protocol;
struct pppol2tp_addr pppol2tp;
-} __packed;
+} __attribute__((__packed__));
struct sockaddr_pppol2tpin6 {
__kernel_sa_family_t sa_family;
unsigned int sa_protocol;
struct pppol2tpin6_addr pppol2tp;
-} __packed;
+} __attribute__((__packed__));
struct sockaddr_pppol2tpv3 {
__kernel_sa_family_t sa_family;
unsigned int sa_protocol;
struct pppol2tpv3_addr pppol2tp;
-} __packed;
+} __attribute__((__packed__));
struct sockaddr_pppol2tpv3in6 {
__kernel_sa_family_t sa_family;
unsigned int sa_protocol;
struct pppol2tpv3in6_addr pppol2tp;
-} __packed;
+} __attribute__((__packed__));
#define PPPOEIOCSFWD _IOW(0xB1, 0, size_t)
#define PPPOEIOCDFWD _IO(0xB1, 1)
#define PADI_CODE 0x09
@@ -108,6 +108,6 @@
__be16 sid;
__be16 length;
struct pppoe_tag tag[];
-} __packed;
+} __attribute__((__packed__));
#define PPPOE_SES_HLEN 8
#endif