Ticket #1956: haiku.h

File haiku.h, 20.5 kB (added by bonefish, 5 months ago)

correct file

Line 
1/* Definitions for Intel x86 running Haiku
2   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004
3   Free Software Foundation, Inc.
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
12GCC is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GCC; see the file COPYING.  If not, write to
19the Free Software Foundation, 59 Temple Place - Suite 330,
20Boston, MA 02111-1307, USA.  */
21
22#ifndef I386
23#include <i386/i386.h>  /* Base i386 target machine definitions */
24#include <i386/att.h>   /* Use the i386 AT&T assembler syntax */
25#include <svr4.h>       /* some common stuff */
26#endif
27
28/* /usr/ccs doesn't exist on Haiku, so we don't want to use it */
29#undef MD_EXEC_PREFIX
30#undef MD_STARTFILE_PREFIX
31
32#undef TARGET_VERSION
33#define TARGET_VERSION fprintf (stderr, " (i386 Haiku/ELF)");
34
35/* Change debugging to Dwarf2.  */
36#undef PREFERRED_DEBUGGING_TYPE
37#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
38
39/* The SVR4 ABI for the i386 says that records and unions are returned
40   in memory.  */
41#undef DEFAULT_PCC_STRUCT_RETURN
42#define DEFAULT_PCC_STRUCT_RETURN 1
43
44#undef ASM_COMMENT_START
45#define ASM_COMMENT_START " #"
46
47/* This is how to output an element of a case-vector that is relative.
48   This is only used for PIC code.  See comments by the `casesi' insn in
49   i386.md for an explanation of the expression this outputs. */
50#undef ASM_OUTPUT_ADDR_DIFF_ELT
51#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
52  fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE)
53
54/* Indicate that jump tables go in the text section.  This is
55   necessary when compiling PIC code.  */
56#define JUMP_TABLES_IN_TEXT_SECTION (flag_pic)
57
58/* Copy this from the svr4 specifications... */
59/* Define the register numbers to be used in Dwarf debugging information.
60   The SVR4 reference port C compiler uses the following register numbers
61   in its Dwarf output code:
62        0 for %eax (gnu regno = 0)
63        1 for %ecx (gnu regno = 2)
64        2 for %edx (gnu regno = 1)
65        3 for %ebx (gnu regno = 3)
66        4 for %esp (gnu regno = 7)
67        5 for %ebp (gnu regno = 6)
68        6 for %esi (gnu regno = 4)
69        7 for %edi (gnu regno = 5)
70   The following three DWARF register numbers are never generated by
71   the SVR4 C compiler or by the GNU compilers, but SDB on x86/svr4
72   believes these numbers have these meanings.
73        8  for %eip    (no gnu equivalent)
74        9  for %eflags (no gnu equivalent)
75        10 for %trapno (no gnu equivalent)
76   It is not at all clear how we should number the FP stack registers
77   for the x86 architecture.  If the version of SDB on x86/svr4 were
78   a bit less brain dead with respect to floating-point then we would
79   have a precedent to follow with respect to DWARF register numbers
80   for x86 FP registers, but the SDB on x86/svr4 is so completely
81   broken with respect to FP registers that it is hardly worth thinking
82   of it as something to strive for compatibility with.
83   The version of x86/svr4 SDB I have at the moment does (partially)
84   seem to believe that DWARF register number 11 is associated with
85   the x86 register %st(0), but that's about all.  Higher DWARF
86   register numbers don't seem to be associated with anything in
87   particular, and even for DWARF regno 11, SDB only seems to under-
88   stand that it should say that a variable lives in %st(0) (when
89   asked via an `=' command) if we said it was in DWARF regno 11,
90   but SDB still prints garbage when asked for the value of the
91   variable in question (via a `/' command).
92   (Also note that the labels SDB prints for various FP stack regs
93   when doing an `x' command are all wrong.)
94   Note that these problems generally don't affect the native SVR4
95   C compiler because it doesn't allow the use of -O with -g and
96   because when it is *not* optimizing, it allocates a memory
97   location for each floating-point variable, and the memory
98   location is what gets described in the DWARF AT_location
99   attribute for the variable in question.
100   Regardless of the severe mental illness of the x86/svr4 SDB, we
101   do something sensible here and we use the following DWARF
102   register numbers.  Note that these are all stack-top-relative
103   numbers.
104        11 for %st(0) (gnu regno = 8)
105        12 for %st(1) (gnu regno = 9)
106        13 for %st(2) (gnu regno = 10)
107        14 for %st(3) (gnu regno = 11)
108        15 for %st(4) (gnu regno = 12)
109        16 for %st(5) (gnu regno = 13)
110        17 for %st(6) (gnu regno = 14)
111        18 for %st(7) (gnu regno = 15)
112*/
113#undef DBX_REGISTER_NUMBER
114#define DBX_REGISTER_NUMBER(n) \
115((n) == 0 ? 0 \
116 : (n) == 1 ? 2 \
117 : (n) == 2 ? 1 \
118 : (n) == 3 ? 3 \
119 : (n) == 4 ? 6 \
120 : (n) == 5 ? 7 \
121 : (n) == 6 ? 5 \
122 : (n) == 7 ? 4 \
123 : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n)+3 \
124 : (-1))
125
126/* Output assembler code to FILE to increment profiler label # LABELNO
127   for profiling a function entry.  */
128
129#undef FUNCTION_PROFILER
130#define FUNCTION_PROFILER(FILE, LABELNO)  \
131{                                                                       \
132  if (flag_pic)                                                         \
133    {                                                                   \
134      fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n",              \
135               LPREFIX, (LABELNO));                                     \
136      fprintf (FILE, "\tcall *mcount@GOT(%%ebx)\n");                    \
137    }                                                                   \
138  else                                                                  \
139    {                                                                   \
140      fprintf (FILE, "\tmovl $%sP%d,%%edx\n", LPREFIX, (LABELNO));      \
141      fprintf (FILE, "\tcall mcount\n");                                \
142    }                                                                   \
143}
144
145#undef SIZE_TYPE
146#define SIZE_TYPE "long unsigned int"
147 
148#undef PTRDIFF_TYPE
149#define PTRDIFF_TYPE "long int"
150 
151#undef WCHAR_TYPE
152#define WCHAR_TYPE "short unsigned int"
153   
154#undef WCHAR_UNSIGNED
155#define WCHAR_UNSIGNED 1
156
157#undef WCHAR_TYPE_SIZE
158#define WCHAR_TYPE_SIZE 16
159   
160#undef CPP_PREDEFINES
161#define CPP_PREDEFINES "-D__ELF__ -D__HAIKU__ -D__BEOS__ -D__INTEL__ -D_X86_=1 \
162-D__stdcall=__attribute__((__stdcall__)) \
163-D__cdecl=__attribute__((__cdecl__)) \
164-D__declspec(x)=__attribute__((x)) \
165-Asystem(haiku)"
166
167#undef CPP_SPEC
168#define CPP_SPEC "%(cpp_cpu) %{!no-fPIC:%{!no-fpic:-D__PIC__ -D__pic__}}"
169
170/* Haiku uses lots of multichars, so don't warn about them unless the
171   user explicitly asks for the warnings with -Wmultichar.  Note that
172   CC1_SPEC is used for both cc1 and cc1plus. */
173
174#undef CC1_SPEC
175#define CC1_SPEC "%{!no-fpic:%{!fPIC:-fpic}} %{!Wmultichar: -Wno-multichar} %(cc1_cpu) %{profile:-p}"
176
177#undef CC1PLUS_SPEC
178#define CC1PLUS_SPEC "%{!Wctor-dtor-privacy:-Wno-ctor-dtor-privacy}"
179
180/* Provide a LINK_SPEC appropriate for BeOS.  Here we provide support
181   for the special GCC options -static and -shared, which allow us to
182   link things in one of these three modes by applying the appropriate
183   combinations of options at link-time. */
184
185/* If ELF is the default format, we should not use /lib/elf. */
186
187#undef  LINK_SPEC
188#define LINK_SPEC "%{!o*:-o %b} -m elf_i386_haiku -shared -Bsymbolic " \
189        "%{nostart:-e 0} %{shared:-e 0} %{!shared: %{!nostart: --no-undefined}}"
190
191/* Provide start and end file specs appropriate to glibc.  */
192
193/* LIB_SPEC for Haiku */
194#undef LIB_SPEC
195#define LIB_SPEC "-lroot"
196
197/* gcc runtime lib is built into libroot.so on Haiku */
198/* ??? This is gonna be lovely when the next release of gcc has
199   some new symbol in, so that links start failing.  */
200#undef LIBGCC_SPEC
201#define LIBGCC_SPEC ""
202
203#undef  STARTFILE_SPEC
204#define STARTFILE_SPEC "crti.o%s crtbegin.o%s %{!nostart: %{!shared: start_dyn.o%s}} init_term_dyn.o%s %{p:i386-mcount.o%s}"
205
206#undef  ENDFILE_SPEC
207#define ENDFILE_SPEC "crtend.o%s crtn.o%s"
208
209/* Get perform_* macros to build libgcc.a.  */
210#include "i386/perform.h"
211
212/* A C statement (sans semicolon) to output to the stdio stream
213   FILE the assembler definition of uninitialized global DECL named
214   NAME whose size is SIZE bytes and alignment is ALIGN bytes.
215   Try to use asm_output_aligned_bss to implement this macro.  */
216
217#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
218  asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
219
220/* A C statement to output to the stdio stream FILE an assembler
221   command to advance the location counter to a multiple of 1<<LOG
222   bytes if it is within MAX_SKIP bytes.
223
224   This is used to align code labels according to Intel recommendations.  */
225
226#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
227#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \
228  do {                                                                  \
229    if ((LOG)!=0) \
230      if ((MAX_SKIP)==0) fprintf ((FILE), "\t.p2align %d\n", (LOG));   \
231      else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \
232  } while (0)
233#endif
234
235/*
236 * Support for __declspec(dllimport) & __declspec(dllexport).
237 */
238
239/* We don't care about dllimport.  */
240#define TARGET_NOP_FUN_DLLIMPORT 1
241
242/* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS
243   is a valid machine specific attribute for DECL.
244   The attributes in ATTRIBUTES have previously been assigned to DECL.  */
245
246#undef VALID_MACHINE_DECL_ATTRIBUTE
247#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) \
248  i386_pe_valid_decl_attribute_p (DECL, ATTRIBUTES, IDENTIFIER, ARGS)
249extern int i386_pe_valid_decl_attribute_p ();
250
251/* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS
252   is a valid machine specific attribute for TYPE.
253   The attributes in ATTRIBUTES have previously been assigned to TYPE.  */
254
255#undef VALID_MACHINE_TYPE_ATTRIBUTE
256#define VALID_MACHINE_TYPE_ATTRIBUTE(TYPE, ATTRIBUTES, IDENTIFIER, ARGS) \
257  i386_pe_valid_type_attribute_p (TYPE, ATTRIBUTES, IDENTIFIER, ARGS)
258extern int i386_pe_valid_type_attribute_p ();
259
260#define MERGE_MACHINE_DECL_ATTRIBUTES(OLD, NEW) \
261  i386_pe_merge_decl_attributes ((OLD), (NEW))
262extern union tree_node *i386_pe_merge_decl_attributes ();
263
264/* Used to implement dllexport overriding dllimport semantics.  It's also used
265   to handle vtables - the first pass won't do anything because
266   DECL_CONTEXT (DECL) will be 0 so i386_pe_dll{ex,im}port_p will return 0.
267   It's also used to handle dllimport override semantics.  */
268#define REDO_SECTION_INFO_P(DECL) \
269  ((DECL_MACHINE_ATTRIBUTES (DECL) != NULL_TREE) \
270   || (TREE_CODE (DECL) == VAR_DECL && DECL_VIRTUAL_P (DECL)))
271
272/* Used only here locally.  If the decl has been exported, emit the
273   necessary assembly.  */
274
275#define ASM_EXPORT_DECL(FILE, NAME, DECL)                               \
276  do {                                                                  \
277    if ((DECL) && i386_pe_dllexport_p (DECL))                           \
278      {                                                                 \
279        fprintf ((FILE), ".section .exports\n");                        \
280        fprintf ((FILE), "\t%s\t\"", STRING_ASM_OP);                    \
281        assemble_name (FILE, NAME);                                     \
282        fprintf ((FILE), "\"\n.previous\n");                            \
283      }                                                                 \
284  } while (0)
285
286/* Write the extra assembler code needed to declare a function properly.
287   Some svr4 assemblers need to also have something extra said about the
288   function's return value.  We allow for that here.  */
289
290#undef ASM_DECLARE_FUNCTION_NAME
291#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)                     \
292  do {                                                                  \
293    ASM_EXPORT_DECL(FILE, NAME, DECL);                                  \
294    fprintf (FILE, "\t%s\t ", TYPE_ASM_OP);                             \
295    assemble_name (FILE, NAME);                                         \
296    putc (',', FILE);                                                   \
297    fprintf (FILE, TYPE_OPERAND_FMT, "function");                       \
298    putc ('\n', FILE);                                                  \
299    ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL));                      \
300    ASM_OUTPUT_LABEL(FILE, NAME);                                       \
301  } while (0)
302
303/* Write the extra assembler code needed to declare an object properly.  */
304
305#undef ASM_DECLARE_OBJECT_NAME
306#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL)                       \
307  do {                                                                  \
308    ASM_EXPORT_DECL(FILE, NAME, DECL);                                  \
309    fprintf (FILE, "\t%s\t ", TYPE_ASM_OP);                             \
310    assemble_name (FILE, NAME);                                         \
311    putc (',', FILE);                                                   \
312    fprintf (FILE, TYPE_OPERAND_FMT, "object");                         \
313    putc ('\n', FILE);                                                  \
314    size_directive_output = 0;                                          \
315    if (!flag_inhibit_size_directive && DECL_SIZE (DECL))               \
316      {                                                                 \
317        size_directive_output = 1;                                      \
318        fprintf (FILE, "\t%s\t ", SIZE_ASM_OP);                         \
319        assemble_name (FILE, NAME);                                     \
320        putc (',', FILE);                                               \
321        fprintf (FILE, HOST_WIDE_INT_PRINT_DEC,                         \
322                 int_size_in_bytes (TREE_TYPE (DECL)));                 \
323        fputc ('\n', FILE);                                             \
324      }                                                                 \
325    ASM_OUTPUT_LABEL(FILE, NAME);                                       \
326  } while (0)
327
328/* Similarly for COMMON symbols.  */
329
330#undef ASM_OUTPUT_ALIGNED_COMMON
331#undef ASM_OUTPUT_ALIGNED_DECL_COMMON
332#define ASM_OUTPUT_ALIGNED_DECL_COMMON(FILE, DECL, NAME, SIZE, ALIGN)   \
333  do {                                                                  \
334    ASM_EXPORT_DECL(FILE, NAME, DECL);                                  \
335    fprintf ((FILE), "\t%s\t", COMMON_ASM_OP);                          \
336    assemble_name ((FILE), (NAME));                                     \
337    fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT);      \
338  } while (0)
339
340#undef ASM_OUTPUT_ALIGNED_LOCAL
341#undef ASM_OUTPUT_ALIGNED_DECL_LOCAL
342#define ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN)         \
343  do {                                                                       \
344    fprintf ((FILE), "\t%s\t", LOCAL_ASM_OP);                                \
345    assemble_name ((FILE), (NAME));                                          \
346    fprintf ((FILE), "\n");                                                  \
347    ASM_OUTPUT_ALIGNED_DECL_COMMON((FILE), (DECL), (NAME), (SIZE), (ALIGN)); \
348  } while (0)
349
350/* Haiku's default stack size for a process' main thread is 16 MB. That's
351   definitely not "small". */
352
353#undef SMALL_STACK
354
355/* For native compiler, use standard Haiku include file search paths
356   rooted in /boot/develop/headers.  For a cross compiler, don't
357   expect the host to use the Haiku directory scheme, and instead look
358   for the Haiku include files relative to TOOL_INCLUDE_DIR.  Yes, we
359   use ANSI string concatenation here (FIXME) */
360
361#ifndef CROSS_COMPILE
362#undef INCLUDE_DEFAULTS
363#define INCLUDE_DEFAULTS \
364    { \
365    { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 },\
366    { GCC_INCLUDE_DIR, "GCC", 0, 0 },\
367    { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1}, \
368    { "/boot/develop/headers/be/add-ons/graphics", 0, 0, 0 },\
369    { "/boot/develop/headers/be/devel", 0, 0, 0 },\
370    { "/boot/develop/headers/be/translation", 0, 0, 0 },\
371    { "/boot/develop/headers/be/mail", 0, 0, 0 },\
372    { "/boot/develop/headers/gnu", 0, 0, 0 },\
373    { "/boot/develop/headers/be/drivers", 0, 0, 0 },\
374    { "/boot/develop/headers/be/opengl", 0, 0, 0 },\
375    { "/boot/develop/headers/be/game", 0, 0, 0 },\
376    { "/boot/develop/headers/be/support", 0, 0, 0 },\
377    { "/boot/develop/headers/be/storage", 0, 0, 0 },\
378    { "/boot/develop/headers/be/kernel", 0, 0, 0 },\
379    { "/boot/develop/headers/be/net", 0, 0, 0 },\
380    { "/boot/develop/headers/be/midi", 0, 0, 0 },\
381    { "/boot/develop/headers/be/midi2", 0, 0, 0 },\
382    { "/boot/develop/headers/be/media", 0, 0, 0 },\
383    { "/boot/develop/headers/be/interface", 0, 0, 0 },\
384    { "/boot/develop/headers/be/device", 0, 0, 0 },\
385    { "/boot/develop/headers/be/app", 0, 0, 0 },\
386    { "/boot/develop/headers/be/precompiled", 0, 0, 0 },\
387    { "/boot/develop/headers/be/add-ons/input_server", 0, 0, 0 },\
388    { "/boot/develop/headers/be/add-ons/net_server", 0, 0, 0 },\
389    { "/boot/develop/headers/be/add-ons/screen_saver", 0, 0, 0 },\
390    { "/boot/develop/headers/be/add-ons/tracker", 0, 0, 0 },\
391    { "/boot/develop/headers/be/be_apps/Deskbar", 0, 0, 0 },\
392    { "/boot/develop/headers/be/be_apps/NetPositive", 0, 0, 0 },\
393    { "/boot/develop/headers/be/be_apps/Tracker", 0, 0, 0 },\
394    { "/boot/develop/headers/be/drivers/tty", 0, 0, 0 },\
395    { "/boot/develop/headers/be/net/netinet", 0, 0, 0 },\
396    { "/boot/develop/headers/be/storage", 0, 0, 0 },\
397    { "/boot/develop/headers/be", 0, 0, 0 },\
398    { "/boot/develop/headers/cpp", 0, 0, 0 },\
399    { "/boot/develop/headers/posix", 0, 0, 0 },\
400    { "/boot/develop/headers", 0, 0, 0 }, \
401    { 0, 0, 0, 0 } \
402    };
403#else /* CROSS_COMPILE */
404#undef  INCLUDE_DEFAULTS
405#define INCLUDE_DEFAULTS                                \
406    { \
407    { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 },\
408    { GCC_INCLUDE_DIR, "GCC", 0, 0 },\
409    { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1}, \
410    { CROSS_INCLUDE_DIR "/be/add-ons/graphics", 0, 0, 0 },\
411    { CROSS_INCLUDE_DIR "/be/devel", 0, 0, 0 },\
412    { CROSS_INCLUDE_DIR "/be/translation", 0, 0, 0 },\
413    { CROSS_INCLUDE_DIR "/be/mail", 0, 0, 0 },\
414    { CROSS_INCLUDE_DIR "/gnu", 0, 0, 0 },\
415    { CROSS_INCLUDE_DIR "/be/drivers", 0, 0, 0 },\
416    { CROSS_INCLUDE_DIR "/be/opengl", 0, 0, 0 },\
417    { CROSS_INCLUDE_DIR "/be/game", 0, 0, 0 },\
418    { CROSS_INCLUDE_DIR "/be/support", 0, 0, 0 },\
419    { CROSS_INCLUDE_DIR "/be/storage", 0, 0, 0 },\
420    { CROSS_INCLUDE_DIR "/be/kernel", 0, 0, 0 },\
421    { CROSS_INCLUDE_DIR "/be/net", 0, 0, 0 },\
422    { CROSS_INCLUDE_DIR "/be/midi", 0, 0, 0 },\
423    { CROSS_INCLUDE_DIR "/be/midi2", 0, 0, 0 },\
424    { CROSS_INCLUDE_DIR "/be/media", 0, 0, 0 },\
425    { CROSS_INCLUDE_DIR "/be/interface", 0, 0, 0 },\
426    { CROSS_INCLUDE_DIR "/be/device", 0, 0, 0 },\
427    { CROSS_INCLUDE_DIR "/be/app", 0, 0, 0 },\
428    { CROSS_INCLUDE_DIR "/be/precompiled", 0, 0, 0 },\
429    { CROSS_INCLUDE_DIR "/be/add-ons/input_server", 0, 0, 0 },\
430    { CROSS_INCLUDE_DIR "/be/add-ons/net_server", 0, 0, 0 },\
431    { CROSS_INCLUDE_DIR "/be/add-ons/screen_saver", 0, 0, 0 },\
432    { CROSS_INCLUDE_DIR "/be/add-ons/tracker", 0, 0, 0 },\
433    { CROSS_INCLUDE_DIR "/be/be_apps/Deskbar", 0, 0, 0 },\
434    { CROSS_INCLUDE_DIR "/be/be_apps/NetPositive", 0, 0, 0 },\
435    { CROSS_INCLUDE_DIR "/be/be_apps/Tracker", 0, 0, 0 },\
436    { CROSS_INCLUDE_DIR "/be/drivers/tty", 0, 0, 0 },\
437    { CROSS_INCLUDE_DIR "/be/net/netinet", 0, 0, 0 },\
438    { CROSS_INCLUDE_DIR "/be/storage", 0, 0, 0 },\
439    { CROSS_INCLUDE_DIR "/be", 0, 0, 0 },\
440    { CROSS_INCLUDE_DIR "/cpp", 0, 0, 0 },\
441    { CROSS_INCLUDE_DIR "/posix", 0, 0, 0 },\
442    { CROSS_INCLUDE_DIR , 0, 0, 0 }, \
443    { 0, 0, 0, 0 } \
444    };
445#endif
446
447/* Whee.  LIBRARY_PATH is Haiku's LD_LIBRARY_PATH, which of course will
448   cause nasty problems if we override it.  */
449#define LIBRARY_PATH_ENV        "BELIBRARIES"
450
451/* Haiku doesn't have a separate math library.  */
452#define MATH_LIBRARY ""
453
454/* Haiku headers are C++-aware (and often use C++).  */
455#define NO_IMPLICIT_EXTERN_C
456
457/* Define this macro if in some cases global symbols from one translation
458   unit may not be bound to undefined symbols in another translation unit
459   without user intervention.  For instance, under Microsoft Windows
460   symbols must be explicitly imported from shared libraries (DLLs).  */
461/* [zooey]:
462        I believe BeOS doesn't actually require this, and *not* using it
463   yields considerably smaller object files.
464   That's why we do not follow the configuration from gnupro-0002224
465   and go with a single symbol space instead: */
466/* [zooey]:
467        After more research, it turned out that with -O0, we require MULTIPLE
468        SYMBOL_SPACES, but with active optimization, we don't.
469        (We get link-errors about BView::SetHighColor(ui,ui,ui,ui) missing
470        when optimization is off).
471        So we do just that, we replace MULTIPLE_SYMBOL_SPACES with a
472        test for optimization (see lex.c, line 4882ff and decl2.c, line 2701).
473*/
474/* [bonefish]:
475    Review! */
476
477#undef MULTIPLE_SYMBOL_SPACES
478
479/* I'm not sure why this is defined this way, but pavel@be.com can
480   probably provide some insight.  :-)  */
481#define LIBSTDCXX "-lstdc++.r4"
482
483/* A C statement to output assembler commands which will identify the object
484   file as having been compiled with GNU CC.  This isn't needed for Haiku
485   because we use DWARF and DWARF has an DW_AT_producer tag that does the
486   same thing.  Gdb is probably the only debugger that uses this anyway,
487   so the most likely ill effect of disabling this is that a BeOS gdb
488   debugging an executable with no debug info would not see the gcc2_compiled
489   label. */
490/* [bonefish]:
491    Review! */
492#undef ASM_IDENTIFY_GCC
493#define ASM_IDENTIFY_GCC(FILE)
494
495/* required to compile winnt.c */
496/* [bonefish]:
497    Review! */
498#define I386_PE_STRIP_ENCODING(SYM_NAME) \
499  ((SYM_NAME) + ((SYM_NAME)[0] == '@' ? 3 : 0))
500
501#define DRECTVE_SECTION_FUNCTION \
502void                                                                    \
503drectve_section ()                                                      \
504{                                                                       \
505  if (in_section != in_drectve)                                         \
506    {                                                                   \
507      fprintf (asm_out_file, "%s\n", "\t.section .drectve\n");          \
508      in_section = in_drectve;                                          \
509    }                                                                   \
510}
511
512#undef EXTRA_SECTION_FUNCTIONS
513#define EXTRA_SECTION_FUNCTIONS                                         \
514  CONST_SECTION_FUNCTION                                                \
515  CTORS_SECTION_FUNCTION                                                \
516  DTORS_SECTION_FUNCTION                                                \
517  DRECTVE_SECTION_FUNCTION
518
519#undef EXTRA_SECTIONS
520#define EXTRA_SECTIONS in_const, in_ctors, in_dtors, in_drectve
521
522/* [zooey]:
523   '#pragma interface' seems to trigger a bug which causes
524   global constructors and destructors (keyed to the first function in
525   a translation unit) not being generated, causing the link to fail.
526   So we ignore '#pragma interface' for Haiku.
527   All this applies only when multiple symbol spaces are active (i.e.
528   if no optimization is done).
529   */
530#define WORK_AROUND_PRAGMA_INTERFACE_BUG 1
531
532/* The origin of Haiku's gcc is egcs 1.1.x, and these version had a bug
533   in mangled name builder. The APIs of Haiku are furnished to the
534   developers as shared library of C++. And if we use fixed mangled
535   names in newer gcc, some APIs are hidden with name problem. */
536#define USE_EGCS_MANGLED_NAMES