Ticket #4204: gcc-4.4.1-diff

File gcc-4.4.1-diff, 56.0 KB (added by jprostko, 15 years ago)

Patch to core/g++ of GCC 4.4.0/4.4.1 (current through Haiku hrev32679)

Line 
1diff -ruN gcc-4.4.1-orig/config.rpath gcc-4.4.1/config.rpath
2--- gcc-4.4.1-orig/config.rpath 2008-03-13 14:55:20.000000000 -0400
3+++ gcc-4.4.1/config.rpath 2009-08-11 15:55:07.000000000 -0400
4@@ -161,6 +161,8 @@
5 ;;
6 netbsd*)
7 ;;
8+ haiku*)
9+ ;;
10 solaris* | sysv5*)
11 if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
12 ld_shlibs=no
13diff -ruN gcc-4.4.1-orig/configure gcc-4.4.1/configure
14--- gcc-4.4.1-orig/configure 2009-04-25 00:10:29.000000000 -0400
15+++ gcc-4.4.1/configure 2009-08-11 15:55:07.000000000 -0400
16@@ -2122,6 +2122,9 @@
17 *-*-cygwin*)
18 noconfigdirs="$noconfigdirs autoconf automake send-pr rcs guile perl"
19 ;;
20+ *-*-haiku*)
21+ noconfigdirs="$noconfigdirs tk itcl libgui gdb"
22+ ;;
23 *-*-netbsd*)
24 noconfigdirs="$noconfigdirs rcs"
25 ;;
26@@ -2243,6 +2246,9 @@
27 ;;
28 esac
29 ;;
30+ *-*-haiku)
31+ noconfigdirs="$noconfigdirs target-libiberty"
32+ ;;
33 *-*-kaos*)
34 # Remove unsupported stuff on all kaOS configurations.
35 skipdirs="target-libiberty ${libgcj} target-libstdc++-v3 target-librx"
36@@ -2688,6 +2694,9 @@
37 ip2k-*-*)
38 noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3 ${libgcj}"
39 ;;
40+ *-*-haiku*)
41+ noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss ${libgcj}"
42+ ;;
43 *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
44 noconfigdirs="$noconfigdirs target-newlib target-libgloss"
45 ;;
46diff -ruN gcc-4.4.1-orig/gcc/config/arm/haiku.h gcc-4.4.1/gcc/config/arm/haiku.h
47--- gcc-4.4.1-orig/gcc/config/arm/haiku.h 1969-12-31 19:00:00.000000000 -0500
48+++ gcc-4.4.1/gcc/config/arm/haiku.h 2009-08-11 16:04:54.000000000 -0400
49@@ -0,0 +1,80 @@
50+/* Definitions for ARM running Haiku systems using ELF
51+ Copyright (C) 2009
52+ Free Software Foundation, Inc.
53+ Contributed by Haiku, Inc.
54+
55+This file is part of GCC.
56+
57+GCC is free software; you can redistribute it and/or modify
58+it under the terms of the GNU General Public License as published by
59+the Free Software Foundation; either version 3, or (at your option)
60+any later version.
61+
62+GCC is distributed in the hope that it will be useful,
63+but WITHOUT ANY WARRANTY; without even the implied warranty of
64+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
65+GNU General Public License for more details.
66+
67+You should have received a copy of the GNU General Public License
68+along with GCC; see the file COPYING3. If not see
69+<http://www.gnu.org/licenses/>. */
70+
71+
72+#undef TARGET_VERSION
73+#define TARGET_VERSION fprintf (stderr, " (ARM Haiku/ELF)");
74+#undef ASM_COMMENT_START
75+#define ASM_COMMENT_START "@"
76+/* Unsigned chars produces much better code than signed. */
77+#define DEFAULT_SIGNED_CHAR 0
78+
79+#undef TARGET_DEFAULT_FLOAT_ABI
80+#define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFT
81+
82+/* bpabi.h sets FPUTYPE_DEFAULT to VFP */
83+/* bpabi.h sets ARM_DEFAULT_ABI */
84+
85+#undef MULTILIB_DEFAULTS
86+#define MULTILIB_DEFAULTS \
87+ { "marm", "mlittle-endian", "msoft-float", "mno-thumb-interwork" }
88+
89+/* Default is set by bpabi.h */
90+/*
91+#undef TARGET_DEFAULT
92+*/
93+
94+#undef SUBTARGET_CPU_DEFAULT
95+#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
96+
97+/* Now we define the strings used to build the spec file. */
98+/* interestingly, bpabi defines __GXX_TYPEINFO_EQUALITY_INLINE=0 too as we do. */
99+
100+#undef TARGET_OS_CPP_BUILTINS
101+#define TARGET_OS_CPP_BUILTINS() \
102+ do \
103+ { \
104+ builtin_define ("__HAIKU__"); \
105+ builtin_define ("__ARM__"); \
106+ builtin_define ("__arm__"); \
107+ builtin_define ("__stdcall=__attribute__((__stdcall__))"); \
108+ builtin_define ("__cdecl=__attribute__((__cdecl__))"); \
109+ builtin_assert ("system=haiku"); \
110+ /* Haiku apparently doesn't support merging of symbols across shared \
111+ object boundaries. Hence we need to explicitly specify that \
112+ type_infos are not merged, so that they get compared by name \
113+ instead of by pointer. */ \
114+ builtin_define ("__GXX_MERGED_TYPEINFO_NAMES=0"); \
115+ /*builtin_define ("__GXX_TYPEINFO_EQUALITY_INLINE=0"); done in bpabi: */\
116+ TARGET_BPABI_CPP_BUILTINS(); \
117+ } \
118+ while (0)
119+
120+/* Use the default LIBGCC_SPEC, not the empty version in haiku.h, as we
121+ do not use multilib (needed ??). */
122+#undef LIBGCC_SPEC
123+
124+/* If ELF is the default format, we should not use /lib/elf. */
125+
126+#undef LINK_SPEC
127+#define LINK_SPEC "%{!o*:-o %b} -m armelf -shared -no-undefined -Bsymbolic %{nostart:-e 0} \
128+ %{mbig-endian:-EB} %{mlittle-endian:-EL} -X"
129+
130diff -ruN gcc-4.4.1-orig/gcc/config/arm/t-haiku gcc-4.4.1/gcc/config/arm/t-haiku
131--- gcc-4.4.1-orig/gcc/config/arm/t-haiku 1969-12-31 19:00:00.000000000 -0500
132+++ gcc-4.4.1/gcc/config/arm/t-haiku 2009-08-11 16:04:54.000000000 -0400
133@@ -0,0 +1,21 @@
134+# build multilib for soft float and VFP
135+# (unsure about how it should be done...)
136+# mix from t-symbian & t-wince-pe
137+
138+#LIB1ASMSRC = arm/lib1funcs.asm
139+#LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _call_via_rX _interwork_call_via_rX
140+
141+
142+#MULTILIB_OPTIONS += mhard-float
143+#MULTILIB_DIRNAMES += fpu
144+
145+MULTILIB_OPTIONS += msoft-float
146+MULTILIB_DIRNAMES += fpu soft
147+MULTILIB_EXCEPTIONS += *mthumb/*mhard-float*
148+
149+MULTILIB_OPTIONS += mfloat-abi=softfp
150+MULTILIB_DIRNAMES += softfp
151+
152+#LIBGCC = stmp-multilib
153+#INSTALL_LIBGCC = install-multilib
154+#TARGET_LIBGCC2_CFLAGS =
155diff -ruN gcc-4.4.1-orig/gcc/config/haiku.h gcc-4.4.1/gcc/config/haiku.h
156--- gcc-4.4.1-orig/gcc/config/haiku.h 1969-12-31 19:00:00.000000000 -0500
157+++ gcc-4.4.1/gcc/config/haiku.h 2009-08-11 15:55:07.000000000 -0400
158@@ -0,0 +1,171 @@
159+/* Definitions of target machine for GCC.
160+ Common Haiku definitions for all architectures.
161+ Copyright (C) 2009
162+ Free Software Foundation, Inc.
163+ Contributed by Haiku, Inc.
164+
165+This file is part of GCC.
166+
167+GCC is free software; you can redistribute it and/or modify
168+it under the terms of the GNU General Public License as published by
169+the Free Software Foundation; either version 3, or (at your option)
170+any later version.
171+
172+GCC is distributed in the hope that it will be useful,
173+but WITHOUT ANY WARRANTY; without even the implied warranty of
174+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
175+GNU General Public License for more details.
176+
177+You should have received a copy of the GNU General Public License
178+along with GCC; see the file COPYING3. If not see
179+<http://www.gnu.org/licenses/>. */
180+
181+
182+/* Change debugging to Dwarf2. */
183+#undef PREFERRED_DEBUGGING_TYPE
184+#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
185+
186+#undef ASM_COMMENT_START
187+#define ASM_COMMENT_START " #"
188+
189+#undef MCOUNT_NAME
190+#define MCOUNT_NAME "_mcount"
191+
192+#define TARGET_DECLSPEC 1
193+
194+#undef SIZE_TYPE
195+#define SIZE_TYPE "long unsigned int"
196+
197+#undef PTRDIFF_TYPE
198+#define PTRDIFF_TYPE "long int"
199+
200+#undef WCHAR_TYPE
201+#define WCHAR_TYPE "int"
202+
203+#undef WCHAR_TYPE_SIZE
204+#define WCHAR_TYPE_SIZE 32
205+
206+/* Haiku uses lots of multichars, so don't warn about them unless the
207+ user explicitly asks for the warnings with -Wmultichar. Note that
208+ CC1_SPEC is used for both cc1 and cc1plus. */
209+#undef CC1_SPEC
210+#define CC1_SPEC "%{!no-fpic:%{!fno-pic:%{!fno-pie:%{!fpie:%{!fPIC:%{!fPIE:-fpic}}}}}} %{!Wmultichar: -Wno-multichar} %(cc1_cpu) %{profile:-p}"
211+
212+#undef CC1PLUS_SPEC
213+#define CC1PLUS_SPEC "%{!Wctor-dtor-privacy:-Wno-ctor-dtor-privacy}"
214+
215+/* LIB_SPEC for Haiku */
216+#undef LIB_SPEC
217+#define LIB_SPEC "-lroot"
218+
219+/* Haiku's libroot.so links against libgcc.a objects */
220+#undef LIBGCC_SPEC
221+#define LIBGCC_SPEC ""
222+
223+#undef STARTFILE_SPEC
224+#define STARTFILE_SPEC "crti.o%s crtbegin.o%s %{!shared:%{!nostart:start_dyn.o%s}} init_term_dyn.o%s"
225+
226+#undef ENDFILE_SPEC
227+#define ENDFILE_SPEC "crtend.o%s crtn.o%s"
228+
229+/* For native compiler, use standard Haiku include file search paths
230+ rooted in /boot/develop/headers. For a cross compiler, don't
231+ expect the host to use the Haiku directory scheme, and instead look
232+ for the Haiku include files relative to TOOL_INCLUDE_DIR. */
233+
234+#ifndef CROSS_DIRECTORY_STRUCTURE
235+#undef INCLUDE_DEFAULTS
236+#define INCLUDE_DEFAULTS \
237+ { \
238+ { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, 0, 0 }, \
239+ { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, 0, 0 }, \
240+ { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, 0, 0 }, \
241+ { GCC_INCLUDE_DIR, "GCC", 0, 0, 0, 0 }, \
242+ { FIXED_INCLUDE_DIR, "GCC", 0, 0, 0, 0 }, \
243+ { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0 }, \
244+ { "/boot/common/include", 0, 0, 0, 0, 0 }, \
245+ { "/boot/develop/headers/os", 0, 0, 0, 0, 0 }, \
246+ { "/boot/develop/headers/os/app", 0, 0, 0, 0, 0 }, \
247+ { "/boot/develop/headers/os/device", 0, 0, 0, 0, 0 }, \
248+ { "/boot/develop/headers/os/drivers", 0, 0, 0, 0, 0 }, \
249+ { "/boot/develop/headers/os/game", 0, 0, 0, 0, 0 }, \
250+ { "/boot/develop/headers/os/interface", 0, 0, 0, 0, 0 }, \
251+ { "/boot/develop/headers/os/kernel", 0, 0, 0, 0, 0 }, \
252+ { "/boot/develop/headers/os/locale", 0, 0, 0, 0, 0 }, \
253+ { "/boot/develop/headers/os/mail", 0, 0, 0, 0, 0 }, \
254+ { "/boot/develop/headers/os/media", 0, 0, 0, 0, 0 }, \
255+ { "/boot/develop/headers/os/midi", 0, 0, 0, 0, 0 }, \
256+ { "/boot/develop/headers/os/midi2", 0, 0, 0, 0, 0 }, \
257+ { "/boot/develop/headers/os/net", 0, 0, 0, 0, 0 }, \
258+ { "/boot/develop/headers/os/opengl", 0, 0, 0, 0, 0 }, \
259+ { "/boot/develop/headers/os/storage", 0, 0, 0, 0, 0 }, \
260+ { "/boot/develop/headers/os/support", 0, 0, 0, 0, 0 }, \
261+ { "/boot/develop/headers/os/translation", 0, 0, 0, 0, 0 }, \
262+ { "/boot/develop/headers/os/add-ons/graphics", 0, 0, 0, 0, 0 }, \
263+ { "/boot/develop/headers/os/add-ons/input_server", 0, 0, 0, 0, 0 }, \
264+ { "/boot/develop/headers/os/add-ons/screen_saver", 0, 0, 0, 0, 0 }, \
265+ { "/boot/develop/headers/os/add-ons/tracker", 0, 0, 0, 0, 0 }, \
266+ { "/boot/develop/headers/os/be_apps/Deskbar", 0, 0, 0, 0, 0 }, \
267+ { "/boot/develop/headers/os/be_apps/NetPositive", 0, 0, 0, 0, 0 }, \
268+ { "/boot/develop/headers/os/be_apps/Tracker", 0, 0, 0, 0, 0 }, \
269+ { "/boot/develop/headers/cpp", 0, 0, 0, 0, 0 }, \
270+ { "/boot/develop/headers/3rdparty", 0, 0, 0, 0, 0 }, \
271+ { "/boot/develop/headers/bsd", 0, 0, 0, 0, 0 }, \
272+ { "/boot/develop/headers/glibc", 0, 0, 0, 0, 0 }, \
273+ { "/boot/develop/headers/posix", 0, 0, 0, 0, 0 }, \
274+ { "/boot/develop/headers", 0, 0, 0, 0, 0 }, \
275+ { 0, 0, 0, 0, 0, 0 } \
276+ }
277+#else /* CROSS_DIRECTORY_STRUCTURE */
278+#undef INCLUDE_DEFAULTS
279+#define INCLUDE_DEFAULTS \
280+ { \
281+ { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, 1, 0 }, \
282+ { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, 1, 0 }, \
283+ { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, 1, 0 }, \
284+ { GCC_INCLUDE_DIR, "GCC", 0, 0, 1, 0 }, \
285+ { FIXED_INCLUDE_DIR, "GCC", 0, 0, 1, 0 }, \
286+ { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 1, 0 }, \
287+ { CROSS_INCLUDE_DIR "/os", 0, 0, 0, 1, 0 }, \
288+ { CROSS_INCLUDE_DIR "/os/app", 0, 0, 0, 1, 0 }, \
289+ { CROSS_INCLUDE_DIR "/os/device", 0, 0, 0, 1, 0 }, \
290+ { CROSS_INCLUDE_DIR "/os/drivers", 0, 0, 0, 1, 0 }, \
291+ { CROSS_INCLUDE_DIR "/os/game", 0, 0, 0, 1, 0 }, \
292+ { CROSS_INCLUDE_DIR "/os/interface", 0, 0, 0, 1, 0 }, \
293+ { CROSS_INCLUDE_DIR "/os/kernel", 0, 0, 0, 1, 0 }, \
294+ { CROSS_INCLUDE_DIR "/os/locale", 0, 0, 0, 1, 0 }, \
295+ { CROSS_INCLUDE_DIR "/os/mail", 0, 0, 0, 1, 0 }, \
296+ { CROSS_INCLUDE_DIR "/os/media", 0, 0, 0, 1, 0 }, \
297+ { CROSS_INCLUDE_DIR "/os/midi", 0, 0, 0, 1, 0 }, \
298+ { CROSS_INCLUDE_DIR "/os/midi2", 0, 0, 0, 1, 0 }, \
299+ { CROSS_INCLUDE_DIR "/os/net", 0, 0, 0, 1, 0 }, \
300+ { CROSS_INCLUDE_DIR "/os/opengl", 0, 0, 0, 1, 0 }, \
301+ { CROSS_INCLUDE_DIR "/os/storage", 0, 0, 0, 1, 0 }, \
302+ { CROSS_INCLUDE_DIR "/os/support", 0, 0, 0, 1, 0 }, \
303+ { CROSS_INCLUDE_DIR "/os/translation", 0, 0, 0, 1, 0 }, \
304+ { CROSS_INCLUDE_DIR "/os/add-ons/graphics", 0, 0, 0, 1, 0 }, \
305+ { CROSS_INCLUDE_DIR "/os/add-ons/input_server", 0, 0, 0, 1, 0 }, \
306+ { CROSS_INCLUDE_DIR "/os/add-ons/screen_saver", 0, 0, 0, 1, 0 }, \
307+ { CROSS_INCLUDE_DIR "/os/add-ons/tracker", 0, 0, 0, 1, 0 }, \
308+ { CROSS_INCLUDE_DIR "/os/be_apps/Deskbar", 0, 0, 0, 1, 0 }, \
309+ { CROSS_INCLUDE_DIR "/os/be_apps/NetPositive", 0, 0, 0, 1, 0 }, \
310+ { CROSS_INCLUDE_DIR "/os/be_apps/Tracker", 0, 0, 0, 1, 0 }, \
311+ { CROSS_INCLUDE_DIR "/cpp", 0, 0, 0, 1, 0 }, \
312+ { CROSS_INCLUDE_DIR "/3rdparty", 0, 0, 0, 1, 0 }, \
313+ { CROSS_INCLUDE_DIR "/bsd", 0, 0, 0, 1, 0 }, \
314+ { CROSS_INCLUDE_DIR "/glibc", 0, 0, 0, 1, 0 }, \
315+ { CROSS_INCLUDE_DIR "/posix", 0, 0, 0, 1, 0 }, \
316+ { CROSS_INCLUDE_DIR , 0, 0, 0, 1, 0 }, \
317+ { 0, 0, 0, 0, 0, 0 } \
318+ }
319+#endif /* CROSS_DIRECTORY_STRUCTURE */
320+
321+/* LIBRARY_PATH is Be's LD_LIBRARY_PATH, which of course will
322+ cause nasty problems if we override it. */
323+#define LIBRARY_PATH_ENV "BELIBRARIES"
324+
325+/* Haiku doesn't have a separate math library. */
326+#define MATH_LIBRARY ""
327+
328+/* Haiku headers are C++-aware (and often use C++). */
329+#define NO_IMPLICIT_EXTERN_C
330diff -ruN gcc-4.4.1-orig/gcc/config/i386/haiku.h gcc-4.4.1/gcc/config/i386/haiku.h
331--- gcc-4.4.1-orig/gcc/config/i386/haiku.h 1969-12-31 19:00:00.000000000 -0500
332+++ gcc-4.4.1/gcc/config/i386/haiku.h 2009-08-11 15:55:07.000000000 -0400
333@@ -0,0 +1,81 @@
334+/* Definitions for Intel x86 running Haiku
335+ Copyright (C) 2008, 2009
336+ Free Software Foundation, Inc.
337+ Contributed by Haiku, Inc.
338+
339+This file is part of GCC.
340+
341+GCC is free software; you can redistribute it and/or modify
342+it under the terms of the GNU General Public License as published by
343+the Free Software Foundation; either version 3, or (at your option)
344+any later version.
345+
346+GCC is distributed in the hope that it will be useful,
347+but WITHOUT ANY WARRANTY; without even the implied warranty of
348+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
349+GNU General Public License for more details.
350+
351+You should have received a copy of the GNU General Public License
352+along with GCC; see the file COPYING3. If not see
353+<http://www.gnu.org/licenses/>. */
354+
355+
356+#define TARGET_VERSION fprintf (stderr, " (i386 Haiku/ELF)");
357+
358+/* The SVR4 ABI for the i386 says that records and unions are returned
359+ in memory. */
360+#undef DEFAULT_PCC_STRUCT_RETURN
361+#define DEFAULT_PCC_STRUCT_RETURN 1
362+
363+#undef DBX_REGISTER_NUMBER
364+#define DBX_REGISTER_NUMBER(n) \
365+ (TARGET_64BIT ? dbx64_register_map[n] : svr4_dbx_register_map[n])
366+
367+#define TARGET_OS_CPP_BUILTINS() \
368+ do \
369+ { \
370+ builtin_define ("__HAIKU__"); \
371+ builtin_define ("__INTEL__"); \
372+ builtin_define ("_X86_"); \
373+ builtin_define ("__stdcall=__attribute__((__stdcall__))"); \
374+ builtin_define ("__cdecl=__attribute__((__cdecl__))"); \
375+ builtin_assert ("system=haiku"); \
376+ /* Haiku apparently doesn't support merging of symbols across shared \
377+ object boundaries. Hence we need to explicitly specify that \
378+ type_infos are not merged, so that they get compared by name \
379+ instead of by pointer. */ \
380+ builtin_define ("__GXX_MERGED_TYPEINFO_NAMES=0"); \
381+ builtin_define ("__GXX_TYPEINFO_EQUALITY_INLINE=0"); \
382+ } \
383+ while (0)
384+
385+/* Provide a LINK_SPEC appropriate for Haiku. Here we provide support
386+ for the special GCC options -static and -shared, which allow us to
387+ link things in one of these three modes by applying the appropriate
388+ combinations of options at link-time. */
389+
390+/* If ELF is the default format, we should not use /lib/elf. */
391+
392+#undef LINK_SPEC
393+#define LINK_SPEC "-m elf_i386_haiku -shared -Bsymbolic %{nostart:-e 0} %{shared:-e 0} %{!shared: %{!nostart: -no-undefined}}"
394+
395+/* A C statement (sans semicolon) to output to the stdio stream
396+ FILE the assembler definition of uninitialized global DECL named
397+ NAME whose size is SIZE bytes and alignment is ALIGN bytes.
398+ Try to use asm_output_aligned_bss to implement this macro. */
399+
400+#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
401+ asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
402+
403+/* A C statement to output to the stdio stream FILE an assembler
404+ command to advance the location counter to a multiple of 1<<LOG
405+ bytes if it is within MAX_SKIP bytes.
406+
407+ This is used to align code labels according to Intel recommendations. */
408+
409+#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
410+#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \
411+ if ((LOG)!=0) \
412+ if ((MAX_SKIP)==0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
413+ else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP))
414+#endif
415diff -ruN gcc-4.4.1-orig/gcc/config/m68k/haiku.h gcc-4.4.1/gcc/config/m68k/haiku.h
416--- gcc-4.4.1-orig/gcc/config/m68k/haiku.h 1969-12-31 19:00:00.000000000 -0500
417+++ gcc-4.4.1/gcc/config/m68k/haiku.h 2009-08-11 15:55:07.000000000 -0400
418@@ -0,0 +1,276 @@
419+/* Definitions for Motorola 68k running Haiku
420+ Copyright (C) 2009
421+ Free Software Foundation, Inc.
422+ Contributed by Haiku, Inc.
423+
424+This file is part of GCC.
425+
426+GCC is free software; you can redistribute it and/or modify
427+it under the terms of the GNU General Public License as published by
428+the Free Software Foundation; either version 3, or (at your option)
429+any later version.
430+
431+GCC is distributed in the hope that it will be useful,
432+but WITHOUT ANY WARRANTY; without even the implied warranty of
433+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
434+GNU General Public License for more details.
435+
436+You should have received a copy of the GNU General Public License
437+along with GCC; see the file COPYING3. If not see
438+<http://www.gnu.org/licenses/>. */
439+
440+
441+#undef TARGET_VERSION
442+#define TARGET_VERSION fprintf (stderr, " (68k Haiku/ELF)");
443+
444+/* Default target comes from config.gcc. */
445+
446+#undef TARGET_DEFAULT
447+#ifdef TARGET_CPU_DEFAULT
448+#define TARGET_DEFAULT TARGET_CPU_DEFAULT
449+#else
450+#define TARGET_DEFAULT (MASK_BITFIELD|MASK_68881|MASK_68020)
451+#endif
452+
453+/* for 68k machines this only needs to be TRUE for the 68000 */
454+
455+#undef STRICT_ALIGNMENT
456+#define STRICT_ALIGNMENT 0
457+
458+/* Here are four prefixes that are used by asm_fprintf to
459+ facilitate customization for alternate assembler syntaxes.
460+ Machines with no likelihood of an alternate syntax need not
461+ define these and need not use asm_fprintf. */
462+
463+/* The prefix for register names. Note that REGISTER_NAMES
464+ is supposed to include this prefix. Also note that this is NOT an
465+ fprintf format string, it is a literal string */
466+
467+#undef REGISTER_PREFIX
468+#define REGISTER_PREFIX "%"
469+
470+/* The prefix for local (compiler generated) labels.
471+ These labels will not appear in the symbol table. */
472+
473+#undef LOCAL_LABEL_PREFIX
474+#define LOCAL_LABEL_PREFIX "."
475+
476+/* The prefix to add to user-visible assembler symbols. */
477+
478+#undef USER_LABEL_PREFIX
479+#define USER_LABEL_PREFIX ""
480+
481+#undef ASM_COMMENT_START
482+#define ASM_COMMENT_START "|"
483+
484+/* Target OS builtins. */
485+
486+#undef TARGET_OS_CPP_BUILTINS
487+#define TARGET_OS_CPP_BUILTINS() \
488+ do \
489+ { \
490+ builtin_define ("__HAIKU__"); \
491+ builtin_define ("__M68K__"); \
492+ builtin_define_std ("mc68000"); \
493+ builtin_define_std ("mc68020"); \
494+ builtin_define ("__stdcall=__attribute__((__stdcall__))"); \
495+ builtin_define ("__cdecl=__attribute__((__cdecl__))"); \
496+ builtin_assert ("system=haiku"); \
497+ /* Haiku apparently doesn't support merging of symbols across shared\
498+ object boundaries. Hence we need to explicitly specify that \
499+ type_infos are not merged, so that they get compared by name \
500+ instead of by pointer. */ \
501+ builtin_define ("__GXX_MERGED_TYPEINFO_NAMES=0"); \
502+ builtin_define ("__GXX_TYPEINFO_EQUALITY_INLINE=0"); \
503+ } \
504+ while (0)
505+
506+#define TARGET_OBJFMT_CPP_BUILTINS() \
507+ do \
508+ { \
509+ builtin_define ("__ELF__"); \
510+ } \
511+ while (0)
512+
513+#undef CPP_SPEC
514+#if TARGET_DEFAULT & MASK_68881
515+#define CPP_SPEC \
516+ "%{fPIC|fpic|fPIE|fpie:-D__PIC__ -D__pic__} %{!msoft-float:-D__HAVE_68881__} %{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
517+#else
518+#define CPP_SPEC \
519+ "%{fPIC|fpic|fPIE|fpie:-D__PIC__ -D__pic__} %{m68881:-D__HAVE_68881__} %{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
520+#endif
521+
522+/* We override the ASM_SPEC from svr4.h because we must pass -m68040 down
523+ to the assembler. */
524+#undef ASM_SPEC
525+#define ASM_SPEC \
526+ "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \
527+%{m68040} %{m68060:-m68040}"
528+
529+/* Provide a LINK_SPEC appropriate for Haiku. Here we provide support
530+ for the special GCC options -static and -shared, which allow us to
531+ link things in one of these three modes by applying the appropriate
532+ combinations of options at link-time. */
533+
534+/* If ELF is the default format, we should not use /lib/elf. */
535+
536+#undef LINK_SPEC
537+/*#define LINK_SPEC "%{!o*:-o %b} -m elf_m68k_haiku -shared -no-undefined -Bsymbolic %{nostart:-e 0}"*/
538+#define LINK_SPEC "%{!o*:-o %b} -m m68kelf -shared -no-undefined -Bsymbolic %{nostart:-e 0}"
539+
540+/* XXX: not sure for the rest there... */
541+
542+/* Currently, JUMP_TABLES_IN_TEXT_SECTION must be defined in order to
543+ keep switch tables in the text section. */
544+
545+#define JUMP_TABLES_IN_TEXT_SECTION 1
546+
547+/* This is how to output an assembler line that says to advance the
548+ location counter to a multiple of 2**LOG bytes. */
549+
550+/* Use the default action for outputting the case label. */
551+#undef ASM_OUTPUT_CASE_LABEL
552+#define ASM_RETURN_CASE_JUMP \
553+ do { \
554+ if (TARGET_COLDFIRE) \
555+ { \
556+ if (ADDRESS_REG_P (operands[0])) \
557+ return "jmp %%pc@(2,%0:l)"; \
558+ else \
559+ return "ext%.l %0\n\tjmp %%pc@(2,%0:l)"; \
560+ } \
561+ else \
562+ return "jmp %%pc@(2,%0:w)"; \
563+ } while (0)
564+
565+#undef ASM_OUTPUT_ALIGN
566+#define ASM_OUTPUT_ALIGN(FILE,LOG) \
567+ if ((LOG) > 0) \
568+ fprintf ((FILE), "%s%u\n", ALIGN_ASM_OP, 1 << (LOG));
569+
570+/* If defined, a C expression whose value is a string containing the
571+ assembler operation to identify the following data as uninitialized global
572+ data. */
573+
574+#define BSS_SECTION_ASM_OP "\t.section\t.bss"
575+
576+/* A C statement (sans semicolon) to output to the stdio stream
577+ FILE the assembler definition of uninitialized global DECL named
578+ NAME whose size is SIZE bytes and alignment is ALIGN bytes.
579+ Try to use asm_output_aligned_bss to implement this macro. */
580+
581+#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
582+ asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
583+
584+/* Output assembler code to FILE to increment profiler label # LABELNO
585+ for profiling a function entry. */
586+
587+#undef FUNCTION_PROFILER
588+#define FUNCTION_PROFILER(FILE, LABELNO) \
589+{ \
590+ asm_fprintf (FILE, "\tlea (%LLP%d,%Rpc),%Ra1\n", (LABELNO)); \
591+ if (flag_pic) \
592+ fprintf (FILE, "\tbsr.l _mcount@PLTPC\n"); \
593+ else \
594+ fprintf (FILE, "\tjbsr _mcount\n"); \
595+}
596+
597+/* How to renumber registers for dbx and gdb.
598+ On the Sun-3, the floating point registers have numbers
599+ 18 to 25, not 16 to 23 as they do in the compiler. */
600+
601+#define DBX_REGISTER_NUMBER(REGNO) ((REGNO) < 16 ? (REGNO) : (REGNO) + 2)
602+
603+/* Do not break .stabs pseudos into continuations. */
604+
605+#define DBX_CONTIN_LENGTH 0
606+
607+/* 1 if N is a possible register number for a function value. For
608+ m68k/SVR4 allow d0, a0, or fp0 as return registers, for integral,
609+ pointer, or floating types, respectively. Reject fp0 if not using
610+ a 68881 coprocessor. */
611+
612+#undef FUNCTION_VALUE_REGNO_P
613+#define FUNCTION_VALUE_REGNO_P(N) \
614+ ((N) == 0 || (N) == 8 || (TARGET_68881 && (N) == 16))
615+
616+/* Define this to be true when FUNCTION_VALUE_REGNO_P is true for
617+ more than one register. */
618+
619+#undef NEEDS_UNTYPED_CALL
620+#define NEEDS_UNTYPED_CALL 1
621+
622+/* Define how to generate (in the callee) the output value of a
623+ function and how to find (in the caller) the value returned by a
624+ function. VALTYPE is the data type of the value (as a tree). If
625+ the precise function being called is known, FUNC is its
626+ FUNCTION_DECL; otherwise, FUNC is 0. For m68k/SVR4 generate the
627+ result in d0, a0, or fp0 as appropriate. */
628+
629+#undef FUNCTION_VALUE
630+#define FUNCTION_VALUE(VALTYPE, FUNC) \
631+ (TREE_CODE (VALTYPE) == REAL_TYPE && TARGET_68881 \
632+ ? gen_rtx_REG (TYPE_MODE (VALTYPE), 16) \
633+ : (POINTER_TYPE_P (VALTYPE) \
634+ ? gen_rtx_REG (TYPE_MODE (VALTYPE), 8) \
635+ : gen_rtx_REG (TYPE_MODE (VALTYPE), 0)))
636+
637+/* For compatibility with the large body of existing code which does
638+ not always properly declare external functions returning pointer
639+ types, the m68k/SVR4 convention is to copy the value returned for
640+ pointer functions from a0 to d0 in the function epilogue, so that
641+ callers that have neglected to properly declare the callee can
642+ still find the correct return value. */
643+
644+#define FUNCTION_EXTRA_EPILOGUE(FILE, SIZE) \
645+do { \
646+ if (current_function_returns_pointer \
647+ && ! find_equiv_reg (0, get_last_insn (), 0, 0, 0, 8, Pmode)) \
648+ asm_fprintf (FILE, "\tmove.l %Ra0,%Rd0\n"); \
649+} while (0);
650+
651+/* Define how to find the value returned by a library function
652+ assuming the value has mode MODE.
653+ For m68k/SVR4 look for integer values in d0, pointer values in d0
654+ (returned in both d0 and a0), and floating values in fp0. */
655+
656+#undef LIBCALL_VALUE
657+#define LIBCALL_VALUE(MODE) \
658+ ((((MODE) == SFmode || (MODE) == DFmode || (MODE) == XFmode) \
659+ && TARGET_68881) \
660+ ? gen_rtx_REG ((MODE), 16) \
661+ : gen_rtx_REG ((MODE), 0))
662+
663+/* For m68k SVR4, structures are returned using the reentrant
664+ technique. */
665+#undef PCC_STATIC_STRUCT_RETURN
666+#define DEFAULT_PCC_STRUCT_RETURN 0
667+
668+/* Finalize the trampoline by flushing the insn cache. */
669+
670+#undef FINALIZE_TRAMPOLINE
671+#define FINALIZE_TRAMPOLINE(TRAMP) \
672+ emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__clear_cache"), \
673+ 0, VOIDmode, 2, TRAMP, Pmode, \
674+ plus_constant (TRAMP, TRAMPOLINE_SIZE), Pmode);
675+
676+/* Clear the instruction cache from `beg' to `end'. This makes an
677+ inline system call to SYS_cacheflush. The arguments are as
678+ follows:
679+
680+ cacheflush (addr, scope, cache, len)
681+
682+ addr - the start address for the flush
683+ scope - the scope of the flush (see the cpush insn)
684+ cache - which cache to flush (see the cpush insn)
685+ len - a factor relating to the number of flushes to perform:
686+ len/16 lines, or len/4096 pages. */
687+
688+#define CLEAR_INSN_CACHE(BEG, END) \
689+{ \
690+extern void clear_caches(void *address, int length, unsigned long flags); \
691+ void *ptr = BEG; \
692+ int len = (END - BEG + 32); \
693+ clear_caches(ptr, len, 0x0005); \
694+}
695diff -ruN gcc-4.4.1-orig/gcc/config/mips/haiku.h gcc-4.4.1/gcc/config/mips/haiku.h
696--- gcc-4.4.1-orig/gcc/config/mips/haiku.h 1969-12-31 19:00:00.000000000 -0500
697+++ gcc-4.4.1/gcc/config/mips/haiku.h 2009-08-11 15:55:07.000000000 -0400
698@@ -0,0 +1,51 @@
699+/* Definitions for MIPS running Haiku
700+ Copyright (C) 2009
701+ Free Software Foundation, Inc.
702+ Contributed by Haiku, Inc.
703+
704+This file is part of GCC.
705+
706+GCC is free software; you can redistribute it and/or modify
707+it under the terms of the GNU General Public License as published by
708+the Free Software Foundation; either version 3, or (at your option)
709+any later version.
710+
711+GCC is distributed in the hope that it will be useful,
712+but WITHOUT ANY WARRANTY; without even the implied warranty of
713+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
714+GNU General Public License for more details.
715+
716+You should have received a copy of the GNU General Public License
717+along with GCC; see the file COPYING3. If not see
718+<http://www.gnu.org/licenses/>. */
719+
720+
721+#undef TARGET_VERSION
722+#define TARGET_VERSION fprintf (stderr, " (MIPSEL Haiku/ELF)");
723+
724+#define TARGET_OS_CPP_BUILTINS() \
725+ do \
726+ { \
727+ builtin_define ("__HAIKU__"); \
728+ builtin_define ("__MIPS__"); \
729+ builtin_define ("__MIPSEL__"); \
730+ builtin_define ("_MIPSEL_"); \
731+ builtin_define ("__stdcall=__attribute__((__stdcall__))"); \
732+ builtin_define ("__cdecl=__attribute__((__cdecl__))"); \
733+ builtin_assert ("system=haiku"); \
734+ if (flag_pic) \
735+ { \
736+ builtin_define ("__PIC__"); \
737+ builtin_define ("__pic__"); \
738+ } \
739+ /* Haiku apparently doesn't support merging of symbols across shared \
740+ object boundaries. Hence we need to explicitly specify that \
741+ type_infos are not merged, so that they get compared by name \
742+ instead of by pointer. */ \
743+ builtin_define ("__GXX_MERGED_TYPEINFO_NAMES=0"); \
744+ builtin_define ("__GXX_TYPEINFO_EQUALITY_INLINE=0"); \
745+ } \
746+ while (0)
747+
748+#undef LINK_SPEC
749+#define LINK_SPEC "%{!o*:-o %b} -m elf_mipsel_haiku -shared -Bsymbolic %{nostart:-e 0}"
750diff -ruN gcc-4.4.1-orig/gcc/config/rs6000/haiku.h gcc-4.4.1/gcc/config/rs6000/haiku.h
751--- gcc-4.4.1-orig/gcc/config/rs6000/haiku.h 1969-12-31 19:00:00.000000000 -0500
752+++ gcc-4.4.1/gcc/config/rs6000/haiku.h 2009-08-11 15:55:07.000000000 -0400
753@@ -0,0 +1,64 @@
754+/* Definitions for PowerPC running Haiku
755+ Copyright (C) 2009
756+ Free Software Foundation, Inc.
757+ Contributed by Haiku, Inc.
758+
759+This file is part of GCC.
760+
761+GCC is free software; you can redistribute it and/or modify
762+it under the terms of the GNU General Public License as published by
763+the Free Software Foundation; either version 3, or (at your option)
764+any later version.
765+
766+GCC is distributed in the hope that it will be useful,
767+but WITHOUT ANY WARRANTY; without even the implied warranty of
768+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
769+GNU General Public License for more details.
770+
771+You should have received a copy of the GNU General Public License
772+along with GCC; see the file COPYING3. If not see
773+<http://www.gnu.org/licenses/>. */
774+
775+
776+#undef TARGET_VERSION
777+#define TARGET_VERSION fprintf (stderr, " (PowerPC Haiku/ELF)");
778+
779+/* long double is 128 bits wide; the documentation claims
780+ LIBGCC2_LONG_DOUBLE_TYPE_SIZE to default to LONG_DOUBLE_TYPE_SIZE, but
781+ it apparently does not */
782+/*#undef LONG_DOUBLE_TYPE_SIZE
783+#define LONG_DOUBLE_TYPE_SIZE 128
784+#undef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
785+#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128*/
786+
787+#undef TARGET_OS_CPP_BUILTINS
788+#define TARGET_OS_CPP_BUILTINS() \
789+ do \
790+ { \
791+ builtin_define ("__HAIKU__"); \
792+ builtin_define ("__POWERPC__"); \
793+ builtin_define ("__powerpc__"); \
794+ builtin_define ("__stdcall=__attribute__((__stdcall__))"); \
795+ builtin_define ("__cdecl=__attribute__((__cdecl__))"); \
796+ builtin_assert ("system=haiku"); \
797+ builtin_assert ("cpu=powerpc"); \
798+ builtin_assert ("machine=powerpc"); \
799+ TARGET_OS_SYSV_CPP_BUILTINS (); \
800+ /* Haiku apparently doesn't support merging of symbols across shared \
801+ object boundaries. Hence we need to explicitly specify that \
802+ type_infos are not merged, so that they get compared by name \
803+ instead of by pointer. */ \
804+ builtin_define ("__GXX_MERGED_TYPEINFO_NAMES=0"); \
805+ builtin_define ("__GXX_TYPEINFO_EQUALITY_INLINE=0"); \
806+ } \
807+ while (0)
808+
809+/* Provide a LINK_SPEC appropriate for Haiku. Here we provide support
810+ for the special GCC options -static and -shared, which allow us to
811+ link things in one of these three modes by applying the appropriate
812+ combinations of options at link-time. */
813+
814+/* If ELF is the default format, we should not use /lib/elf. */
815+
816+#undef LINK_SPEC
817+#define LINK_SPEC "%{!o*:-o %b} -m elf_ppc_haiku -shared -no-undefined -Bsymbolic %{nostart:-e 0}"
818diff -ruN gcc-4.4.1-orig/gcc/config/t-haiku gcc-4.4.1/gcc/config/t-haiku
819--- gcc-4.4.1-orig/gcc/config/t-haiku 1969-12-31 19:00:00.000000000 -0500
820+++ gcc-4.4.1/gcc/config/t-haiku 2009-08-11 15:55:07.000000000 -0400
821@@ -0,0 +1,4 @@
822+# There are system headers elsewhere, but these are the ones that
823+# we are most likely to want to apply any fixes to.
824+NATIVE_SYSTEM_HEADER_DIR = /boot/develop/headers
825+LIMITS_H_TEST = [ -f $(SYSTEM_HEADER_DIR)/posix/limits.h ]
826diff -ruN gcc-4.4.1-orig/gcc/config.gcc gcc-4.4.1/gcc/config.gcc
827--- gcc-4.4.1-orig/gcc/config.gcc 2009-04-17 07:58:41.000000000 -0400
828+++ gcc-4.4.1/gcc/config.gcc 2009-08-11 16:03:29.000000000 -0400
829@@ -693,6 +693,16 @@
830 tm_file="dbxelf.h elfos.h ${fbsd_tm_file} arm/elf.h arm/aout.h arm/freebsd.h arm/arm.h"
831 tmake_file="${tmake_file} arm/t-arm arm/t-strongarm-elf"
832 ;;
833+arm*-*-haiku*)
834+ tmake_file="${tmake_file} t-haiku arm/t-arm arm/t-arm-elf arm/t-bpabi arm/t-haiku"
835+ tm_file="dbxelf.h elfos.h haiku.h arm/elf.h arm/bpabi.h arm/haiku.h"
836+ # The BPABI long long divmod functions return a 128-bit value in
837+ # registers r0-r3. Correctly modeling that requires the use of
838+ # TImode.
839+ need_64bit_hwint=yes
840+ default_use_cxa_atexit=yes
841+ tm_file="${tm_file} arm/aout.h arm/arm.h"
842+ ;;
843 arm*-*-netbsdelf*)
844 tm_file="dbxelf.h elfos.h netbsd.h netbsd-elf.h arm/elf.h arm/aout.h arm/arm.h arm/netbsd-elf.h"
845 tmake_file="${tmake_file} arm/t-arm arm/t-netbsd"
846@@ -1047,6 +1057,11 @@
847 tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${fbsd_tm_file} i386/x86-64.h i386/freebsd.h i386/freebsd64.h"
848 tmake_file="${tmake_file} i386/t-crtstuff"
849 ;;
850+i[34567]86-*-haiku*)
851+ tmake_file='t-haiku i386/t-crtpic'
852+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h svr4.h haiku.h i386/haiku.h"
853+ extra_parts='crtbegin.o crtend.o'
854+ ;;
855 i[34567]86-*-netbsdelf*)
856 tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-elf.h i386/netbsd-elf.h"
857 ;;
858@@ -1449,6 +1464,13 @@
859 esac
860 extra_parts="crtbegin.o crtend.o"
861 ;;
862+m68k-*-haiku*)
863+ default_m68k_cpu=68020
864+ default_cf_cpu=5206
865+ tmake_file="m68k/t-m68kbare m68k/t-crtstuff t-haiku"
866+ tm_file="${tm_file} dbxelf.h elfos.h haiku.h m68k/haiku.h"
867+ tm_defines="${tm_defines} MOTOROLA=1"
868+ ;;
869 m68k*-*-netbsdelf*)
870 default_m68k_cpu=68020
871 default_cf_cpu=5475
872@@ -1676,6 +1698,11 @@
873 tm_file="elfos.h ${tm_file} mips/elf.h"
874 tmake_file="mips/t-elf mips/t-libgcc-mips16"
875 ;;
876+mipsel-*-haiku*)
877+ tmake_file='mips/t-elf t-haiku'
878+ tm_file="elfos.h ${tm_file} haiku.h mips/haiku.h"
879+ extra_parts='crtbegin.o crtend.o'
880+ ;;
881 mips64-*-elf* | mips64el-*-elf*)
882 tm_file="elfos.h ${tm_file} mips/elf.h"
883 tmake_file="mips/t-elf mips/t-libgcc-mips16"
884@@ -1812,6 +1839,11 @@
885 extra_options="${extra_options} rs6000/sysv4.opt"
886 tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcgas rs6000/t-ppccomm"
887 ;;
888+powerpc-*-haiku*)
889+ tmake_file="rs6000/t-fprules rs6000/t-ppcos rs6000/t-ppccomm t-haiku"
890+ tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h haiku.h rs6000/haiku.h"
891+ extra_options="${extra_options} rs6000/sysv4.opt"
892+ ;;
893 powerpc-*-rtems*)
894 tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/eabi.h rs6000/e500.h rs6000/rtems.h rtems.h"
895 extra_options="${extra_options} rs6000/sysv4.opt"
896diff -ruN gcc-4.4.1-orig/gcc/configure gcc-4.4.1/gcc/configure
897--- gcc-4.4.1-orig/gcc/configure 2009-03-24 13:46:03.000000000 -0400
898+++ gcc-4.4.1/gcc/configure 2009-08-11 15:55:07.000000000 -0400
899@@ -9674,6 +9674,15 @@
900 # --------
901
902
903+# Configure -lm usage for host tools that need it
904+math_library="-lm"
905+case $host in
906+ *-*-haiku* | *-*-cygwin* | *-*-pw32* | *-*-darwin*)
907+ # no separate math library needed
908+ math_library=
909+ ;;
910+esac
911+
912 # These libraries may be used by collect2.
913 # We may need a special search path to get them linked.
914 echo "$as_me:$LINENO: checking for collect2 libraries" >&5
915@@ -17039,7 +17048,7 @@
916 esac
917 ;;
918
919- beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
920+ beos* | haiku* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
921 # PIC is the default for these OSes.
922 ;;
923
924@@ -17686,6 +17695,11 @@
925 fi
926 ;;
927
928+ haiku*)
929+ allow_undefined_flag=unsupported
930+ archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
931+ ;;
932+
933 interix[3-9]*)
934 hardcode_direct=no
935 hardcode_shlibpath_var=no
936@@ -18985,7 +18999,7 @@
937 esac
938 ;;
939
940-beos*)
941+beos* | haiku*)
942 library_names_spec='${libname}${shared_ext}'
943 dynamic_linker="$host_os ld.so"
944 shlibpath_var=LIBRARY_PATH
945@@ -25652,6 +25666,7 @@
946 s,@LTLIBOBJS@,$LTLIBOBJS,;t t
947 /@language_hooks@/r $language_hooks
948 s,@language_hooks@,,;t t
949+s,@math_library@,$math_library,;t t
950 CEOF
951
952 _ACEOF
953diff -ruN gcc-4.4.1-orig/gcc/configure.ac gcc-4.4.1/gcc/configure.ac
954--- gcc-4.4.1-orig/gcc/configure.ac 2009-03-24 13:46:03.000000000 -0400
955+++ gcc-4.4.1/gcc/configure.ac 2009-08-11 15:55:07.000000000 -0400
956@@ -1353,7 +1353,7 @@
957 # default
958 target_thread_file='single'
959 ;;
960- aix | dce | gnat | irix | posix | posix95 | rtems | \
961+ aix | dce | gnat | haiku | irix | posix | posix95 | rtems | \
962 single | solaris | vxworks | win32 | mipssde)
963 target_thread_file=${enable_threads}
964 ;;
965diff -ruN gcc-4.4.1-orig/gcc/defaults.h gcc-4.4.1/gcc/defaults.h
966--- gcc-4.4.1-orig/gcc/defaults.h 2009-07-11 15:06:26.000000000 -0400
967+++ gcc-4.4.1/gcc/defaults.h 2009-08-11 15:55:07.000000000 -0400
968@@ -365,9 +365,11 @@
969 at program start-up time. */
970 #if defined (TARGET_ASM_NAMED_SECTION) && SUPPORTS_WEAK
971 #ifndef JCR_SECTION_NAME
972+#ifndef __HAIKU__
973 #define JCR_SECTION_NAME ".jcr"
974 #endif
975 #endif
976+#endif
977
978 /* This decision to use a .jcr section can be overridden by defining
979 USE_JCR_SECTION to 0 in target file. This is necessary if target
980diff -ruN gcc-4.4.1-orig/gcc/ginclude/stdarg.h gcc-4.4.1/gcc/ginclude/stdarg.h
981--- gcc-4.4.1-orig/gcc/ginclude/stdarg.h 2009-04-09 19:23:07.000000000 -0400
982+++ gcc-4.4.1/gcc/ginclude/stdarg.h 2009-08-11 15:55:07.000000000 -0400
983@@ -97,7 +97,7 @@
984 #ifndef _VA_LIST
985 /* The macro _VA_LIST_T_H is used in the Bull dpx2 */
986 #ifndef _VA_LIST_T_H
987-/* The macro __va_list__ is used by BeOS. */
988+/* The macro __va_list__ is used by BeOS and Haiku. */
989 #ifndef __va_list__
990 typedef __gnuc_va_list va_list;
991 #endif /* not __va_list__ */
992diff -ruN gcc-4.4.1-orig/gcc/ginclude/stddef.h gcc-4.4.1/gcc/ginclude/stddef.h
993--- gcc-4.4.1-orig/gcc/ginclude/stddef.h 2009-04-09 19:23:07.000000000 -0400
994+++ gcc-4.4.1/gcc/ginclude/stddef.h 2009-08-11 15:55:07.000000000 -0400
995@@ -166,7 +166,7 @@
996 /* Define this type if we are doing the whole job,
997 or if we want this type in particular. */
998 #if defined (_STDDEF_H) || defined (__need_size_t)
999-#ifndef __size_t__ /* BeOS */
1000+#ifndef __size_t__ /* BeOS, Haiku */
1001 #ifndef __SIZE_T__ /* Cray Unicos/Mk */
1002 #ifndef _SIZE_T /* in case <sys/types.h> has defined it. */
1003 #ifndef _SYS_SIZE_T_H
1004@@ -183,7 +183,7 @@
1005 #ifndef _GCC_SIZE_T
1006 #ifndef _SIZET_
1007 #ifndef __size_t
1008-#define __size_t__ /* BeOS */
1009+#define __size_t__ /* BeOS, Haiku */
1010 #define __SIZE_T__ /* Cray Unicos/Mk */
1011 #define _SIZE_T
1012 #define _SYS_SIZE_T_H
1013@@ -209,9 +209,9 @@
1014 #endif
1015 #if !(defined (__GNUG__) && defined (size_t))
1016 typedef __SIZE_TYPE__ size_t;
1017-#ifdef __BEOS__
1018+#if defined(__BEOS__) || defined(__HAIKU__)
1019 typedef long ssize_t;
1020-#endif /* __BEOS__ */
1021+#endif /* __BEOS__ and __HAIKU__ */
1022 #endif /* !(defined (__GNUG__) && defined (size_t)) */
1023 #endif /* __size_t */
1024 #endif /* _SIZET_ */
1025@@ -242,7 +242,7 @@
1026 /* Define this type if we are doing the whole job,
1027 or if we want this type in particular. */
1028 #if defined (_STDDEF_H) || defined (__need_wchar_t)
1029-#ifndef __wchar_t__ /* BeOS */
1030+#ifndef __wchar_t__ /* BeOS, Haiku */
1031 #ifndef __WCHAR_T__ /* Cray Unicos/Mk */
1032 #ifndef _WCHAR_T
1033 #ifndef _T_WCHAR_
1034@@ -259,7 +259,7 @@
1035 #ifndef ___int_wchar_t_h
1036 #ifndef __INT_WCHAR_T_H
1037 #ifndef _GCC_WCHAR_T
1038-#define __wchar_t__ /* BeOS */
1039+#define __wchar_t__ /* BeOS, Haiku */
1040 #define __WCHAR_T__ /* Cray Unicos/Mk */
1041 #define _WCHAR_T
1042 #define _T_WCHAR_
1043diff -ruN gcc-4.4.1-orig/gcc/Makefile.in gcc-4.4.1/gcc/Makefile.in
1044--- gcc-4.4.1-orig/gcc/Makefile.in 2009-05-21 19:17:37.000000000 -0400
1045+++ gcc-4.4.1/gcc/Makefile.in 2009-08-11 15:55:07.000000000 -0400
1046@@ -3441,7 +3441,7 @@
1047 $(genprogmd:%=build/gen%$(build_exeext)): $(BUILD_RTL) $(BUILD_ERRORS)
1048
1049 # These programs need libs over and above what they get from the above list.
1050-build/genautomata$(build_exeext) : BUILD_LIBS += -lm
1051+build/genautomata$(build_exeext) : BUILD_LIBS += @math_library@
1052
1053 # These programs are not linked with the MD reader.
1054 build/gengenrtl$(build_exeext) : $(BUILD_ERRORS)
1055diff -ruN gcc-4.4.1-orig/intl/loadmsgcat.c gcc-4.4.1/intl/loadmsgcat.c
1056--- gcc-4.4.1-orig/intl/loadmsgcat.c 2005-05-13 04:03:47.000000000 -0400
1057+++ gcc-4.4.1/intl/loadmsgcat.c 2009-08-11 15:55:07.000000000 -0400
1058@@ -480,8 +480,8 @@
1059 # define O_BINARY _O_BINARY
1060 # define O_TEXT _O_TEXT
1061 #endif
1062-#ifdef __BEOS__
1063- /* BeOS 5 has O_BINARY and O_TEXT, but they have no effect. */
1064+#if defined(__BEOS__) || defined(__HAIKU__)
1065+ /* BeOS 5 and Haiku R1 have O_BINARY and O_TEXT, but they have no effect. */
1066 # undef O_BINARY
1067 # undef O_TEXT
1068 #endif
1069diff -ruN gcc-4.4.1-orig/libgcc/config.host gcc-4.4.1/libgcc/config.host
1070--- gcc-4.4.1-orig/libgcc/config.host 2009-04-17 07:58:41.000000000 -0400
1071+++ gcc-4.4.1/libgcc/config.host 2009-08-11 15:55:07.000000000 -0400
1072@@ -198,6 +198,8 @@
1073 ;;
1074 arm*-*-freebsd*)
1075 ;;
1076+arm-*-haiku*)
1077+ ;;
1078 arm*-*-netbsdelf*)
1079 ;;
1080 arm*-*-netbsd*)
1081@@ -281,6 +283,8 @@
1082 ;;
1083 x86_64-*-freebsd*)
1084 ;;
1085+i[34567]86-*-haiku*)
1086+ ;;
1087 i[34567]86-*-netbsdelf*)
1088 ;;
1089 i[34567]86-*-netbsd*)
1090@@ -373,6 +377,8 @@
1091 ;;
1092 m68k-*-elf*)
1093 ;;
1094+m68k-*-haiku*)
1095+ ;;
1096 m68k*-*-netbsdelf*)
1097 ;;
1098 m68k*-*-openbsd*)
1099@@ -391,6 +397,8 @@
1100 ;;
1101 mips-sgi-irix[56]*)
1102 ;;
1103+mips*-*-haiku*)
1104+ ;;
1105 mips*-*-netbsd*) # NetBSD/mips, either endian.
1106 ;;
1107 mips64*-*-linux*)
1108@@ -447,6 +455,8 @@
1109 ;;
1110 powerpc*-*-freebsd*)
1111 ;;
1112+powerpc-*-haiku*)
1113+ ;;
1114 powerpc-*-netbsd*)
1115 ;;
1116 powerpc-*-eabispe*)
1117diff -ruN gcc-4.4.1-orig/libgomp/configure gcc-4.4.1/libgomp/configure
1118--- gcc-4.4.1-orig/libgomp/configure 2009-07-22 03:43:59.000000000 -0400
1119+++ gcc-4.4.1/libgomp/configure 2009-08-11 15:55:07.000000000 -0400
1120@@ -7169,7 +7169,7 @@
1121 esac
1122 ;;
1123
1124- beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
1125+ beos* | haiku* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
1126 # PIC is the default for these OSes.
1127 ;;
1128
1129@@ -7816,6 +7816,11 @@
1130 fi
1131 ;;
1132
1133+ haiku*)
1134+ allow_undefined_flag=unsupported
1135+ archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
1136+ ;;
1137+
1138 interix[3-9]*)
1139 hardcode_direct=no
1140 hardcode_shlibpath_var=no
1141@@ -9115,7 +9120,7 @@
1142 esac
1143 ;;
1144
1145-beos*)
1146+beos* | haiku*)
1147 library_names_spec='${libname}${shared_ext}'
1148 dynamic_linker="$host_os ld.so"
1149 shlibpath_var=LIBRARY_PATH
1150diff -ruN gcc-4.4.1-orig/libmudflap/configure gcc-4.4.1/libmudflap/configure
1151--- gcc-4.4.1-orig/libmudflap/configure 2009-03-01 12:49:31.000000000 -0500
1152+++ gcc-4.4.1/libmudflap/configure 2009-08-11 15:55:07.000000000 -0400
1153@@ -6132,7 +6132,7 @@
1154 lt_cv_deplibs_check_method=pass_all
1155 ;;
1156
1157-beos*)
1158+beos* | haiku*)
1159 lt_cv_deplibs_check_method=pass_all
1160 ;;
1161
1162@@ -8300,7 +8300,7 @@
1163 esac
1164 ;;
1165
1166- beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
1167+ beos* | haiku* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
1168 # PIC is the default for these OSes.
1169 ;;
1170
1171@@ -8947,6 +8947,11 @@
1172 fi
1173 ;;
1174
1175+ haiku*)
1176+ allow_undefined_flag=unsupported
1177+ archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
1178+ ;;
1179+
1180 interix[3-9]*)
1181 hardcode_direct=no
1182 hardcode_shlibpath_var=no
1183@@ -10246,7 +10251,7 @@
1184 esac
1185 ;;
1186
1187-beos*)
1188+beos* | haiku*)
1189 library_names_spec='${libname}${shared_ext}'
1190 dynamic_linker="$host_os ld.so"
1191 shlibpath_var=LIBRARY_PATH
1192@@ -10947,7 +10952,7 @@
1193 lt_cv_dlopen_libs=
1194
1195 case $host_os in
1196- beos*)
1197+ beos* | haiku*)
1198 lt_cv_dlopen="load_add_on"
1199 lt_cv_dlopen_libs=
1200 lt_cv_dlopen_self=yes
1201diff -ruN gcc-4.4.1-orig/libssp/configure gcc-4.4.1/libssp/configure
1202--- gcc-4.4.1-orig/libssp/configure 2009-03-01 12:49:31.000000000 -0500
1203+++ gcc-4.4.1/libssp/configure 2009-08-11 15:55:07.000000000 -0400
1204@@ -7286,7 +7286,7 @@
1205 esac
1206 ;;
1207
1208- beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
1209+ beos* | haiku* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
1210 # PIC is the default for these OSes.
1211 ;;
1212
1213@@ -7933,6 +7933,11 @@
1214 fi
1215 ;;
1216
1217+ haiku*)
1218+ allow_undefined_flag=unsupported
1219+ archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
1220+ ;;
1221+
1222 interix[3-9]*)
1223 hardcode_direct=no
1224 hardcode_shlibpath_var=no
1225@@ -9247,7 +9252,7 @@
1226 esac
1227 ;;
1228
1229-beos*)
1230+beos* | haiku*)
1231 library_names_spec='${libname}${shared_ext}'
1232 dynamic_linker="$host_os ld.so"
1233 shlibpath_var=LIBRARY_PATH
1234diff -ruN gcc-4.4.1-orig/libstdc++-v3/configure gcc-4.4.1/libstdc++-v3/configure
1235--- gcc-4.4.1-orig/libstdc++-v3/configure 2009-05-07 06:23:06.000000000 -0400
1236+++ gcc-4.4.1/libstdc++-v3/configure 2009-08-11 15:55:07.000000000 -0400
1237@@ -4934,7 +4934,7 @@
1238 lt_cv_deplibs_check_method=pass_all
1239 ;;
1240
1241-beos*)
1242+beos* | haiku*)
1243 lt_cv_deplibs_check_method=pass_all
1244 ;;
1245
1246@@ -7944,7 +7944,7 @@
1247 esac
1248 ;;
1249
1250- beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
1251+ beos* | haiku* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
1252 # PIC is the default for these OSes.
1253 ;;
1254
1255@@ -8591,6 +8591,11 @@
1256 fi
1257 ;;
1258
1259+ haiku*)
1260+ allow_undefined_flag=unsupported
1261+ archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
1262+ ;;
1263+
1264 interix[3-9]*)
1265 hardcode_direct=no
1266 hardcode_shlibpath_var=no
1267@@ -9905,7 +9910,7 @@
1268 esac
1269 ;;
1270
1271-beos*)
1272+beos* | haiku*)
1273 library_names_spec='${libname}${shared_ext}'
1274 dynamic_linker="$host_os ld.so"
1275 shlibpath_var=LIBRARY_PATH
1276@@ -10611,7 +10616,7 @@
1277 lt_cv_dlopen_libs=
1278
1279 case $host_os in
1280- beos*)
1281+ beos* | haiku*)
1282 lt_cv_dlopen="load_add_on"
1283 lt_cv_dlopen_libs=
1284 lt_cv_dlopen_self=yes
1285@@ -12192,6 +12197,11 @@
1286 gnu*)
1287 ;;
1288
1289+ haiku*)
1290+ allow_undefined_flag=unsupported
1291+ archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
1292+ ;;
1293+
1294 hpux9*)
1295 hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
1296 hardcode_libdir_separator_CXX=:
1297@@ -13051,8 +13061,7 @@
1298 ;;
1299 esac
1300 ;;
1301-
1302- beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
1303+ beos* | haiku* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
1304 # PIC is the default for these OSes.
1305 ;;
1306 mingw* | cygwin* | os2* | pw32* | cegcc*)
1307@@ -13832,7 +13841,7 @@
1308 esac
1309 ;;
1310
1311-beos*)
1312+beos* | haiku*)
1313 library_names_spec='${libname}${shared_ext}'
1314 dynamic_linker="$host_os ld.so"
1315 shlibpath_var=LIBRARY_PATH
1316@@ -76608,6 +76617,122 @@
1317
1318 fi
1319 ;;
1320+ *-haiku*)
1321+ SECTION_FLAGS='-ffunction-sections -fdata-sections'
1322+
1323+ cat >>confdefs.h <<\_ACEOF
1324+#define HAVE_ACOSF 1
1325+_ACEOF
1326+
1327+ cat >>confdefs.h <<\_ACEOF
1328+#define HAVE_ASINF 1
1329+_ACEOF
1330+
1331+ cat >>confdefs.h <<\_ACEOF
1332+#define HAVE_ATAN2F 1
1333+_ACEOF
1334+
1335+ cat >>confdefs.h <<\_ACEOF
1336+#define HAVE_ATANF 1
1337+_ACEOF
1338+
1339+ cat >>confdefs.h <<\_ACEOF
1340+#define HAVE_CEILF 1
1341+_ACEOF
1342+
1343+ cat >>confdefs.h <<\_ACEOF
1344+#define HAVE_COSF 1
1345+_ACEOF
1346+
1347+ cat >>confdefs.h <<\_ACEOF
1348+#define HAVE_COSHF 1
1349+_ACEOF
1350+
1351+ cat >>confdefs.h <<\_ACEOF
1352+#define HAVE_EXPF 1
1353+_ACEOF
1354+
1355+ cat >>confdefs.h <<\_ACEOF
1356+#define HAVE_FABSF 1
1357+_ACEOF
1358+
1359+ cat >>confdefs.h <<\_ACEOF
1360+#define HAVE_FINITE 1
1361+_ACEOF
1362+
1363+ cat >>confdefs.h <<\_ACEOF
1364+#define HAVE_FINITEF 1
1365+_ACEOF
1366+
1367+ cat >>confdefs.h <<\_ACEOF
1368+#define HAVE_FLOORF 1
1369+_ACEOF
1370+
1371+ cat >>confdefs.h <<\_ACEOF
1372+#define HAVE_FMODF 1
1373+_ACEOF
1374+
1375+ cat >>confdefs.h <<\_ACEOF
1376+#define HAVE_FREXPF 1
1377+_ACEOF
1378+
1379+ cat >>confdefs.h <<\_ACEOF
1380+#define HAVE_HYPOT 1
1381+_ACEOF
1382+
1383+ cat >>confdefs.h <<\_ACEOF
1384+#define HAVE_HYPOTF 1
1385+_ACEOF
1386+
1387+ cat >>confdefs.h <<\_ACEOF
1388+#define HAVE_ISINF 1
1389+_ACEOF
1390+
1391+ cat >>confdefs.h <<\_ACEOF
1392+#define HAVE_ISINFF 1
1393+_ACEOF
1394+
1395+ cat >>confdefs.h <<\_ACEOF
1396+#define HAVE_ISNAN 1
1397+_ACEOF
1398+
1399+ cat >>confdefs.h <<\_ACEOF
1400+#define HAVE_ISNANF 1
1401+_ACEOF
1402+
1403+ cat >>confdefs.h <<\_ACEOF
1404+#define HAVE_LOG10F 1
1405+_ACEOF
1406+
1407+ cat >>confdefs.h <<\_ACEOF
1408+#define HAVE_LOGF 1
1409+_ACEOF
1410+
1411+ cat >>confdefs.h <<\_ACEOF
1412+#define HAVE_MODFF 1
1413+_ACEOF
1414+
1415+ cat >>confdefs.h <<\_ACEOF
1416+#define HAVE_SINF 1
1417+_ACEOF
1418+
1419+ cat >>confdefs.h <<\_ACEOF
1420+#define HAVE_SINHF 1
1421+_ACEOF
1422+
1423+ cat >>confdefs.h <<\_ACEOF
1424+#define HAVE_SQRTF 1
1425+_ACEOF
1426+
1427+ cat >>confdefs.h <<\_ACEOF
1428+#define HAVE_TANF 1
1429+_ACEOF
1430+
1431+ cat >>confdefs.h <<\_ACEOF
1432+#define HAVE_TANHF 1
1433+_ACEOF
1434+
1435+ ;;
1436 *-hpux*)
1437 SECTION_FLAGS='-ffunction-sections -fdata-sections'
1438
1439diff -ruN gcc-4.4.1-orig/libstdc++-v3/crossconfig.m4 gcc-4.4.1/libstdc++-v3/crossconfig.m4
1440--- gcc-4.4.1-orig/libstdc++-v3/crossconfig.m4 2009-01-20 14:30:51.000000000 -0500
1441+++ gcc-4.4.1/libstdc++-v3/crossconfig.m4 2009-08-11 15:55:07.000000000 -0400
1442@@ -89,6 +89,41 @@
1443 AC_DEFINE(HAVE_ISNANL)
1444 fi
1445 ;;
1446+
1447+ *-haiku*)
1448+ SECTION_FLAGS='-ffunction-sections -fdata-sections'
1449+ AC_SUBST(SECTION_FLAGS)
1450+
1451+ AC_DEFINE(HAVE_ACOSF)
1452+ AC_DEFINE(HAVE_ASINF)
1453+ AC_DEFINE(HAVE_ATAN2F)
1454+ AC_DEFINE(HAVE_ATANF)
1455+ AC_DEFINE(HAVE_CEILF)
1456+ AC_DEFINE(HAVE_COSF)
1457+ AC_DEFINE(HAVE_COSHF)
1458+ AC_DEFINE(HAVE_EXPF)
1459+ AC_DEFINE(HAVE_FABSF)
1460+ AC_DEFINE(HAVE_FINITE)
1461+ AC_DEFINE(HAVE_FINITEF)
1462+ AC_DEFINE(HAVE_FLOORF)
1463+ AC_DEFINE(HAVE_FMODF)
1464+ AC_DEFINE(HAVE_FREXPF)
1465+ AC_DEFINE(HAVE_HYPOT)
1466+ AC_DEFINE(HAVE_HYPOTF)
1467+ AC_DEFINE(HAVE_ISINF)
1468+ AC_DEFINE(HAVE_ISINFF)
1469+ AC_DEFINE(HAVE_ISNAN)
1470+ AC_DEFINE(HAVE_ISNANF)
1471+ AC_DEFINE(HAVE_LOG10F)
1472+ AC_DEFINE(HAVE_LOGF)
1473+ AC_DEFINE(HAVE_MODFF)
1474+ AC_DEFINE(HAVE_SINF)
1475+ AC_DEFINE(HAVE_SINHF)
1476+ AC_DEFINE(HAVE_SQRTF)
1477+ AC_DEFINE(HAVE_TANF)
1478+ AC_DEFINE(HAVE_TANHF)
1479+ ;;
1480+
1481 *-hpux*)
1482 SECTION_FLAGS='-ffunction-sections -fdata-sections'
1483 AC_SUBST(SECTION_FLAGS)
1484diff -ruN gcc-4.4.1-orig/libstdc++-v3/libsupc++/tinfo.cc gcc-4.4.1/libstdc++-v3/libsupc++/tinfo.cc
1485--- gcc-4.4.1-orig/libstdc++-v3/libsupc++/tinfo.cc 2009-04-09 19:23:07.000000000 -0400
1486+++ gcc-4.4.1/libstdc++-v3/libsupc++/tinfo.cc 2009-08-11 15:55:07.000000000 -0400
1487@@ -32,6 +32,15 @@
1488 ~type_info ()
1489 { }
1490
1491+#ifdef __HAIKU__
1492+#ifndef __GXX_MERGED_TYPEINFO_NAMES
1493+#define __GXX_MERGED_TYPEINFO_NAMES 0
1494+#endif
1495+#ifndef __GXX_TYPEINFO_EQUALITY_INLINE
1496+#define __GXX_TYPEINFO_EQUALITY_INLINE 0
1497+#endif
1498+#endif
1499+
1500 #if !__GXX_TYPEINFO_EQUALITY_INLINE
1501
1502 // We can't rely on common symbols being shared between shared objects.
1503diff -ruN gcc-4.4.1-orig/libtool.m4 gcc-4.4.1/libtool.m4
1504--- gcc-4.4.1-orig/libtool.m4 2009-03-01 12:49:31.000000000 -0500
1505+++ gcc-4.4.1/libtool.m4 2009-08-11 15:55:07.000000000 -0400
1506@@ -1732,7 +1732,7 @@
1507 lt_cv_dlopen_libs=
1508
1509 case $host_os in
1510- beos*)
1511+ beos* | haiku*)
1512 lt_cv_dlopen="load_add_on"
1513 lt_cv_dlopen_libs=
1514 lt_cv_dlopen_self=yes
1515@@ -2180,7 +2180,7 @@
1516 esac
1517 ;;
1518
1519-beos*)
1520+beos* | haiku*)
1521 library_names_spec='${libname}${shared_ext}'
1522 dynamic_linker="$host_os ld.so"
1523 shlibpath_var=LIBRARY_PATH
1524@@ -2984,7 +2984,7 @@
1525 lt_cv_deplibs_check_method=pass_all
1526 ;;
1527
1528-beos*)
1529+beos* | haiku*)
1530 lt_cv_deplibs_check_method=pass_all
1531 ;;
1532
1533@@ -3261,7 +3261,7 @@
1534 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
1535 LIBM=
1536 case $host in
1537-*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*)
1538+*-*-beos* | *-*-haiku* | *-*-cygwin* | *-*-pw32* | *-*-darwin*)
1539 # These system don't have libm, or don't need it
1540 ;;
1541 *-ncr-sysv4.3*)
1542@@ -3572,8 +3572,7 @@
1543 ;;
1544 esac
1545 ;;
1546-
1547- beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
1548+ beos* | haiku* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
1549 # PIC is the default for these OSes.
1550 ;;
1551 mingw* | cygwin* | os2* | pw32* | cegcc*)
1552@@ -3879,7 +3878,7 @@
1553 esac
1554 ;;
1555
1556- beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
1557+ beos* | haiku* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
1558 # PIC is the default for these OSes.
1559 ;;
1560
1561@@ -4348,6 +4347,11 @@
1562 fi
1563 ;;
1564
1565+ haiku*)
1566+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
1567+ _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
1568+ ;;
1569+
1570 interix[[3-9]]*)
1571 _LT_TAGVAR(hardcode_direct, $1)=no
1572 _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
1573@@ -5692,6 +5696,11 @@
1574 gnu*)
1575 ;;
1576
1577+ haiku*)
1578+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
1579+ _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
1580+ ;;
1581+
1582 hpux9*)
1583 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
1584 _LT_TAGVAR(hardcode_libdir_separator, $1)=:
1585diff -ruN gcc-4.4.1-orig/ltmain.sh gcc-4.4.1/ltmain.sh
1586--- gcc-4.4.1-orig/ltmain.sh 2008-09-26 12:21:02.000000000 -0400
1587+++ gcc-4.4.1/ltmain.sh 2009-08-11 15:55:07.000000000 -0400
1588@@ -4522,7 +4522,7 @@
1589 -l*)
1590 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1591 case $host in
1592- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*)
1593+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-*-haiku* | *-cegcc*)
1594 # These systems don't actually have a C or math library (as such)
1595 continue
1596 ;;
1597@@ -6476,7 +6476,7 @@
1598 if test "$build_libtool_libs" = yes; then
1599 if test -n "$rpath"; then
1600 case $host in
1601- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*)
1602+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-*-haiku* | *-cegcc*)
1603 # these systems don't actually have a c library (as such)!
1604 ;;
1605 *-*-rhapsody* | *-*-darwin1.[012])
1606diff -ruN gcc-4.4.1-orig/Makefile.in gcc-4.4.1/Makefile.in
1607--- gcc-4.4.1-orig/Makefile.in 2009-04-25 00:10:29.000000000 -0400
1608+++ gcc-4.4.1/Makefile.in 2009-08-11 15:55:07.000000000 -0400
1609@@ -54010,6 +54010,11 @@
1610 cd .. ; \
1611 for file in $${files} ; do \
1612 f1=$$r/stage2-gcc/$$file; f2=$$r/stage3-gcc/$$file; \
1613+ if test '$(host_os)' = 'haiku' -a '$(target_os)' = '$(host_os)'; then \
1614+ objdump -d $$f1 | tail -n+5 > dumped_object_f1; \
1615+ objdump -d $$f2 | tail -n+5 > dumped_object_f2; \
1616+ f1=$$dumped_object_f1; f2=$$dumped_object_f2; \
1617+ fi; \
1618 $(do-compare) > /dev/null 2>&1; \
1619 if test $$? -eq 1; then \
1620 case $$file in \
1621@@ -54020,6 +54025,9 @@
1622 esac ; \
1623 fi ; \
1624 done ; \
1625+ if test '$(host_os)' = 'haiku' -a '$(target_os)' = '$(host_os)'; then \
1626+ rm dumped_object_f*; \
1627+ fi; \
1628 if [ -f .bad_compare ]; then \
1629 echo "Bootstrap comparison failure!"; \
1630 cat .bad_compare; \
1631@@ -54332,6 +54340,11 @@
1632 cd .. ; \
1633 for file in $${files} ; do \
1634 f1=$$r/stageb2g0-gcc/$$file; f2=$$r/stageb3g2-gcc/$$file; \
1635+ if test '$(host_os)' = 'haiku' -a '$(target_os)' = '$(host_os)'; then \
1636+ objdump -d $$f1 | tail -n+5 > dumped_object_f1; \
1637+ objdump -d $$f2 | tail -n+5 > dumped_object_f2; \
1638+ f1=$$dumped_object_f1; f2=$$dumped_object_f2; \
1639+ fi; \
1640 $(do-compare-debug) > /dev/null 2>&1; \
1641 if test $$? -eq 1; then \
1642 case $$file in \
1643@@ -54342,6 +54355,9 @@
1644 esac ; \
1645 fi ; \
1646 done ; \
1647+ if test '$(host_os)' = 'haiku' -a '$(target_os)' = '$(host_os)'; then \
1648+ rm dumped_object_f*; \
1649+ fi; \
1650 if [ -f .bad_compare ]; then \
1651 echo "Bootstrap comparison failure!"; \
1652 cat .bad_compare; \
1653@@ -54654,6 +54670,11 @@
1654 cd .. ; \
1655 for file in $${files} ; do \
1656 f1=$$r/stage3-gcc/$$file; f2=$$r/stage4-gcc/$$file; \
1657+ if test '$(host_os)' = 'haiku' -a '$(target_os)' = '$(host_os)'; then \
1658+ objdump -d $$f1 | tail -n+5 > dumped_object_f1; \
1659+ objdump -d $$f2 | tail -n+5 > dumped_object_f2; \
1660+ f1=$$dumped_object_f1; f2=$$dumped_object_f2; \
1661+ fi; \
1662 $(do-compare3) > /dev/null 2>&1; \
1663 if test $$? -eq 1; then \
1664 case $$file in \
1665@@ -54664,6 +54685,9 @@
1666 esac ; \
1667 fi ; \
1668 done ; \
1669+ if test '$(host_os)' = 'haiku' -a '$(target_os)' = '$(host_os)'; then \
1670+ rm dumped_object_f*; \
1671+ fi; \
1672 if [ -f .bad_compare ]; then \
1673 echo "Bootstrap comparison failure!"; \
1674 cat .bad_compare; \
1675diff -ruN gcc-4.4.1-orig/Makefile.tpl gcc-4.4.1/Makefile.tpl
1676--- gcc-4.4.1-orig/Makefile.tpl 2009-04-14 04:57:33.000000000 -0400
1677+++ gcc-4.4.1/Makefile.tpl 2009-08-11 15:55:07.000000000 -0400
1678@@ -1378,6 +1378,11 @@
1679 cd .. ; \
1680 for file in $${files} ; do \
1681 f1=$$r/stage[+prev+]-gcc/$$file; f2=$$r/stage[+id+]-gcc/$$file; \
1682+ if test '$(host_os)' = 'haiku' -a '$(target_os)' = '$(host_os)'; then \
1683+ objdump -d $$f1 | tail -n+5 > dumped_object_f1; \
1684+ objdump -d $$f2 | tail -n+5 > dumped_object_f2; \
1685+ f1=$$dumped_object_f1; f2=$$dumped_object_f2; \
1686+ fi; \
1687 $(do-[+compare-target+]) > /dev/null 2>&1; \
1688 if test $$? -eq 1; then \
1689 case $$file in \
1690@@ -1388,6 +1393,9 @@
1691 esac ; \
1692 fi ; \
1693 done ; \
1694+ if test '$(host_os)' = 'haiku' -a '$(target_os)' = '$(host_os)'; then \
1695+ rm dumped_object_f*; \
1696+ fi; \
1697 if [ -f .bad_compare ]; then \
1698 echo "Bootstrap comparison failure!"; \
1699 cat .bad_compare; \