iris.h revision 169689
138032Speter/* Definitions of target machine for GNU compiler.  Generic IRIX version.
2203004Sgshapiro   Copyright (C) 1993, 1995, 1996, 1998, 2000,
364565Sgshapiro   2001, 2002, 2003, 2004 Free Software Foundation, Inc.
438032Speter
538032SpeterThis file is part of GCC.
638032Speter
738032SpeterGCC is free software; you can redistribute it and/or modify
838032Speterit under the terms of the GNU General Public License as published by
938032Speterthe Free Software Foundation; either version 2, or (at your option)
1038032Speterany later version.
1138032Speter
1238032SpeterGCC is distributed in the hope that it will be useful,
1338032Speterbut WITHOUT ANY WARRANTY; without even the implied warranty of
1490795SgshapiroMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1590795SgshapiroGNU General Public License for more details.
1690795Sgshapiro
1773191SgshapiroYou should have received a copy of the GNU General Public License
1864565Sgshapiroalong with GCC; see the file COPYING.  If not, write to
1964565Sgshapirothe Free Software Foundation, 51 Franklin Street, Fifth Floor,
2064565SgshapiroBoston, MA 02110-1301, USA.  */
2190795Sgshapiro
2238032Speter/* We are compiling for IRIX now.  */
23203004Sgshapiro#undef TARGET_IRIX
2438032Speter#define TARGET_IRIX 1
2564565Sgshapiro
2664565Sgshapiro/* The size in bytes of a DWARF field indicating an offset or length
2764565Sgshapiro   relative to a debug info section, specified to be 4 bytes in the DWARF-2
2864565Sgshapiro   specification.  The SGI/MIPS ABI defines it to be the same as PTR_SIZE.  */
2964565Sgshapiro#define DWARF_OFFSET_SIZE PTR_SIZE
3064565Sgshapiro
3164565Sgshapiro/* The size in bytes of the initial length field in a debug info
3264565Sgshapiro   section.  The DWARF 3 (draft) specification defines this to be
3364565Sgshapiro   either 4 or 12 (with a 4-byte "escape" word when it's 12), but the
3464565Sgshapiro   SGI/MIPS ABI predates this standard and defines it to be the same
3538032Speter   as DWARF_OFFSET_SIZE.  */
3638032Speter#define DWARF_INITIAL_LENGTH_SIZE DWARF_OFFSET_SIZE
3764565Sgshapiro
3864565Sgshapiro/* MIPS assemblers don't have the usual .set foo,bar construct;
3964565Sgshapiro   .set is used for assembler options instead.  */
4064565Sgshapiro#undef SET_ASM_OP
4138032Speter#define ASM_OUTPUT_DEF(FILE, LABEL1, LABEL2)			\
4264565Sgshapiro  do								\
4338032Speter    {								\
4464565Sgshapiro      fputc ('\t', FILE);					\
4564565Sgshapiro      assemble_name (FILE, LABEL1);				\
4664565Sgshapiro      fputs (" = ", FILE);					\
4764565Sgshapiro      assemble_name (FILE, LABEL2);				\
48173343Sgshapiro      fputc ('\n', FILE);					\
4964565Sgshapiro    }								\
5064565Sgshapiro  while (0)
5190795Sgshapiro
5264565Sgshapiro/* The MIPSpro o32 linker warns about not linking .comment sections.  */
5364565Sgshapiro#undef IDENT_ASM_OP
5438032Speter
5571348Sgshapiro#undef LOCAL_LABEL_PREFIX
5671348Sgshapiro#define LOCAL_LABEL_PREFIX (TARGET_NEWABI ? "." : "$")
5764565Sgshapiro
5838032Speter#undef ASM_DECLARE_OBJECT_NAME
5938032Speter#define ASM_DECLARE_OBJECT_NAME mips_declare_object_name
6038032Speter
6138032Speter#undef ASM_FINISH_DECLARE_OBJECT
6238032Speter#define ASM_FINISH_DECLARE_OBJECT mips_finish_declare_object
6342580Speter
6442580Speter/* Also do this for libcalls.  */
6590795Sgshapiro#undef TARGET_ASM_EXTERNAL_LIBCALL
6638032Speter#define TARGET_ASM_EXTERNAL_LIBCALL irix_output_external_libcall
6742580Speter
6842580Speter/* The linker needs a space after "-o".  */
6964565Sgshapiro#define SWITCHES_NEED_SPACES "o"
7064565Sgshapiro
7164565Sgshapiro/* Specify wchar_t types.  */
7264565Sgshapiro#undef WCHAR_TYPE
7338032Speter#define WCHAR_TYPE (Pmode == DImode ? "int" : "long int")
7464565Sgshapiro
7564565Sgshapiro#undef WCHAR_TYPE_SIZE
7664565Sgshapiro#define WCHAR_TYPE_SIZE INT_TYPE_SIZE
7764565Sgshapiro
7864565Sgshapiro/* Same for wint_t.  */
7964565Sgshapiro#undef WINT_TYPE
8064565Sgshapiro#define WINT_TYPE (Pmode == DImode ? "int" : "long int")
8164565Sgshapiro
8290795Sgshapiro#undef WINT_TYPE_SIZE
8364565Sgshapiro#define WINT_TYPE_SIZE 32
8464565Sgshapiro
8590795Sgshapiro/* Plain char is unsigned in the SGI compiler.  */
8690795Sgshapiro#undef DEFAULT_SIGNED_CHAR
8764565Sgshapiro#define DEFAULT_SIGNED_CHAR 0
8864565Sgshapiro
8990795Sgshapiro#define WORD_SWITCH_TAKES_ARG(STR)			\
9042580Speter  (DEFAULT_WORD_SWITCH_TAKES_ARG (STR)			\
9142580Speter   || strcmp (STR, "rpath") == 0)
9242580Speter
9342580Speter#define TARGET_OS_CPP_BUILTINS()				\
9442580Speter  do								\
9542580Speter    {								\
9638032Speter      builtin_define_std ("host_mips");				\
9738032Speter      builtin_define_std ("sgi");				\
9838032Speter      builtin_define_std ("unix");				\
9938032Speter      builtin_define_std ("SYSTYPE_SVR4");			\
10038032Speter      builtin_define ("_MODERN_C");				\
10190795Sgshapiro      builtin_define ("_SVR4_SOURCE");				\
102203004Sgshapiro      builtin_define ("__DSO__");				\
103203004Sgshapiro      builtin_assert ("system=unix");				\
10438032Speter      builtin_assert ("system=svr4");				\
10538032Speter      builtin_assert ("machine=sgi");				\
10642580Speter								\
10738032Speter      if (mips_abi == ABI_32)					\
10838032Speter	{							\
10938032Speter	  builtin_define ("_ABIO32=1");				\
11042580Speter	  builtin_define ("_MIPS_SIM=_ABIO32");			\
11142580Speter	  builtin_define ("_MIPS_SZINT=32");			\
11242580Speter	  builtin_define ("_MIPS_SZLONG=32");			\
11342580Speter	  builtin_define ("_MIPS_SZPTR=32");			\
11442580Speter	}							\
11542580Speter      else if (mips_abi == ABI_64)				\
11690795Sgshapiro	{							\
11790795Sgshapiro	  builtin_define ("_ABI64=3");				\
11842580Speter	  builtin_define ("_MIPS_SIM=_ABI64");			\
11990795Sgshapiro	  builtin_define ("_MIPS_SZINT=32");			\
12090795Sgshapiro	  builtin_define ("_MIPS_SZLONG=64");			\
12190795Sgshapiro	  builtin_define ("_MIPS_SZPTR=64");			\
12242580Speter	}							\
12342580Speter      else							\
12442580Speter	{							\
12590795Sgshapiro	  builtin_define ("_ABIN32=2");				\
12642580Speter	  builtin_define ("_MIPS_SIM=_ABIN32");			\
12742580Speter	  builtin_define ("_MIPS_SZINT=32");			\
12842580Speter	  builtin_define ("_MIPS_SZLONG=32");			\
12964565Sgshapiro	  builtin_define ("_MIPS_SZPTR=32");			\
13064565Sgshapiro        }							\
13164565Sgshapiro								\
13264565Sgshapiro      if (!ISA_MIPS1 && !ISA_MIPS2)				\
13342580Speter	builtin_define ("_COMPILER_VERSION=601");		\
13442580Speter								\
13542580Speter      if (!TARGET_FLOAT64)					\
13642580Speter	builtin_define ("_MIPS_FPSET=16");			\
13790795Sgshapiro      else							\
13842580Speter	builtin_define ("_MIPS_FPSET=32");			\
13942580Speter								\
14042580Speter      /* We must always define _LONGLONG, even when -ansi is	\
14142580Speter	 used, because IRIX 5 system header files require it.	\
14242580Speter	 This is OK, because gcc never warns when long long	\
14342580Speter	 is used in system header files.			\
14442580Speter								\
14542580Speter	 An alternative would be to support the SGI builtin	\
14642580Speter	 type __long_long.  */					\
14742580Speter      builtin_define ("_LONGLONG");				\
14842580Speter								\
14942580Speter      /* IRIX 6.5.18 and above provide many ISO C99		\
15042580Speter	 features protected by the __c99 macro.			\
15142580Speter	 libstdc++ v3 needs them as well.  */			\
15242580Speter      if (TARGET_IRIX6)						\
15342580Speter	if (flag_isoc99 || c_dialect_cxx ())			\
15490795Sgshapiro	  builtin_define ("__c99");				\
15564565Sgshapiro								\
15642580Speter      /* The GNU C++ standard library requires that		\
15790795Sgshapiro	 __EXTENSIONS__ and _SGI_SOURCE be defined on at	\
15890795Sgshapiro	 least IRIX 6.2 and probably all IRIX 6 prior to 6.5.	\
15942580Speter	 We don't need this on IRIX 6.5 itself, but it		\
16090795Sgshapiro	 shouldn't hurt other than the namespace pollution.  */	\
16142580Speter      if (!flag_iso || (TARGET_IRIX6 && c_dialect_cxx ()))	\
16242580Speter	{							\
16342580Speter	  builtin_define ("__EXTENSIONS__");			\
16442580Speter	  builtin_define ("_SGI_SOURCE");			\
16542580Speter	}							\
16642580Speter    }								\
16742580Speter  while (0)
16842580Speter
16942580Speter#undef SUBTARGET_CC1_SPEC
17042580Speter#define SUBTARGET_CC1_SPEC "%{static: -mno-abicalls}"
17142580Speter
17242580Speter#undef INIT_SECTION_ASM_OP
17371348Sgshapiro#define INIT_SECTION_ASM_OP "\t.section\t.gcc_init,\"ax\",@progbits"
17464565Sgshapiro
17542580Speter#undef FINI_SECTION_ASM_OP
17642580Speter#define FINI_SECTION_ASM_OP "\t.section\t.gcc_fini,\"ax\",@progbits"
17764565Sgshapiro
17890795Sgshapiro#ifdef IRIX_USING_GNU_LD
17964565Sgshapiro#define IRIX_NO_UNRESOLVED ""
18064565Sgshapiro#else
18164565Sgshapiro#define IRIX_NO_UNRESOLVED "-no_unresolved"
18264565Sgshapiro#endif
18364565Sgshapiro
18464565Sgshapiro/* Generic part of the LINK_SPEC.  */
18564565Sgshapiro#undef LINK_SPEC
18664565Sgshapiro#define LINK_SPEC "\
18764565Sgshapiro%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} %{mips4} \
18864565Sgshapiro%{bestGnum} %{shared} %{non_shared} \
18964565Sgshapiro%{call_shared} %{no_archive} %{exact_version} \
19064565Sgshapiro%{!shared: \
19164565Sgshapiro  %{!non_shared: %{!call_shared:%{!r: -call_shared " IRIX_NO_UNRESOLVED "}}}} \
19264565Sgshapiro%{rpath} -init __gcc_init -fini __gcc_fini " IRIX_SUBTARGET_LINK_SPEC
19364565Sgshapiro
19464565Sgshapiro/* A linker error can empirically be avoided by removing duplicate
19564565Sgshapiro   library search directories.  */
19664565Sgshapiro#define LINK_ELIMINATE_DUPLICATE_LDIRECTORIES 1
19764565Sgshapiro
19864565Sgshapiro/* Add -g to mips.h default to avoid confusing gas with local symbols
19964565Sgshapiro   generated from stabs info.  */
20064565Sgshapiro#undef NM_FLAGS
20164565Sgshapiro#define NM_FLAGS "-Bng"
20264565Sgshapiro
20364565Sgshapiro/* The system header files are C++ aware.  */
20464565Sgshapiro/* ??? Unfortunately, most but not all of the headers are C++ aware.
20564565Sgshapiro   Specifically, curses.h is not, and as a consequence, defining this
20642580Speter   used to prevent libg++ building.  This is no longer the case so
20764565Sgshapiro   define it again to prevent other problems, e.g. with getopt in
20864565Sgshapiro   unistd.h.  We still need some way to fix just those files that need
20964565Sgshapiro   fixing.  */
21064565Sgshapiro#define NO_IMPLICIT_EXTERN_C 1
21164565Sgshapiro
21264565Sgshapiro/* -G is incompatible with -KPIC which is the default, so only allow objects
21364565Sgshapiro   in the small data section if the user explicitly asks for it.  */
21464565Sgshapiro#undef MIPS_DEFAULT_GVALUE
21564565Sgshapiro#define MIPS_DEFAULT_GVALUE 0
21642580Speter
21764565Sgshapiro/* The native o32 IRIX linker does not support merging without a
21842580Speter   special elspec(5) file.  */
21942580Speter#ifndef IRIX_USING_GNU_LD
22042580Speter#undef HAVE_GAS_SHF_MERGE
22142580Speter#define HAVE_GAS_SHF_MERGE 0
22242580Speter#endif
22342580Speter