diff --git a/build-toolchain b/build-toolchain index 7918a1ad..42db6b31 100755 --- a/build-toolchain +++ b/build-toolchain @@ -41,7 +41,8 @@ cd $BASEDIR/toolchain/gcc/arm/arm-linux-androideabi/build/binutils --enable-gold=default \ --enable-plugins -make -j $(nproc) && make install +make -j $(nproc) +make install # build gcc for arm cd .. && mkdir -p gcc && cd gcc @@ -81,7 +82,8 @@ cd .. && mkdir -p gcc && cd gcc --enable-gold=default \ --program-transform-name='s&^&arm-linux-androideabi-&' -make -j $(nproc) && make install +make -j $(nproc) +make install # build binutils for host @@ -95,15 +97,19 @@ cd host/build/binutils --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' \ --with-gold-ldflags='-static-libgcc -static-libstdc++' \ --enable-gold=default \ - --enable-plugins + --enable-plugins \ + --disable-ld -make -j $(nproc) && make install +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 \ + --host=x86_64-linux-gnu \ + --build=x86_64-linux-gnu \ --enable-multiarch \ --with-arch-32=i686 \ --with-abi=m64 \ @@ -111,8 +117,6 @@ cd .. && mkdir -p gcc && cd gcc --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 \ @@ -123,12 +127,18 @@ cd .. && mkdir -p gcc && cd gcc --enable-gold=default \ --enable-languages=c,c++ -make -j $(nproc) && make install +make -j $(nproc) +make install # we need to link against the correct stdatomic.h cd ../../install/lib/gcc/x86_64-linux/4.9.x/include rm stdatomic.h ln -s ../../../../../../../../../bionic/libc/include/stdatomic.h stdatomic.h +# use gold ld from /usr because Google's binutils can't handle a recent libc +cd ../../../../../x86_64-linux/bin/ +rm ld +ln -s /usr/bin/x86_64-linux-gnu-ld.gold ld + cd $BASEDIR