summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenda Xu <heroxbd@gentoo.org>2018-08-13 23:30:15 +0900
committerBenda Xu <heroxbd@gentoo.org>2018-08-13 23:37:32 +0900
commit18a05d2fff4c7dd9c720930b06ca184efb1622e2 (patch)
treed41bb3ca8e4c878e1f8afee3f3d38a554ed2994c
parentdev-util/soong: Combined hack to support gentoo toolchain. (diff)
downloadandroid-18a05d2fff4c7dd9c720930b06ca184efb1622e2.tar.gz
android-18a05d2fff4c7dd9c720930b06ca184efb1622e2.tar.bz2
android-18a05d2fff4c7dd9c720930b06ca184efb1622e2.zip
sys-libs/bionic: port bionic to gentoo toolchain.
binutils-2.29 errors on overlapping eh-frame-hdr, so disable it. The ELF field is only useful for stack trace. Explicitly link against libgcc_s for Unwind. The android prebuilt toolchain has bundled libgcc_s into libgcc. Remove the visibility hack on libutils introduced in https://android.googlesource.com/platform/system/core/+/96ccb85fa226d74b82ba0e6f69e5439f4a81adf3 glibc-2.26 does not ship RPC anymore, symlink tirpc because soong pretends that it cannot access anything outside the work directory. Generate llvm-tblgen, google has rewritten it into a completely different program, despite the name collision with upstream llvm. Remove binary build of demangle and zlib. Remove all windows host builds. Package-Manager: Portage-2.3.40, Repoman-2.3.9
-rw-r--r--sys-libs/bionic/Manifest10
-rw-r--r--sys-libs/bionic/bionic-8.1.0_p41.ebuild39
-rw-r--r--sys-libs/bionic/files/amd64-soong.variables3
-rw-r--r--sys-libs/bionic/files/bionic-binutils-port.patch36
-rw-r--r--sys-libs/bionic/files/bionic-glibc-port.patch65
-rw-r--r--sys-libs/bionic/files/bionic-no-visibility-hack.patch13
-rw-r--r--sys-libs/bionic/files/bionic-unwind-gcc_s.patch40
7 files changed, 195 insertions, 11 deletions
diff --git a/sys-libs/bionic/Manifest b/sys-libs/bionic/Manifest
index 79f2b9c..f7e5c6a 100644
--- a/sys-libs/bionic/Manifest
+++ b/sys-libs/bionic/Manifest
@@ -1,5 +1,8 @@
-AUX amd64-soong.variables 1816 BLAKE2B 1e9517739ddb81abf79643dbc0dd5d9431a43dcd94d28f8cc75f1ba13961768a882379bda3b58dba3c290010e8b64a2d4e63497080561fe84fb0ccd2e80695bc SHA512 97f9bddd86c228c75a53ece728b44fb890d737dc2ef422ae7c074169f657e66e084523d7efbb5f0eb37823a2a58e8bfb4aa66e09b5e2a6c6f3be1ff114dec0c5
-AUX bionic-glibc-port.patch 1103 BLAKE2B 5459570f68469ac854735103474ff94097183dafe25d82beae968ff265be32df1c3dd8f0607ef4e44572ac5dc5ebb0e6a9dab1a7f6f7b3887cf792f59bb4916d SHA512 f84f613dad932d42170247d8754fea43825a064c1f5689a0f9fd889a925606eb388e44dbd8c89132641fbfeab4d759ef48d5df7ecef42b933f8ac7477538711a
+AUX amd64-soong.variables 1720 BLAKE2B ecbbc9404f714b47a64a6c31f29a4ba8fe4e803182ad59bbf786af42dd0e4818812707137f6144373cc88673c1fb861266e1a7633ff3a11c712ba87e786c6985 SHA512 bca04367b2535184cff7bcffe3c43cb2dd1090f373aa8352c19566f7f408970e3bf80c67a692d62189c9c6411fa455bf8d4d60fb6fd41be31cffebaddb86f341
+AUX bionic-binutils-port.patch 1152 BLAKE2B a50612ed7aecadc117bbe1e0b5f4675431d61b368ace7a77fade9c296403efa2aa60be2ee25d3c26a7ba7b8e0f3ce091af73d8432147c0fe5219fb1b193c0d06 SHA512 d2a89e8fc4cb7f4cdb6abbdf2536368c8f4a4340d1197977b9626df89445ba77d233e1760c569916e5da18b76b17e84ce2d8cbac1cb03e67d05ca8b1eeed46d8
+AUX bionic-glibc-port.patch 4112 BLAKE2B 26471da03d2471f0b3674fd26d2e7f7893631421366d7e2bb0c15f1228fa944e0195c3159d3f62e4cbc3fc0133063164eb4f72552d08728375b6c56b1d703512 SHA512 183eb20f64f203d7c814551d63acb351c34d91c4c1be8caa9ce88a6f5b8fad2f3ee2fcabc62e33a966cb5a082265ccb2b7cc32f44174bd644e5714c6116da2e5
+AUX bionic-no-visibility-hack.patch 456 BLAKE2B 659b5d940d198bb2d7bb0b8464abe6dcb1339f76ea46b8f62cd376d2e55a97cdde303a3d5e1c02b7a8a0aa56f47b5172e89c4b035a256b2e52a4c126148208e4 SHA512 604ac7152d74725980dc19f18427a6afbceb845be9e016e4ecec0778e636fb85c7c34075550edf9cf227939fb46f82b2a1903c27b2bdb6aacc3909798948ce51
+AUX bionic-unwind-gcc_s.patch 1463 BLAKE2B aa2caad4b0400a48e25eb53c726d01806751d06fe06d819e16109cbe180cb7c987f545ad808cf3ee2784c743b9eafcb1234657c1c55884d7546278a79061b812 SHA512 23f2ad6c934cee8636a284b2010791dc4a04122b09faf3013b3e87cb0015a87083df67081ca2e6b18fd7ffb54df5929313ab4b482739f1028c6a31d7d93c8889
DIST bionic-8.1.0_p41.tar.gz 3517518 BLAKE2B 4c5121cda0e3562b3b65d8e7fa621c6e231973077d582b7d4abf861d03533fd4881901bd48ec971d5baaf155dc8f1a92eb62068a910199fa751fb3001d20d0ba SHA512 b110b46e9f67174f8f30f3b8da0e0fa02c42f2dbb5ced6a9ba9ad948d6cd0a82c1850e8a8d4cd5f3b81ad286e9eb400236fb5320ab02b72f44a0510829cd3e6d
DIST build-8.1.0_p41.tar.gz 2587534 BLAKE2B 5a0eb0dab1d41c60b8eb2e14c5f6e82584ed57e63541fcfc1087f841d8206bb45302b341cff5754ca641e392ed3cccca7ab4609932620fe100aba37ff61679b1 SHA512 a4b0f24800055cc9e433b578c9e1ae7f511959512459cb916b63fd3ec9312fe272858117f15beea28a60464a04fd8fd17a7bfb6772b346edecfb387aad89a97d
DIST compiler-rt-8.1.0_p41.tar.gz 2377259 BLAKE2B 09104aba4ef1dc9ce18609cae395f3849d3df6dbb9b9759c3a1532759afd52d7af37475df21ae2db3bbea0891f9974785833405c3731d0082e749c304a86bc89 SHA512 9472ca3fed7a0215f6bd7506f5ba722891c65f9a88a4296c57a69bd038854ad416b7ce433d11451408c632ec23b3f19c4a3fc6373a7955c27563d7786301b6de
@@ -9,8 +12,9 @@ DIST libcxx-8.1.0_p41.tar.gz 2346631 BLAKE2B ba37b446d722108dba6d970e07f3ce63ed4
DIST libcxxabi-8.1.0_p41.tar.gz 709877 BLAKE2B 31ccf771a7397e9207bac222b9ac24bdba07103508426782f743dd0b7766702eac6db22edcfe214135b41f4bec7b12d148fae62fce27348c38fecadc3b127659 SHA512 7c26527f569464e93893e4fe31032b18bf9553ef1bd695a0177bdf4e6a8462040a6694f2b87eee0265f777da9ca5f4ebf2be302c6aaec86bbbfbf2f41785bd96
DIST libunwind-8.1.0_p41.tar.gz 444441 BLAKE2B e02b2a5f9be17ffa61d607f4e7a0f878d77d3f26f195f9f2a5f6cdb043508aabefff2f18b1e6844700d50b984bc2331bd4f897c1bda73a9edc05f23e656b89f2 SHA512 e47282f05baf3accb87b8d7164790929789e84ec4c2542c1da6553ead10558529f4a15d478f43970f4c5ca0ddbd4ce86d96e2aa0c4b859fff24f398e6779ca5d
DIST libunwind_llvm-8.1.0_p41.tar.gz 90999 BLAKE2B 3ebd73a228513548ee9f6f84ab22190b9eed4b29b28acde5ed9e7dc8211691629a04980b04712d50fe3f1690e2e4e4df823c818ddd8e23448d4840029bb7acd2 SHA512 2a433a5c929b65e4738b9507a807c005aab22ba303676145806d000db9a21b04f6589282a15f36a4be725099501eccfce07349f5734871d59f09e1f732a6dae3
+DIST llvm-8.1.0_p41.tar.gz 26253027 BLAKE2B 50687a47c6a271d0881f6a115d25a698c3fc86d9477cafe361147beaaf4b3c2dd8599391287141f20efa2db8e0be183eed2d44744269b50471c1364a2f6f7687 SHA512 dbc7848cbc7d48c5b4d02fcc855aea57bf1922e8c116cd4f8424826d6aa49569474298f371561360cc2af6050c175b90296eec359443a9a81f65a8cf309fd27b
DIST lzma-8.1.0_p41.tar.gz 733693 BLAKE2B 733b0995778adce01af50b9f22276ec4a54d3c73ff7b9709a6b3c0327dd89c0a785cb991dbd3343e4e7b9c5eb9009afaea3d78db993a48e1dcbaa9807fdaf7ff SHA512 4cebceabb9096c19ccf3ab25ef27d4ce6f1655e431c6381f888345613f310509864135bc0ee7fd78dc5f1170521effea2113f149e71cca56a07254566755c0c5
DIST safe-iop-8.1.0_p41.tar.gz 10800 BLAKE2B 02959e9a0f02259362bfbe840eae50bdfa429b09de8f56f8beec2f99697eabb4a0a71a175a79a52f943facded257a68bff383a53acbe61249b76fe2ff95911e1 SHA512 8b717408601194b76a6a44fec5bd62ff2121b89f5f8fea7b3eee7ca46c122e346f8d73d92f5b34575318b1015e74186affda1e1aca7b53ac9c3c303d4e8e7710
DIST zlib-8.1.0_p41.tar.gz 607311 BLAKE2B b175cf9d4548df24cfd587abea62ee4c3dcee56f6a68b4044c4b1419be148ab4542c42cb19ce0d773b247ceaf3193afca385170674c9d6d2f92a4df8f6d346ba SHA512 0d587729c1210ee6efa6bb7cdac723da71a9c56252be67f6973e80c3597dbb7f2c96ea093078e580d97709de5e8d8fabf92aae0594f382b95e2d9559e43953d2
-EBUILD bionic-8.1.0_p41.ebuild 2514 BLAKE2B f42b461e16eb666a1c9165642f3d9e8f0e0c89fbe1245f0c4e2b85ccaebdd693566bfafec6c8477f379c59e304d3747bf1f98e43ad6a793b76e690e79671786e SHA512 85879143e1e44943094737d9a4d615864fbfaa563946118c63642031d800628f71032c39bac4faddfc9f6b8c3d499635729d1e3997342661e9f795cea27530f2
+EBUILD bionic-8.1.0_p41.ebuild 3428 BLAKE2B 6f2a309f12e200acfd42eaa5f5eab13720e15476c0015e785136ce5b06e613724e338dd3a6d210515b20c5769e33ed4d18a942065647bea0ac5444993849e119 SHA512 0caf25d16d3d06768578c981fed5cdc0bfecb20767f3b8bac95f130c77776613693ec84de5d74dc936e6b921937b934b3fd63d1a67f334b7cbed8c6ba8992dd3
MISC metadata.xml 242 BLAKE2B 08b4880748ab6d685ce28f65a9f6cc5ad62deff8f85d4e0a55a3dc12aa8bd63cf1de56b28ff89929e054a6831e223d6ef0207e8b19c6887f09ee22621bd76928 SHA512 ae57aaeecc094cffa640d88329a0baa6c2b0703330d84f6406f3f68d8bb9b724d2e19a8478be8708de284db9ac452f95f225a9f79cd1c5d0236aa2f9935b9b21
diff --git a/sys-libs/bionic/bionic-8.1.0_p41.ebuild b/sys-libs/bionic/bionic-8.1.0_p41.ebuild
index 434bff6..fcd6271 100644
--- a/sys-libs/bionic/bionic-8.1.0_p41.ebuild
+++ b/sys-libs/bionic/bionic-8.1.0_p41.ebuild
@@ -9,7 +9,8 @@ DESCRIPTION="Lightweight libc of Android."
HOMEPAGE="https://android.googlesource.com/platform/bionic"
KEYWORDS="~amd64"
-SM=( ${PN} build external/{safe-iop,libcxx{,abi},compiler-rt,libunwind{,_llvm},lzma,zlib,jemalloc} system/core )
+SM=( ${PN} build external/{llvm,safe-iop,libcxx{,abi},compiler-rt,libunwind{,_llvm},lzma,zlib,jemalloc}
+ system/core )
for m in ${SM[@]}; do
SRC_URI+="http://aosp.airelinux.org/platform/${m}/+archive/android-${PV/p/r}.tar.gz -> ${m##*/}-${PV}.tar.gz"$'\n'
@@ -18,9 +19,15 @@ SLOT=0
LICENSE="Apache-2.0"
-DEPEND="dev-util/soong"
+DEPEND="dev-util/soong
+ dev-libs/libpcre2
+ net-libs/libtirpc"
-PATCHES=( "${FILESDIR}"/bionic-glibc-port.patch )
+PATCHES=( "${FILESDIR}"/bionic-glibc-port.patch
+ "${FILESDIR}"/bionic-binutils-port.patch
+ "${FILESDIR}"/bionic-unwind-gcc_s.patch
+ "${FILESDIR}"/bionic-no-visibility-hack.patch
+ )
src_unpack() {
for m in ${SM[@]}; do
@@ -39,10 +46,19 @@ src_prepare() {
cp "${EPREFIX}"/usr/share/soong/root.bp Android.bp || die
ln -s "${EPREFIX}"/usr/share/soong build || die
+ ln -s "${EPREFIX}"/usr/include/tirpc external/ || die
# Remove ndk libraries. But keep ndk headers, because they are the
# headers of the GNU/Linux sense.
sed -e '/ndk_library/,/subdir/{/subdir/p;d}' -i bionic/libc/Android.bp || die
+ # only llvm headers and llvm_tblgen are needed.
+ sed -e '/^force_build_llvm/,$d' -i external/llvm/Android.bp || die
+ cat >> external/llvm/Android.bp <<EOF
+subdirs = [ "utils/TableGen", "lib/TableGen", "lib/Support" ]
+EOF
+
+ # -O0 is not compatible with -DFORTIFY_SOURCE
+ sed -e '/cflags.*O0/d' -i system/core/libbacktrace/Android.bp || die
local core_keep=( base liblog debuggerd libziparchive libbacktrace libcutils demangle \
Android.bp include libutils libsystem libvndksupport )
@@ -53,12 +69,22 @@ src_prepare() {
done
rm -r system/core_delete || die
+ # do not need binaries for a libc.
+ sed -e '/cc_binary {/,$d' -i system/core/demangle/Android.bp \
+ -i external/zlib/Android.bp || die
+
find "${WORKDIR}" -name Android.bp -exec sed -e '/cc_test.*{/,$d' \
-e "/\ssdk_version/d" \
-e '/ndk_library/,$d' \
-i {} \; || die
+
+ # remove windows recipes.
+ for f in $(find "${WORKDIR}" -name Android.bp); do
+ pcre2grep -M -v '\swindows: (\{(?>[^{}]|(?1))*\})' < "${f}" > "${f}".tmp || die
+ mv "${f}".tmp "${f}" || die
+ done
+
sed -e '/ANDROIDMK TRANSLATION ERROR/,$d' -i external/compiler-rt/lib/asan/Android.bp || die
- sed -e '/llvm-headers/d' -i system/core/libbacktrace/Android.bp || die
mkdir out || die
echo "{}" >> out/soong.config || die
cp "${FILESDIR}"/${ARCH}-soong.variables out/soong.variables || die
@@ -75,3 +101,8 @@ src_configure() {
src_compile() {
eninja -f out/build.ninja -v
}
+
+src_install() {
+ insinto /
+ doins -r out/target/product/*/system
+}
diff --git a/sys-libs/bionic/files/amd64-soong.variables b/sys-libs/bionic/files/amd64-soong.variables
index 9b1aebd..0f112ec 100644
--- a/sys-libs/bionic/files/amd64-soong.variables
+++ b/sys-libs/bionic/files/amd64-soong.variables
@@ -53,9 +53,6 @@
"HostArch": "x86_64",
"HostSecondaryArch": "x86",
- "CrossHost": "windows",
- "CrossHostArch": "x86",
- "CrossHostSecondaryArch": "x86_64",
"Safestack": false,
"EnableCFI": true,
"IntegerOverflowExcludePaths": ["",""],
diff --git a/sys-libs/bionic/files/bionic-binutils-port.patch b/sys-libs/bionic/files/bionic-binutils-port.patch
new file mode 100644
index 0000000..09f98ab
--- /dev/null
+++ b/sys-libs/bionic/files/bionic-binutils-port.patch
@@ -0,0 +1,36 @@
+Index: bionic-8.1.0_p41/bionic/libc/Android.bp
+===================================================================
+--- bionic-8.1.0_p41.orig/bionic/libc/Android.bp
++++ bionic-8.1.0_p41/bionic/libc/Android.bp
+@@ -1800,6 +1800,7 @@ cc_library {
+ shared_libs: ["libdl"],
+ whole_static_libs: ["libc_common", "libjemalloc"],
+
++ ldflags: ["-Wl,--no-eh-frame-hdr"],
+ nocrt: true,
+
+ arch: {
+Index: bionic-8.1.0_p41/bionic/libm/Android.bp
+===================================================================
+--- bionic-8.1.0_p41.orig/bionic/libm/Android.bp
++++ bionic-8.1.0_p41/bionic/libm/Android.bp
+@@ -277,6 +277,7 @@ cc_library {
+ },
+ },
+
++ ldflags: ["-Wl,--no-eh-frame-hdr"],
+ // arch-specific settings
+ arch: {
+ arm: {
+Index: bionic-8.1.0_p41/bionic/linker/Android.bp
+===================================================================
+--- bionic-8.1.0_p41.orig/bionic/linker/Android.bp
++++ bionic-8.1.0_p41/bionic/linker/Android.bp
+@@ -78,6 +78,7 @@ cc_binary {
+ "-shared",
+ "-Wl,-Bsymbolic",
+ "-Wl,--exclude-libs,ALL",
++ "-Wl,--no-eh-frame-hdr"
+ ],
+
+ cflags: [
diff --git a/sys-libs/bionic/files/bionic-glibc-port.patch b/sys-libs/bionic/files/bionic-glibc-port.patch
index c1baaed..0edab91 100644
--- a/sys-libs/bionic/files/bionic-glibc-port.patch
+++ b/sys-libs/bionic/files/bionic-glibc-port.patch
@@ -2,7 +2,15 @@ Index: bionic-8.1.0_p41/system/core/libbacktrace/include/backtrace/Backtrace.h
===================================================================
--- bionic-8.1.0_p41.orig/system/core/libbacktrace/include/backtrace/Backtrace.h
+++ bionic-8.1.0_p41/system/core/libbacktrace/include/backtrace/Backtrace.h
-@@ -68,7 +68,6 @@ struct __darwin_ucontext;
+@@ -19,6 +19,7 @@
+
+ #include <inttypes.h>
+ #include <stdint.h>
++#include <ucontext.h>
+
+ #include <string>
+ #include <vector>
+@@ -68,7 +69,6 @@ struct __darwin_ucontext;
typedef __darwin_ucontext ucontext_t;
#else
struct ucontext;
@@ -22,3 +30,58 @@ Index: bionic-8.1.0_p41/external/libcxx/include/__locale
#elif defined(_LIBCPP_HAS_MUSL_LIBC)
# include <support/musl/xlocale.h>
#endif // __GLIBC__ || __APPLE__ || __FreeBSD__ || __sun__ || __EMSCRIPTEN__ || __IBMCPP__
+Index: bionic-8.1.0_p41/external/compiler-rt/lib/sanitizer_common/Android.bp
+===================================================================
+--- bionic-8.1.0_p41.orig/external/compiler-rt/lib/sanitizer_common/Android.bp
++++ bionic-8.1.0_p41/external/compiler-rt/lib/sanitizer_common/Android.bp
+@@ -23,7 +23,8 @@ cc_library_static {
+ host_supported: true,
+ clang: true,
+
+- include_dirs: ["external/compiler-rt/lib"],
++ include_dirs: ["external/compiler-rt/lib",
++ "external/tirpc"],
+ cppflags: [
+ "-fvisibility=hidden",
+ "-fno-exceptions",
+Index: bionic-8.1.0_p41/external/compiler-rt/lib/sanitizer_common/sanitizer_linux.h
+===================================================================
+--- bionic-8.1.0_p41.orig/external/compiler-rt/lib/sanitizer_common/sanitizer_linux.h
++++ bionic-8.1.0_p41/external/compiler-rt/lib/sanitizer_common/sanitizer_linux.h
+@@ -30,8 +30,8 @@ struct linux_dirent;
+
+ // Syscall wrappers.
+ uptr internal_getdents(fd_t fd, struct linux_dirent *dirp, unsigned int count);
+-uptr internal_sigaltstack(const struct sigaltstack* ss,
+- struct sigaltstack* oss);
++uptr internal_sigaltstack(const void* ss,
++ void* oss);
+ uptr internal_sigprocmask(int how, __sanitizer_sigset_t *set,
+ __sanitizer_sigset_t *oldset);
+
+Index: bionic-8.1.0_p41/external/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
+===================================================================
+--- bionic-8.1.0_p41.orig/external/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
++++ bionic-8.1.0_p41/external/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
+@@ -273,7 +273,7 @@ static int TracerThread(void* argument)
+
+ // Alternate stack for signal handling.
+ InternalScopedBuffer<char> handler_stack_memory(kHandlerStackSize);
+- struct sigaltstack handler_stack;
++ stack_t handler_stack;
+ internal_memset(&handler_stack, 0, sizeof(handler_stack));
+ handler_stack.ss_sp = handler_stack_memory.data();
+ handler_stack.ss_size = kHandlerStackSize;
+Index: bionic-8.1.0_p41/external/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc
+===================================================================
+--- bionic-8.1.0_p41.orig/external/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc
++++ bionic-8.1.0_p41/external/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc
+@@ -282,7 +282,7 @@ void InitializePlatform() {
+ int ExtractResolvFDs(void *state, int *fds, int nfd) {
+ #if SANITIZER_LINUX && !SANITIZER_ANDROID
+ int cnt = 0;
+- __res_state *statp = (__res_state*)state;
++ struct __res_state *statp = (struct __res_state*)state;
+ for (int i = 0; i < MAXNS && cnt < nfd; i++) {
+ if (statp->_u._ext.nsaddrs[i] && statp->_u._ext.nssocks[i] != -1)
+ fds[cnt++] = statp->_u._ext.nssocks[i];
diff --git a/sys-libs/bionic/files/bionic-no-visibility-hack.patch b/sys-libs/bionic/files/bionic-no-visibility-hack.patch
new file mode 100644
index 0000000..326fffc
--- /dev/null
+++ b/sys-libs/bionic/files/bionic-no-visibility-hack.patch
@@ -0,0 +1,13 @@
+Index: bionic-8.1.0_p41/system/core/libutils/Android.bp
+===================================================================
+--- bionic-8.1.0_p41.orig/system/core/libutils/Android.bp
++++ bionic-8.1.0_p41/system/core/libutils/Android.bp
+@@ -99,8 +99,6 @@ cc_library {
+ "Trace.cpp",
+ ],
+
+- cflags: ["-fvisibility=protected"],
+-
+ shared_libs: [
+ "libbacktrace",
+ "libcutils",
diff --git a/sys-libs/bionic/files/bionic-unwind-gcc_s.patch b/sys-libs/bionic/files/bionic-unwind-gcc_s.patch
new file mode 100644
index 0000000..4df2a5c
--- /dev/null
+++ b/sys-libs/bionic/files/bionic-unwind-gcc_s.patch
@@ -0,0 +1,40 @@
+Index: bionic-8.1.0_p41/external/libcxx/Android.bp
+===================================================================
+--- bionic-8.1.0_p41.orig/external/libcxx/Android.bp
++++ bionic-8.1.0_p41/external/libcxx/Android.bp
+@@ -87,6 +87,7 @@ cc_library_shared {
+ target: {
+ android: {
+ shared_libs: ["libdl"],
++ ldflags: ["-Wl,-lgcc_s"],
+ },
+ android_arm: {
+ static_libs: ["libunwind_llvm"],
+Index: bionic-8.1.0_p41/external/libunwind/Android.bp
+===================================================================
+--- bionic-8.1.0_p41.orig/external/libunwind/Android.bp
++++ bionic-8.1.0_p41/external/libunwind/Android.bp
+@@ -404,6 +404,7 @@ cc_library {
+ target: {
+ android: {
+ shared_libs: ["libdl"],
++ ldflags: ["-Wl,-lgcc_s"],
+ },
+ linux: {
+ ldflags: ["-nostdlib"],
+Index: bionic-8.1.0_p41/bionic/linker/Android.bp
+===================================================================
+--- bionic-8.1.0_p41.orig/bionic/linker/Android.bp
++++ bionic-8.1.0_p41/bionic/linker/Android.bp
+@@ -148,9 +148,11 @@ cc_binary {
+ target: {
+ android: {
+ static_libs: ["libdebuggerd_client"],
++ ldflags: ["-Wl,-lgcc_s"],
+ },
+ android64: {
+ cflags: ["-DTARGET_IS_64_BIT"],
++ ldflags: ["-Wl,-lgcc_s"],
+ },
+ linux_bionic: {
+ cflags: ["-DTARGET_IS_64_BIT"],