190075Sobrien/* Definitions for Intel x86 running BeOS
2169689Skan   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004
3169689Skan   Free Software Foundation, Inc.
490075Sobrien
5132718SkanThis file is part of GCC.
690075Sobrien
7132718SkanGCC is free software; you can redistribute it and/or modify
890075Sobrienit under the terms of the GNU General Public License as published by
990075Sobrienthe Free Software Foundation; either version 2, or (at your option)
1090075Sobrienany later version.
1190075Sobrien
12132718SkanGCC is distributed in the hope that it will be useful,
1390075Sobrienbut WITHOUT ANY WARRANTY; without even the implied warranty of
1490075SobrienMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1590075SobrienGNU General Public License for more details.
1690075Sobrien
1790075SobrienYou should have received a copy of the GNU General Public License
18132718Skanalong with GCC; see the file COPYING.  If not, write to
19169689Skanthe Free Software Foundation, 51 Franklin Street, Fifth Floor,
20169689SkanBoston, MA 02110-1301, USA.  */
2190075Sobrien
2290075Sobrien
2390075Sobrien#define TARGET_VERSION fprintf (stderr, " (i386 BeOS/ELF)");
2490075Sobrien
2590075Sobrien/* Change debugging to Dwarf2.  */
2690075Sobrien#undef PREFERRED_DEBUGGING_TYPE
2790075Sobrien#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
2890075Sobrien
2990075Sobrien/* The SVR4 ABI for the i386 says that records and unions are returned
3090075Sobrien   in memory.  */
3190075Sobrien#undef DEFAULT_PCC_STRUCT_RETURN
3290075Sobrien#define DEFAULT_PCC_STRUCT_RETURN 1
3390075Sobrien
3490075Sobrien#undef ASM_COMMENT_START
3590075Sobrien#define ASM_COMMENT_START " #"
3690075Sobrien
3790075Sobrien#undef DBX_REGISTER_NUMBER
3890075Sobrien#define DBX_REGISTER_NUMBER(n) \
3990075Sobrien  (TARGET_64BIT ? dbx64_register_map[n] : svr4_dbx_register_map[n])
4090075Sobrien
4190075Sobrien/* Output assembler code to FILE to increment profiler label # LABELNO
4290075Sobrien   for profiling a function entry.  */
4390075Sobrien
44117395Skan#undef MCOUNT_NAME
45117395Skan#define MCOUNT_NAME "mcount"
4690075Sobrien
4790075Sobrien#undef SIZE_TYPE
4890075Sobrien#define SIZE_TYPE "long unsigned int"
4990075Sobrien
5090075Sobrien#undef PTRDIFF_TYPE
5190075Sobrien#define PTRDIFF_TYPE "long int"
5290075Sobrien
5390075Sobrien#undef WCHAR_TYPE
5490075Sobrien#define WCHAR_TYPE "short unsigned int"
5590075Sobrien
5690075Sobrien#undef WCHAR_TYPE_SIZE
5790075Sobrien#define WCHAR_TYPE_SIZE 16
58117395Skan
59169689Skan#define TARGET_DECLSPEC 1
60169689Skan
61117395Skan#define TARGET_OS_CPP_BUILTINS()					\
62117395Skan  do									\
63117395Skan    {									\
64117395Skan	builtin_define ("__BEOS__");					\
65117395Skan	builtin_define ("__INTEL__");					\
66117395Skan	builtin_define ("_X86_");					\
67117395Skan	builtin_define ("__stdcall=__attribute__((__stdcall__))");	\
68117395Skan	builtin_define ("__cdecl=__attribute__((__cdecl__))");		\
69117395Skan	builtin_assert ("system=beos");					\
70117395Skan    }									\
71117395Skan  while (0)
7290075Sobrien
7390075Sobrien/* BeOS uses lots of multichars, so don't warn about them unless the
7490075Sobrien   user explicitly asks for the warnings with -Wmultichar.  Note that
7590075Sobrien   CC1_SPEC is used for both cc1 and cc1plus.  */
7690075Sobrien
7790075Sobrien#undef CC1_SPEC
78132718Skan#define CC1_SPEC "%{!no-fpic:%{!fno-pic:%{!fno-pie:%{!fpie:%{!fPIC:%{!fPIE:-fpic}}}}}} %{!Wmultichar: -Wno-multichar} %(cc1_cpu) %{profile:-p}"
7990075Sobrien
8090075Sobrien#undef CC1PLUS_SPEC
8190075Sobrien#define CC1PLUS_SPEC "%{!Wctor-dtor-privacy:-Wno-ctor-dtor-privacy}"
8290075Sobrien
8390075Sobrien/* Provide a LINK_SPEC appropriate for BeOS.  Here we provide support
8490075Sobrien   for the special GCC options -static and -shared, which allow us to
8590075Sobrien   link things in one of these three modes by applying the appropriate
8690075Sobrien   combinations of options at link-time.  */
8790075Sobrien
8890075Sobrien/* If ELF is the default format, we should not use /lib/elf.  */
8990075Sobrien
9090075Sobrien#undef	LINK_SPEC
9190075Sobrien#define LINK_SPEC "%{!o*:-o %b} -m elf_i386_be -shared -Bsymbolic %{nostart:-e 0}"
9290075Sobrien
9390075Sobrien/* Provide start and end file specs appropriate to glibc.  */
9490075Sobrien
9590075Sobrien/* LIB_SPEC for BeOS */
9690075Sobrien#undef LIB_SPEC
9790075Sobrien#define LIB_SPEC "-lnet -lroot"
9890075Sobrien
9990075Sobrien/* gcc runtime lib is built into libroot.so on BeOS */
10090075Sobrien/* ??? This is gonna be lovely when the next release of gcc has
10190075Sobrien   some new symbol in, so that links start failing.  */
10290075Sobrien#undef LIBGCC_SPEC
10390075Sobrien#define LIBGCC_SPEC ""
10490075Sobrien
10590075Sobrien#undef  STARTFILE_SPEC
10690075Sobrien#define STARTFILE_SPEC "crti.o%s crtbegin.o%s %{!nostart:start_dyn.o%s} init_term_dyn.o%s %{p:i386-mcount.o%s}"
10790075Sobrien
10890075Sobrien#undef  ENDFILE_SPEC
10990075Sobrien#define ENDFILE_SPEC "crtend.o%s crtn.o%s"
11090075Sobrien
11190075Sobrien/* A C statement (sans semicolon) to output to the stdio stream
11290075Sobrien   FILE the assembler definition of uninitialized global DECL named
11390075Sobrien   NAME whose size is SIZE bytes and alignment is ALIGN bytes.
11490075Sobrien   Try to use asm_output_aligned_bss to implement this macro.  */
11590075Sobrien
11690075Sobrien#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
11790075Sobrien  asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
11890075Sobrien
11990075Sobrien/* A C statement to output to the stdio stream FILE an assembler
12090075Sobrien   command to advance the location counter to a multiple of 1<<LOG
12190075Sobrien   bytes if it is within MAX_SKIP bytes.
12290075Sobrien
12390075Sobrien   This is used to align code labels according to Intel recommendations.  */
12490075Sobrien
12590075Sobrien#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
12690075Sobrien#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \
12790075Sobrien  if ((LOG)!=0) \
12890075Sobrien    if ((MAX_SKIP)==0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
12990075Sobrien    else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP))
13090075Sobrien#endif
13190075Sobrien
13290075Sobrien/* For native compiler, use standard BeOS include file search paths
13390075Sobrien   rooted in /boot/develop/headers.  For a cross compiler, don't
13490075Sobrien   expect the host to use the BeOS directory scheme, and instead look
13590075Sobrien   for the BeOS include files relative to TOOL_INCLUDE_DIR.  Yes, we
13690075Sobrien   use ANSI string concatenation here (FIXME) */
13790075Sobrien
13890075Sobrien#ifndef CROSS_COMPILE
13990075Sobrien#undef INCLUDE_DEFAULTS
14090075Sobrien#define INCLUDE_DEFAULTS \
14190075Sobrien    { \
14290075Sobrien    { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 },\
14390075Sobrien    { GCC_INCLUDE_DIR, "GCC", 0, 0 },\
14490075Sobrien    { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1}, \
14590075Sobrien    { "/boot/develop/headers/be/add-ons/graphics", 0, 0, 0 },\
14690075Sobrien    { "/boot/develop/headers/be/devel", 0, 0, 0 },\
14790075Sobrien    { "/boot/develop/headers/be/translation", 0, 0, 0 },\
14890075Sobrien    { "/boot/develop/headers/be/mail", 0, 0, 0 },\
14990075Sobrien    { "/boot/develop/headers/gnu", 0, 0, 0 },\
15090075Sobrien    { "/boot/develop/headers/be/drivers", 0, 0, 0 },\
15190075Sobrien    { "/boot/develop/headers/be/opengl", 0, 0, 0 },\
15290075Sobrien    { "/boot/develop/headers/be/game", 0, 0, 0 },\
15390075Sobrien    { "/boot/develop/headers/be/support", 0, 0, 0 },\
15490075Sobrien    { "/boot/develop/headers/be/storage", 0, 0, 0 },\
15590075Sobrien    { "/boot/develop/headers/be/kernel", 0, 0, 0 },\
15690075Sobrien    { "/boot/develop/headers/be/net", 0, 0, 0 },\
15790075Sobrien    { "/boot/develop/headers/be/midi", 0, 0, 0 },\
15890075Sobrien    { "/boot/develop/headers/be/midi2", 0, 0, 0 },\
15990075Sobrien    { "/boot/develop/headers/be/media", 0, 0, 0 },\
16090075Sobrien    { "/boot/develop/headers/be/interface", 0, 0, 0 },\
16190075Sobrien    { "/boot/develop/headers/be/device", 0, 0, 0 },\
16290075Sobrien    { "/boot/develop/headers/be/app", 0, 0, 0 },\
16390075Sobrien    { "/boot/develop/headers/be/precompiled", 0, 0, 0 },\
16490075Sobrien    { "/boot/develop/headers/be/add-ons/input_server", 0, 0, 0 },\
16590075Sobrien    { "/boot/develop/headers/be/add-ons/net_server", 0, 0, 0 },\
16690075Sobrien    { "/boot/develop/headers/be/add-ons/screen_saver", 0, 0, 0 },\
16790075Sobrien    { "/boot/develop/headers/be/add-ons/tracker", 0, 0, 0 },\
16890075Sobrien    { "/boot/develop/headers/be/be_apps/Deskbar", 0, 0, 0 },\
16990075Sobrien    { "/boot/develop/headers/be/be_apps/NetPositive", 0, 0, 0 },\
17090075Sobrien    { "/boot/develop/headers/be/be_apps/Tracker", 0, 0, 0 },\
17190075Sobrien    { "/boot/develop/headers/be/drivers/tty", 0, 0, 0 },\
17290075Sobrien    { "/boot/develop/headers/be/net/netinet", 0, 0, 0 },\
17390075Sobrien    { "/boot/develop/headers/be/storage", 0, 0, 0 },\
17490075Sobrien    { "/boot/develop/headers/be", 0, 0, 0 },\
17590075Sobrien    { "/boot/develop/headers/cpp", 0, 0, 0 },\
17690075Sobrien    { "/boot/develop/headers/posix", 0, 0, 0 },\
17790075Sobrien    { "/boot/develop/headers", 0, 0, 0 }, \
17890075Sobrien    { 0, 0, 0, 0 } \
17990075Sobrien    }
18090075Sobrien#else /* CROSS_COMPILE */
18190075Sobrien#undef	INCLUDE_DEFAULTS
18290075Sobrien#define INCLUDE_DEFAULTS				\
18390075Sobrien    { \
18490075Sobrien    { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 },\
18590075Sobrien    { GCC_INCLUDE_DIR, "GCC", 0, 0 },\
18690075Sobrien    { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1}, \
18790075Sobrien    { CROSS_INCLUDE_DIR "/be/add-ons/graphics", 0, 0, 0 },\
18890075Sobrien    { CROSS_INCLUDE_DIR "/be/devel", 0, 0, 0 },\
18990075Sobrien    { CROSS_INCLUDE_DIR "/be/translation", 0, 0, 0 },\
19090075Sobrien    { CROSS_INCLUDE_DIR "/be/mail", 0, 0, 0 },\
19190075Sobrien    { CROSS_INCLUDE_DIR "/gnu", 0, 0, 0 },\
19290075Sobrien    { CROSS_INCLUDE_DIR "/be/drivers", 0, 0, 0 },\
19390075Sobrien    { CROSS_INCLUDE_DIR "/be/opengl", 0, 0, 0 },\
19490075Sobrien    { CROSS_INCLUDE_DIR "/be/game", 0, 0, 0 },\
19590075Sobrien    { CROSS_INCLUDE_DIR "/be/support", 0, 0, 0 },\
19690075Sobrien    { CROSS_INCLUDE_DIR "/be/storage", 0, 0, 0 },\
19790075Sobrien    { CROSS_INCLUDE_DIR "/be/kernel", 0, 0, 0 },\
19890075Sobrien    { CROSS_INCLUDE_DIR "/be/net", 0, 0, 0 },\
19990075Sobrien    { CROSS_INCLUDE_DIR "/be/midi", 0, 0, 0 },\
20090075Sobrien    { CROSS_INCLUDE_DIR "/be/midi2", 0, 0, 0 },\
20190075Sobrien    { CROSS_INCLUDE_DIR "/be/media", 0, 0, 0 },\
20290075Sobrien    { CROSS_INCLUDE_DIR "/be/interface", 0, 0, 0 },\
20390075Sobrien    { CROSS_INCLUDE_DIR "/be/device", 0, 0, 0 },\
20490075Sobrien    { CROSS_INCLUDE_DIR "/be/app", 0, 0, 0 },\
20590075Sobrien    { CROSS_INCLUDE_DIR "/be/precompiled", 0, 0, 0 },\
20690075Sobrien    { CROSS_INCLUDE_DIR "/be/add-ons/input_server", 0, 0, 0 },\
20790075Sobrien    { CROSS_INCLUDE_DIR "/be/add-ons/net_server", 0, 0, 0 },\
20890075Sobrien    { CROSS_INCLUDE_DIR "/be/add-ons/screen_saver", 0, 0, 0 },\
20990075Sobrien    { CROSS_INCLUDE_DIR "/be/add-ons/tracker", 0, 0, 0 },\
21090075Sobrien    { CROSS_INCLUDE_DIR "/be/be_apps/Deskbar", 0, 0, 0 },\
21190075Sobrien    { CROSS_INCLUDE_DIR "/be/be_apps/NetPositive", 0, 0, 0 },\
21290075Sobrien    { CROSS_INCLUDE_DIR "/be/be_apps/Tracker", 0, 0, 0 },\
21390075Sobrien    { CROSS_INCLUDE_DIR "/be/drivers/tty", 0, 0, 0 },\
21490075Sobrien    { CROSS_INCLUDE_DIR "/be/net/netinet", 0, 0, 0 },\
21590075Sobrien    { CROSS_INCLUDE_DIR "/be/storage", 0, 0, 0 },\
21690075Sobrien    { CROSS_INCLUDE_DIR "/be", 0, 0, 0 },\
21790075Sobrien    { CROSS_INCLUDE_DIR "/cpp", 0, 0, 0 },\
21890075Sobrien    { CROSS_INCLUDE_DIR "/posix", 0, 0, 0 },\
21990075Sobrien    { CROSS_INCLUDE_DIR , 0, 0, 0 }, \
22090075Sobrien    { 0, 0, 0, 0 } \
22190075Sobrien    }
22290075Sobrien#endif
22390075Sobrien
22490075Sobrien/* Whee.  LIBRARY_PATH is Be's LD_LIBRARY_PATH, which of course will
22590075Sobrien   cause nasty problems if we override it.  */
22690075Sobrien#define LIBRARY_PATH_ENV        "BELIBRARIES"
22790075Sobrien
22890075Sobrien/* BeOS doesn't have a separate math library.  */
22990075Sobrien#define MATH_LIBRARY ""
23090075Sobrien
23190075Sobrien/* BeOS headers are C++-aware (and often use C++).  */
23290075Sobrien#define NO_IMPLICIT_EXTERN_C
23390075Sobrien
234169689Skan/* BeOS uses explicit import from shared libraries.  */
235169689Skan#define MULTIPLE_SYMBOL_SPACES 1
236