From ab34b47b359aced9e363f4e4d7018a82720f6868 Mon Sep 17 00:00:00 2001 From: Dan Willemsen Date: Tue, 29 Nov 2016 13:32:55 -0800 Subject: [PATCH 1/2] Enable libbase/libutils/libziparchive on host bionic Bug: 31559095 Test: Test linux_bionic compile Change-Id: Ib42c063532c1cbeb3e1418ab16a1fb54d5902aab --- base/Android.bp | 5 +++++ libutils/Android.bp | 7 +++++++ libziparchive/Android.bp | 12 +++++++++++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/base/Android.bp b/base/Android.bp index e6ad15bf4..b9a6e0bd6 100644 --- a/base/Android.bp +++ b/base/Android.bp @@ -49,6 +49,11 @@ cc_library { srcs: ["errors_unix.cpp"], cppflags: ["-Wexit-time-destructors"], }, + linux_bionic: { + srcs: ["errors_unix.cpp"], + cppflags: ["-Wexit-time-destructors"], + enabled: true, + }, linux: { srcs: ["errors_unix.cpp"], cppflags: ["-Wexit-time-destructors"], diff --git a/libutils/Android.bp b/libutils/Android.bp index 25c779ea1..217b8c378 100644 --- a/libutils/Android.bp +++ b/libutils/Android.bp @@ -86,6 +86,13 @@ cc_library { "ProcessCallStack.cpp", ], }, + linux_bionic: { + enabled: true, + srcs: [ + "Looper.cpp", + "ProcessCallStack.cpp", + ], + }, darwin: { cflags: ["-Wno-unused-parameter"], diff --git a/libziparchive/Android.bp b/libziparchive/Android.bp index 5ed0fe853..fce137852 100644 --- a/libziparchive/Android.bp +++ b/libziparchive/Android.bp @@ -62,7 +62,17 @@ cc_library { android: { static_libs: ["libz"], }, - host: { + linux_bionic: { + static_libs: ["libz"], + enabled: true, + }, + linux: { + shared_libs: ["libz-host"], + }, + darwin: { + shared_libs: ["libz-host"], + }, + windows: { shared_libs: ["libz-host"], }, }, From 0910d2dbb924fd70911e89526ad936282c54a650 Mon Sep 17 00:00:00 2001 From: Dan Willemsen Date: Tue, 29 Nov 2016 13:39:55 -0800 Subject: [PATCH 2/2] Enable liblog on host bionic Some of the __BIONIC__ checks were actually looking for an android device. Host bionic has __BIONIC__, but not __ANDROID__. Bug: 31559095 Test: Test linux_bionic compile Change-Id: Ia0ca36fc9486fe8ea7e5d1b2e26ab0491903723c --- liblog/Android.bp | 3 +++ liblog/logger_write.c | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/liblog/Android.bp b/liblog/Android.bp index 16aa4fa29..c4981536a 100644 --- a/liblog/Android.bp +++ b/liblog/Android.bp @@ -73,6 +73,9 @@ cc_library { linux: { host_ldlibs: ["-lrt"], }, + linux_bionic: { + enabled: true, + }, }, cflags: [ diff --git a/liblog/logger_write.c b/liblog/logger_write.c index 157bd88a1..fe2bd6da7 100644 --- a/liblog/logger_write.c +++ b/liblog/logger_write.c @@ -48,7 +48,7 @@ static enum { static int check_log_uid_permissions() { -#if defined(__BIONIC__) +#if defined(__ANDROID__) uid_t uid = __android_log_uid(); /* Matches clientHasLogCredentials() in logd */ @@ -130,7 +130,7 @@ LIBLOG_ABI_PUBLIC int __android_log_dev_available() return kLogNotAvailable; } -#if defined(__BIONIC__) +#if defined(__ANDROID__) static atomic_uintptr_t tagMap; #endif @@ -140,7 +140,7 @@ static atomic_uintptr_t tagMap; LIBLOG_ABI_PUBLIC void __android_log_close() { struct android_log_transport_write *transport; -#if defined(__BIONIC__) +#if defined(__ANDROID__) EventTagMap *m; #endif @@ -170,7 +170,7 @@ LIBLOG_ABI_PUBLIC void __android_log_close() } } -#if defined(__BIONIC__) +#if defined(__ANDROID__) /* * Additional risk here somewhat mitigated by immediately unlock flushing * the processor cache. The multi-threaded race that we choose to accept, @@ -188,7 +188,7 @@ LIBLOG_ABI_PUBLIC void __android_log_close() __android_log_unlock(); -#if defined(__BIONIC__) +#if defined(__ANDROID__) if (m != (EventTagMap *)(uintptr_t)-1LL) android_closeEventTagMap(m); #endif @@ -261,7 +261,7 @@ static int __write_to_log_daemon(log_id_t log_id, struct iovec *vec, size_t nr) return -EINVAL; } -#if defined(__BIONIC__) +#if defined(__ANDROID__) if (log_id == LOG_ID_SECURITY) { if (vec[0].iov_len < 4) { return -EINVAL;