blob: fe5c035545f8713bcbedfcda92a23641f93386ab [file] [log] [blame]
#!/bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
set -o errtrace
trap 'echo Fatal error: script $0 aborting at line $LINENO, command \"$BASH_COMMAND\" returned $?; exit 1' ERR
gdbserver_version=8.0.1
# Upgrade gdbserver ${gdbserver_version}
function build_gdbserver {
pushd ${SCRIPT_DIR}
local readonly arch=${1}
local readonly abi=${2}
local readonly name=${arch}-cros-linux-${abi}
# 5. Install gdbserver ${gdbserver_version}
wget https://ftp.gnu.org/gnu/gdb/gdb-${gdbserver_version}.tar.gz
tar -xf gdb-${gdbserver_version}.tar.gz
# patch the gdb-8.0.1 to pass compilation w/ glibc 2.32
pushd gdb-${gdbserver_version}
patch -p1 < ../fix_gdb-8.0.1_glibc-2.32.patch
popd
pushd gdb-${gdbserver_version}/gdb/gdbserver
PATH=`pwd`/../../../${arch}/usr/bin/:$PATH ; ./configure --host=${name} \
CC=${name}-clang CXX=${name}-clang++ CFLAGS="-stdlib=libc++" LDFLAGS="-stdlib=libc++ --rtlib=compiler-rt"
make -j50
popd
cp gdb-${gdbserver_version}/gdb/gdbserver/gdbserver ${arch}/usr/${arch}-cros-linux-${abi}/usr/bin/gdbserver
rm -rf gdb-*
popd # ${SCRIPT_DIR}
}
build_gdbserver armv7a gnueabihf
build_gdbserver aarch64 gnu