/* Definitions for MIPS running Linux-based GNU systems with ELF format.
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
- Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
+the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
#undef WCHAR_TYPE
#define WCHAR_TYPE "int"
#undef WCHAR_TYPE_SIZE
#define WCHAR_TYPE_SIZE 32
-/* If defined, a C expression whose value is a string containing the
- assembler operation to identify the following data as
- uninitialized global data. If not defined, and neither
- `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined,
- uninitialized global data will be output in the data section if
- `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be
- used. */
-#define BSS_SECTION_ASM_OP "\t.section\t.bss"
-
-#define ASM_OUTPUT_ALIGNED_BSS mips_output_aligned_bss
-
#undef ASM_DECLARE_OBJECT_NAME
#define ASM_DECLARE_OBJECT_NAME mips_declare_object_name
#define TARGET_DEFAULT MASK_ABICALLS
#define TARGET_OS_CPP_BUILTINS() \
- do { \
- LINUX_TARGET_OS_CPP_BUILTINS(); \
- builtin_define ("__PIC__"); \
- builtin_define ("__pic__"); \
- builtin_assert ("machine=mips"); \
- /* The GNU C++ standard library requires this. */ \
- if (c_dialect_cxx ()) \
- builtin_define ("_GNU_SOURCE"); \
- \
- if (mips_abi == ABI_N32) \
- { \
- builtin_define ("_ABIN32=2"); \
- builtin_define ("_MIPS_SIM=_ABIN32"); \
- builtin_define ("_MIPS_SZLONG=32"); \
- builtin_define ("_MIPS_SZPTR=32"); \
- } \
- else if (mips_abi == ABI_64) \
- { \
- builtin_define ("_ABI64=3"); \
- builtin_define ("_MIPS_SIM=_ABI64"); \
- builtin_define ("_MIPS_SZLONG=64"); \
- builtin_define ("_MIPS_SZPTR=64"); \
- } \
- else \
- { \
- builtin_define ("_ABIO32=1"); \
- builtin_define ("_MIPS_SIM=_ABIO32"); \
- builtin_define ("_MIPS_SZLONG=32"); \
- builtin_define ("_MIPS_SZPTR=32"); \
- } \
- if (TARGET_FLOAT64) \
- builtin_define ("_MIPS_FPSET=32"); \
- else \
- builtin_define ("_MIPS_FPSET=16"); \
- \
- if (TARGET_INT64) \
- builtin_define ("_MIPS_SZINT=64"); \
- else \
- builtin_define ("_MIPS_SZINT=32"); \
-} while (0)
+ do { \
+ LINUX_TARGET_OS_CPP_BUILTINS(); \
+ /* The GNU C++ standard library requires this. */ \
+ if (c_dialect_cxx ()) \
+ builtin_define ("_GNU_SOURCE"); \
+ } while (0)
-#undef SUBTARGET_CPP_SPEC
-#define SUBTARGET_CPP_SPEC "\
-%{fno-PIC:-U__PIC__ -U__pic__} %{fno-pic:-U__PIC__ -U__pic__} \
-%{fPIC|fPIE|fpic|fpie:-D__PIC__ -D__pic__} \
-%{pthread:-D_REENTRANT}"
+#undef SUBTARGET_CPP_SPEC
+#define SUBTARGET_CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
+
+/* A standard GNU/Linux mapping. On most targets, it is included in
+ CC1_SPEC itself by config/linux.h, but mips.h overrides CC1_SPEC
+ and provides this hook instead. */
+#undef SUBTARGET_CC1_SPEC
+#define SUBTARGET_CC1_SPEC "%{profile:-p}"
/* From iris5.h */
/* -G is incompatible with -KPIC which is the default, so only allow objects
#undef MIPS_DEFAULT_GVALUE
#define MIPS_DEFAULT_GVALUE 0
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
+
/* Borrowed from sparc/linux.h */
#undef LINK_SPEC
#define LINK_SPEC \
%{!ibcs: \
%{!static: \
%{rdynamic:-export-dynamic} \
- %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
+ %{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER "}} \
%{static:-static}}}"
#undef SUBTARGET_ASM_SPEC
-#define SUBTARGET_ASM_SPEC "\
-%{mabi=64: -64} \
-%{!fno-PIC:%{!fno-pic:-KPIC}} \
-%{fno-PIC:-non_shared} %{fno-pic:-non_shared}"
+#define SUBTARGET_ASM_SPEC "%{mabi=64: -64} %{!mno-abicalls:-KPIC}"
/* The MIPS assembler has different syntax for .set. We set it to
.dummy to trap any errors. */
#undef LIB_SPEC
#define LIB_SPEC "\
-%{shared: -lc} \
-%{!static:-rpath-link %R/lib:%R/usr/lib} \
-%{!shared: %{pthread:-lpthread} \
- %{profile:-lc_p} %{!profile: -lc}}"
+%{pthread:-lpthread} \
+%{shared:-lc} \
+%{!shared: \
+ %{profile:-lc_p} %{!profile:-lc}}"
-#ifndef inhibit_libc
-/* Do code reading to identify a signal frame, and set the frame
- state data appropriately. See unwind-dw2.c for the structs. */
-#ifdef IN_LIBGCC2
-#include <signal.h>
+#define MD_UNWIND_SUPPORT "config/mips/linux-unwind.h"
-/* The third parameter to the signal handler points to something with
- * this structure defined in asm/ucontext.h, but the name clashes with
- * struct ucontext from sys/ucontext.h so this private copy is used. */
-typedef struct _sig_ucontext {
- unsigned long uc_flags;
- struct _sig_ucontext *uc_link;
- stack_t uc_stack;
- struct sigcontext uc_mcontext;
- sigset_t uc_sigmask;
-} _sig_ucontext_t;
+#ifdef HAVE_AS_NO_SHARED
+/* Default to -mno-shared for non-PIC. */
+# define NO_SHARED_SPECS \
+ "%{mshared|mno-shared|fpic|fPIC|fpie|fPIE:;:-mno-shared}"
+#else
+# define NO_SHARED_SPECS ""
+#endif
-#endif /* IN_LIBGCC2 */
+/* -march=native handling only makes sense with compiler running on
+ a MIPS chip. */
+#if defined(__mips__)
+extern const char *host_detect_local_cpu (int argc, const char **argv);
+# define EXTRA_SPEC_FUNCTIONS \
+ { "local_cpu_detect", host_detect_local_cpu },
-#define MD_FALLBACK_FRAME_STATE_FOR(CONTEXT, FS, SUCCESS) \
- do { \
- u_int32_t *pc_ = (u_int32_t *) (CONTEXT)->ra; \
- struct sigcontext *sc_; \
- _Unwind_Ptr new_cfa_; \
- int i_; \
- \
- /* 24021061 li v0, 0x1061 (rt_sigreturn)*/ \
- /* 0000000c syscall */ \
- /* or */ \
- /* 24021017 li v0, 0x1017 (sigreturn) */ \
- /* 0000000c syscall */ \
- if (*(pc_ + 1) != 0x0000000c) \
- break; \
- if (*(pc_ + 0) == 0x24021017) \
- { \
- struct sigframe { \
- u_int32_t trampoline[2]; \
- struct sigcontext sigctx; \
- } *rt_ = (CONTEXT)->ra; \
- sc_ = &rt_->sigctx; \
- } \
- else if (*(pc_ + 0) == 0x24021061) \
- { \
- struct rt_sigframe { \
- u_int32_t trampoline[2]; \
- struct siginfo info; \
- _sig_ucontext_t uc; \
- } *rt_ = (CONTEXT)->ra; \
- sc_ = &rt_->uc.uc_mcontext; \
- } \
- else \
- break; \
- \
- new_cfa_ = (_Unwind_Ptr)sc_; \
- (FS)->cfa_how = CFA_REG_OFFSET; \
- (FS)->cfa_reg = STACK_POINTER_REGNUM; \
- (FS)->cfa_offset = new_cfa_ - (_Unwind_Ptr) (CONTEXT)->cfa; \
- \
- for (i_ = 0; i_ < 32; i_++) { \
- (FS)->regs.reg[i_].how = REG_SAVED_OFFSET; \
- (FS)->regs.reg[i_].loc.offset \
- = (_Unwind_Ptr)&(sc_->sc_regs[i_]) - new_cfa_; \
- } \
- (FS)->regs.reg[SIGNAL_UNWIND_RETURN_COLUMN].how = REG_SAVED_OFFSET; \
- (FS)->regs.reg[SIGNAL_UNWIND_RETURN_COLUMN].loc.offset \
- = (_Unwind_Ptr)&(sc_->sc_pc) - new_cfa_; \
- (FS)->retaddr_column = SIGNAL_UNWIND_RETURN_COLUMN; \
- \
- goto SUCCESS; \
- } while (0)
+# define MARCH_MTUNE_NATIVE_SPECS \
+ " %{march=native:%<march=native %:local_cpu_detect(arch)}" \
+ " %{mtune=native:%<mtune=native %:local_cpu_detect(tune)}"
+#else
+# define MARCH_MTUNE_NATIVE_SPECS ""
#endif
+
+#define BASE_DRIVER_SELF_SPECS \
+ NO_SHARED_SPECS \
+ MARCH_MTUNE_NATIVE_SPECS
+#define DRIVER_SELF_SPECS BASE_DRIVER_SELF_SPECS