diff --git a/.gitmodules b/.gitmodules index 7628e40..359c415 100644 --- a/.gitmodules +++ b/.gitmodules @@ -16,3 +16,6 @@ [submodule "boringssl"] path = vendor/boringssl url = https://boringssl.googlesource.com/boringssl.git +[submodule "vendor/mkbootimg"] + path = vendor/mkbootimg + url = https://android.googlesource.com/platform/system/tools/mkbootimg diff --git a/CMakeLists.txt b/CMakeLists.txt index 8a3aac0..89e5012 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,9 +10,12 @@ cmake_minimum_required(VERSION 3.1.0) set(ANDROID_MKE2FS_NAME "mke2fs.android") # Version of android-tools and the version of boringssl being used. -# See: https://android.googlesource.com/platform/external/boringssl/+/android-${ANDROID_VERSION}/BORINGSSL_REVISION -set(ANDROID_VERSION 9.0.0_r33) -set(BORINGSSL_VERSION 45210dd4e21ace9d28cb76b3f83303fcdd2efcce) +# See: https://android.googlesource.com/platform/external/boringssl/+/platform-tools-${ANDROID_VERSION}/BORINGSSL_REVISION +set(ANDROID_VERSION 29.0.2) +set(BORINGSSL_VERSION c9827e073f64e353c4891ecc2c73721882543ee0) + +# Vendor string used in version outputs. +set(ANDROID_VENDOR android-tools) # The CMakeLists.txt in the vendor subdirectory is responsible for # patching, building and installing the software. diff --git a/patches/core/0001-Don-t-use-the-internal-glibc-header-sys-cdefs.h.patch b/patches/core/0001-Don-t-use-the-internal-glibc-header-sys-cdefs.h.patch index e1116cd..6f27ed6 100644 --- a/patches/core/0001-Don-t-use-the-internal-glibc-header-sys-cdefs.h.patch +++ b/patches/core/0001-Don-t-use-the-internal-glibc-header-sys-cdefs.h.patch @@ -1,6 +1,6 @@ -From 3a5363e0b4fd7ed20225d8eda77d35e0073c02b0 Mon Sep 17 00:00:00 2001 +From b6b5d681d6abebd0635802389b382077d575754a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Tempel?= -Date: Tue, 12 Feb 2019 23:38:46 +0100 +Date: Wed, 21 Aug 2019 19:17:23 +0200 Subject: [PATCH] Don't use the internal glibc header sys/cdefs.h This patch was created using sed(1) and ag(1) with the following script: @@ -14,58 +14,86 @@ This patch was created using sed(1) and ag(1) with the following script: https://wiki.musl-libc.org/faq.html#Q:-When-compiling-something-against-musl,-I-get-error-messages-about-sys/cdefs.h --- - adf/libadf/include/adf/adf.h | 9 ++++++--- - adf/libadfhwc/include/adfhwc/adfhwc.h | 9 ++++++--- - debuggerd/include/debuggerd/handler.h | 9 ++++++--- - libbacktrace/backtrace_testlib.h | 9 ++++++--- - libbacktrace/thread_utils.h | 8 ++++++-- - libcutils/include/cutils/android_reboot.h | 9 ++++++--- - libcutils/include/cutils/bitops.h | 9 ++++++--- - libcutils/include/cutils/klog.h | 9 ++++++--- - libcutils/include/cutils/partition_utils.h | 9 ++++++--- - libcutils/include/cutils/str_parms.h | 9 ++++++--- - libcutils/include/cutils/trace.h | 9 ++++++--- - libcutils/include/private/canned_fs_config.h | 8 ++++++-- - libcutils/include/private/fs_config.h | 9 ++++++--- - libion/include/ion/ion.h | 8 ++++++-- - libkeyutils/include/keyutils.h | 9 ++++++--- - liblog/config_read.h | 8 ++++++-- - liblog/config_write.h | 8 ++++++-- - liblog/include/log/log_main.h | 9 ++++++--- - liblog/log_portability.h | 14 -------------- - liblog/logd_reader.h | 8 ++++++-- - liblog/logger.h | 8 ++++++-- - libmemunreachable/Binder.cpp | 9 ++++++--- - libmemunreachable/bionic.h | 9 ++++++--- - .../include/memunreachable/memunreachable.h | 9 ++++++--- - .../include/nativeloader/dlext_namespaces.h | 8 ++++++-- - libnetutils/include/netutils/ifc.h | 9 ++++++--- - .../include/packagelistparser/packagelistparser.h | 9 ++++++--- - .../include/processgroup/processgroup.h | 9 ++++++--- - libsuspend/autosuspend_ops.h | 8 ++++++-- - libsuspend/include/suspend/autosuspend.h | 9 ++++++--- - libsync/include/android/sync.h | 8 ++++++-- - libsync/include/ndk/sync.h | 8 ++++++-- - libsync/sw_sync.h | 8 ++++++-- - libsystem/include/system/camera.h | 9 ++++++--- - libutils/tests/Singleton_test.h | 9 ++++++--- - libziparchive/include/ziparchive/zip_archive.h | 1 - - lmkd/include/liblmkd_utils.h | 9 ++++++--- - lmkd/include/lmkd.h | 9 ++++++--- - lmkd/statslog.h | 9 ++++++--- - logcat/include/log/getopt.h | 9 ++++++--- - logd/libaudit.h | 9 ++++++--- - logwrapper/include/logwrap/logwrap.h | 8 ++++++-- - toolbox/bsd-compatibility.h | 8 ++++++-- - trusty/gatekeeper/trusty_gatekeeper_ipc.h | 8 ++++++-- - trusty/keymaster/trusty_keymaster_ipc.h | 8 ++++++-- - trusty/storage/lib/include/trusty/lib/storage.h | 8 ++++++-- - 46 files changed, 264 insertions(+), 130 deletions(-) + debuggerd/include/debuggerd/handler.h | 9 +++++--- + deprecated-adf/libadf/include/adf/adf.h | 9 +++++--- + .../libadfhwc/include/adfhwc/adfhwc.h | 9 +++++--- + libbacktrace/backtrace_testlib.h | 9 +++++--- + libcutils/android_get_control_env.h | 9 +++++--- + libcutils/include/cutils/android_reboot.h | 9 +++++--- + libcutils/include/cutils/bitops.h | 9 +++++--- + libcutils/include/cutils/klog.h | 9 +++++--- + libcutils/include/cutils/partition_utils.h | 9 +++++--- + libcutils/include/cutils/str_parms.h | 9 +++++--- + libcutils/include/cutils/trace.h | 9 +++++--- + libcutils/include/private/canned_fs_config.h | 8 +++++-- + libcutils/include/private/fs_config.h | 9 +++++--- + libion/include/ion/ion.h | 8 +++++-- + libkeyutils/include/keyutils.h | 9 +++++--- + liblog/config_read.h | 8 +++++-- + liblog/config_write.h | 8 +++++-- + liblog/fake_log_device.h | 8 +++++-- + liblog/include/log/log_main.h | 9 +++++--- + liblog/log_portability.h | 14 ------------- + liblog/logd_reader.h | 8 +++++-- + liblog/logger.h | 8 +++++-- + libmemunreachable/Binder.cpp | 9 +++++--- + libmemunreachable/bionic.h | 9 +++++--- + .../include/memunreachable/memunreachable.h | 9 +++++--- + .../include/nativeloader/dlext_namespaces.h | 8 +++++-- + libnetutils/include/netutils/ifc.h | 9 +++++--- + .../packagelistparser/packagelistparser.h | 9 +++++--- + .../cgrouprc/include/android/cgrouprc.h | 8 +++++-- + .../include/processgroup/processgroup.h | 9 +++++--- + libsuspend/autosuspend_ops.h | 8 +++++-- + libsuspend/include/suspend/autosuspend.h | 9 +++++--- + libsync/include/android/sync.h | 8 +++++-- + libsync/include/ndk/sync.h | 9 +++++--- + libsync/sw_sync.h | 8 +++++-- + libsystem/include/system/camera.h | 9 +++++--- + libutils/Singleton_test.h | 9 +++++--- + .../include/ziparchive/zip_archive.h | 1 - + llkd/include/llkd.h | 21 +++++++++++++------ + lmkd/include/liblmkd_utils.h | 9 +++++--- + lmkd/include/lmkd.h | 9 +++++--- + lmkd/libpsi/include/psi/psi.h | 9 +++++--- + lmkd/statslog.h | 9 +++++--- + logd/libaudit.h | 9 +++++--- + logwrapper/include/logwrap/logwrap.h | 8 +++++-- + trusty/gatekeeper/trusty_gatekeeper_ipc.h | 8 +++++-- + .../ipc/trusty_keymaster_ipc.h | 8 +++++-- + .../storage/lib/include/trusty/lib/storage.h | 8 +++++-- + 48 files changed, 285 insertions(+), 140 deletions(-) -diff --git a/adf/libadf/include/adf/adf.h b/adf/libadf/include/adf/adf.h +diff --git a/debuggerd/include/debuggerd/handler.h b/debuggerd/include/debuggerd/handler.h +index 7196e0ad4..9ba20db19 100644 +--- a/debuggerd/include/debuggerd/handler.h ++++ b/debuggerd/include/debuggerd/handler.h +@@ -18,10 +18,11 @@ + + #include + #include +-#include + #include + +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + + // These callbacks are called in a signal handler, and thus must be async signal safe. + // If null, the callbacks will not be called. +@@ -53,4 +54,6 @@ static void __attribute__((__unused__)) debuggerd_register_handlers(struct sigac + sigaction(DEBUGGER_SIGNAL, action, nullptr); + } + +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif +diff --git a/deprecated-adf/libadf/include/adf/adf.h b/deprecated-adf/libadf/include/adf/adf.h index e4c7b28cc..41b3da475 100644 ---- a/adf/libadf/include/adf/adf.h -+++ b/adf/libadf/include/adf/adf.h +--- a/deprecated-adf/libadf/include/adf/adf.h ++++ b/deprecated-adf/libadf/include/adf/adf.h @@ -19,7 +19,6 @@ #include @@ -95,10 +123,10 @@ index e4c7b28cc..41b3da475 100644 +#endif #endif /* _LIBADF_ADF_H_ */ -diff --git a/adf/libadfhwc/include/adfhwc/adfhwc.h b/adf/libadfhwc/include/adfhwc/adfhwc.h +diff --git a/deprecated-adf/libadfhwc/include/adfhwc/adfhwc.h b/deprecated-adf/libadfhwc/include/adfhwc/adfhwc.h index 4f7092507..97beb2f71 100644 ---- a/adf/libadfhwc/include/adfhwc/adfhwc.h -+++ b/adf/libadfhwc/include/adfhwc/adfhwc.h +--- a/deprecated-adf/libadfhwc/include/adfhwc/adfhwc.h ++++ b/deprecated-adf/libadfhwc/include/adfhwc/adfhwc.h @@ -19,7 +19,6 @@ #include @@ -128,32 +156,6 @@ index 4f7092507..97beb2f71 100644 +#endif #endif /* _LIBADFHWC_ADFHWC_H_ */ -diff --git a/debuggerd/include/debuggerd/handler.h b/debuggerd/include/debuggerd/handler.h -index 7196e0ad4..9ba20db19 100644 ---- a/debuggerd/include/debuggerd/handler.h -+++ b/debuggerd/include/debuggerd/handler.h -@@ -18,10 +18,11 @@ - - #include - #include --#include - #include - --__BEGIN_DECLS -+#ifdef __cplusplus -+extern "C" { -+#endif - - // These callbacks are called in a signal handler, and thus must be async signal safe. - // If null, the callbacks will not be called. -@@ -53,4 +54,6 @@ static void __attribute__((__unused__)) debuggerd_register_handlers(struct sigac - sigaction(DEBUGGER_SIGNAL, action, nullptr); - } - --__END_DECLS -+#ifdef __cplusplus -+} -+#endif diff --git a/libbacktrace/backtrace_testlib.h b/libbacktrace/backtrace_testlib.h index 9b55e56d4..6289c66b9 100644 --- a/libbacktrace/backtrace_testlib.h @@ -181,34 +183,35 @@ index 9b55e56d4..6289c66b9 100644 +#endif #endif // _LIBBACKTRACE_BACKTRACE_TESTLIB_H -diff --git a/libbacktrace/thread_utils.h b/libbacktrace/thread_utils.h -index 9590657e3..2438aa157 100644 ---- a/libbacktrace/thread_utils.h -+++ b/libbacktrace/thread_utils.h -@@ -23,10 +23,14 @@ - #include - #endif +diff --git a/libcutils/android_get_control_env.h b/libcutils/android_get_control_env.h +index a83026918..40edc2d37 100644 +--- a/libcutils/android_get_control_env.h ++++ b/libcutils/android_get_control_env.h +@@ -16,11 +16,14 @@ + + #pragma once + +-#include -__BEGIN_DECLS +#ifdef __cplusplus +extern "C" { +#endif - int tgkill(int tgid, int tid, int sig); + int __android_get_control_from_env(const char* prefix, const char* name) + __attribute__((visibility("hidden"))); -__END_DECLS +#ifdef __cplusplus +} +#endif - - #endif /* _LIBBACKTRACE_THREAD_UTILS_H */ diff --git a/libcutils/include/cutils/android_reboot.h b/libcutils/include/cutils/android_reboot.h -index 99030eddd..f428505de 100644 +index cd27eef88..2e86f6cb8 100644 --- a/libcutils/include/cutils/android_reboot.h +++ b/libcutils/include/cutils/android_reboot.h -@@ -17,9 +17,10 @@ - #ifndef __CUTILS_ANDROID_REBOOT_H__ - #define __CUTILS_ANDROID_REBOOT_H__ +@@ -16,9 +16,10 @@ + + #pragma once -#include @@ -219,16 +222,14 @@ index 99030eddd..f428505de 100644 /* Commands */ #define ANDROID_RB_RESTART 0xDEAD0001 /* deprecated. Use RESTART2. */ -@@ -40,6 +41,8 @@ __BEGIN_DECLS +@@ -39,4 +40,6 @@ __BEGIN_DECLS */ - int android_reboot(int cmd, int flags, const char *arg); + int android_reboot(unsigned cmd, int flags, const char* arg); -__END_DECLS +#ifdef __cplusplus +} +#endif - - #endif /* __CUTILS_ANDROID_REBOOT_H__ */ diff --git a/libcutils/include/cutils/bitops.h b/libcutils/include/cutils/bitops.h index 38d284039..79193b589 100644 --- a/libcutils/include/cutils/bitops.h @@ -287,7 +288,7 @@ index 5ae6216eb..8006be730 100644 #define KLOG_ERROR_LEVEL 3 #define KLOG_WARNING_LEVEL 4 diff --git a/libcutils/include/cutils/partition_utils.h b/libcutils/include/cutils/partition_utils.h -index 7518559a4..da0a40b14 100644 +index 8bc9b48b3..ff1d13a06 100644 --- a/libcutils/include/cutils/partition_utils.h +++ b/libcutils/include/cutils/partition_utils.h @@ -17,12 +17,15 @@ @@ -301,7 +302,7 @@ index 7518559a4..da0a40b14 100644 +extern "C" { +#endif - int partition_wiped(char *source); + int partition_wiped(const char* source); -__END_DECLS +#ifdef __cplusplus @@ -337,7 +338,7 @@ index aa1435a08..160792a37 100644 #endif /* __CUTILS_STR_PARMS_H */ diff --git a/libcutils/include/cutils/trace.h b/libcutils/include/cutils/trace.h -index bbb150d12..504e0ee88 100644 +index 79b4b355b..712f75c4f 100644 --- a/libcutils/include/cutils/trace.h +++ b/libcutils/include/cutils/trace.h @@ -22,13 +22,14 @@ @@ -357,7 +358,7 @@ index bbb150d12..504e0ee88 100644 /** * The ATRACE_TAG macro can be defined before including this header to trace -@@ -254,6 +255,8 @@ static inline void atrace_int64(uint64_t tag, const char* name, int64_t value) +@@ -256,6 +257,8 @@ static inline void atrace_int64(uint64_t tag, const char* name, int64_t value) } } @@ -391,18 +392,18 @@ index 135b91c6c..c155a8945 100644 #endif diff --git a/libcutils/include/private/fs_config.h b/libcutils/include/private/fs_config.h -index 892649187..8d912cb9c 100644 +index 8a9a1ffd7..40cb55f23 100644 --- a/libcutils/include/private/fs_config.h +++ b/libcutils/include/private/fs_config.h -@@ -23,7 +23,6 @@ - #define _LIBS_CUTILS_PRIVATE_FS_CONFIG_H +@@ -22,7 +22,6 @@ + #pragma once #include -#include - #include #if defined(__BIONIC__) -@@ -59,7 +58,9 @@ struct fs_path_config { + #include +@@ -32,7 +31,9 @@ /* Rules for directories and files has moved to system/code/libcutils/fs_config.c */ @@ -413,16 +414,14 @@ index 892649187..8d912cb9c 100644 /* * Used in: -@@ -76,6 +77,8 @@ void fs_config(const char* path, int dir, const char* target_out_path, unsigned* - - ssize_t fs_config_generate(char* buffer, size_t length, const struct fs_path_config* pc); +@@ -47,4 +48,6 @@ __BEGIN_DECLS + void fs_config(const char* path, int dir, const char* target_out_path, unsigned* uid, unsigned* gid, + unsigned* mode, uint64_t* capabilities); -__END_DECLS +#ifdef __cplusplus +} +#endif - - #endif /* _LIBS_CUTILS_PRIVATE_FS_CONFIG_H */ diff --git a/libion/include/ion/ion.h b/libion/include/ion/ion.h index a60d24eaf..14d1f91ac 100644 --- a/libion/include/ion/ion.h @@ -449,7 +448,7 @@ index a60d24eaf..14d1f91ac 100644 #endif /* __SYS_CORE_ION_H */ diff --git a/libkeyutils/include/keyutils.h b/libkeyutils/include/keyutils.h -index 585767d7a..d8b103c7e 100644 +index c508f2790..2c3b4b0b1 100644 --- a/libkeyutils/include/keyutils.h +++ b/libkeyutils/include/keyutils.h @@ -31,9 +31,10 @@ @@ -465,9 +464,9 @@ index 585767d7a..d8b103c7e 100644 typedef int32_t key_serial_t; -@@ -51,6 +52,8 @@ long keyctl_setperm(key_serial_t id, int permissions); +@@ -55,6 +56,8 @@ long keyctl_restrict_keyring(key_serial_t keyring, const char* type, const char* - long keyctl_unlink(key_serial_t key, key_serial_t keyring); + long keyctl_get_security(key_serial_t key, char* buffer, size_t buflen); -__END_DECLS +#ifdef __cplusplus @@ -476,10 +475,10 @@ index 585767d7a..d8b103c7e 100644 #endif diff --git a/liblog/config_read.h b/liblog/config_read.h -index 7b29fa4c2..dcf5a8365 100644 +index 212b8a09f..97abb11e5 100644 --- a/liblog/config_read.h +++ b/liblog/config_read.h -@@ -21,7 +21,9 @@ +@@ -20,7 +20,9 @@ #include "log_portability.h" @@ -488,23 +487,21 @@ index 7b29fa4c2..dcf5a8365 100644 +extern "C" { +#endif - extern LIBLOG_HIDDEN struct listnode __android_log_transport_read; - extern LIBLOG_HIDDEN struct listnode __android_log_persist_read; -@@ -50,6 +52,8 @@ extern LIBLOG_HIDDEN struct listnode __android_log_persist_read; - LIBLOG_HIDDEN void __android_log_config_read(); - LIBLOG_HIDDEN void __android_log_config_read_close(); + extern struct listnode __android_log_transport_read; + extern struct listnode __android_log_persist_read; +@@ -49,4 +51,6 @@ extern struct listnode __android_log_persist_read; + void __android_log_config_read(); + void __android_log_config_read_close(); -__END_DECLS +#ifdef __cplusplus +} +#endif - - #endif /* _LIBLOG_CONFIG_READ_H__ */ diff --git a/liblog/config_write.h b/liblog/config_write.h -index db1a08314..66088b387 100644 +index a901f1352..5afc4378e 100644 --- a/liblog/config_write.h +++ b/liblog/config_write.h -@@ -21,7 +21,9 @@ +@@ -20,7 +20,9 @@ #include "log_portability.h" @@ -513,27 +510,51 @@ index db1a08314..66088b387 100644 +extern "C" { +#endif - extern LIBLOG_HIDDEN struct listnode __android_log_transport_write; - extern LIBLOG_HIDDEN struct listnode __android_log_persist_write; -@@ -50,6 +52,8 @@ extern LIBLOG_HIDDEN struct listnode __android_log_persist_write; - LIBLOG_HIDDEN void __android_log_config_write(); - LIBLOG_HIDDEN void __android_log_config_write_close(); + extern struct listnode __android_log_transport_write; + extern struct listnode __android_log_persist_write; +@@ -49,4 +51,6 @@ extern struct listnode __android_log_persist_write; + void __android_log_config_write(); + void __android_log_config_write_close(); -__END_DECLS +#ifdef __cplusplus +} +#endif +diff --git a/liblog/fake_log_device.h b/liblog/fake_log_device.h +index ce54db2bf..fc37085e6 100644 +--- a/liblog/fake_log_device.h ++++ b/liblog/fake_log_device.h +@@ -23,7 +23,9 @@ + + struct iovec; + +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + + int fakeLogOpen(const char* pathName); + int fakeLogClose(int fd); +@@ -34,4 +36,6 @@ int __android_log_is_loggable(int prio, const char*, int def); + int __android_log_is_loggable_len(int prio, const char*, size_t, int def); + int __android_log_is_debuggable(); - #endif /* _LIBLOG_CONFIG_WRITE_H__ */ +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif diff --git a/liblog/include/log/log_main.h b/liblog/include/log/log_main.h -index 21fc7cca0..1af9b3f02 100644 +index 64791c2cc..f9ebf23f8 100644 --- a/liblog/include/log/log_main.h +++ b/liblog/include/log/log_main.h -@@ -20,9 +20,10 @@ +@@ -17,12 +17,13 @@ + #pragma once + #include +-#include + #include #include --#include -__BEGIN_DECLS +#ifdef __cplusplus @@ -542,7 +563,7 @@ index 21fc7cca0..1af9b3f02 100644 /* * Normally we strip the effects of ALOGV (VERBOSE messages), -@@ -386,6 +387,8 @@ int __android_log_is_loggable_len(int prio, const char* tag, size_t len, +@@ -372,4 +373,6 @@ int __android_log_is_loggable_len(int prio, const char* tag, size_t len, int def #pragma clang diagnostic pop #endif @@ -550,24 +571,17 @@ index 21fc7cca0..1af9b3f02 100644 +#ifdef __cplusplus +} +#endif - - #endif /* _LIBS_LOG_LOG_MAIN_H */ diff --git a/liblog/log_portability.h b/liblog/log_portability.h -index 88805c75f..66b82f313 100644 +index b7279d1d8..ea413b92d 100644 --- a/liblog/log_portability.h +++ b/liblog/log_portability.h -@@ -17,7 +17,6 @@ - #ifndef _LIBLOG_PORTABILITY_H__ - #define _LIBLOG_PORTABILITY_H__ +@@ -16,22 +16,8 @@ + + #pragma once -#include #include - /* Helpful private sys/cdefs.h like definitions */ -@@ -49,19 +48,6 @@ - #define LIBLOG_WEAK __attribute__((weak, visibility("default"))) - #endif - -/* possible missing definitions in sys/cdefs.h */ - -/* DECLS */ @@ -581,14 +595,14 @@ index 88805c75f..66b82f313 100644 -#endif -#endif - - /* Unused argument. For C code only, remove symbol name for C++ */ - #ifndef __unused - #define __unused __attribute__((__unused__)) + /* possible missing definitions in unistd.h */ + + #ifndef TEMP_FAILURE_RETRY diff --git a/liblog/logd_reader.h b/liblog/logd_reader.h -index 8ebb1aee1..adcbdc450 100644 +index 7c53cbb65..df881ec51 100644 --- a/liblog/logd_reader.h +++ b/liblog/logd_reader.h -@@ -21,10 +21,14 @@ +@@ -20,8 +20,12 @@ #include "log_portability.h" @@ -597,21 +611,19 @@ index 8ebb1aee1..adcbdc450 100644 +extern "C" { +#endif - LIBLOG_HIDDEN ssize_t __send_log_msg(char* buf, size_t buf_size); + ssize_t __send_log_msg(char* buf, size_t buf_size); -__END_DECLS +#ifdef __cplusplus +} +#endif - - #endif /* _LIBLOG_LOGD_READER_H__ */ diff --git a/liblog/logger.h b/liblog/logger.h -index 246b33ccc..cf2452451 100644 +index 1f632c037..24cbcfd2e 100644 --- a/liblog/logger.h +++ b/liblog/logger.h -@@ -26,7 +26,9 @@ - +@@ -25,7 +25,9 @@ #include "log_portability.h" + #include "uio.h" -__BEGIN_DECLS +#ifdef __cplusplus @@ -619,17 +631,15 @@ index 246b33ccc..cf2452451 100644 +#endif /* Union, sock or fd of zero is not allowed unless static initialized */ - union android_log_context { -@@ -195,6 +197,8 @@ LIBLOG_HIDDEN void __android_log_unlock(); + union android_log_context_union { +@@ -162,4 +164,6 @@ void __android_log_unlock(); - LIBLOG_HIDDEN int __android_log_transport; + extern int __android_log_transport; -__END_DECLS +#ifdef __cplusplus +} +#endif - - #endif /* _LIBLOG_LOGGER_H__ */ diff --git a/libmemunreachable/Binder.cpp b/libmemunreachable/Binder.cpp index 60512a3f8..834507459 100644 --- a/libmemunreachable/Binder.cpp @@ -692,7 +702,7 @@ index dd1ec79d6..cc7374d07 100644 #endif // LIBMEMUNREACHABLE_BIONIC_H_ diff --git a/libmemunreachable/include/memunreachable/memunreachable.h b/libmemunreachable/include/memunreachable/memunreachable.h -index c028eabf2..bf207a0aa 100644 +index 011443fe3..86e9f5ff3 100644 --- a/libmemunreachable/include/memunreachable/memunreachable.h +++ b/libmemunreachable/include/memunreachable/memunreachable.h @@ -18,7 +18,6 @@ @@ -703,7 +713,7 @@ index c028eabf2..bf207a0aa 100644 #ifdef __cplusplus -@@ -75,12 +74,16 @@ std::string GetUnreachableMemoryString(bool log_contents = false, size_t limit = +@@ -82,12 +81,16 @@ std::string GetUnreachableMemoryString(bool log_contents = false, size_t limit = #endif @@ -723,12 +733,12 @@ index c028eabf2..bf207a0aa 100644 #endif // LIBMEMUNREACHABLE_MEMUNREACHABLE_H_ diff --git a/libnativeloader/include/nativeloader/dlext_namespaces.h b/libnativeloader/include/nativeloader/dlext_namespaces.h -index 43c932978..b04de6a72 100644 +index 2d6ce8569..d22defc9c 100644 --- a/libnativeloader/include/nativeloader/dlext_namespaces.h +++ b/libnativeloader/include/nativeloader/dlext_namespaces.h -@@ -19,7 +19,9 @@ - +@@ -20,7 +20,9 @@ #include + #include -__BEGIN_DECLS +#ifdef __cplusplus @@ -737,9 +747,9 @@ index 43c932978..b04de6a72 100644 /* * Initializes anonymous namespaces. The shared_libs_sonames is the list of sonames -@@ -126,6 +128,8 @@ extern void android_get_LD_LIBRARY_PATH(char* buffer, size_t buffer_size); +@@ -111,6 +113,8 @@ extern bool android_link_namespaces(struct android_namespace_t* from, - extern android_namespace_t* android_get_exported_namespace(const char* name); + extern struct android_namespace_t* android_get_exported_namespace(const char* name); -__END_DECLS +#ifdef __cplusplus @@ -776,7 +786,7 @@ index 3b272343d..60c68d76c 100644 #endif /* _NETUTILS_IFC_H_ */ diff --git a/libpackagelistparser/include/packagelistparser/packagelistparser.h b/libpackagelistparser/include/packagelistparser/packagelistparser.h -index d602c26dc..45c0763ac 100644 +index 3cb6b9af0..9e641ad2b 100644 --- a/libpackagelistparser/include/packagelistparser/packagelistparser.h +++ b/libpackagelistparser/include/packagelistparser/packagelistparser.h @@ -29,10 +29,11 @@ @@ -793,7 +803,7 @@ index d602c26dc..45c0763ac 100644 /** The file containing the list of installed packages on the system */ #define PACKAGES_LIST_FILE "/data/system/packages.list" -@@ -87,6 +88,8 @@ extern bool packagelist_parse(pfn_on_package callback, void *userdata); +@@ -89,6 +90,8 @@ extern bool packagelist_parse(pfn_on_package callback, void *userdata); */ extern void packagelist_free(pkg_info *info); @@ -803,34 +813,59 @@ index d602c26dc..45c0763ac 100644 +#endif #endif /* PACKAGELISTPARSER_H_ */ +diff --git a/libprocessgroup/cgrouprc/include/android/cgrouprc.h b/libprocessgroup/cgrouprc/include/android/cgrouprc.h +index 0f6a9cd5d..3a41a550d 100644 +--- a/libprocessgroup/cgrouprc/include/android/cgrouprc.h ++++ b/libprocessgroup/cgrouprc/include/android/cgrouprc.h +@@ -18,7 +18,9 @@ + + #include + +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + + // For host builds, __INTRODUCED_IN is not defined. + #ifndef __INTRODUCED_IN +@@ -84,6 +86,8 @@ __attribute__((warn_unused_result)) const char* ACgroupController_getName(const + __attribute__((warn_unused_result)) const char* ACgroupController_getPath(const ACgroupController*) + __INTRODUCED_IN(29); + +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + #endif diff --git a/libprocessgroup/include/processgroup/processgroup.h b/libprocessgroup/include/processgroup/processgroup.h -index 9fa4154ab..cc8e432f9 100644 +index f73ec2d41..8f1455acf 100644 --- a/libprocessgroup/include/processgroup/processgroup.h +++ b/libprocessgroup/include/processgroup/processgroup.h -@@ -17,10 +17,11 @@ - #ifndef _PROCESSGROUP_H_ - #define _PROCESSGROUP_H_ +@@ -16,12 +16,13 @@ + + #pragma once -#include #include + #include + #include -__BEGIN_DECLS +#ifdef __cplusplus +extern "C" { +#endif - // Return 0 and removes the cgroup if there are no longer any processes in it. - // Returns -1 in the case of an error occurring or if there are processes still running -@@ -39,6 +40,8 @@ bool setProcessGroupLimit(uid_t uid, int initialPid, int64_t limitInBytes); + static constexpr const char* CGROUPV2_CONTROLLER_NAME = "cgroup2"; + +@@ -65,4 +66,6 @@ void removeAllProcessGroups(void); - void removeAllProcessGroups(void); + #endif // __ANDROID_VNDK__ -__END_DECLS +#ifdef __cplusplus +} +#endif - - #endif diff --git a/libsuspend/autosuspend_ops.h b/libsuspend/autosuspend_ops.h index b0024c8bb..ea0eafd00 100644 --- a/libsuspend/autosuspend_ops.h @@ -879,10 +914,10 @@ index 21f4d61bf..dbbca161c 100644 #endif diff --git a/libsync/include/android/sync.h b/libsync/include/android/sync.h -index 68f74a0b2..7508b4cec 100644 +index 32bb878ba..59a8f9fad 100644 --- a/libsync/include/android/sync.h +++ b/libsync/include/android/sync.h -@@ -39,7 +39,9 @@ +@@ -39,11 +39,15 @@ #include "../ndk/sync.h" @@ -891,11 +926,8 @@ index 68f74a0b2..7508b4cec 100644 +extern "C" { +#endif - struct sync_fence_info_data { - uint32_t len; -@@ -64,6 +66,8 @@ struct sync_pt_info *sync_pt_info(struct sync_fence_info_data *info, - struct sync_pt_info *itr); - void sync_fence_info_free(struct sync_fence_info_data *info); + /* timeout in msecs */ + int sync_wait(int fd, int timeout); -__END_DECLS +#ifdef __cplusplus @@ -904,10 +936,14 @@ index 68f74a0b2..7508b4cec 100644 #endif /* __SYS_CORE_SYNC_H */ diff --git a/libsync/include/ndk/sync.h b/libsync/include/ndk/sync.h -index 3c5578313..d31039085 100644 +index 2a59e35bb..64d23a43c 100644 --- a/libsync/include/ndk/sync.h +++ b/libsync/include/ndk/sync.h -@@ -21,7 +21,9 @@ +@@ -27,11 +27,12 @@ + #define ANDROID_SYNC_H + + #include +-#include #include @@ -916,11 +952,11 @@ index 3c5578313..d31039085 100644 +extern "C" { +#endif - #if __ANDROID_API__ >= __ANDROID_API_O__ + #if __ANDROID_API__ >= 26 -@@ -83,6 +85,8 @@ void sync_file_info_free(struct sync_file_info *info); +@@ -103,7 +104,9 @@ void sync_file_info_free(struct sync_file_info* info) __INTRODUCED_IN(26); - #endif // __ANDROID_API__ >= __ANDROID_API_O__ + #endif /* __ANDROID_API__ >= 26 */ -__END_DECLS +#ifdef __cplusplus @@ -928,6 +964,7 @@ index 3c5578313..d31039085 100644 +#endif #endif /* ANDROID_SYNC_H */ + diff --git a/libsync/sw_sync.h b/libsync/sw_sync.h index fda1c4c57..395c38072 100644 --- a/libsync/sw_sync.h @@ -954,7 +991,7 @@ index fda1c4c57..395c38072 100644 #endif /* __SYS_CORE_SW_SYNC_H */ diff --git a/libsystem/include/system/camera.h b/libsystem/include/system/camera.h -index 7d796737c..55fdc9b1e 100644 +index 2ca90c395..c42f55966 100644 --- a/libsystem/include/system/camera.h +++ b/libsystem/include/system/camera.h @@ -18,13 +18,14 @@ @@ -984,10 +1021,10 @@ index 7d796737c..55fdc9b1e 100644 +#endif #endif /* SYSTEM_CORE_INCLUDE_ANDROID_CAMERA_H */ -diff --git a/libutils/tests/Singleton_test.h b/libutils/tests/Singleton_test.h +diff --git a/libutils/Singleton_test.h b/libutils/Singleton_test.h index c77d9ffe6..00bd56242 100644 ---- a/libutils/tests/Singleton_test.h -+++ b/libutils/tests/Singleton_test.h +--- a/libutils/Singleton_test.h ++++ b/libutils/Singleton_test.h @@ -17,7 +17,6 @@ #ifndef ANDROID_UTILS_SINGLETON_TEST_H #define ANDROID_UTILS_SINGLETON_TEST_H @@ -1017,7 +1054,7 @@ index c77d9ffe6..00bd56242 100644 } diff --git a/libziparchive/include/ziparchive/zip_archive.h b/libziparchive/include/ziparchive/zip_archive.h -index 018b1a922..03b08ea5b 100644 +index e3ac114f2..30518f0fe 100644 --- a/libziparchive/include/ziparchive/zip_archive.h +++ b/libziparchive/include/ziparchive/zip_archive.h @@ -22,7 +22,6 @@ @@ -1026,8 +1063,55 @@ index 018b1a922..03b08ea5b 100644 #include -#include #include - #include + #include +diff --git a/llkd/include/llkd.h b/llkd/include/llkd.h +index 3586ca1b1..b606c60d8 100644 +--- a/llkd/include/llkd.h ++++ b/llkd/include/llkd.h +@@ -22,9 +22,10 @@ + #endif + + #include +-#include + +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + + bool llkInit(const char* threadname); /* threadname NULL, not spawned */ + unsigned llkCheckMilliseconds(void); +@@ -63,17 +64,25 @@ unsigned llkCheckMilliseconds(void); + #define LLK_BLACKLIST_STACK_DEFAULT "init,lmkd.llkd,llkd,keystore,ueventd,apexd" + /* clang-format on */ + +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + + #ifdef __cplusplus +-extern "C++" { /* In case this included wrapped with __BEGIN_DECLS */ ++extern "C++" { /* In case this included wrapped with #ifdef __cplusplus ++extern "C" { ++#endif */ + + #include + +-__BEGIN_DECLS ++#ifdef __cplusplus ++extern "C" { ++#endif + /* C++ code allowed to not specify threadname argument for this C linkage */ + bool llkInit(const char* threadname = nullptr); +-__END_DECLS ++#ifdef __cplusplus ++} ++#endif + std::chrono::milliseconds llkCheck(bool checkRunning = false); + + /* clang-format off */ diff --git a/lmkd/include/liblmkd_utils.h b/lmkd/include/liblmkd_utils.h index 72e3f4a2b..64d060c6a 100644 --- a/lmkd/include/liblmkd_utils.h @@ -1059,7 +1143,7 @@ index 72e3f4a2b..64d060c6a 100644 #endif /* _LIBLMKD_UTILS_H_ */ diff --git a/lmkd/include/lmkd.h b/lmkd/include/lmkd.h -index e8f51da77..f44ff4f85 100644 +index 59377dd1f..bdc5413f2 100644 --- a/lmkd/include/lmkd.h +++ b/lmkd/include/lmkd.h @@ -18,10 +18,11 @@ @@ -1076,8 +1160,8 @@ index e8f51da77..f44ff4f85 100644 /* * Supported LMKD commands -@@ -152,6 +153,8 @@ inline size_t lmkd_pack_set_procpurge(LMKD_CTRL_PACKET packet) { - return sizeof(int); +@@ -188,6 +189,8 @@ static inline size_t lmkd_pack_set_getkillcnt_repl(LMKD_CTRL_PACKET packet, int + return 2 * sizeof(int); } -__END_DECLS @@ -1086,68 +1170,65 @@ index e8f51da77..f44ff4f85 100644 +#endif #endif /* _LMKD_H_ */ -diff --git a/lmkd/statslog.h b/lmkd/statslog.h -index 84584805d..06631524b 100644 ---- a/lmkd/statslog.h -+++ b/lmkd/statslog.h -@@ -20,11 +20,12 @@ - #include - #include - #include --#include +diff --git a/lmkd/libpsi/include/psi/psi.h b/lmkd/libpsi/include/psi/psi.h +index cd49e8b60..b4f4afe70 100644 +--- a/lmkd/libpsi/include/psi/psi.h ++++ b/lmkd/libpsi/include/psi/psi.h +@@ -17,10 +17,11 @@ + #ifndef __ANDROID_PSI_H__ + #define __ANDROID_PSI_H__ - #include +-#include + #include -__BEGIN_DECLS +#ifdef __cplusplus +extern "C" { +#endif - /* - * These are defined in -@@ -89,6 +90,8 @@ stats_write_lmk_kill_occurred(android_log_context ctx, int32_t code, int32_t uid - int64_t pgmajfault, int64_t rss_in_bytes, int64_t cache_in_bytes, - int64_t swap_in_bytes); + enum psi_stall_type { + PSI_SOME, +@@ -63,6 +64,8 @@ int unregister_psi_monitor(int epollfd, int fd); + */ + void destroy_psi_monitor(int fd); -__END_DECLS +#ifdef __cplusplus +} +#endif - #endif /* _STATSLOG_H_ */ -diff --git a/logcat/include/log/getopt.h b/logcat/include/log/getopt.h -index 0da2b1027..a23e21cc6 100644 ---- a/logcat/include/log/getopt.h -+++ b/logcat/include/log/getopt.h -@@ -30,7 +30,6 @@ - #if __ANDROID_USE_LIBLOG_LOGCAT_INTERFACE - - #include + #endif // __ANDROID_PSI_H__ +diff --git a/lmkd/statslog.h b/lmkd/statslog.h +index 2edba7a72..63b5b3e87 100644 +--- a/lmkd/statslog.h ++++ b/lmkd/statslog.h +@@ -20,11 +20,12 @@ + #include + #include + #include -#include - struct getopt_context { - int opterr; -@@ -55,12 +54,16 @@ struct getopt_context { - #define INIT_GETOPT_CONTEXT(context) \ - context = { 1, 1, '?', 0, NULL, NULL, EMSG, -1, -1, NO_PREFIX, 0, NULL } + #include -__BEGIN_DECLS +#ifdef __cplusplus +extern "C" { +#endif - int getopt_long_r(int nargc, char* const* nargv, const char* options, - const struct option* long_options, int* idx, - struct getopt_context* context); + + /* + * These are defined in +@@ -91,6 +92,8 @@ stats_write_lmk_kill_occurred(android_log_context ctx, int32_t code, int32_t uid + int64_t swap_in_bytes, int64_t process_start_time_ns, + int32_t min_oom_score); -__END_DECLS +#ifdef __cplusplus +} +#endif - #endif /* __ANDROID_USE_LIBLOG_LOGCAT_INTERFACE */ - + #endif /* _STATSLOG_H_ */ diff --git a/logd/libaudit.h b/logd/libaudit.h -index 2a93ea361..03f9f35bb 100644 +index b4a92a8a3..6cf37914e 100644 --- a/logd/libaudit.h +++ b/logd/libaudit.h @@ -21,14 +21,15 @@ @@ -1168,9 +1249,9 @@ index 2a93ea361..03f9f35bb 100644 #define MAX_AUDIT_MESSAGE_LENGTH 8970 -@@ -92,6 +93,8 @@ extern int audit_setup(int fd, pid_t pid); - /* Max audit messages per second */ - #define AUDIT_RATE_LIMIT 5 +@@ -101,6 +102,8 @@ extern int audit_setup(int fd, pid_t pid); + */ + extern int audit_rate_limit(int fd, uint32_t limit); -__END_DECLS +#ifdef __cplusplus @@ -1203,29 +1284,6 @@ index d3538b30c..1fe8e0309 100644 +#endif #endif /* __LIBS_LOGWRAP_H */ -diff --git a/toolbox/bsd-compatibility.h b/toolbox/bsd-compatibility.h -index 7c3ddd452..78ac825b1 100644 ---- a/toolbox/bsd-compatibility.h -+++ b/toolbox/bsd-compatibility.h -@@ -50,7 +50,9 @@ - - #define S_ISWHT(x) false - --__BEGIN_DECLS -+#ifdef __cplusplus -+extern "C" { -+#endif - - /* From NetBSD . */ - #define HN_DECIMAL 0x01 -@@ -81,4 +83,6 @@ void swab(const void * __restrict, void * __restrict, ssize_t); - /* From NetBSD . */ - int raise_default_signal(int); - --__END_DECLS -+#ifdef __cplusplus -+} -+#endif diff --git a/trusty/gatekeeper/trusty_gatekeeper_ipc.h b/trusty/gatekeeper/trusty_gatekeeper_ipc.h index f8de7f873..fa8fd4019 100644 --- a/trusty/gatekeeper/trusty_gatekeeper_ipc.h @@ -1248,23 +1306,24 @@ index f8de7f873..fa8fd4019 100644 +#ifdef __cplusplus +} +#endif -diff --git a/trusty/keymaster/trusty_keymaster_ipc.h b/trusty/keymaster/trusty_keymaster_ipc.h -index c15f7c1da..797e1f005 100644 ---- a/trusty/keymaster/trusty_keymaster_ipc.h -+++ b/trusty/keymaster/trusty_keymaster_ipc.h -@@ -17,13 +17,17 @@ - #ifndef TRUSTY_KEYMASTER_TRUSTY_KEYMASTER_IPC_H_ - #define TRUSTY_KEYMASTER_TRUSTY_KEYMASTER_IPC_H_ +diff --git a/trusty/keymaster/include/trusty_keymaster/ipc/trusty_keymaster_ipc.h b/trusty/keymaster/include/trusty_keymaster/ipc/trusty_keymaster_ipc.h +index 16207e6d9..9a1245886 100644 +--- a/trusty/keymaster/include/trusty_keymaster/ipc/trusty_keymaster_ipc.h ++++ b/trusty/keymaster/include/trusty_keymaster/ipc/trusty_keymaster_ipc.h +@@ -20,7 +20,9 @@ + #include + #include -__BEGIN_DECLS +#ifdef __cplusplus +extern "C" { +#endif - int trusty_keymaster_connect(void); - int trusty_keymaster_call(uint32_t cmd, void* in, uint32_t in_size, uint8_t* out, - uint32_t* out_size); - void trusty_keymaster_disconnect(void); + const uint32_t TRUSTY_KEYMASTER_RECV_BUF_SIZE = 2 * PAGE_SIZE; + const uint32_t TRUSTY_KEYMASTER_SEND_BUF_SIZE = +@@ -35,6 +37,8 @@ keymaster_error_t translate_error(int err); + keymaster_error_t trusty_keymaster_send(uint32_t command, const keymaster::Serializable& req, + keymaster::KeymasterResponse* rsp); -__END_DECLS +#ifdef __cplusplus diff --git a/patches/core/0002-Fix-inclusion-of-stdatomic.h-with-g.patch b/patches/core/0002-Fix-inclusion-of-stdatomic.h-with-g.patch deleted file mode 100644 index 2c5982e..0000000 --- a/patches/core/0002-Fix-inclusion-of-stdatomic.h-with-g.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 8537b265ff1c091376e200448929ebe1610d0f85 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?S=C3=B6ren=20Tempel?= -Date: Tue, 27 Feb 2018 16:30:30 +0100 -Subject: [PATCH] Fix inclusion of stdatomic.h with g++ - -See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60932#c5 ---- - libcutils/include/cutils/trace.h | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/libcutils/include/cutils/trace.h b/libcutils/include/cutils/trace.h -index 504e0ee88..a64c2b672 100644 ---- a/libcutils/include/cutils/trace.h -+++ b/libcutils/include/cutils/trace.h -@@ -18,7 +18,12 @@ - #define _LIBS_CUTILS_TRACE_H - - #include -+#ifdef __cplusplus -+#include -+using namespace std; -+#else - #include -+#endif - #include - #include - #include diff --git a/patches/core/0002-adb-disable-mdns-transport-support.patch b/patches/core/0002-adb-disable-mdns-transport-support.patch new file mode 100644 index 0000000..fca8c42 --- /dev/null +++ b/patches/core/0002-adb-disable-mdns-transport-support.patch @@ -0,0 +1,25 @@ +From 9e84fd21dbd5387f5eea9afd0dbbbeb4d27c8aaf Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?S=C3=B6ren=20Tempel?= +Date: Sun, 1 Sep 2019 15:04:18 +0000 +Subject: [PATCH] adb: disable mdns transport support + +Would require patching the MDNS code as well. +--- + adb/client/main.cpp | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/adb/client/main.cpp b/adb/client/main.cpp +index 0c5c28f1b..b6a128152 100644 +--- a/adb/client/main.cpp ++++ b/adb/client/main.cpp +@@ -118,10 +118,6 @@ int adb_server_main(int is_daemon, const std::string& socket_spec, int ack_reply + init_transport_registration(); + init_reconnect_handler(); + +- if (!getenv("ADB_MDNS") || strcmp(getenv("ADB_MDNS"), "0") != 0) { +- init_mdns_transport_discovery(); +- } +- + if (!getenv("ADB_USB") || strcmp(getenv("ADB_USB"), "0") != 0) { + usb_init(); + } else { diff --git a/patches/core/0003-fdevent-missing-atomic-include.patch b/patches/core/0003-fdevent-missing-atomic-include.patch new file mode 100644 index 0000000..aa60519 --- /dev/null +++ b/patches/core/0003-fdevent-missing-atomic-include.patch @@ -0,0 +1,21 @@ +From a94177f5cbc73f8806fcddc7640af491d4da3050 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?S=C3=B6ren=20Tempel?= +Date: Sun, 1 Sep 2019 15:05:17 +0000 +Subject: [PATCH] fdevent: missing atomic include + +--- + adb/fdevent/fdevent.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/adb/fdevent/fdevent.h b/adb/fdevent/fdevent.h +index ccb0c9221..e7a84f49b 100644 +--- a/adb/fdevent/fdevent.h ++++ b/adb/fdevent/fdevent.h +@@ -26,6 +26,7 @@ + #include + #include + #include ++#include + + #include + diff --git a/patches/core/0004-Fix-inclusion-of-stdatomic.h-with-g.patch b/patches/core/0004-Fix-inclusion-of-stdatomic.h-with-g.patch new file mode 100644 index 0000000..2dde0b4 --- /dev/null +++ b/patches/core/0004-Fix-inclusion-of-stdatomic.h-with-g.patch @@ -0,0 +1,64 @@ +From 7d39438932de32c95c5a90f1ffeac31bfd8a21a7 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?S=C3=B6ren=20Tempel?= +Date: Tue, 27 Feb 2018 16:30:30 +0100 +Subject: [PATCH] Fix inclusion of stdatomic.h with g++ + +See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60932#c5 +--- + libcutils/include/cutils/trace.h | 5 +++++ + liblog/logger.h | 6 ++++++ + liblog/logger_write.cpp | 5 +++++ + 3 files changed, 16 insertions(+) + +diff --git a/libcutils/include/cutils/trace.h b/libcutils/include/cutils/trace.h +index 712f75c4f..9a41f4be7 100644 +--- a/libcutils/include/cutils/trace.h ++++ b/libcutils/include/cutils/trace.h +@@ -18,7 +18,12 @@ + #define _LIBS_CUTILS_TRACE_H + + #include ++#ifdef __cplusplus ++#include ++using namespace std; ++#else + #include ++#endif + #include + #include + #include +diff --git a/liblog/logger.h b/liblog/logger.h +index 24cbcfd2e..046710332 100644 +--- a/liblog/logger.h ++++ b/liblog/logger.h +@@ -16,7 +16,13 @@ + + #pragma once + ++#ifdef __cplusplus ++#include ++using namespace std; ++#else + #include ++#endif ++ + #include + + #include +diff --git a/liblog/logger_write.cpp b/liblog/logger_write.cpp +index a4b3cd7b2..0f44b859c 100644 +--- a/liblog/logger_write.cpp ++++ b/liblog/logger_write.cpp +@@ -15,7 +15,12 @@ + */ + + #include ++#ifdef __cplusplus ++#include ++using namespace std; ++#else + #include ++#endif + #include + #include + #include diff --git a/patches/core/0004-getprogname-3-is-usually-only-defined-on-BSDs.patch b/patches/core/0004-getprogname-3-is-usually-only-defined-on-BSDs.patch deleted file mode 100644 index f1bbccc..0000000 --- a/patches/core/0004-getprogname-3-is-usually-only-defined-on-BSDs.patch +++ /dev/null @@ -1,24 +0,0 @@ -From b34f018c53f6b3d38bd8406ba24430779b64d6b8 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?S=C3=B6ren=20Tempel?= -Date: Tue, 27 Feb 2018 17:27:39 +0100 -Subject: [PATCH] getprogname(3) is usually only defined on BSDs - -musl libc doesn't have it either, therefore just check for __linux__ -instead of __GLIBC__. ---- - base/logging.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/base/logging.cpp b/base/logging.cpp -index a31feefab..8b933622d 100644 ---- a/base/logging.cpp -+++ b/base/logging.cpp -@@ -91,7 +91,7 @@ static thread_id GetThreadId() { - } - - namespace { --#if defined(__GLIBC__) -+#if defined(__linux__) - const char* getprogname() { - return program_invocation_short_name; - } diff --git a/patches/core/0003-group_member-is-a-nonstandard-GNU-extension.patch b/patches/core/0005-group_member-is-a-nonstandard-GNU-extension.patch similarity index 63% rename from patches/core/0003-group_member-is-a-nonstandard-GNU-extension.patch rename to patches/core/0005-group_member-is-a-nonstandard-GNU-extension.patch index 4958b07..988b986 100644 --- a/patches/core/0003-group_member-is-a-nonstandard-GNU-extension.patch +++ b/patches/core/0005-group_member-is-a-nonstandard-GNU-extension.patch @@ -1,23 +1,23 @@ -From 5dc90b09ee874a16d3198912dc32718751e34da7 Mon Sep 17 00:00:00 2001 +From 3252e667ddbfa93d1412b66d772333b7193c3aaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Tempel?= Date: Tue, 27 Feb 2018 17:24:05 +0100 Subject: [PATCH] group_member is a nonstandard GNU extension Only use that function if __GLIBC__ is defined. --- - adb/diagnose_usb.cpp | 2 +- + diagnose_usb/diagnose_usb.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/adb/diagnose_usb.cpp b/adb/diagnose_usb.cpp -index 9f721bf5f..976c1a216 100644 ---- a/adb/diagnose_usb.cpp -+++ b/adb/diagnose_usb.cpp +diff --git a/diagnose_usb/diagnose_usb.cpp b/diagnose_usb/diagnose_usb.cpp +index 5695ecec5..1a155d0c1 100644 +--- a/diagnose_usb/diagnose_usb.cpp ++++ b/diagnose_usb/diagnose_usb.cpp @@ -33,7 +33,7 @@ static const char kPermissionsHelpUrl[] = "http://developer.android.com/tools/de // Returns a message describing any potential problems we find with udev, or an empty string if we // can't find plugdev information (i.e. udev is not installed). static std::string GetUdevProblem() { --#if defined(__linux__) -+#if defined(__GLIBC__) +-#if defined(__linux__) && !defined(__BIONIC__) ++#if defined(__GLIBC__) && !defined(__BIONIC__) errno = 0; group* plugdev_group = getgrnam("plugdev"); diff --git a/patches/core/0006-getprogname-3-is-usually-only-defined-on-BSDs.patch b/patches/core/0006-getprogname-3-is-usually-only-defined-on-BSDs.patch new file mode 100644 index 0000000..3287dcf --- /dev/null +++ b/patches/core/0006-getprogname-3-is-usually-only-defined-on-BSDs.patch @@ -0,0 +1,27 @@ +From a04b665ed514ed8d1d0a493caaf2fb3e91d4d47c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?S=C3=B6ren=20Tempel?= +Date: Tue, 27 Feb 2018 17:27:39 +0100 +Subject: [PATCH] getprogname(3) is usually only defined on BSDs + +musl libc doesn't have it either, therefore just check for __linux__ +instead of __GLIBC__. +--- + base/logging.cpp | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/base/logging.cpp b/base/logging.cpp +index f89168c0f..582a8f6df 100644 +--- a/base/logging.cpp ++++ b/base/logging.cpp +@@ -63,9 +63,9 @@ namespace android { + namespace base { + + // BSD-based systems like Android/macOS have getprogname(). Others need us to provide one. +-#if defined(__GLIBC__) || defined(_WIN32) ++#if defined(__linux__) || defined(_WIN32) + static const char* getprogname() { +-#if defined(__GLIBC__) ++#if defined(__linux__) + return program_invocation_short_name; + #elif defined(_WIN32) + static bool first = true; diff --git a/patches/core/0005-fix-initializer-element-is-not-constant-error-when-b.patch b/patches/core/0007-fix-initializer-element-is-not-constant-error-when-b.patch similarity index 66% rename from patches/core/0005-fix-initializer-element-is-not-constant-error-when-b.patch rename to patches/core/0007-fix-initializer-element-is-not-constant-error-when-b.patch index 21e843a..a6723f2 100644 --- a/patches/core/0005-fix-initializer-element-is-not-constant-error-when-b.patch +++ b/patches/core/0007-fix-initializer-element-is-not-constant-error-when-b.patch @@ -1,18 +1,18 @@ -From defc2b0dbf91b7ef53490a2df0c8e95df7469f7c Mon Sep 17 00:00:00 2001 +From df248f89ceca999a6d836f6409c7f1a48f71fe8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Tempel?= Date: Tue, 27 Feb 2018 17:37:12 +0100 Subject: [PATCH] fix "initializer element is not constant"-error when building with g++ --- - liblog/logprint.c | 6 +++--- + liblog/logprint.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -diff --git a/liblog/logprint.c b/liblog/logprint.c -index a2839bfb6..23f83c73a 100644 ---- a/liblog/logprint.c -+++ b/liblog/logprint.c -@@ -926,9 +926,9 @@ static int android_log_printBinaryEvent(const unsigned char** pEventData, +diff --git a/liblog/logprint.cpp b/liblog/logprint.cpp +index 6b5ea4c23..d33c7d0f3 100644 +--- a/liblog/logprint.cpp ++++ b/liblog/logprint.cpp +@@ -910,9 +910,9 @@ static int android_log_printBinaryEvent(const unsigned char** pEventData, size_t } break; case TYPE_MONOTONIC: { diff --git a/patches/core/0006-Define-clang-only-nullability-specifiers-when-__clan.patch b/patches/core/0008-Define-clang-only-nullability-specifiers-when-__clan.patch similarity index 75% rename from patches/core/0006-Define-clang-only-nullability-specifiers-when-__clan.patch rename to patches/core/0008-Define-clang-only-nullability-specifiers-when-__clan.patch index dcf0580..3512f36 100644 --- a/patches/core/0006-Define-clang-only-nullability-specifiers-when-__clan.patch +++ b/patches/core/0008-Define-clang-only-nullability-specifiers-when-__clan.patch @@ -1,4 +1,4 @@ -From be4e489b9d8d84964b34f7fbb3b4fbae993b4f8f Mon Sep 17 00:00:00 2001 +From dbaf896f4f6aea7d905138466aaddc5ff79c5f54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Tempel?= Date: Tue, 27 Feb 2018 17:48:49 +0100 Subject: [PATCH] Define clang-only nullability specifiers when __clang__ is @@ -9,12 +9,12 @@ Subject: [PATCH] Define clang-only nullability specifiers when __clang__ is 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/adb/sysdeps.h b/adb/sysdeps.h -index edeacc116..3df19dd2f 100644 +index b0e7fa097..ecc96e76f 100644 --- a/adb/sysdeps.h +++ b/adb/sysdeps.h -@@ -52,11 +52,13 @@ - #endif - #endif +@@ -41,11 +41,13 @@ + #include "sysdeps/network.h" + #include "sysdeps/stat.h" -#ifdef _WIN32 - diff --git a/patches/core/0007-Include-libusb-1.0-libusb.h-instead-of-libusb-libusb.patch b/patches/core/0009-Include-libusb-1.0-libusb.h-instead-of-libusb-libusb.patch similarity index 85% rename from patches/core/0007-Include-libusb-1.0-libusb.h-instead-of-libusb-libusb.patch rename to patches/core/0009-Include-libusb-1.0-libusb.h-instead-of-libusb-libusb.patch index 905e9ef..83b9ae3 100644 --- a/patches/core/0007-Include-libusb-1.0-libusb.h-instead-of-libusb-libusb.patch +++ b/patches/core/0009-Include-libusb-1.0-libusb.h-instead-of-libusb-libusb.patch @@ -1,4 +1,4 @@ -From 8b825c819b625e0dd0d22bee4ef6870f8cbc6868 Mon Sep 17 00:00:00 2001 +From a97e2e0e568bc678afba2abeeee23bfcb7a56c37 Mon Sep 17 00:00:00 2001 From: Anatol Pomozov Date: Fri, 25 Aug 2017 23:30:34 +0000 Subject: [PATCH] Include libusb-1.0/libusb.h instead of libusb/libusb.h @@ -8,7 +8,7 @@ Subject: [PATCH] Include libusb-1.0/libusb.h instead of libusb/libusb.h 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adb/client/usb_libusb.cpp b/adb/client/usb_libusb.cpp -index 46c3f58ec..35d5e1e1c 100644 +index 53f01a0ce..b4c3aadc2 100644 --- a/adb/client/usb_libusb.cpp +++ b/adb/client/usb_libusb.cpp @@ -30,7 +30,7 @@ diff --git a/patches/core/0009-socket.h-include-sys-select.h-for-fd_set-used-in-soc.patch b/patches/core/0010-socket.h-include-sys-select.h-for-fd_set-used-in-soc.patch similarity index 81% rename from patches/core/0009-socket.h-include-sys-select.h-for-fd_set-used-in-soc.patch rename to patches/core/0010-socket.h-include-sys-select.h-for-fd_set-used-in-soc.patch index a263434..6d17cff 100644 --- a/patches/core/0009-socket.h-include-sys-select.h-for-fd_set-used-in-soc.patch +++ b/patches/core/0010-socket.h-include-sys-select.h-for-fd_set-used-in-soc.patch @@ -1,4 +1,4 @@ -From 44a8e5a2d61ad8e2ea0c714625b94dc48440afe8 Mon Sep 17 00:00:00 2001 +From 3d7bdd11ac7839b650dce086f4b3374fc4aaffb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Tempel?= Date: Wed, 28 Feb 2018 20:22:09 +0100 Subject: [PATCH] socket.h: include sys/select.h for fd_set used in socket.cpp @@ -8,10 +8,10 @@ Subject: [PATCH] socket.h: include sys/select.h for fd_set used in socket.cpp 1 file changed, 1 insertion(+) diff --git a/fastboot/socket.h b/fastboot/socket.h -index 7eaa0ab2c..a772b1227 100644 +index e791f2c8b..ced760c03 100644 --- a/fastboot/socket.h +++ b/fastboot/socket.h -@@ -39,6 +39,7 @@ +@@ -38,6 +38,7 @@ #include #include diff --git a/patches/core/0011-Include-string.h-in-various-file-missing-it.patch b/patches/core/0011-Include-string.h-in-various-file-missing-it.patch index d9e4de3..bff8727 100644 --- a/patches/core/0011-Include-string.h-in-various-file-missing-it.patch +++ b/patches/core/0011-Include-string.h-in-various-file-missing-it.patch @@ -1,4 +1,4 @@ -From a2a5e85e8c0638a4f039063bd43c0b8ccb72583f Mon Sep 17 00:00:00 2001 +From d4dc162302db5da549ddc5d0ee01b8e2cf848272 Mon Sep 17 00:00:00 2001 From: Anatol Pomozov Date: Fri, 25 Aug 2017 23:30:34 +0000 Subject: [PATCH] Include string.h in various file missing it @@ -9,21 +9,20 @@ Most of these need string.h for strerror(3). base/errors_unix.cpp | 1 + base/file.cpp | 1 + base/logging.cpp | 1 + - libsparse/sparse_read.cpp | 1 + - 5 files changed, 5 insertions(+) + 4 files changed, 4 insertions(+) diff --git a/adb/sysdeps/posix/network.cpp b/adb/sysdeps/posix/network.cpp -index ecd1fd24e..86166c0e2 100644 +index c5c227568..99686f15f 100644 --- a/adb/sysdeps/posix/network.cpp +++ b/adb/sysdeps/posix/network.cpp -@@ -21,6 +21,7 @@ +@@ -22,6 +22,7 @@ #include #include +#include - #include "adb_unique_fd.h" - + #include + #include diff --git a/base/errors_unix.cpp b/base/errors_unix.cpp index 296995efe..48269b675 100644 --- a/base/errors_unix.cpp @@ -37,10 +36,10 @@ index 296995efe..48269b675 100644 namespace android { namespace base { diff --git a/base/file.cpp b/base/file.cpp -index 2f697a1cc..81aef5758 100644 +index 3dfcfbb7e..1b5c0203f 100644 --- a/base/file.cpp +++ b/base/file.cpp -@@ -22,6 +22,7 @@ +@@ -26,6 +26,7 @@ #include #include #include @@ -49,26 +48,14 @@ index 2f697a1cc..81aef5758 100644 #include #include diff --git a/base/logging.cpp b/base/logging.cpp -index 8b933622d..c74fc6273 100644 +index 582a8f6df..860f7921f 100644 --- a/base/logging.cpp +++ b/base/logging.cpp -@@ -23,6 +23,7 @@ - #include +@@ -24,6 +24,7 @@ + #include #include #include +#include // For getprogname(3) or program_invocation_short_name. #if defined(__ANDROID__) || defined(__APPLE__) -diff --git a/libsparse/sparse_read.cpp b/libsparse/sparse_read.cpp -index 437963527..ccb565bb6 100644 ---- a/libsparse/sparse_read.cpp -+++ b/libsparse/sparse_read.cpp -@@ -26,6 +26,7 @@ - #include - #include - #include -+#include - #include - - #include diff --git a/patches/core/0012-fastboot-make-mke2fs_path-configurable.patch b/patches/core/0012-fastboot-make-mke2fs_path-configurable.patch index 2f3bbc1..1ca6ddf 100644 --- a/patches/core/0012-fastboot-make-mke2fs_path-configurable.patch +++ b/patches/core/0012-fastboot-make-mke2fs_path-configurable.patch @@ -1,4 +1,4 @@ -From 151f7216f727f042ce7467cb2055046269510ecc Mon Sep 17 00:00:00 2001 +From 7790312626a476622ace72896117d13359ff9240 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Tempel?= Date: Mon, 18 Jun 2018 23:25:14 +0200 Subject: [PATCH] fastboot: make mke2fs_path configurable @@ -11,7 +11,7 @@ See: https://bugs.archlinux.org/task/56955 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastboot/fs.cpp b/fastboot/fs.cpp -index c30ca1e4b..a34fcf81c 100644 +index 8c0aa6bf4..51c480b62 100644 --- a/fastboot/fs.cpp +++ b/fastboot/fs.cpp @@ -117,7 +117,7 @@ static int generate_ext4_image(const char* fileName, long long partSize, diff --git a/patches/core/0013-adb.cpp-fix-warning-regarding-execl-3-invocation.patch b/patches/core/0013-adb.cpp-fix-warning-regarding-execl-3-invocation.patch index 61d74e2..c74ab11 100644 --- a/patches/core/0013-adb.cpp-fix-warning-regarding-execl-3-invocation.patch +++ b/patches/core/0013-adb.cpp-fix-warning-regarding-execl-3-invocation.patch @@ -1,4 +1,4 @@ -From 0bca76eb142738e701762799597fdbf81a66d6fd Mon Sep 17 00:00:00 2001 +From cc70096e75ea5558330dc2a1acf83661046948dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Tempel?= Date: Tue, 19 Jun 2018 09:44:06 +0200 Subject: [PATCH] adb.cpp: fix warning regarding execl(3) invocation @@ -12,11 +12,11 @@ warning: missing sentinel in function call [-Wformat=] 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adb/adb.cpp b/adb/adb.cpp -index a62d368a2..9dce6cbef 100644 +index 24d4292d0..687d9f096 100644 --- a/adb/adb.cpp +++ b/adb/adb.cpp -@@ -906,7 +906,7 @@ int launch_server(const std::string& socket_spec) { - snprintf(reply_fd, sizeof(reply_fd), "%d", fd[1]); +@@ -876,7 +876,7 @@ int launch_server(const std::string& socket_spec) { + snprintf(reply_fd, sizeof(reply_fd), "%d", pipe_write.get()); // child process int result = execl(path.c_str(), "adb", "-L", socket_spec.c_str(), "fork-server", "server", - "--reply-fd", reply_fd, NULL); diff --git a/patches/core/0014-usb_linux.cpp-include-sys-sysmacros.h-for-minor-majo.patch b/patches/core/0014-usb_linux.cpp-include-sys-sysmacros.h-for-minor-majo.patch index dbd0850..b6e6f4a 100644 --- a/patches/core/0014-usb_linux.cpp-include-sys-sysmacros.h-for-minor-majo.patch +++ b/patches/core/0014-usb_linux.cpp-include-sys-sysmacros.h-for-minor-majo.patch @@ -1,4 +1,4 @@ -From 8f832a95e05d24469d160d92a1c31bba2000ac8f Mon Sep 17 00:00:00 2001 +From a7af5afd435766dcb197f93446d8133511a8809a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Tempel?= Date: Tue, 19 Jun 2018 12:47:09 +0000 Subject: [PATCH] usb_linux.cpp: include sys/sysmacros.h for minor/major @@ -8,12 +8,12 @@ Subject: [PATCH] usb_linux.cpp: include sys/sysmacros.h for minor/major 1 file changed, 1 insertion(+) diff --git a/adb/client/usb_linux.cpp b/adb/client/usb_linux.cpp -index 1f376a4c9..77227a1d0 100644 +index 81b830643..97a2bbc7a 100644 --- a/adb/client/usb_linux.cpp +++ b/adb/client/usb_linux.cpp -@@ -31,6 +31,7 @@ - #include +@@ -32,6 +32,7 @@ #include + #include #include +#include #include diff --git a/patches/core/0015-adb-Reduce-fallback-size-for-_SC_GETPW_R_SIZE_MAX.patch b/patches/core/0015-adb-Reduce-fallback-size-for-_SC_GETPW_R_SIZE_MAX.patch new file mode 100644 index 0000000..ece0661 --- /dev/null +++ b/patches/core/0015-adb-Reduce-fallback-size-for-_SC_GETPW_R_SIZE_MAX.patch @@ -0,0 +1,23 @@ +From 435700088eaed2b8cbbc75a7d59c52cc50430aab Mon Sep 17 00:00:00 2001 +From: Robert Yang +Date: Wed, 24 Oct 2018 09:48:40 -0400 +Subject: [PATCH] adb: Reduce fallback size for _SC_GETPW_R_SIZE_MAX + +See: https://github.com/nmeum/android-tools/pull/5#discussion_r227946282 +--- + adb/adb_utils.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/adb/adb_utils.cpp b/adb/adb_utils.cpp +index cf5fbc88d..d1392f06d 100644 +--- a/adb/adb_utils.cpp ++++ b/adb/adb_utils.cpp +@@ -294,7 +294,7 @@ std::string adb_get_homedir_path() { + struct passwd* result; + int pwent_max = sysconf(_SC_GETPW_R_SIZE_MAX); + if (pwent_max == -1) { +- pwent_max = 16384; ++ pwent_max = 1024; + } + std::vector buf(pwent_max); + int rc = getpwuid_r(getuid(), &pwent, buf.data(), buf.size(), &result); diff --git a/patches/core/0015-libziparchive-Don-t-use-string_view.patch b/patches/core/0015-libziparchive-Don-t-use-string_view.patch deleted file mode 100644 index a3b39cd..0000000 --- a/patches/core/0015-libziparchive-Don-t-use-string_view.patch +++ /dev/null @@ -1,37 +0,0 @@ -From dfa3ad4ad485141c1bf3040c6efd92bb479bfe0a Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?S=C3=B6ren=20Tempel?= -Date: Thu, 13 Sep 2018 23:45:29 +0200 -Subject: [PATCH] libziparchive: Don't use string_view - -This seems to be a C++17 feature [0] and Alpine's GCC doesn't properly -support C++17 yet. The proper way to fix this would of cause be checking -whether or not C++17/string_view is supported. - -[0]: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3921.html ---- - libziparchive/zip_archive.cc | 5 ----- - 1 file changed, 5 deletions(-) - -diff --git a/libziparchive/zip_archive.cc b/libziparchive/zip_archive.cc -index 5e5e7afd1..409029c2f 100644 ---- a/libziparchive/zip_archive.cc -+++ b/libziparchive/zip_archive.cc -@@ -100,10 +100,6 @@ static uint32_t RoundUpPower2(uint32_t val) { - } - - static uint32_t ComputeHash(const ZipString& name) { --#if !defined(_WIN32) -- return std::hash{}( -- std::string_view(reinterpret_cast(name.name), name.name_length)); --#else - // Remove this code path once the windows compiler knows how to compile the above statement. - uint32_t hash = 0; - uint16_t len = name.name_length; -@@ -114,7 +110,6 @@ static uint32_t ComputeHash(const ZipString& name) { - } - - return hash; --#endif - } - - /* diff --git a/patches/core/0016-adb-Use-a-default-_SC_GETPW_R_SIZE_MAX-size.patch b/patches/core/0016-adb-Use-a-default-_SC_GETPW_R_SIZE_MAX-size.patch deleted file mode 100644 index b4b0a9b..0000000 --- a/patches/core/0016-adb-Use-a-default-_SC_GETPW_R_SIZE_MAX-size.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 8b43a0588b88ab4e48c114916788d68e5f1f99ac Mon Sep 17 00:00:00 2001 -From: Robert Yang -Date: Wed, 24 Oct 2018 09:48:40 -0400 -Subject: [PATCH] adb: Use a default _SC_GETPW_R_SIZE_MAX size -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -sysconf(_SC_GETPW_R_SIZE_MAX) may return −1 if there is no hard limit on -the the buffer size. Some libc implementations such as musl don't define -this limit and will return -1. - -Use a default buffer size to handle this case. ---- - adb/adb_utils.cpp | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/adb/adb_utils.cpp b/adb/adb_utils.cpp -index b236fb39f..1c3bdf2d3 100644 ---- a/adb/adb_utils.cpp -+++ b/adb/adb_utils.cpp -@@ -249,6 +249,9 @@ std::string adb_get_homedir_path() { - struct passwd pwent; - struct passwd* result; - int pwent_max = sysconf(_SC_GETPW_R_SIZE_MAX); -+ if (pwent_max == -1) { -+ pwent_max = 1024; -+ } - std::vector buf(pwent_max); - int rc = getpwuid_r(getuid(), &pwent, buf.data(), buf.size(), &result); - if (rc == 0 && result) { diff --git a/patches/core/0016-libcutils-include-sys-select.h-for-timeval.patch b/patches/core/0016-libcutils-include-sys-select.h-for-timeval.patch new file mode 100644 index 0000000..b6426a4 --- /dev/null +++ b/patches/core/0016-libcutils-include-sys-select.h-for-timeval.patch @@ -0,0 +1,21 @@ +From 697ea0147bd28082cc834b37efb15b4da4540447 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?S=C3=B6ren=20Tempel?= +Date: Wed, 21 Aug 2019 19:59:43 +0200 +Subject: [PATCH] libcutils: include sys/select.h for timeval + +--- + libcutils/sockets_unix.cpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/libcutils/sockets_unix.cpp b/libcutils/sockets_unix.cpp +index 6acdcd89b..32ab56080 100644 +--- a/libcutils/sockets_unix.cpp ++++ b/libcutils/sockets_unix.cpp +@@ -20,6 +20,7 @@ + #include + #include + #include ++#include + #include + #include + #include diff --git a/patches/core/0017-liblog-Fix-initialization-of-android_log_transport_w.patch b/patches/core/0017-liblog-Fix-initialization-of-android_log_transport_w.patch new file mode 100644 index 0000000..ccbd2fb --- /dev/null +++ b/patches/core/0017-liblog-Fix-initialization-of-android_log_transport_w.patch @@ -0,0 +1,38 @@ +From 2d94bd3f415975f294b046ab43ea438f1dd924ce Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?S=C3=B6ren=20Tempel?= +Date: Wed, 21 Aug 2019 20:01:26 +0200 +Subject: [PATCH] liblog: Fix initialization of android_log_transport_write + +--- + liblog/fake_writer.cpp | 2 +- + liblog/stderr_write.cpp | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/liblog/fake_writer.cpp b/liblog/fake_writer.cpp +index c0b0e69a5..29bcd4f75 100644 +--- a/liblog/fake_writer.cpp ++++ b/liblog/fake_writer.cpp +@@ -33,8 +33,8 @@ static int logFds[(int)LOG_ID_MAX] = {-1, -1, -1, -1, -1, -1}; + + struct android_log_transport_write fakeLoggerWrite = { + .node = {&fakeLoggerWrite.node, &fakeLoggerWrite.node}, +- .context.priv = &logFds, + .name = "fake", ++ .context = { .priv = &logFds }, + .available = NULL, + .open = fakeOpen, + .close = fakeClose, +diff --git a/liblog/stderr_write.cpp b/liblog/stderr_write.cpp +index e324a7c65..a32626099 100644 +--- a/liblog/stderr_write.cpp ++++ b/liblog/stderr_write.cpp +@@ -56,8 +56,8 @@ struct stderrContext { + + struct android_log_transport_write stderrLoggerWrite = { + .node = {&stderrLoggerWrite.node, &stderrLoggerWrite.node}, +- .context.priv = NULL, + .name = "stderr", ++ .context = { .priv = NULL }, + .available = stderrAvailable, + .open = stderrOpen, + .close = stderrClose, diff --git a/patches/core/0018-logging.h-only-activate-ostream-warnings-when-clang-.patch b/patches/core/0018-logging.h-only-activate-ostream-warnings-when-clang-.patch new file mode 100644 index 0000000..1e1cbcf --- /dev/null +++ b/patches/core/0018-logging.h-only-activate-ostream-warnings-when-clang-.patch @@ -0,0 +1,30 @@ +From 23889a11c2e0cdda76e04925d8364d1ccb99180d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?S=C3=B6ren=20Tempel?= +Date: Sun, 25 Aug 2019 13:01:38 +0200 +Subject: [PATCH] logging.h: only activate ostream warnings when clang is used + +With gcc this results in a `attributes are not allowed on a +function-definition` error. +--- + base/include/android-base/logging.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/base/include/android-base/logging.h b/base/include/android-base/logging.h +index ab6476c59..e88f3d75f 100644 +--- a/base/include/android-base/logging.h ++++ b/base/include/android-base/logging.h +@@ -482,6 +482,7 @@ namespace std { // NOLINT(cert-dcl58-cpp) + // Note: to print the pointer, use "<< static_cast(string_pointer)" instead. + // Note: a not-recommended alternative is to let Clang ignore the warning by adding + // -Wno-user-defined-warnings to CPPFLAGS. ++#ifdef __clang__ + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wgcc-compat" + #define OSTREAM_STRING_POINTER_USAGE_WARNING \ +@@ -491,5 +492,6 @@ inline std::ostream& operator<<(std::ostream& stream, const std::string* string_ + return stream << static_cast(string_pointer); + } + #pragma clang diagnostic pop ++#endif + + } // namespace std diff --git a/patches/core/0019-Don-t-include-version.h.patch b/patches/core/0019-Don-t-include-version.h.patch new file mode 100644 index 0000000..a2eb0bf --- /dev/null +++ b/patches/core/0019-Don-t-include-version.h.patch @@ -0,0 +1,56 @@ +From 7b0d908f0a06d0efb49120103bee139528daaf5c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?S=C3=B6ren=20Tempel?= +Date: Sun, 1 Sep 2019 13:40:05 +0000 +Subject: [PATCH] Don't include version.h + +Version is set using a CPPFLAG. +--- + adb/adb.cpp | 4 +--- + fastboot/fastboot.cpp | 4 +--- + 2 files changed, 2 insertions(+), 6 deletions(-) + +diff --git a/adb/adb.cpp b/adb/adb.cpp +index 687d9f096..8841170ba 100644 +--- a/adb/adb.cpp ++++ b/adb/adb.cpp +@@ -44,8 +44,6 @@ + #include + #include + #include +-#include +-#include + + #include "adb_auth.h" + #include "adb_io.h" +@@ -69,7 +67,7 @@ std::string adb_version() { + "Version %s-%s\n" + "Installed as %s\n", + ADB_VERSION_MAJOR, ADB_VERSION_MINOR, ADB_SERVER_VERSION, +- PLATFORM_TOOLS_VERSION, android::build::GetBuildNumber().c_str(), ++ PLATFORM_TOOLS_VERSION, PLATFORM_TOOLS_VENDOR, + android::base::GetExecutablePath().c_str()); + } + +diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp +index 8923f409d..cc3d2f78e 100644 +--- a/fastboot/fastboot.cpp ++++ b/fastboot/fastboot.cpp +@@ -58,9 +58,7 @@ + #include + #include + #include +-#include + #include +-#include + #include + #include + +@@ -1749,7 +1747,7 @@ int FastBootTool::Main(int argc, char* argv[]) { + setvbuf(stdout, nullptr, _IONBF, 0); + setvbuf(stderr, nullptr, _IONBF, 0); + } else if (name == "version") { +- fprintf(stdout, "fastboot version %s-%s\n", PLATFORM_TOOLS_VERSION, android::build::GetBuildNumber().c_str()); ++ fprintf(stdout, "fastboot version %s-%s\n", PLATFORM_TOOLS_VERSION, PLATFORM_TOOLS_VENDOR); + fprintf(stdout, "Installed as %s\n", android::base::GetExecutablePath().c_str()); + return 0; + #if !defined(_WIN32) diff --git a/patches/core/0020-Include-cstring-in-various-file-missing-it.patch b/patches/core/0020-Include-cstring-in-various-file-missing-it.patch new file mode 100644 index 0000000..56426d2 --- /dev/null +++ b/patches/core/0020-Include-cstring-in-various-file-missing-it.patch @@ -0,0 +1,47 @@ +From 9f3cc5bd8c2004cef236c22c47c05a3be726f5a8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?S=C3=B6ren=20Tempel?= +Date: Sun, 1 Sep 2019 14:22:06 +0000 +Subject: [PATCH] Include cstring in various file missing it + +--- + adb/types.h | 1 + + fs_mgr/liblp/reader.cpp | 1 + + fs_mgr/liblp/writer.cpp | 1 + + 3 files changed, 3 insertions(+) + +diff --git a/adb/types.h b/adb/types.h +index cd1366dfb..1eb7e4b6d 100644 +--- a/adb/types.h ++++ b/adb/types.h +@@ -22,6 +22,7 @@ + #include + #include + #include ++#include + + #include + +diff --git a/fs_mgr/liblp/reader.cpp b/fs_mgr/liblp/reader.cpp +index dcee6d2d8..6fcd613ab 100644 +--- a/fs_mgr/liblp/reader.cpp ++++ b/fs_mgr/liblp/reader.cpp +@@ -19,6 +19,7 @@ + #include + #include + #include ++#include + + #include + +diff --git a/fs_mgr/liblp/writer.cpp b/fs_mgr/liblp/writer.cpp +index bffcb7e6e..1bf95b56b 100644 +--- a/fs_mgr/liblp/writer.cpp ++++ b/fs_mgr/liblp/writer.cpp +@@ -19,6 +19,7 @@ + #include + #include + ++#include + #include + + #include diff --git a/patches/core/0021-Don-t-use-thread-safety-annotations-with-gcc.patch b/patches/core/0021-Don-t-use-thread-safety-annotations-with-gcc.patch new file mode 100644 index 0000000..2155322 --- /dev/null +++ b/patches/core/0021-Don-t-use-thread-safety-annotations-with-gcc.patch @@ -0,0 +1,30 @@ +From 1b0be10ea58e094cbb953501a9deabff96767437 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?S=C3=B6ren=20Tempel?= +Date: Mon, 16 Sep 2019 19:24:15 +0200 +Subject: [PATCH] Don't use thread safety annotations with gcc + +These annotations are primarily useful for detecting race conditions in +code. They don't seem to have any runtime effect and are not supported +by gcc. + +See: https://clang.llvm.org/docs/ThreadSafetyAnalysis.html +--- + base/include/android-base/thread_annotations.h | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/base/include/android-base/thread_annotations.h b/base/include/android-base/thread_annotations.h +index 53fe6dae9..bc62f80bd 100644 +--- a/base/include/android-base/thread_annotations.h ++++ b/base/include/android-base/thread_annotations.h +@@ -18,7 +18,11 @@ + + #include + ++#ifdef __clang__ + #define THREAD_ANNOTATION_ATTRIBUTE__(x) __attribute__((x)) ++#else ++#define THREAD_ANNOTATION_ATTRIBUTE__(x) ++#endif + + #define CAPABILITY(x) \ + THREAD_ANNOTATION_ATTRIBUTE__(capability(x)) diff --git a/patches/e2fsprogs/0001-linux-types.h-seem-to-already-define-__bitwise.patch b/patches/e2fsprogs/0001-linux-types.h-seem-to-already-define-__bitwise.patch index 44544f1..42c4db1 100644 --- a/patches/e2fsprogs/0001-linux-types.h-seem-to-already-define-__bitwise.patch +++ b/patches/e2fsprogs/0001-linux-types.h-seem-to-already-define-__bitwise.patch @@ -1,4 +1,4 @@ -From 31dc73f6fbb0da8f142c46bfc17f1d8bd1dd09e0 Mon Sep 17 00:00:00 2001 +From e575cbedf5e5b061ac83c1db2d0d6efe757f6c7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Tempel?= Date: Tue, 19 Jun 2018 12:44:59 +0000 Subject: [PATCH] linux/types.h seem to already define __bitwise @@ -10,7 +10,7 @@ Thus #undef it before defining it again. 2 files changed, 8 insertions(+) diff --git a/lib/blkid/blkid_types.h b/lib/blkid/blkid_types.h -index a43ed2fe..4a800adb 100644 +index a8d7cff1..4230845a 100644 --- a/lib/blkid/blkid_types.h +++ b/lib/blkid/blkid_types.h @@ -23,6 +23,10 @@ typedef __signed__ long long __s64; @@ -22,10 +22,10 @@ index a43ed2fe..4a800adb 100644 +#undef __force + #ifdef __CHECKER__ + #ifndef __bitwise #define __bitwise __attribute__((bitwise)) - #define __force __attribute__((force)) diff --git a/lib/ext2fs/ext2_types.h b/lib/ext2fs/ext2_types.h -index a43ed2fe..4a800adb 100644 +index a8d7cff1..4230845a 100644 --- a/lib/ext2fs/ext2_types.h +++ b/lib/ext2fs/ext2_types.h @@ -23,6 +23,10 @@ typedef __signed__ long long __s64; @@ -37,5 +37,5 @@ index a43ed2fe..4a800adb 100644 +#undef __force + #ifdef __CHECKER__ + #ifndef __bitwise #define __bitwise __attribute__((bitwise)) - #define __force __attribute__((force)) diff --git a/patches/e2fsprogs/0002-create_inode-don-t-define-copy_file_range-twice.patch b/patches/e2fsprogs/0002-create_inode-don-t-define-copy_file_range-twice.patch deleted file mode 100644 index 4e4ba4d..0000000 --- a/patches/e2fsprogs/0002-create_inode-don-t-define-copy_file_range-twice.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 020c9832b21f5a612dc4c6dc9acdaae110ed2a52 Mon Sep 17 00:00:00 2001 -From: Anatol Pomozov -Date: Tue, 12 Feb 2019 23:52:50 +0100 -Subject: [PATCH] create_inode: don't define copy_file_range twice - -glibc defines a copy_file_range prototype when `_GNU_SOURCE` is set when -`unistd.h` is included. Rename the android function to prevent this -conflict. ---- - misc/create_inode.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/misc/create_inode.c b/misc/create_inode.c -index 1373b46b..e6f34bd9 100644 ---- a/misc/create_inode.c -+++ b/misc/create_inode.c -@@ -403,7 +403,7 @@ static ssize_t my_pread(int fd, void *buf, size_t count, off_t offset) - } - #endif /* !defined HAVE_PREAD64 && !defined HAVE_PREAD */ - --static errcode_t copy_file_range(ext2_filsys fs, int fd, ext2_file_t e2_file, -+static errcode_t e2_copy_file_range(ext2_filsys fs, int fd, ext2_file_t e2_file, - off_t start, off_t end, char *buf, - char *zerobuf) - { -@@ -477,7 +477,7 @@ static errcode_t try_lseek_copy(ext2_filsys fs, int fd, struct stat *statbuf, - - data_blk = data & ~(fs->blocksize - 1); - hole_blk = (hole + (fs->blocksize - 1)) & ~(fs->blocksize - 1); -- err = copy_file_range(fs, fd, e2_file, data_blk, hole_blk, buf, -+ err = e2_copy_file_range(fs, fd, e2_file, data_blk, hole_blk, buf, - zerobuf); - if (err) - return err; -@@ -527,7 +527,7 @@ static errcode_t try_fiemap_copy(ext2_filsys fs, int fd, ext2_file_t e2_file, - } - for (i = 0, ext = ext_buf; i < fiemap_buf->fm_mapped_extents; - i++, ext++) { -- err = copy_file_range(fs, fd, e2_file, ext->fe_logical, -+ err = e2_copy_file_range(fs, fd, e2_file, ext->fe_logical, - ext->fe_logical + ext->fe_length, - buf, zerobuf); - if (err) -@@ -580,7 +580,7 @@ static errcode_t copy_file(ext2_filsys fs, int fd, struct stat *statbuf, - goto out; - #endif - -- err = copy_file_range(fs, fd, e2_file, 0, statbuf->st_size, buf, -+ err = e2_copy_file_range(fs, fd, e2_file, 0, statbuf->st_size, buf, - zerobuf); - out: - ext2fs_free_mem(&zerobuf); diff --git a/patches/extras/0001-Don-t-use-the-internal-glibc-header-sys-cdefs.h.patch b/patches/extras/0001-Don-t-use-the-internal-glibc-header-sys-cdefs.h.patch index eaf99c3..ad9306a 100644 --- a/patches/extras/0001-Don-t-use-the-internal-glibc-header-sys-cdefs.h.patch +++ b/patches/extras/0001-Don-t-use-the-internal-glibc-header-sys-cdefs.h.patch @@ -1,4 +1,4 @@ -From f20a0e43789aa20102a9c4b8f78ac670e7123b79 Mon Sep 17 00:00:00 2001 +From ae66cdec744d81232c58583ae8c3226b7e74d860 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Tempel?= Date: Thu, 13 Sep 2018 23:19:07 +0200 Subject: [PATCH] Don't use the internal glibc header sys/cdefs.h @@ -14,19 +14,18 @@ This patch was created using sed(1) and ag(1) with the following script: https://wiki.musl-libc.org/faq.html#Q:-When-compiling-something-against-musl,-I-get-error-messages-about-sys/cdefs.h --- - ext4_utils/include/ext4_utils/ext4_crypt.h | 9 ++++++--- - .../include/ext4_utils/ext4_crypt_init_extensions.h | 9 ++++++--- - libpagemap/include/pagemap/pagemap.h | 9 ++++++--- - tests/lib/testUtil/include/testUtil.h | 8 ++++++-- - 4 files changed, 24 insertions(+), 11 deletions(-) + libfscrypt/include/fscrypt/fscrypt.h | 9 ++++++--- + libfscrypt/include/fscrypt/fscrypt_init_extensions.h | 9 ++++++--- + tests/lib/testUtil/include/testUtil.h | 8 ++++++-- + 3 files changed, 18 insertions(+), 8 deletions(-) -diff --git a/ext4_utils/include/ext4_utils/ext4_crypt.h b/ext4_utils/include/ext4_utils/ext4_crypt.h -index d410ccfd..29e161f4 100644 ---- a/ext4_utils/include/ext4_utils/ext4_crypt.h -+++ b/ext4_utils/include/ext4_utils/ext4_crypt.h +diff --git a/libfscrypt/include/fscrypt/fscrypt.h b/libfscrypt/include/fscrypt/fscrypt.h +index 8a68b935..06456cdb 100644 +--- a/libfscrypt/include/fscrypt/fscrypt.h ++++ b/libfscrypt/include/fscrypt/fscrypt.h @@ -17,11 +17,12 @@ - #ifndef _EXT4_CRYPT_H_ - #define _EXT4_CRYPT_H_ + #ifndef _FSCRYPT_H_ + #define _FSCRYPT_H_ -#include #include @@ -37,25 +36,25 @@ index d410ccfd..29e161f4 100644 +extern "C" { +#endif - bool e4crypt_is_native(); + bool fscrypt_is_native(); -@@ -34,6 +35,8 @@ static const char* e4crypt_unencrypted_folder = "/unencrypted"; - static const char* e4crypt_key_ref = "/unencrypted/ref"; - static const char* e4crypt_key_mode = "/unencrypted/mode"; +@@ -34,6 +35,8 @@ static const char* fscrypt_unencrypted_folder = "/unencrypted"; + static const char* fscrypt_key_ref = "/unencrypted/ref"; + static const char* fscrypt_key_mode = "/unencrypted/mode"; -__END_DECLS +#ifdef __cplusplus +} +#endif - #endif // _EXT4_CRYPT_H_ -diff --git a/ext4_utils/include/ext4_utils/ext4_crypt_init_extensions.h b/ext4_utils/include/ext4_utils/ext4_crypt_init_extensions.h -index f14d4a99..13873296 100644 ---- a/ext4_utils/include/ext4_utils/ext4_crypt_init_extensions.h -+++ b/ext4_utils/include/ext4_utils/ext4_crypt_init_extensions.h + #endif // _FSCRYPT_H_ +diff --git a/libfscrypt/include/fscrypt/fscrypt_init_extensions.h b/libfscrypt/include/fscrypt/fscrypt_init_extensions.h +index 2b6c46e1..cf0de3f6 100644 +--- a/libfscrypt/include/fscrypt/fscrypt_init_extensions.h ++++ b/libfscrypt/include/fscrypt/fscrypt_init_extensions.h @@ -17,17 +17,20 @@ - #ifndef _EXT4_CRYPT_INIT_EXTENSIONS_H_ - #define _EXT4_CRYPT_INIT_EXTENSIONS_H_ + #ifndef _FSCRYPT_INIT_EXTENSIONS_H_ + #define _FSCRYPT_INIT_EXTENSIONS_H_ -#include #include @@ -68,46 +67,15 @@ index f14d4a99..13873296 100644 // These functions assume they are being called from init // They will not operate properly outside of init - int e4crypt_install_keyring(); - int e4crypt_set_directory_policy(const char* path); + int fscrypt_install_keyring(); + int fscrypt_set_directory_policy(const char* path); -__END_DECLS +#ifdef __cplusplus +} +#endif - #endif // _EXT4_CRYPT_INIT_EXTENSIONS_H_ -diff --git a/libpagemap/include/pagemap/pagemap.h b/libpagemap/include/pagemap/pagemap.h -index b03614e8..80da8485 100644 ---- a/libpagemap/include/pagemap/pagemap.h -+++ b/libpagemap/include/pagemap/pagemap.h -@@ -19,13 +19,14 @@ - - #include - #include --#include - #include - #include - - #include - --__BEGIN_DECLS -+#ifdef __cplusplus -+extern "C" { -+#endif - - typedef struct pm_proportional_swap pm_proportional_swap_t; - -@@ -205,6 +206,8 @@ int pm_map_usage_flags(pm_map_t *map, pm_memusage_t *usage_out, - /* Get the working set of this map alone. */ - int pm_map_workingset(pm_map_t *map, pm_memusage_t *ws_out); - --__END_DECLS -+#ifdef __cplusplus -+} -+#endif - - #endif + #endif // _FSCRYPT_INIT_EXTENSIONS_H_ diff --git a/tests/lib/testUtil/include/testUtil.h b/tests/lib/testUtil/include/testUtil.h index 3b75914d..bdef437d 100644 --- a/tests/lib/testUtil/include/testUtil.h diff --git a/vendor/CMakeLists.adb.txt b/vendor/CMakeLists.adb.txt index 4634bbe..bbd3362 100644 --- a/vendor/CMakeLists.adb.txt +++ b/vendor/CMakeLists.adb.txt @@ -1,22 +1,27 @@ add_library(libadb STATIC - core/adb/console.cpp core/adb/socket_spec.cpp - core/adb/commandline.cpp - core/adb/adb_client.cpp core/adb/services.cpp - core/adb/file_sync_client.cpp core/adb/sysdeps_unix.cpp core/adb/sysdeps/errno.cpp + core/adb/sysdeps/posix/network.cpp core/adb/client/main.cpp + core/adb/client/auth.cpp + core/adb/client/commandline.cpp + core/adb/client/adb_client.cpp core/adb/client/usb_dispatch.cpp core/adb/client/usb_linux.cpp core/adb/client/usb_libusb.cpp + core/adb/client/bugreport.cpp + core/adb/client/file_sync_client.cpp + core/adb/client/line_printer.cpp + core/adb/client/adb_install.cpp + core/adb/client/console.cpp core/adb/sysdeps/posix/network.cpp) target_compile_definitions(libadb PRIVATE -D_GNU_SOURCE) target_compile_definitions(libadb PUBLIC -DADB_HOST=1) target_include_directories(libadb PUBLIC - core/include core/base/include core/adb boringssl/include) + core/include core/base/include core/adb boringssl/include core/libcrypto_utils/include) add_library(libbase STATIC core/base/file.cpp @@ -25,24 +30,26 @@ add_library(libbase STATIC core/base/stringprintf.cpp core/base/strings.cpp core/base/errors_unix.cpp - core/base/test_utils.cpp) + core/base/test_utils.cpp + core/base/mapped_file.cpp + core/base/chrono_utils.cpp + core/base/threads.cpp) target_include_directories(libbase PUBLIC core/base/include core/include) add_library(liblog STATIC - core/liblog/log_event_write.c - core/liblog/fake_log_device.c - core/liblog/log_event_list.c - core/liblog/logger_write.c - core/liblog/config_write.c - core/liblog/config_read.c - core/liblog/logger_lock.c - core/liblog/local_logger.c - core/liblog/fake_writer.c - core/liblog/logger_name.c - core/liblog/stderr_write.c - core/liblog/logprint.c) + core/liblog/log_event_write.cpp + core/liblog/fake_log_device.cpp + core/liblog/log_event_list.cpp + core/liblog/logger_write.cpp + core/liblog/config_write.cpp + core/liblog/config_read.cpp + core/liblog/logger_lock.cpp + core/liblog/fake_writer.cpp + core/liblog/logger_name.cpp + core/liblog/stderr_write.cpp + core/liblog/logprint.cpp) target_compile_definitions(liblog PRIVATE -DLIBLOG_LOG_TAG=1006 -D_XOPEN_SOURCE=700 -DFAKE_LOG_DEVICE=1) @@ -63,11 +70,15 @@ add_library(libcutils STATIC core/libcutils/canned_fs_config.cpp) target_compile_definitions(libcutils PRIVATE -D_GNU_SOURCE) +target_include_directories(libcutils PRIVATE + core/liblog/include core/libutils/include) target_include_directories(libcutils PUBLIC - core/libcutils/include core/include) + core/libcutils/include core/base/include) add_library(libdiagnoseusb STATIC - core/adb/diagnose_usb.cpp) + core/diagnose_usb/diagnose_usb.cpp) +target_include_directories(libdiagnoseusb PUBLIC + core/diagnose_usb/include) target_include_directories(libdiagnoseusb PUBLIC core/include core/base/include) @@ -84,18 +95,17 @@ add_executable(adb core/adb/adb_listeners.cpp core/adb/adb_trace.cpp core/adb/adb_utils.cpp - core/adb/bugreport.cpp - core/adb/line_printer.cpp core/adb/sockets.cpp core/adb/transport.cpp core/adb/transport_local.cpp core/adb/transport_usb.cpp - core/adb/transport_mdns_unsupported.cpp - core/adb/fdevent.cpp - core/adb/adb_auth_host.cpp + core/adb/fdevent/fdevent.cpp + core/adb/fdevent/fdevent_poll.cpp core/adb/shell_service_protocol.cpp) -target_compile_definitions(adb PRIVATE -DADB_VERSION="${ANDROID_VERSION}") +target_compile_definitions(adb PRIVATE + -DPLATFORM_TOOLS_VERSION="${ANDROID_VERSION}" + -DPLATFORM_TOOLS_VENDOR="${ANDROID_VENDOR}") target_include_directories(adb PRIVATE core/include core/base/include core/adb core/libcrypto_utils/include boringssl/include) diff --git a/vendor/CMakeLists.fastboot.txt b/vendor/CMakeLists.fastboot.txt index ed96d44..0d8bfca 100644 --- a/vendor/CMakeLists.fastboot.txt +++ b/vendor/CMakeLists.fastboot.txt @@ -1,9 +1,9 @@ add_library(libsparse STATIC - core/libsparse/backed_block.c - core/libsparse/output_file.c - core/libsparse/sparse.c - core/libsparse/sparse_crc32.c - core/libsparse/sparse_err.c + core/libsparse/backed_block.cpp + core/libsparse/output_file.cpp + core/libsparse/sparse.cpp + core/libsparse/sparse_crc32.cpp + core/libsparse/sparse_err.cpp core/libsparse/sparse_read.cpp) target_include_directories(libsparse PUBLIC @@ -22,12 +22,24 @@ target_include_directories(libutil PUBLIC core/include) add_library(libext4 STATIC - extras/ext4_utils/ext4_utils.c - extras/ext4_utils/wipe.c - extras/ext4_utils/ext4_sb.c) + extras/ext4_utils/ext4_utils.cpp + extras/ext4_utils/wipe.cpp + extras/ext4_utils/ext4_sb.cpp) target_include_directories(libext4 PUBLIC - core/libsparse/include core/include selinux/libselinux/include extras/ext4_utils/include) + core/libsparse/include core/include selinux/libselinux/include + extras/ext4_utils/include core/base/include) + +add_library(libfsmgr STATIC + core/fs_mgr/liblp/reader.cpp + core/fs_mgr/liblp/writer.cpp + core/fs_mgr/liblp/utility.cpp + core/fs_mgr/liblp/partition_opener.cpp + core/fs_mgr/liblp/images.cpp) +target_include_directories(libfsmgr PRIVATE + core/fs_mgr/liblp/include core/base/include + extras/ext4_utils/include core/libsparse/include + boringssl/include) add_library(libselinux STATIC selinux/libselinux/src/callbacks.c @@ -92,10 +104,10 @@ target_include_directories(libsepol PUBLIC selinux/libsepol/include) add_executable(fastboot - core/fastboot/protocol.cpp - core/fastboot/engine.cpp + core/fastboot/fastboot_driver.cpp core/fastboot/bootimg_utils.cpp core/fastboot/fastboot.cpp + core/fastboot/main.cpp core/fastboot/util.cpp core/fastboot/fs.cpp core/fastboot/usb_linux.cpp @@ -106,12 +118,14 @@ add_executable(fastboot target_include_directories(fastboot PRIVATE core/base/include core/include core/adb core/libsparse/include extras/ext4_utils/include extras/f2fs_utils - core/libziparchive/include core/mkbootimg/include/bootimg) + core/libziparchive/include mkbootimg/include/bootimg + core/fs_mgr/liblp/include) target_compile_definitions(fastboot PRIVATE - -DFASTBOOT_VERSION="${ANDROID_VERSION}" + -DPLATFORM_TOOLS_VERSION="${ANDROID_VERSION}" + -DPLATFORM_TOOLS_VENDOR="${ANDROID_VENDOR}" -D_GNU_SOURCE -D_XOPEN_SOURCE=700 -DUSE_F2FS -DANDROID_MKE2FS_NAME="${ANDROID_MKE2FS_NAME}") target_link_libraries(fastboot - libsparse libzip libcutils liblog libutil libbase libext4 - libselinux libsepol libdiagnoseusb + libsparse libzip libcutils liblog libfsmgr libutil + libbase libext4 libselinux libsepol libdiagnoseusb crypto z pcre2-8 pthread dl) diff --git a/vendor/CMakeLists.mke2fs.txt b/vendor/CMakeLists.mke2fs.txt index 6163ce3..361f2f3 100644 --- a/vendor/CMakeLists.mke2fs.txt +++ b/vendor/CMakeLists.mke2fs.txt @@ -91,6 +91,7 @@ add_library(libext2fs STATIC e2fsprogs/lib/support/quotaio.c e2fsprogs/lib/support/quotaio_tree.c e2fsprogs/lib/support/quotaio_v2.c + e2fsprogs/lib/uuid/clear.c e2fsprogs/lib/uuid/gen_uuid.c e2fsprogs/lib/uuid/isnull.c e2fsprogs/lib/uuid/pack.c diff --git a/vendor/CMakeLists.txt b/vendor/CMakeLists.txt index b1388a0..6d1cd21 100644 --- a/vendor/CMakeLists.txt +++ b/vendor/CMakeLists.txt @@ -1,7 +1,7 @@ # TODO: https://cmake.org/cmake/help/v3.0/module/ExternalProject.html # To patch the submodule -add_subdirectory(boringssl) +add_subdirectory(boringssl EXCLUDE_FROM_ALL) set(android-vendored core extras @@ -29,5 +29,11 @@ include(CMakeLists.adb.txt) include(CMakeLists.fastboot.txt) include(CMakeLists.mke2fs.txt) +# Various C++20 features are used across the codebase, e.g. +# std::string_view.starts_with. Additionally, GNU extension +# (such as typeof) are used occasionally. +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11 -Wno-attributes") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++2a -Wno-attributes") + # Targets which should be installed by `make install`. install(TARGETS adb fastboot "${ANDROID_MKE2FS_NAME}" DESTINATION bin) diff --git a/vendor/boringssl b/vendor/boringssl index 45210dd..c9827e0 160000 --- a/vendor/boringssl +++ b/vendor/boringssl @@ -1 +1 @@ -Subproject commit 45210dd4e21ace9d28cb76b3f83303fcdd2efcce +Subproject commit c9827e073f64e353c4891ecc2c73721882543ee0 diff --git a/vendor/core b/vendor/core index cddcc0d..4d954bb 160000 --- a/vendor/core +++ b/vendor/core @@ -1 +1 @@ -Subproject commit cddcc0d9cf7cbba53e54d67455737a3900ae5d9f +Subproject commit 4d954bbff078b339cecf476ef73f69858f486913 diff --git a/vendor/e2fsprogs b/vendor/e2fsprogs index 425d1b4..9be2b64 160000 --- a/vendor/e2fsprogs +++ b/vendor/e2fsprogs @@ -1 +1 @@ -Subproject commit 425d1b42eaeb44558ced57fc50dfb22187d01d05 +Subproject commit 9be2b64ed78d71451bd3d4437cda8817aa210d8b diff --git a/vendor/extras b/vendor/extras index 9ec7ba8..720471e 160000 --- a/vendor/extras +++ b/vendor/extras @@ -1 +1 @@ -Subproject commit 9ec7ba8443caa905c2ebdf6eadd5e6148a348d37 +Subproject commit 720471e8dd58d30fca89bb5c22005f2d5f211c75 diff --git a/vendor/f2fs-tools b/vendor/f2fs-tools index eeedf7c..3997eac 160000 --- a/vendor/f2fs-tools +++ b/vendor/f2fs-tools @@ -1 +1 @@ -Subproject commit eeedf7c7d04c223ea9e27674fd3809b5506ca5f4 +Subproject commit 3997eacde0906d4000f44e599e476a7f5804f815 diff --git a/vendor/mkbootimg b/vendor/mkbootimg new file mode 160000 index 0000000..983425f --- /dev/null +++ b/vendor/mkbootimg @@ -0,0 +1 @@ +Subproject commit 983425fe948027f60562088f270a80abbfb1018c diff --git a/vendor/selinux b/vendor/selinux index ea4e518..e21201b 160000 --- a/vendor/selinux +++ b/vendor/selinux @@ -1 +1 @@ -Subproject commit ea4e5184d243c137da4827e6f83a80014dd86c4b +Subproject commit e21201b375ecb9dd04c6f5ea9a195bf23122a78d