From 3fd596faf5276236c1857875b1527758cdb95c9e Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Thu, 24 Mar 2022 15:45:22 -0700 Subject: [PATCH] Tweak linux_glibc properties for musl builds in libcore For convenience, builds against musl libc currently use the linux_glibc properties because they are almost always linux-specific and not glibc-specific. In preparation for removing this hack, tweak the linux_glibc properties by either moving them to host_linux, which will apply to linux_glibc, linux_musl and linux_bionic, or by setting appropriate musl or linux_musl properties. Properties that must not be repeated while musl uses linux_musl and also still uses the linux_glibc properties are moved to glibc properties, which don't apply to musl. Whether these stay as glibc properties or get moved back to linux_glibc later once the musl hack is removed is TBD. Bug: 223257095 Test: m checkbuild Test: m USE_HOST_MUSL=true host-native Change-Id: I798f23b139c678040571009aa41322f8ad90f006 --- NativeCode.bp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/NativeCode.bp b/NativeCode.bp index 8b1a2d9b6bf..2db70196d78 100644 --- a/NativeCode.bp +++ b/NativeCode.bp @@ -135,15 +135,22 @@ cc_defaults { ], target: { - linux_glibc: { - cflags: [ // Sigh. + musl: { + cflags: [ + // Sigh. "-D_LARGEFILE64_SOURCE", "-D_GNU_SOURCE", "-DLINUX", ], }, glibc: { - cflags: ["-D__GLIBC__"], + cflags: [ + "-D__GLIBC__", + // Sigh. + "-D_LARGEFILE64_SOURCE", + "-D_GNU_SOURCE", + "-DLINUX", + ], }, android: { shared_libs: [