OSDN Git Service

* config/gnu.h (HURD_TARGET_OS_CPP_BUILTINS): New.
[pf3gnuchains/gcc-fork.git] / gcc / config / mips / linux.h
index 133ce28..ae64020 100644 (file)
@@ -2,20 +2,20 @@
    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
    Free Software Foundation, Inc.
 
-This file is part of GNU CC.
+This file is part of GCC.
 
-GNU CC is free software; you can redistribute it and/or modify
+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)
 any later version.
 
-GNU CC is distributed in the hope that it will be useful,
+GCC is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING.  If not, write to
+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.  */
 
@@ -34,47 +34,10 @@ Boston, MA 02111-1307, USA.  */
    used.  */
 #define BSS_SECTION_ASM_OP     "\t.section\t.bss"
 
-/* Like `ASM_OUTPUT_BSS' except takes the required alignment as a
-   separate, explicit argument.  If you define this macro, it is used
-   in place of `ASM_OUTPUT_BSS', and gives you more flexibility in
-   handling the required alignment of the variable.  The alignment is
-   specified as the number of bits.
-
-   Try to use function `asm_output_aligned_bss' defined in file
-   `varasm.c' when defining this macro.  */
-#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN)  \
-do {                                                           \
-  if (SIZE > 0 && (long)(SIZE) <= mips_section_threshold)      \
-    named_section (0, ".sbss", 0);                             \
-  else                                                         \
-    bss_section ();                                            \
-  ASM_OUTPUT_ALIGN (FILE, floor_log2 (ALIGN / BITS_PER_UNIT)); \
-  last_assemble_variable_decl = DECL;                          \
-  ASM_DECLARE_OBJECT_NAME (FILE, NAME, DECL);                  \
-  ASM_OUTPUT_SKIP (FILE, SIZE ? SIZE : 1);                     \
-} while (0)
-
-/* These macros generate the special .type and .size directives which
-   are used to set the corresponding fields of the linker symbol table
-   entries in an ELF object file under SVR4.  These macros also output
-   the starting labels for the relevant functions/objects.  */
-
-/* Write the extra assembler code needed to declare an object properly.  */
+#define ASM_OUTPUT_ALIGNED_BSS mips_output_aligned_bss
 
 #undef ASM_DECLARE_OBJECT_NAME
-#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL)                      \
-  do {                                                                 \
-    HOST_WIDE_INT size;                                                        \
-    ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object");                  \
-    size_directive_output = 0;                                         \
-    if (!flag_inhibit_size_directive && DECL_SIZE (DECL))              \
-      {                                                                        \
-       size_directive_output = 1;                                      \
-       size = int_size_in_bytes (TREE_TYPE (DECL));                    \
-       ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size);                   \
-      }                                                                        \
-    mips_declare_object (FILE, NAME, "", ":\n", 0);                    \
-  } while (0)
+#define ASM_DECLARE_OBJECT_NAME mips_declare_object_name
 
 #undef TARGET_VERSION
 #if TARGET_ENDIAN_DEFAULT == 0
@@ -92,12 +55,9 @@ do {                                                         \
 
 #define TARGET_OS_CPP_BUILTINS()                               \
     do {                                                       \
-       builtin_define ("__gnu_linux__");                       \
+       LINUX_TARGET_OS_CPP_BUILTINS();                         \
        builtin_define ("__PIC__");                             \
        builtin_define ("__pic__");                             \
-       builtin_define_std ("unix");                            \
-       builtin_define_std ("linux");                           \
-       builtin_assert ("system=linux");                        \
        /* The GNU C++ standard library requires this.  */      \
        if (c_dialect_cxx ())                                   \
          builtin_define ("_GNU_SOURCE");                       \
@@ -118,7 +78,8 @@ do {                                                         \
       }                                                                \
      else                                                      \
       {                                                                \
-        builtin_define ("_MIPS_SIM=_MIPS_SIM_ABI32");          \
+       builtin_define ("_ABIO32=1");                   \
+       builtin_define ("_MIPS_SIM=_ABIO32");           \
         builtin_define ("_MIPS_SZLONG=32");                    \
         builtin_define ("_MIPS_SZPTR=32");                     \
       }                                                                \
@@ -208,7 +169,8 @@ do {                                                                \
 
 /* Tell function_prologue in mips.c that we have already output the .ent/.end
    pseudo-ops.  */
-#define FUNCTION_NAME_ALREADY_DECLARED
+#undef FUNCTION_NAME_ALREADY_DECLARED
+#define FUNCTION_NAME_ALREADY_DECLARED 1
 
 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL)                     \
   (flag_pic                                                            \
@@ -227,3 +189,75 @@ do {                                                               \
 %{!static:-rpath-link %R/lib:%R/usr/lib} \
 %{!shared: %{pthread:-lpthread} \
   %{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>
+
+/* 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;
+
+#endif /* IN_LIBGCC2  */
+
+#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)
+#endif