export TARGET=aarch64-none-elf
export PREFIX=/work/public/$TARGET
export PATH=$PATH:$PREFIX/bin
mkdir build-binutils
cd build-binutils
../binutils-source/configure --target=$TARGET --prefix=$PREFIX
make all
make install
cd gcc-source
bash ./contrib/download_prerequisites
cd ..
prerequisite libs (GMP/MPFR/MPC), put them into gcc director, and link statically.
If not, the system gmp/mpft/mpc libraries will be used, and linked dynamically.
http://advogato.org/person/redi/diary/253.html
mkdir build-gcc
cd build-gcc
../gcc-source/configure --target=$TARGET --prefix=$PREFIX --without-header --with-newlib --with-gnu-as --with-gnu-ld --enable-lto --enable-linker-build-id --disable-libmudflap --disable-libgomp --disable-libssp --disable-libstdcxx-pch --enable-multiarch --disable-multilib --enable-languages=c,c++ --with-headers=../newlib-source/newlib/libc/include --disable-shared
make
make install
mkdir build-newlib
cd build-newlib
../newlib-source/configure --target=$TARGET --prefix=$PREFIX
make -j8
make install
cd build-gcc
make -j8
make install
mkdir build-gdb
cd build-gdb
../gdb-source/configure --target=$TARGET --prefix=$PREFIX --enable-interwork
--with-headers=../newlib-source/newlib/libc/include
Please refer to step 3
Don't use
--with-headers=../newlib-source/newlib/libc/include
Use
--without-headers
, and then on second gcc build configure it again, this time without--without-headers
See this for explanation.