diff --git a/altcross-2stage.sh b/altcross-2stage.sh index a225dca..de4c81d 100755 --- a/altcross-2stage.sh +++ b/altcross-2stage.sh @@ -3,6 +3,9 @@ set -e set -x TARGET=aarch64-linux-gnu +ARCH=aarch64 +LINUX_ARCH=arm64 +QEMU_ARCH=aarch64 unset NIL @@ -103,7 +106,7 @@ make -j$(nproc) install-gcc install-target-libgcc DESTDIR="$BOOTSTRAP_INSTALLDIR make -j$(nproc) \ -C "$SRCDIR/linux" \ O="$BUILDDIR/obj_linux" \ - ARCH=arm64 \ + ARCH=${LINUX_ARCH} \ INSTALL_HDR_PATH="$SYSROOTDIR/usr" \ headers_install @@ -148,7 +151,7 @@ cd "$BUILDDIR/obj_gcc" --disable-multilib \ ${NIL} -make -j$(nproc) +make -j$(nproc) make -j$(nproc) install DESTDIR="$INSTALLDIR" @@ -168,14 +171,18 @@ mv $INSTALLDIR/lib/gcc/$TARGET/lib64/libgcc_s.so* "$INSTALLDIR/lib/gcc/$TARGET/$ rmdir "$INSTALLDIR/lib/gcc/$TARGET/lib64" -$INSTALLDIR/bin/${target}-gcc -o ${BUILDDIR}/hello_c hello.c || exit 2 -$INSTALLDIR/bin/${target}-g++ -o ${BUILDDIR}/hello_cpp hello.cpp || exit 3 +$INSTALLDIR/bin/${TARGET}-gcc -o ${BUILDDIR}/hello_c hello.c || exit 2 +$INSTALLDIR/bin/${TARGET}-g++ -o ${BUILDDIR}/hello_cpp hello.cpp || exit 3 +$INSTALLDIR/bin/${TARGET}-gcc -o ${BUILDDIR}/bye_asm -static -nostdlib bye-${LINUX_ARCH}.S || exit 11 -gcc_runtime_libdir=`$INSTALLDIR/bin/${target}-gcc --print-libgcc-file-name` +gcc_runtime_libdir=`$INSTALLDIR/bin/${TARGET}-gcc --print-libgcc-file-name` gcc_runtime_libdir="${gcc_runtime_libdir%/*}" -env LD_LIBRARY_PATH=$INSTALLDIR${SYSROOT}/lib64:${gcc_runtime_libdir} \ - qemu-${arch}-static -L ${INSTALLDIR}${SYSROOT} ${BUILDDIR}/hello_c || exit 5 -env LD_LIBRARY_PATH=$INSTALLDIR${SYSROOT}/lib64:${gcc_runtime_libdir} \ - qemu-${arch}-static -L ${INSTALLDIR}${SYSROOT} ${BUILDDIR}/hello_cpp || exit 7 - +if command -v qemu-${QEMU_ARCH}-static; then + # run test binaries + env LD_LIBRARY_PATH=$INSTALLDIR${SYSROOT}/lib64:${gcc_runtime_libdir} \ + qemu-${QEMU_ARCH}-static -L ${INSTALLDIR}${SYSROOT} ${BUILDDIR}/hello_c || exit 5 + env LD_LIBRARY_PATH=$INSTALLDIR${SYSROOT}/lib64:${gcc_runtime_libdir} \ + qemu-${QEMU_ARCH}-static -L ${INSTALLDIR}${SYSROOT} ${BUILDDIR}/hello_cpp || exit 7 + qemu-${QEMU_ARCH}-static ${BUILDDIR}/bye_asm || exit 13 +fi diff --git a/bye-aarch64.S b/bye-arm64.S similarity index 100% rename from bye-aarch64.S rename to bye-arm64.S