gcc-bisect.sh 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. #!/bin/sh
  2. rm -rf host_x86_64-linux-gnu target_sparc_glibc
  3. rm -rf gcc-*
  4. mkdir host_x86_64-linux-gnu
  5. mkdir target_sparc_glibc
  6. tar xvf binutils-2.24.tar.bz2
  7. cd binutils-2.24
  8. ./configure \
  9. --prefix=/home/wbx/smoke/host_x86_64-linux-gnu \
  10. --target=sparc-openadk-linux-gnu \
  11. --with-sysroot=/home/wbx/smoke/target_sparc_glibc \
  12. --disable-dependency-tracking \
  13. --disable-libtool-lock \
  14. --disable-nls \
  15. --disable-werror \
  16. --disable-plugins \
  17. --disable-libssp --disable-multilib
  18. make -j4 all
  19. make install
  20. cd ..
  21. tar xvf gmp-5.1.3.tar.xz
  22. cd gmp-5.1.3
  23. cp configfsf.guess config.guess
  24. PATH="/home/wbx/smoke/host_x86_64-linux-gnu/usr/bin:$PATH" \
  25. ./configure \
  26. --prefix=/home/wbx/smoke/host_x86_64-linux-gnu \
  27. --with-pic \
  28. --disable-shared \
  29. --enable-static
  30. make -j4 all
  31. make install
  32. cd ..
  33. tar xvf mpfr-3.1.2.tar.xz
  34. cd mpfr-3.1.2
  35. ./configure \
  36. --prefix=/home/wbx/smoke/host_x86_64-linux-gnu \
  37. --with-gmp-build=/home/wbx/smoke/gmp-5.1.3 \
  38. --disable-shared \
  39. --enable-static
  40. make -j4 all
  41. make install
  42. cd ..
  43. tar xvf mpc-0.8.2.tar.gz
  44. cd mpc-0.8.2
  45. ./configure \
  46. --prefix=/home/wbx/smoke/host_x86_64-linux-gnu \
  47. --with-gmp=/home/wbx/smoke/host_x86_64-linux-gnu \
  48. --disable-shared \
  49. --enable-static
  50. make -j4 all
  51. make install
  52. make install
  53. cd ..
  54. tar xvf libelf-0.8.13.tar.gz
  55. cd libelf-0.8.13
  56. ./configure \
  57. --prefix=/home/wbx/smoke/host_x86_64-linux-gnu \
  58. --disable-nls \
  59. --disable-shared \
  60. --enable-static
  61. make -j4 all
  62. make install
  63. cd ..
  64. rm -rf host_x86_64-linux-gnu/sparc-openadk-linux-gnu/{lib,sys-include}
  65. cd host_x86_64-linux-gnu/sparc-openadk-linux-gnu/
  66. ln -sf ../../target_sparc_glibc/usr/include sys-include
  67. ln -sf ../../target_sparc_glibc/lib lib
  68. cd -
  69. mkdir gcc-minimal
  70. cd gcc-minimal
  71. CFLAGS="-O0 -g0" \
  72. CXXFLAGS="-O0 -g0" \
  73. PATH="/home/wbx/smoke/host_x86_64-linux-gnu/bin:$PATH" \
  74. ../gcc/configure \
  75. --prefix=/home/wbx/smoke/host_x86_64-linux-gnu --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=sparc-openadk-linux-gnu --with-gmp=/home/wbx/smoke/host_x86_64-linux-gnu --with-mpfr=/home/wbx/smoke/host_x86_64-linux-gnu --with-libelf=/home/wbx/smoke/host_x86_64-linux-gnu --disable-__cxa_atexit --with-gnu-ld --with-gnu-as --enable-tls --disable-libsanitizer --disable-libitm --disable-libmudflap --disable-libgomp --disable-decimal-float --disable-libstdcxx-pch --disable-ppl-version-check --disable-cloog-version-check --without-system-zlib --without-ppl --without-cloog --without-isl --disable-nls --enable-target-optspace \
  76. --enable-languages=c \
  77. --disable-multilib \
  78. --disable-lto \
  79. --disable-libssp \
  80. --disable-shared \
  81. --without-headers
  82. PATH="/home/wbx/smoke/host_x86_64-linux-gnu/bin:$PATH" make -j4 all-gcc
  83. if [ $? -ne 0 ];then
  84. echo failed
  85. exit
  86. fi
  87. PATH="/home/wbx/smoke/host_x86_64-linux-gnu/bin:$PATH" make install-gcc
  88. if [ $? -ne 0 ];then
  89. echo failed
  90. exit
  91. fi
  92. cd ..
  93. cd linux-3.13.6
  94. make V=1 ARCH=sparc CROSS_COMPILE="/home/wbx/smoke/host_x86_64-linux-gnu/bin/sparc-openadk-linux-gnu-" CC="/home/wbx/smoke/host_x86_64-linux-gnu/bin/sparc-openadk-linux-gnu-gcc" HOSTCC="cc" CONFIG_SHELL='/bin/bash' HOSTCFLAGS='-O2 -Wall' INSTALL_HDR_PATH=/home/wbx/smoke/target_sparc_glibc/usr headers_install
  95. cd ..
  96. cd glibc-2.19-header
  97. libc_cv_forced_unwind=yes \
  98. libc_cv_cc_with_libunwind=yes \
  99. libc_cv_c_cleanup=yes \
  100. libc_cv_gnu99_inline=yes \
  101. libc_cv_initfini_array=yes \
  102. PATH="/home/wbx/smoke/host_x86_64-linux-gnu/bin:$PATH" ../glibc-2.19/configure \
  103. --prefix=/home/wbx/smoke/target_sparc_glibc/usr \
  104. --with-sysroot=/home/wbx/smoke/target_sparc_glibc \
  105. --build=x86_64-linux-gnu --host=sparc-openadk-linux-gnu --with-headers=/home/wbx/smoke/target_sparc_glibc/usr/include --disable-sanity-checks --disable-nls --without-cvs --disable-profile --disable-debug --without-gd --disable-nscd --with-__thread --with-tls --enable-kernel="2.6.32" --enable-add-ons
  106. PATH="/home/wbx/smoke/host_x86_64-linux-gnu/bin:$PATH" make cross-compiling=yes PARALLELMFLAGS="-j1" install-headers
  107. if [ $? -ne 0 ];then
  108. echo failed
  109. exit
  110. fi
  111. cd ..
  112. touch target_sparc_glibc/usr/include/gnu/stubs.h
  113. mkdir gcc-initial
  114. cd gcc-initial
  115. CFLAGS="-O0 -g0" \
  116. CXXFLAGS="-O0 -g0" \
  117. PATH="/home/wbx/smoke/host_x86_64-linux-gnu/bin:$PATH" ../gcc/configure \
  118. --prefix=/home/wbx/smoke/host_x86_64-linux-gnu --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=sparc-openadk-linux-gnu --with-gmp=/home/wbx/smoke/host_x86_64-linux-gnu --with-mpfr=/home/wbx/smoke/host_x86_64-linux-gnu --with-libelf=/home/wbx/smoke/host_x86_64-linux-gnu --disable-__cxa_atexit --with-gnu-ld --with-gnu-as --enable-tls --disable-libsanitizer --disable-libitm --disable-libmudflap --disable-libgomp --disable-decimal-float --disable-libstdcxx-pch --disable-ppl-version-check --disable-cloog-version-check --without-system-zlib --without-ppl --without-cloog --without-isl --disable-nls --enable-target-optspace \
  119. --disable-biarch --disable-multilib --enable-libssp --enable-lto \
  120. --enable-languages=c \
  121. --disable-shared \
  122. --disable-threads \
  123. --with-sysroot=/home/wbx/smoke/target_sparc_glibc
  124. PATH="/home/wbx/smoke/host_x86_64-linux-gnu/bin:$PATH" make all-gcc
  125. if [ $? -ne 0 ];then
  126. echo failed
  127. exit
  128. fi
  129. PATH="/home/wbx/smoke/host_x86_64-linux-gnu/bin:$PATH" make all-target-libgcc
  130. if [ $? -ne 0 ];then
  131. echo failed
  132. exit
  133. fi
  134. PATH="/home/wbx/smoke/host_x86_64-linux-gnu/bin:$PATH" make install-gcc install-target-libgcc
  135. if [ $? -ne 0 ];then
  136. echo failed
  137. exit
  138. fi
  139. cd ..
  140. cd glibc-2.19-final
  141. PATH="/home/wbx/smoke/host_x86_64-linux-gnu/bin:$PATH" SHELL='/bin/bash' BUILD_CC=cc CFLAGS="-mcpu=v8 -fwrapv -fno-ident -fomit-frame-pointer -O2 -pipe -fno-unwind-tables -fno-asynchronous-unwind-tables -g3" CC="/home/wbx/smoke/host_x86_64-linux-gnu/bin/sparc-openadk-linux-gnu-gcc" CXX="/home/wbx/smoke/host_x86_64-linux-gnu/bin/sparc-openadk-linux-gnu-g++" AR="/home/wbx/smoke/host_x86_64-linux-gnu/bin/sparc-openadk-linux-gnu-ar" RANLIB="/home/wbx/smoke/host_x86_64-linux-gnu/bin/sparc-openadk-linux-gnu-ranlib" libc_cv_forced_unwind=yes libc_cv_cc_with_libunwind=yes libc_cv_c_cleanup=yes libc_cv_gnu99_inline=yes libc_cv_initfini_array=yes \
  142. ../glibc-2.19/configure \
  143. --prefix=/usr \
  144. --enable-shared \
  145. --enable-stackguard-randomization \
  146. --build=x86_64-linux-gnu --host=sparc-openadk-linux-gnu --with-headers=/home/wbx/smoke/target_sparc_glibc/usr/include --disable-sanity-checks --disable-nls --without-cvs --disable-profile --disable-debug --without-gd --disable-nscd --with-__thread --with-tls --enable-kernel="2.6.32" --enable-add-ons
  147. PATH="/home/wbx/smoke/host_x86_64-linux-gnu/bin:$PATH" make all
  148. PATH="/home/wbx/smoke/host_x86_64-linux-gnu/bin:$PATH" make install_root=/home/wbx/smoke/target_sparc_glibc install
  149. if [ $? -ne 0 ];then
  150. echo failed
  151. exit
  152. fi
  153. cd ..
  154. mkdir gcc-final
  155. cd gcc-final
  156. ../gcc/configure \
  157. --prefix=/home/wbx/smoke/host_x86_64-linux-gnu --with-bugurl="http://www.openadk.org/" --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=sparc-openadk-linux-gnu --with-gmp=/home/wbx/smoke/host_x86_64-linux-gnu --with-mpfr=/home/wbx/smoke/host_x86_64-linux-gnu --with-libelf=/home/wbx/smoke/host_x86_64-linux-gnu --disable-__cxa_atexit --with-gnu-ld --with-gnu-as --enable-tls --disable-libsanitizer --disable-libitm --disable-libmudflap --disable-libgomp --disable-decimal-float --disable-libstdcxx-pch --disable-ppl-version-check --disable-cloog-version-check --without-system-zlib --without-ppl --without-cloog --without-isl --disable-nls --enable-target-optspace \
  158. --disable-biarch --disable-multilib --enable-libssp --enable-lto \
  159. --enable-languages=c,c++ \
  160. --with-build-sysroot='${prefix}/../target_sparc_glibc' \
  161. --with-sysroot='${prefix}/../target_sparc_glibc' \
  162. --enable-shared
  163. make -j4 all
  164. if [ $? -ne 0 ];then
  165. echo failed
  166. exit
  167. fi
  168. make install
  169. if [ $? -ne 0 ];then
  170. echo failed
  171. exit
  172. fi
  173. cd ..
  174. cd linux-3.13.6/
  175. cat > mini.config <<EOF
  176. CONFIG_SPARC=y
  177. CONFIG_SPARC32=y
  178. CONFIG_SBUS=y
  179. CONFIG_SBUSCHAR=y
  180. CONFIG_PCI=y
  181. CONFIG_PCI_SYSCALL=y
  182. CONFIG_PCIC_PCI=y
  183. CONFIG_OF=y
  184. CONFIG_NET_VENDOR_AMD=y
  185. CONFIG_SUNLANCE=y
  186. CONFIG_SERIAL_CONSOLE=y
  187. CONFIG_SERIAL_SUNCORE=y
  188. CONFIG_SERIAL_SUNZILOG=y
  189. CONFIG_SERIAL_SUNZILOG_CONSOLE=y
  190. EOF
  191. PATH="/home/wbx/smoke/host_x86_64-linux-gnu/bin:$PATH" make V=1 ARCH=sparc CROSS_COMPILE="/home/wbx/smoke/host_x86_64-linux-gnu/bin/sparc-openadk-linux-gnu-" CC="/home/wbx/smoke/host_x86_64-linux-gnu/bin/sparc-openadk-linux-gnu-gcc" HOSTCC="cc" CONFIG_SHELL='/bin/bash' HOSTCFLAGS='-O2 -Wall' KCONFIG_ALLCONFIG=mini.config allnoconfig
  192. PATH="/home/wbx/smoke/host_x86_64-linux-gnu/bin:$PATH" make V=1 ARCH=sparc CROSS_COMPILE="/home/wbx/smoke/host_x86_64-linux-gnu/bin/sparc-openadk-linux-gnu-" CC="/home/wbx/smoke/host_x86_64-linux-gnu/bin/sparc-openadk-linux-gnu-gcc" HOSTCC="cc" CONFIG_SHELL='/bin/bash' HOSTCFLAGS='-O2 -Wall' -j4 zImage