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