chiark / gitweb /
Attach arm issues with C++ exception unwinding
authorFredrik Fornwall <fredrik@fornwall.net>
Thu, 27 Jul 2017 00:06:37 +0000 (02:06 +0200)
committerFredrik Fornwall <fredrik@fornwall.net>
Thu, 27 Jul 2017 00:06:37 +0000 (02:06 +0200)
See https://github.com/android-ndk/ndk/issues/379

Fixes #1163

Fixes issues with gdb segfaulting on arm on an unrecognized command.

build-package.sh
packages/gdb/build.sh
packages/libprotobuf/build.sh
packages/mosh/build.sh

index 8b84f0e4e4656255bd3b6741369f2ba44a86f75a..e502b17874bfb02bd008c385fd67fa0c256a6826 100755 (executable)
@@ -562,6 +562,22 @@ termux_step_setup_toolchain() {
                           $_TERMUX_TOOLCHAIN_TMPDIR/aarch64-linux-android/bin/ld
                fi
 
+               if [ "$TERMUX_ARCH" = "arm" ]; then
+                       # Linker wrapper script to add '--exclude-libs libgcc.a', see
+                       # https://github.com/android-ndk/ndk/issues/379
+                       # https://android-review.googlesource.com/#/c/389852/
+                       local linker
+                       for linker in ld ld.bfd ld.gold; do
+                               local wrap_linker=$_TERMUX_TOOLCHAIN_TMPDIR/$TERMUX_HOST_PLATFORM/bin/$linker
+                               local real_linker=$_TERMUX_TOOLCHAIN_TMPDIR/$TERMUX_HOST_PLATFORM/bin/$linker.real
+                               cp $wrap_linker $real_linker
+                               echo '#!/bin/bash' > $wrap_linker
+                               echo -n '`dirname $0`/' >> $wrap_linker
+                               echo -n $linker.real >> $wrap_linker
+                               echo ' --exclude-libs libgcc.a "$@"' >> $wrap_linker
+                       done
+               fi
+
                cd $_TERMUX_TOOLCHAIN_TMPDIR/sysroot
 
                for f in $TERMUX_SCRIPTDIR/ndk-patches/*.patch; do
@@ -598,8 +614,8 @@ termux_step_setup_toolchain() {
        fi
 
        local _STL_LIBFILE_NAME=libc++_shared.so
-       if [ ! -f $TERMUX_PREFIX/lib/libstdc++.so ] || [ `readlink $TERMUX_PREFIX/lib/libstdc++.so` != $_STL_LIBFILE_NAME ]; then
-               # Setup libgnustl_shared.so in $PREFIX/lib and libstdc++.so as a symlink to it,
+       if [ ! -f $TERMUX_PREFIX/lib/libstdc++.so ]; then
+               # Setup libgnustl_shared.so in $PREFIX/lib and libstdc++.so as a link to it,
                # so that other C++ using packages links to it instead of the default android
                # C++ library which does not support exceptions or STL:
                # https://developer.android.com/ndk/guides/cpp-support.html
@@ -622,7 +638,12 @@ termux_step_setup_toolchain() {
                cp "$_STL_LIBFILE" .
                $STRIP --strip-unneeded $_STL_LIBFILE_NAME
                $TERMUX_ELF_CLEANER $_STL_LIBFILE_NAME
-               ln -f -s $_STL_LIBFILE_NAME libstdc++.so
+               if [ $TERMUX_ARCH = "arm" ]; then
+                       # Use a linker script to get libunwind.a.
+                       echo 'INPUT(-lunwind -lc++_shared)' > libstdc++.so
+               else
+                       ln -f $_STL_LIBFILE_NAME libstdc++.so
+               fi
        fi
 
        export PKG_CONFIG_LIBDIR="$TERMUX_PKG_CONFIG_LIBDIR"
index 12155c8941113d3f134c226da905d58c4356fe1c..d96cc59fd55cdc1a2a3a4454db3d4555fddff1d6 100755 (executable)
@@ -2,6 +2,7 @@ TERMUX_PKG_HOMEPAGE=https://www.gnu.org/software/gdb/
 TERMUX_PKG_DESCRIPTION="The standard GNU Debugger that runs on many Unix-like systems and works for many programming languages"
 TERMUX_PKG_DEPENDS="liblzma, libexpat, readline"
 TERMUX_PKG_VERSION=8.0
+TERMUX_PKG_REVISION=1
 TERMUX_PKG_SRCURL=https://mirrors.kernel.org/gnu/gdb/gdb-${TERMUX_PKG_VERSION}.tar.xz
 TERMUX_PKG_SHA256=f6a24ffe4917e67014ef9273eb8b547cb96a13e5ca74895b06d683b391f3f4ee
 # gdb can not build with our normal --disable-static: https://sourceware.org/bugzilla/show_bug.cgi?id=15916
index caa6b91b6398d39d90b2c6bbb85714b25bca0a12..df885f15ae1a699f11bbe1f2a0a929a72691f5ce 100755 (executable)
@@ -1,7 +1,7 @@
 TERMUX_PKG_HOMEPAGE=https://github.com/google/protobuf
 TERMUX_PKG_DESCRIPTION="Protocol buffers C++ library"
 TERMUX_PKG_VERSION=3.3.2
-TERMUX_PKG_REVISION=1
+TERMUX_PKG_REVISION=2
 TERMUX_PKG_SRCURL=https://github.com/google/protobuf/archive/v${TERMUX_PKG_VERSION}.tar.gz
 TERMUX_PKG_SHA256=8b8e442becbeff637f160c1ef4a3a56769c50ba7c9ff939ccc94086530ff00e4
 TERMUX_PKG_FOLDERNAME=protobuf-$TERMUX_PKG_VERSION
index 52d5fd9f9d0f505818806598bfdb1085f607b9c4..ee165c682a3bac4907291b5672e081bcb0000319 100644 (file)
@@ -1,6 +1,7 @@
 TERMUX_PKG_HOMEPAGE=https://mosh.org
 TERMUX_PKG_DESCRIPTION="Mobile shell that supports roaming and intelligent local echo"
 TERMUX_PKG_VERSION=1.3.2
+TERMUX_PKG_REVISION=1
 TERMUX_PKG_SHA256=da600573dfa827d88ce114e0fed30210689381bbdcff543c931e4d6a2e851216
 TERMUX_PKG_SRCURL=https://github.com/mobile-shell/mosh/releases/download/mosh-${TERMUX_PKG_VERSION}/mosh-${TERMUX_PKG_VERSION}.tar.gz
 TERMUX_PKG_FOLDERNAME=mosh-$TERMUX_PKG_VERSION