/* Definitions of target machine for GNU compiler. Iris version 6.
- Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002
+ Free Software Foundation, Inc.
This file is part of GNU CC.
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+/* Let mips.c know we need the Irix6 functions. */
+#define TARGET_IRIX6 1
+
/* Default to -mabi=n32 and -mips3. */
#define MIPS_ISA_DEFAULT 3
#define MIPS_ABI_DEFAULT ABI_N32
#include "mips/abi64.h"
/* Irix6 assembler does handle DWARF2 directives. Override setting in
- irix5.h file. */
+ irix5.h file. */
#undef DWARF2_UNWIND_INFO
/* The Irix6 assembler will sometimes assign labels to the wrong
we avoid creating such labels. */
#define DWARF2_GENERATE_TEXT_SECTION_LABEL 0
+/* wchar_t is defined differently with and without -mabi=64. */
+
+#undef WCHAR_TYPE
+#define WCHAR_TYPE (Pmode == DImode ? "int" : "long int")
+
+#undef WCHAR_TYPE_SIZE
+#define WCHAR_TYPE_SIZE 32
+
+/* Same for wint_t. */
+
+#undef WINT_TYPE
+#define WINT_TYPE (Pmode == DImode ? "int" : "long int")
+
+#undef WINT_TYPE_SIZE
+#define WINT_TYPE_SIZE 32
+
/* For Irix 6, -mabi=64 implies TARGET_LONG64. */
/* This is handled in override_options. */
#undef SUBTARGET_CC1_SPEC
-#define SUBTARGET_CC1_SPEC "%{static: -mno-abicalls}"
+#define SUBTARGET_CC1_SPEC ""
/* We must pass -D_LONGLONG always, even when -ansi is used, because irix6
system header files require it. This is OK, because gcc never warns
#define CPP_PREDEFINES \
"-Dunix -Dmips -Dsgi -Dhost_mips -DMIPSEB -D_MIPSEB -DSYSTYPE_SVR4 \
-D_LONGLONG -D_SVR4_SOURCE -D_MODERN_C -D__DSO__ \
- -Asystem(unix) -Asystem(svr4) -Acpu(mips) -Amachine(sgi)"
-
-#undef SUBTARGET_CPP_SIZE_SPEC
-#define SUBTARGET_CPP_SIZE_SPEC "\
-%{mabi=32: -D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int} \
-%{mabi=n32: -D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int} \
-%{mabi=64: -D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int} \
-%{!mabi*: -D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int}"
+ -Asystem=unix -Asystem=svr4 -Acpu=mips -Amachine=sgi"
/* We must make -mips3 do what -mlong64 used to do. */
/* ??? If no mipsX option given, but a mabi=X option is, then should set
_MIPS_SIM based on the mipsX option. */
/* ??? Same for _MIPS_SZINT. */
/* ??? Same for _MIPS_SZPTR. */
-/* ??? Same for __SIZE_TYPE and __PTRDIFF_TYPE. */
#undef SUBTARGET_CPP_SPEC
#define SUBTARGET_CPP_SPEC "\
%{!ansi:-D__EXTENSIONS__ -D_SGI_SOURCE} \
%{mabi=64: -D__mips64} \
%{!mabi*: -D__mips64}"
+/* The GNU C++ standard library requires that __EXTENSIONS__ and
+ _SGI_SOURCE be defined on at least irix6.2 and probably all irix6
+ prior to 6.5. They normally get defined in SUBTARGET_CPP_SPEC if
+ !ansi, for g++ we want them regardless. We don't need this on
+ irix6.5 itself, but it shouldn't hurt other than the namespace
+ polution. */
+#undef CPLUSPLUS_CPP_SPEC
+#define CPLUSPLUS_CPP_SPEC "\
+-D__LANGUAGE_C_PLUS_PLUS -D_LANGUAGE_C_PLUS_PLUS \
+%{ansi:-D__EXTENSIONS__ -D_SGI_SOURCE} %(cpp) \
+"
+
/* Irix 6 uses DWARF-2. */
#define DWARF2_DEBUGGING_INFO
#define MIPS_DEBUGGING_INFO
#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
/* Force the generation of dwarf .debug_frame sections even if not
- compiling -g. This guarantees that we can unwind the stack. */
+ compiling -g. This guarantees that we can unwind the stack. */
#define DWARF2_FRAME_INFO 1
+
/* The size in bytes of a DWARF field indicating an offset or length
relative to a debug info section, specified to be 4 bytes in the DWARF-2
specification. The SGI/MIPS ABI defines it to be the same as PTR_SIZE. */
#undef MACHINE_TYPE
#define MACHINE_TYPE "SGI running IRIX 6.x"
-/* The Irix 6.0.1 assembler doesn't like labels in the text section, so
- just avoid emitting them. */
-#define ASM_IDENTIFY_GCC(x) ((void)0)
-#define ASM_IDENTIFY_LANGUAGE(x) ((void)0)
-
/* Irix 5 stuff that we don't need for Irix 6. */
/* ??? We do need this for the -mabi=32 switch though. */
#undef ASM_OUTPUT_UNDEF_FUNCTION
/* Define the strings used for the special svr4 .type and .size directives. */
-#define TYPE_ASM_OP ".type"
-#define SIZE_ASM_OP ".size"
-
-/* This is how we tell the assembler that a symbol is weak. */
-
-#define ASM_OUTPUT_WEAK_ALIAS(FILE,NAME,VALUE) \
- do { \
- ASM_GLOBALIZE_LABEL (FILE, NAME); \
- fputs ("\t.weakext\t", FILE); \
- assemble_name (FILE, NAME); \
- if (VALUE) \
- { \
- fputc (' ', FILE); \
- assemble_name (FILE, VALUE); \
- } \
- fputc ('\n', FILE); \
- } while (0)
-
-#define ASM_WEAKEN_LABEL(FILE,NAME) ASM_OUTPUT_WEAK_ALIAS(FILE,NAME,0)
-
-#define POPSECTION_ASM_OP ".popsection"
-
-#define DEBUG_INFO_SECTION ".debug_info,0x7000001e,0,0,1"
-#define DEBUG_LINE_SECTION ".debug_line,0x7000001e,0,0,1"
-#define SFNAMES_SECTION ".debug_sfnames,0x7000001e,0,0,1"
-#define SRCINFO_SECTION ".debug_srcinfo,0x7000001e,0,0,1"
-#define MACINFO_SECTION ".debug_macinfo,0x7000001e,0,0,1"
-#define PUBNAMES_SECTION ".debug_pubnames,0x7000001e,0,0,1"
-#define ARANGES_SECTION ".debug_aranges,0x7000001e,0,0,1"
-#define FRAME_SECTION ".debug_frame,0x7000001e,0x08000000,0,1"
-#define ABBREV_SECTION ".debug_abbrev,0x7000001e,0,0,1"
+#define TYPE_ASM_OP "\t.type\t"
+#define SIZE_ASM_OP "\t.size\t"
+
+/* Irix assembler does not support the init_priority C++ attribute. */
+#undef SUPPORTS_INIT_PRIORITY
+#define SUPPORTS_INIT_PRIORITY 0
+
+/* A linker error can empirically be avoided by removing duplicate
+ library search directories. */
+#define LINK_ELIMINATE_DUPLICATE_LDIRECTORIES 1
+
+#define POPSECTION_ASM_OP "\t.popsection"
/* ??? If no mabi=X option give, but a mipsX option is, then should depend
on the mipsX option. */
+/* If no mips[3,4] option given, give the appropriate default for mabi=X */
#undef SUBTARGET_ASM_SPEC
-#define SUBTARGET_ASM_SPEC "%{!mabi*:-n32}"
+#define SUBTARGET_ASM_SPEC "%{!mabi*:-n32} %{!mips*: %{!mabi*:-mips3} %{mabi=n32:-mips3} %{mabi=64:-mips4}}"
/* Must pass -g0 to the assembler, otherwise it may overwrite our
- debug info with its own debug info. */
+ debug info with its own debug info. */
/* Must pass -show instead of -v. */
/* Must pass -G 0 to the assembler, otherwise we may get warnings about
GOT overflow. */
#undef SUBTARGET_ASM_OPTIMIZING_SPEC
#define SUBTARGET_ASM_OPTIMIZING_SPEC "-O0"
-/* Stuff for constructors. Start here. */
-
/* The assembler now accepts .section pseudo-ops, but it does not allow
one to change the section in the middle of a function, so we can't use
the INIT_SECTION_ASM_OP code in crtstuff. But we can build up the ctor
and dtor lists this way, so we use -init and -fini to invoke the
do_global_* functions instead of running collect2. */
-#define BSS_SECTION_ASM_OP ".section\t.bss"
-#define CONST_SECTION_ASM_OP_32 "\t.rdata"
-#define CONST_SECTION_ASM_OP_64 ".section\t.rodata"
-
-/* The IRIX 6 assembler .section directive takes four additional args:
- section type, flags, entry size, and alignment. The alignment of the
- .ctors and .dtors sections needs to be the same as the size of a pointer
- so that the linker doesn't add padding between elements. */
-#if defined (CRT_BEGIN) || defined (CRT_END)
-
-/* If we are included from crtstuff.c, these need to be plain strings.
- _MIPS_SZPTR is defined in SUBTARGET_CPP_SPEC above. */
-#if _MIPS_SZPTR == 64
-#define CTORS_SECTION_ASM_OP ".section\t.ctors,1,2,0,8"
-#define DTORS_SECTION_ASM_OP ".section\t.dtors,1,2,0,8"
-#else /* _MIPS_SZPTR != 64 */
-#define CTORS_SECTION_ASM_OP ".section\t.ctors,1,2,0,4"
-#define DTORS_SECTION_ASM_OP ".section\t.dtors,1,2,0,4"
-#endif /* _MIPS_SZPTR == 64 */
-
-#else /* ! (defined (CRT_BEGIN) || defined (CRT_END)) */
-
-/* If we are included from varasm.c, these need to depend on -mabi. */
-#define CTORS_SECTION_ASM_OP \
- (Pmode == DImode ? ".section\t.ctors,1,2,0,8" : ".section\t.ctors,1,2,0,4")
-#define DTORS_SECTION_ASM_OP \
- (Pmode == DImode ? ".section\t.dtors,1,2,0,8" : ".section\t.dtors,1,2,0,4")
-#endif /* defined (CRT_BEGIN) || defined (CRT_END) */
-
-/* dwarf2out will handle padding this data properly. We definitely don't
- want it 8-byte aligned on n32. */
-#define EH_FRAME_SECTION_ASM_OP ".section\t.eh_frame,1,2,0,1"
+#define BSS_SECTION_ASM_OP "\t.section\t.bss"
+
+#undef READONLY_DATA_SECTION_ASM_OP
+#define READONLY_DATA_SECTION_ASM_OP_32 "\t.rdata"
+#define READONLY_DATA_SECTION_ASM_OP_64 "\t.section\t.rodata"
+#define READONLY_DATA_SECTION_ASM_OP \
+ (mips_abi != ABI_32 && mips_abi != ABI_O64 \
+ ? READONLY_DATA_SECTION_ASM_OP_64 \
+ : READONLY_DATA_SECTION_ASM_OP_32)
/* A default list of other sections which we might be "in" at any given
time. For targets that use additional sections (e.g. .tdesc) you
includes this file. */
#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_sdata, in_rdata, in_const, in_ctors, in_dtors
+#define EXTRA_SECTIONS in_sdata
/* A default list of extra section function definitions. For targets
that use additional sections (e.g. .tdesc) you should override this
definition in the target-specific file which includes this file. */
-/* ??? rdata_section is now same as svr4 const_section. */
-
#undef EXTRA_SECTION_FUNCTIONS
#define EXTRA_SECTION_FUNCTIONS \
void \
} \
} \
\
-void \
-rdata_section () \
+const char * \
+current_section_name () \
{ \
- if (in_section != in_rdata) \
+ switch (in_section) \
{ \
+ case no_section: return NULL; \
+ case in_text: return ".text"; \
+ case in_data: return ".data"; \
+ case in_sdata: return ".sdata"; \
+ case in_bss: return ".bss"; \
+ case in_readonly_data: \
if (mips_abi != ABI_32 && mips_abi != ABI_O64) \
- fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP_64); \
+ return ".rodata"; \
else \
- fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP_32); \
- in_section = in_rdata; \
+ return ".rdata"; \
+ case in_named: \
+ return in_named_name; \
} \
+ abort (); \
} \
- CTORS_SECTION_FUNCTION \
- DTORS_SECTION_FUNCTION
-
-#define CTORS_SECTION_FUNCTION \
-void \
-ctors_section () \
-{ \
- if (in_section != in_ctors) \
- { \
- fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \
- in_section = in_ctors; \
- } \
-}
-
-#define DTORS_SECTION_FUNCTION \
-void \
-dtors_section () \
+ \
+unsigned int \
+current_section_flags () \
{ \
- if (in_section != in_dtors) \
+ switch (in_section) \
{ \
- fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \
- in_section = in_dtors; \
+ case no_section: return 0; \
+ case in_text: return SECTION_CODE; \
+ case in_data: return SECTION_WRITE; \
+ case in_sdata: return SECTION_WRITE | SECTION_SMALL; \
+ case in_bss: return SECTION_WRITE | SECTION_BSS; \
+ case in_readonly_data: return 0; \
+ case in_named: return get_named_section_flags (in_named_name); \
} \
+ abort (); \
}
-/* A C statement (sans semicolon) to output an element in the table of
- global constructors. */
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
- do { \
- ctors_section (); \
- fprintf (FILE, "\t%s\t ", \
- (Pmode == DImode) ? ".dword" : ".word"); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* A C statement (sans semicolon) to output an element in the table of
- global destructors. */
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
- do { \
- dtors_section (); \
- fprintf (FILE, "\t%s\t ", \
- (Pmode == DImode) ? ".dword" : ".word"); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "\n"); \
- } while (0)
-
-/* A C statement to output something to the assembler file to switch to section
- NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
- NULL_TREE. */
+/* Switch into a generic section. */
+#undef TARGET_ASM_NAMED_SECTION
+#define TARGET_ASM_NAMED_SECTION iris6_asm_named_section
-#define ASM_OUTPUT_SECTION_NAME(F, DECL, NAME, RELOC) \
-do { \
- extern FILE *asm_out_text_file; \
- if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL) \
- fprintf (asm_out_text_file, "\t.section %s,1,6,4,4\n", (NAME)); \
- else if ((DECL) && DECL_READONLY_SECTION (DECL, RELOC)) \
- fprintf (F, "\t.section %s,1,2,0,8\n", (NAME)); \
- else \
- fprintf (F, "\t.section %s,1,3,0,8\n", (NAME)); \
-} while (0)
+/* SGI assembler needs all sorts of extra help to do alignment properly. */
+#undef ASM_OUTPUT_ALIGN
+#define ASM_OUTPUT_ALIGN iris6_asm_output_align
+#undef ASM_FILE_START
+#define ASM_FILE_START iris6_asm_file_start
+#undef ASM_FILE_END
+#define ASM_FILE_END iris6_asm_file_end
-/* Stuff for constructors. End here. */
-
-/* ??? Perhaps just include svr4.h in this file? */
+#undef MAX_OFILE_ALIGNMENT
+#define MAX_OFILE_ALIGNMENT (32768*8)
/* ??? SGI assembler may core dump when compiling with -g.
Sometimes as succeeds, but then we get a linker error. (cmds.c in 072.sc)
{ \
if (mips_abi != ABI_32 && mips_abi != ABI_O64) \
{ \
- fprintf (STREAM, "%s\n", BSS_SECTION_ASM_OP); \
+ bss_section (); \
mips_declare_object (STREAM, NAME, "", ":\n", 0); \
ASM_OUTPUT_ALIGN (STREAM, floor_log2 (ALIGN / BITS_PER_UNIT)); \
ASM_OUTPUT_SKIP (STREAM, SIZE); \
- fprintf (STREAM, "\t%s\n", POPSECTION_ASM_OP); \
} \
else \
mips_declare_object (STREAM, NAME, "\n\t.lcomm\t", ",%u\n", (SIZE)); \
if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
{ \
size_directive_output = 1; \
- fprintf (STREAM, "\t%s\t ", SIZE_ASM_OP); \
+ fprintf (STREAM, "%s", SIZE_ASM_OP); \
assemble_name (STREAM, NAME); \
- fprintf (STREAM, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
+ fprintf (STREAM, ","); \
+ fprintf (STREAM, HOST_WIDE_INT_PRINT_DEC, int_size_in_bytes (TREE_TYPE (DECL))); \
+ fprintf (STREAM, "\n"); \
} \
mips_declare_object (STREAM, NAME, "", ":\n", 0); \
} \
#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
do { \
- char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
+ const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \
&& ! AT_END && TOP_LEVEL \
&& DECL_INITIAL (DECL) == error_mark_node \
&& !size_directive_output) \
{ \
size_directive_output = 1; \
- fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
+ fprintf (FILE, "%s", SIZE_ASM_OP); \
assemble_name (FILE, name); \
- fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
+ fprintf (FILE, ","); \
+ fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, int_size_in_bytes (TREE_TYPE (DECL))); \
+ fprintf (FILE, "\n"); \
} \
} while (0)
on the mipsX option. */
#undef STARTFILE_SPEC
#define STARTFILE_SPEC \
- "%{!static:%{!shared: \
+ "%{!shared: \
%{mabi=32:%{pg:gcrt1.o%s} \
%{!pg:%{p:mcrt1.o%s libprof1.a%s}%{!p:crt1.o%s}}} \
%{mabi=n32: \
%{!p:/usr/lib32/mips4/crt1.o%s}}} \
%{!mips4:%{pg:/usr/lib32/mips3/gcrt1.o%s} \
%{!pg:%{p:/usr/lib32/mips3/mcrt1.o%s /usr/lib32/mips3/libprof1.a%s} \
- %{!p:/usr/lib32/mips3/crt1.o%s}}}}}} \
- %{static: \
- %{mabi=32:%{pg:/usr/lib/nonshared/gcrt1.o%s} \
- %{!pg:%{p:/usr/lib/nonshared/mcrt1.o%s /usr/lib/nonshared/libprof1.a%s} \
- %{!p:/usr/lib/nonshared/crt1.o%s}}} \
- %{mabi=n32: \
- %{mips4:%{pg:/usr/lib32/mips4/nonshared/gcrt1.o%s} \
- %{!pg:%{p:/usr/lib32/mips4/nonshared/mcrt1.o%s \
- /usr/lib32/mips4/nonshared/libprof1.a%s} \
- %{!p:/usr/lib32/mips4/nonshared/crt1.o%s}}} \
- %{!mips4:%{pg:/usr/lib32/mips3/nonshared/gcrt1.o%s} \
- %{!pg:%{p:/usr/lib32/mips3/nonshared/mcrt1.o%s \
- /usr/lib32/mips3/nonshared/libprof1.a%s} \
- %{!p:/usr/lib32/mips3/nonshared/crt1.o%s}}}} \
- %{mabi=64: \
- %{mips4:%{pg:/usr/lib64/mips4/nonshared/gcrt1.o} \
- %{!pg:%{p:/usr/lib64/mips4/nonshared/mcrt1.o \
- /usr/lib64/mips4/nonshared/libprof1.a} \
- %{!p:/usr/lib64/mips4/nonshared/crt1.o}}} \
- %{!mips4:%{pg:/usr/lib64/mips3/nonshared/gcrt1.o} \
- %{!pg:%{p:/usr/lib64/mips3/nonshared/mcrt1.o \
- /usr/lib64/mips3/nonshared/libprof1.a} \
- %{!p:/usr/lib64/mips3/nonshared/crt1.o}}}} \
- %{!mabi*: \
- %{mips4:%{pg:/usr/lib32/mips4/nonshared/gcrt1.o%s} \
- %{!pg:%{p:/usr/lib32/mips4/nonshared/mcrt1.o%s \
- /usr/lib32/mips4/nonshared/libprof1.a%s} \
- %{!p:/usr/lib32/mips4/nonshared/crt1.o%s}}} \
- %{!mips4:%{pg:/usr/lib32/mips3/nonshared/gcrt1.o%s} \
- %{!pg:%{p:/usr/lib32/mips3/nonshared/mcrt1.o%s \
- /usr/lib32/mips3/nonshared/libprof1.a%s} \
- %{!pg:%{p:/usr/lib32/mips3/nonshared/mcrt1.o%s \
- /usr/lib32/mips3/nonshared/libprof1.a%s} \
- %{!p:/usr/lib32/mips3/nonshared/crt1.o%s}}}}}} \
+ %{!p:/usr/lib32/mips3/crt1.o%s}}}}} \
crtbegin.o%s"
#undef LIB_SPEC
%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} %{mips4} \
%{bestGnum} %{shared} %{non_shared} \
%{call_shared} %{no_archive} %{exact_version} %{w} \
-%{static: -non_shared} \
-%{!static: \
- %{!shared: %{!non_shared: %{!call_shared: -call_shared -no_unresolved}}}} \
+%{!shared: %{!non_shared: %{!call_shared: -call_shared -no_unresolved}}} \
%{rpath} -init __do_global_ctors -fini __do_global_dtors \
-%{shared:-hidden_symbol __do_global_ctors,__do_global_dtors,__EH_FRAME_BEGIN__,__frame_dummy} \
+%{shared:-hidden_symbol __do_global_ctors,__do_global_ctors_1,__do_global_dtors} \
-_SYSTYPE_SVR4 -woff 131 \
%{mabi=32: -32}%{mabi=n32: -n32}%{mabi=64: -64}%{!mabi*: -n32}"