binutils的编译
../binutils-2.24/configure --prefix=/home/liuch/build/gcc_install --target=i386-pc-linux --with-sysroot=/home/liuch/build/gcc_install/i386-pc-linux --disable-nls --disable-multilib
(possible solution) make gcc_cv_libc_provides_ssp=yes
Kernel头文件
gcc编译时需要
make INSTALL_HDR_PATH=../build/gcc_install headers_install
gcc一次编译 静态static
patch to gcc/configure
之后的glibc编译时出现错误
undefined reference to `__stack_chk_guard'
seek /stack protector/
-> # Test for stack protector support in target C library.
add new line:
gcc_cv_libc_provides_ssp=yes
../gcc-4.8.2/configure --prefix=/home/liuch/build/gcc_install --build=x86_64 --host=x86_64 --target=i386-pc-linux --with-sysroot=/home/liuch/build/gcc_install/i386-pc-linux --disable-nls --disable-shared --without-headers --with-newlib --disable-decimal-float --disable-libgomp --disable-libmudflap --disable-libssp --disable-libatomic --disable-libquadmath --disable-threads --enable-languages=c --disable-multilib --with-arch=i486
make
(possible solution) make gcc_cv_libc_provides_ssp=yes
glibc编译
CFLAGS="-march=i486 -mtune=native -fno-stack-protector -O2" CC="i386-pc-linux-gcc" AR="i386-pc-linux-ar" RANLIB="i386-pc-linux-ranlib" PATH="/home/liuch/build/gcc_install/bin:$PATH" ../glibc-2.18/configure --prefix=/home/liuch/build/gcc_install --host=i686-pc-linux --build=x86_64-pc-linux-gnu --disable-profile --enable-kernel=3.12.4 --with-headers=/home/liuch/build/gcc_install/include --disable-sanity-check libc_cv_forced_unwind=yes libc_cv_ctors_header=yes libc_cv_c_cleanup=yes
CFLAGS="-march=i486 -mtune=native -fno-stack-protector -O2" CC="i386-pc-linux-gcc" AR="i386-pc-linux-ar" RANLIB="i386-pc-linux-ranlib" PATH="/home/liuch/build/gcc_install/bin:$PATH" make -j 6