100-uclibc-conf.patch 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. Warning! The powerpc patch (rs6000/linux.h) is hack-ish and would
  2. definitely need to be improved to be acceptable upstream. Also,
  3. this patch isn't complete as it only supports i386, arm, mips, and
  4. powerpc (rs6000).
  5. diff -urN gcc-20011006/config.sub gcc-20011006-new/config.sub
  6. --- gcc-20011006/config.sub 2004-01-13 06:15:28.000000000 -0600
  7. +++ gcc-20011006-new/config.sub 2004-01-10 11:09:35.000000000 -0600
  8. @@ -68,7 +68,7 @@
  9. # Here we must recognize all the valid KERNEL-OS combinations.
  10. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
  11. case $maybe_os in
  12. - linux-gnu*)
  13. + linux-gnu* | linux-uclibc*)
  14. os=-$maybe_os
  15. basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
  16. ;;
  17. @@ -936,7 +936,8 @@
  18. | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
  19. | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
  20. | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
  21. - | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
  22. + | -mingw32* | -linux-gnu* | -linux-uclibc* \
  23. + | -uxpv* | -beos* | -mpeix* | -udk* \
  24. | -interix* | -uwin* )
  25. # Remember, each alternative MUST END IN *, to match a version number.
  26. ;;
  27. diff -urN gcc-20011006/gcc/config/arm/linux-elf.h gcc-20011006-new/gcc/config/arm/linux-elf.h
  28. --- gcc-20011006/gcc/config/arm/linux-elf.h 2004-01-13 06:15:28.000000000 -0600
  29. +++ gcc-20011006-new/gcc/config/arm/linux-elf.h 2004-01-10 11:12:11.000000000 -0600
  30. @@ -90,6 +90,18 @@
  31. #define ENDFILE_SPEC \
  32. "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
  33. +#ifdef USE_UCLIBC
  34. +#define LINK_SPEC "%{h*} %{version:-v} \
  35. + %{b} %{Wl,*:%*} \
  36. + %{static:-Bstatic} \
  37. + %{shared:-shared} \
  38. + %{symbolic:-Bsymbolic} \
  39. + %{rdynamic:-export-dynamic} \
  40. + %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0} \
  41. + -X \
  42. + %{mbig-endian:-EB}" \
  43. + SUBTARGET_EXTRA_LINK_SPEC
  44. +#else
  45. #define LINK_SPEC "%{h*} %{version:-v} \
  46. %{b} %{Wl,*:%*} \
  47. %{static:-Bstatic} \
  48. @@ -100,6 +112,7 @@
  49. -X \
  50. %{mbig-endian:-EB}" \
  51. SUBTARGET_EXTRA_LINK_SPEC
  52. +#endif
  53. #undef CPP_PREDEFINES
  54. #define CPP_PREDEFINES \
  55. diff -urN gcc-20011006/gcc/config/i386/linux.h gcc-20011006-new/gcc/config/i386/linux.h
  56. --- gcc-20011006/gcc/config/i386/linux.h 2001-04-03 17:38:59.000000000 -0500
  57. +++ gcc-20011006-new/gcc/config/i386/linux.h 2004-01-10 11:15:38.000000000 -0600
  58. @@ -199,6 +199,15 @@
  59. %{static:-static}}}"
  60. #endif
  61. #else
  62. +#if defined USE_UCLIBC
  63. +#define LINK_SPEC "-m elf_i386 %{shared:-shared} \
  64. + %{!shared: \
  65. + %{!ibcs: \
  66. + %{!static: \
  67. + %{rdynamic:-export-dynamic} \
  68. + %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}} \
  69. + %{static:-static}}}"
  70. +#else
  71. #define LINK_SPEC "-m elf_i386 %{shared:-shared} \
  72. %{!shared: \
  73. %{!ibcs: \
  74. @@ -207,6 +216,7 @@
  75. %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
  76. %{static:-static}}}"
  77. #endif
  78. +#endif
  79. /* Get perform_* macros to build libgcc.a. */
  80. #include "i386/perform.h"
  81. diff -urN gcc-20011006/gcc/config/mips/linux.h gcc-20011006-new/gcc/config/mips/linux.h
  82. --- gcc-20011006/gcc/config/mips/linux.h 2004-01-13 06:15:28.000000000 -0600
  83. +++ gcc-20011006-new/gcc/config/mips/linux.h 2004-01-10 11:16:39.000000000 -0600
  84. @@ -154,6 +154,17 @@
  85. /* Borrowed from sparc/linux.h */
  86. #undef LINK_SPEC
  87. +#ifdef USE_UCLIBC
  88. +#define LINK_SPEC \
  89. + "%(endian_spec) \
  90. + %{shared:-shared} \
  91. + %{!shared: \
  92. + %{!ibcs: \
  93. + %{!static: \
  94. + %{rdynamic:-export-dynamic} \
  95. + %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}} \
  96. + %{static:-static}}}"
  97. +#else
  98. #define LINK_SPEC \
  99. "%(endian_spec) \
  100. %{shared:-shared} \
  101. @@ -163,6 +174,7 @@
  102. %{rdynamic:-export-dynamic} \
  103. %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
  104. %{static:-static}}}"
  105. +#endif
  106. #undef SUBTARGET_ASM_SPEC
  107. diff -urN old/gcc-20011006/gcc/config/mips/t-linux-uclibc gcc-20011006/gcc/config/mips/t-linux-uclibc
  108. --- old/gcc-20011006/gcc/config/mips/t-linux-uclibc 1969-12-31 18:00:00.000000000 -0600
  109. +++ gcc-20011006/gcc/config/mips/t-linux-uclibc 2004-01-14 02:51:10.000000000 -0600
  110. @@ -0,0 +1 @@
  111. +T_CFLAGS = -DUSE_UCLIBC
  112. diff -urN gcc-20011006/gcc/config/rs6000/linux.h gcc-20011006-new/gcc/config/rs6000/linux.h
  113. --- gcc-20011006/gcc/config/rs6000/linux.h 2001-04-03 17:38:59.000000000 -0500
  114. +++ gcc-20011006-new/gcc/config/rs6000/linux.h 2004-01-10 11:15:38.000000000 -0600
  115. @@ -36,12 +36,21 @@
  116. #define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)"
  117. #undef LINK_SPEC
  118. +#ifdef USE_UCLIBC
  119. +#define LINK_SPEC "-m elf32ppclinux %{G*} %{shared:-shared} \
  120. + %{!shared: \
  121. + %{!static: \
  122. + %{rdynamic:-export-dynamic} \
  123. + %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}} \
  124. + %{static:-static}}"
  125. +#else
  126. #define LINK_SPEC "-m elf32ppclinux %{G*} %{shared:-shared} \
  127. %{!shared: \
  128. %{!static: \
  129. %{rdynamic:-export-dynamic} \
  130. %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
  131. %{static:-static}}"
  132. +#endif
  133. #undef LIB_DEFAULT_SPEC
  134. #define LIB_DEFAULT_SPEC "%(lib_linux)"
  135. diff -urN gcc-20011006/gcc/config/t-linux-uclibc gcc-20011006-new/gcc/config/t-linux-uclibc
  136. --- gcc-20011006/gcc/config/t-linux-uclibc 1969-12-31 18:00:00.000000000 -0600
  137. +++ gcc-20011006-new/gcc/config/t-linux-uclibc 2004-01-10 11:18:46.000000000 -0600
  138. @@ -0,0 +1,18 @@
  139. +T_CFLAGS = -DUSE_UCLIBC
  140. +
  141. +# Don't run fixproto
  142. +STMP_FIXPROTO =
  143. +
  144. +# Don't install "assert.h" in gcc. We use the one in glibc.
  145. +INSTALL_ASSERT_H =
  146. +
  147. +# Compile crtbeginS.o and crtendS.o with pic.
  148. +CRTSTUFF_T_CFLAGS_S = -fPIC
  149. +# Compile libgcc2.a with pic.
  150. +TARGET_LIBGCC2_CFLAGS = -fPIC
  151. +
  152. +# Do not build libgcc1. Let gcc generate those functions. The GNU/Linux
  153. +# C library can handle them.
  154. +LIBGCC1 =
  155. +CROSS_LIBGCC1 =
  156. +LIBGCC1_TEST =
  157. diff -urN gcc-20011006/gcc/configure gcc-20011006-new/gcc/configure
  158. --- gcc-20011006/gcc/configure 2004-01-13 06:15:28.000000000 -0600
  159. +++ gcc-20011006-new/gcc/configure 2004-01-10 11:28:54.000000000 -0600
  160. @@ -3219,6 +3219,24 @@
  161. ;;
  162. esac
  163. ;;
  164. + arm*-*-linux-uclibc*) # ARM GNU/Linux with ELF - uClibc
  165. + xm_file=arm/xm-linux.h
  166. + xmake_file=x-linux
  167. + tm_file="arm/linux-elf.h"
  168. + case $machine in
  169. + armv2*-*-*)
  170. + tm_file="arm/linux-elf26.h $tm_file"
  171. + ;;
  172. + esac
  173. + tmake_file="t-linux-uclibc arm/t-linux"
  174. + extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
  175. + gnu_ld=yes
  176. + case x${enable_threads} in
  177. + x | xyes | xpthreads | xposix)
  178. + thread_file='posix'
  179. + ;;
  180. + esac
  181. + ;;
  182. arm*-*-aout)
  183. tm_file=arm/aout.h
  184. tmake_file=arm/t-bare
  185. @@ -3631,6 +3649,18 @@
  186. thread_file='single'
  187. fi
  188. ;;
  189. + i[34567]86-*-linux*uclibc*) # Intel 80386's running GNU/Linux
  190. + # with ELF format using uClibc
  191. + xmake_file=x-linux
  192. + tm_file=i386/linux.h
  193. + tmake_file="t-linux-uclibc i386/t-crtstuff"
  194. + extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
  195. + gnu_ld=yes
  196. + float_format=i386
  197. + if test x$enable_threads = xyes; then
  198. + thread_file='posix'
  199. + fi
  200. + ;;
  201. i[34567]86-*-linux-gnu*) # Intel 80386's running GNU/Linux
  202. # aka GNU/Linux C library 6
  203. xmake_file=x-linux
  204. @@ -4696,7 +4726,19 @@
  205. # On NetBSD, the headers are already okay, except for math.h.
  206. tmake_file=t-netbsd
  207. ;;
  208. - mips*-*-linux*) # Linux MIPS, either endian.
  209. + mips*-*-linux-uclibc*) # Linux (uclibc) MIPS, either endian.
  210. + tmake_file=mips/t-linux-uclibc
  211. + xmake_file=x-linux
  212. + xm_file="xm-siglist.h ${xm_file}"
  213. + case $machine in
  214. + mipsel-*) tm_file="mips/elfl.h mips/linux.h" ;;
  215. + *) tm_file="mips/elf.h mips/linux.h" ;;
  216. + esac
  217. + extra_parts="crtbegin.o crtend.o"
  218. + gnu_ld=yes
  219. + gas=yes
  220. + ;;
  221. + mips*-*-linux*) # Linux MIPS, either endian.
  222. xmake_file=x-linux
  223. xm_file="xm-siglist.h ${xm_file}"
  224. case $machine in
  225. @@ -5159,6 +5201,24 @@
  226. thread_file='posix'
  227. fi
  228. ;;
  229. + powerpc-*-linux-uclibc*)
  230. + tm_file=rs6000/linux.h
  231. + xm_file="xm-siglist.h rs6000/xm-sysv4.h"
  232. + xm_defines="USG ${xm_defines}"
  233. + out_file=rs6000/rs6000.c
  234. + if test x$gas = xyes
  235. + then
  236. + tmake_file="rs6000/t-ppcos t-linux-uclibc rs6000/t-ppccomm"
  237. + else
  238. + tmake_file="rs6000/t-ppc t-linux-uclibc rs6000/t-ppccomm"
  239. + fi
  240. + xmake_file=x-linux
  241. + extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
  242. + extra_headers=ppc-asm.h
  243. + if test x$enable_threads = xyes; then
  244. + thread_file='posix'
  245. + fi
  246. + ;;
  247. powerpc-wrs-vxworks*)
  248. cpu_type=rs6000
  249. xm_file="xm-siglist.h rs6000/xm-sysv4.h"
  250. diff -urN gcc-20011006/ltconfig gcc-20011006-new/ltconfig
  251. --- gcc-20011006/ltconfig 1999-06-21 21:35:12.000000000 -0500
  252. +++ gcc-20011006-new/ltconfig 2004-01-10 11:34:23.000000000 -0600
  253. @@ -436,6 +436,7 @@
  254. # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
  255. case "$host_os" in
  256. linux-gnu*) ;;
  257. +linux-uclibc*) ;;
  258. linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
  259. esac
  260. @@ -1773,6 +1774,22 @@
  261. fi
  262. ;;
  263. +linux-uclibc*)
  264. + version_type=linux
  265. + need_lib_prefix=no
  266. + need_version=no
  267. + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
  268. + soname_spec='${libname}${release}.so$major'
  269. + finish_cmds='PATH="$PATH:/sbin" ldconfig -n $libdir'
  270. + shlibpath_var=LD_LIBRARY_PATH
  271. + shlibpath_overrides_runpath=no
  272. + deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
  273. + file_magic_cmd=/usr/bin/file
  274. + file_magic_test_file=`echo /lib/libuClibc-*.so`
  275. + # Assume using the uClibc dynamic linker.
  276. + dynamic_linker="uClibc ld.so"
  277. + ;;
  278. +
  279. netbsd*)
  280. version_type=sunos
  281. if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then