extend toolchain script: build gcc toolchains

add patch for prebuilt/ndk

Signed-off-by: Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de>
This commit is contained in:
Wolfgang Wiedmeyer 2016-01-15 00:25:31 +01:00
parent cd55ab2858
commit 6d69e550e5
2 changed files with 166 additions and 5 deletions

View File

@ -14,10 +14,124 @@ make -j $(nproc)
cd $BASEDIR
#TODO: copy include header (now in /usr/include)
# include patch for binutils
# enable optimization for llvm (more stuff?)
# test with gcc-4.8 binaries if there are errors
# document renaming of binaries of cross compiler build and export flag
# build binutils for arm
mkdir -p $BASEDIR/toolchain/gcc/arm/arm-linux-androideabi/build/binutils
cd $BASEDIR/toolchain/gcc/arm/arm-linux-androideabi/build/binutils
./../../../../../src/binutils/binutils-2.25/configure \
--prefix=$BASEDIR/toolchain/gcc/arm/arm-linux-androideabi/install \
--target=arm-linux-androideabi \
--enable-gold=default \
--enable-plugins
make -j $(nproc) && make install
# build gcc for arm
cd .. && mkdir -p gcc && cd gcc
./../../../../../src/gcc/gcc-4.9/configure \
--prefix=$BASEDIR/toolchain/gcc/arm/arm-linux-androideabi/install \
--target=arm-linux-androideabi \
--host=x86_64-linux-gnu \
--build=x86_64-linux-gnu \
--with-gnu-as \
--with-gnu-ld \
--enable-languages=c,c++ \
--enable-cloog-backend=isl \
--disable-libssp \
--enable-threads \
--disable-nls \
--disable-libmudflap \
--enable-libgomp \
--disable-libstdc__-v3 \
--disable-sjlj-exceptions \
--disable-shared \
--disable-tls \
--disable-libitm \
--with-float=soft \
--with-fpu=vfp \
--with-arch=armv5te \
--enable-target-optspace \
--enable-initfini-array \
--disable-bootstrap \
--disable-libquadmath \
--enable-plugins \
--with-sysroot=$BASEDIR/prebuilts/ndk/current/platforms/android-21/arch-arm \
--with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' \
--enable-gnu-indirect-function \
--disable-libsanitizer \
--enable-graphite=yes \
--enable-eh-frame-hdr-for-static \
--enable-gold=default \
--program-transform-name='s&^&arm-linux-androideabi-&'
make -j $(nproc) && make install
# build binutils for host
cd ../../../../ && mkdir -p host/build/binutils
cd host/build/binutils
./../../../../src/binutils/binutils-2.25/configure \
--prefix=$BASEDIR/toolchain/gcc/host/install \
--target=x86_64-linux \
--host=x86_64-linux-gnu \
--build=x86_64-linux-gnu \
--with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' \
--with-gold-ldflags='-static-libgcc -static-libstdc++' \
--enable-gold=default \
--enable-plugins
make -j $(nproc) && make install
# build gcc for host
cd .. && mkdir -p gcc && cd gcc
./../../../../src/gcc/gcc-4.9/configure \
--prefix=$BASEDIR/toolchain/gcc/host/install \
--target=x86_64-linux \
--enable-multiarch \
--with-arch-32=i686 \
--with-abi=m64 \
--with-arch=x86-64 \
--with-multilib-list=m32,m64 \
--disable-nls \
--enable-target-optspace \
--host=x86_64-linux-gnu \
--build=x86_64-linux-gnu \
--disable-plugin \
--disable-docs \
--disable-bootstrap \
--disable-libgomp \
--disable-libmudflap \
--disable-libquadmath \
--disable-libsanitizer \
--enable-gold=default \
--enable-languages=c,c++
make -j $(nproc) && make install
# we need to link against the correct stdatomic.h
cd ../../install/lib/gcc/x86_64-linux/4.9/include
rm stdatomic.h
ln -s ../../../../../../../../../bionic/libc/include/stdatomic.h stdatomic.h
cd $BASEDIR
# an empty Android.mk is needed (Android.mk in jack and jill repo should be ignored)
touch toolchain/src/Android.mk
# clang needs this header as a system header
mkdir -p toolchain/headers/clang
cd toolchain/headers/clang
if [ ! -f stdatomic.h ]
then
ln -s ../../../bionic/libc/include/stdatomic.h stdatomic.h
fi
cd $BASEDIR
#TODO:
# review other prebuilt tools from misc, tools, devtools and sdk
# search for bin directories in external and remove binaries
# build jack from source and rest of java toolchain (jack source has prebuilts, builds with ant dist)
# add relocation_packer correctly as dependency
# packages to install: gcc-arm-none-eabi

View File

@ -0,0 +1,47 @@
From 2df3726ab2be5b0addc87e292d2b0fbdd28e66e8 Mon Sep 17 00:00:00 2001
From: Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de>
Date: Thu, 14 Jan 2016 19:57:50 +0100
Subject: [PATCH] math header: fix for clang toolchain
Change-Id: Id617f610eb6aefdbc9903ded4149a296f5e87a03
Signed-off-by: Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de>
---
9/platforms/android-14/arch-arm/usr/include/math.h | 5 -----
9/platforms/android-8/arch-arm/usr/include/math.h | 5 -----
2 files changed, 10 deletions(-)
diff --git a/9/platforms/android-14/arch-arm/usr/include/math.h b/9/platforms/android-14/arch-arm/usr/include/math.h
index 7fe24b9..4c773f3 100644
--- a/9/platforms/android-14/arch-arm/usr/include/math.h
+++ b/9/platforms/android-14/arch-arm/usr/include/math.h
@@ -528,11 +528,6 @@ double __builtin_fma(double, double, double) __NDK_FPABI_MATH__;
double __builtin_hypot(double, double) __NDK_FPABI_MATH__;
int __builtin_ilogb(double) __NDK_FPABI_MATH__ __pure2;
/* int __builtin_isinf(double) __NDK_FPABI_MATH__ __pure2; */
-#if !defined(__clang__) || __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 7)
-int __builtin_isnan(double) __NDK_FPABI_MATH__ __pure2;
-#else
-/* clang < 3.7 has faulty prototype for __builtin_isnan */
-#endif
double __builtin_lgamma(double) __NDK_FPABI_MATH__;
long long __builtin_llrint(double) __NDK_FPABI_MATH__;
long long __builtin_llround(double) __NDK_FPABI_MATH__;
diff --git a/9/platforms/android-8/arch-arm/usr/include/math.h b/9/platforms/android-8/arch-arm/usr/include/math.h
index 0706a1f..5be7d1c 100644
--- a/9/platforms/android-8/arch-arm/usr/include/math.h
+++ b/9/platforms/android-8/arch-arm/usr/include/math.h
@@ -523,11 +523,6 @@ double __builtin_fma(double, double, double) __NDK_FPABI_MATH__;
double __builtin_hypot(double, double) __NDK_FPABI_MATH__;
int __builtin_ilogb(double) __NDK_FPABI_MATH__ __pure2;
/* int __builtin_isinf(double) __NDK_FPABI_MATH__ __pure2; */
-#if !defined(__clang__) || __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 7)
-int __builtin_isnan(double) __NDK_FPABI_MATH__ __pure2;
-#else
-/* clang < 3.7 has faulty prototype for __builtin_isnan */
-#endif
double __builtin_lgamma(double) __NDK_FPABI_MATH__;
long long __builtin_llrint(double) __NDK_FPABI_MATH__;
long long __builtin_llround(double) __NDK_FPABI_MATH__;
--
2.1.4