Solaris, Linux changes
authorMichael Meissner <meissner@gcc.gnu.org>
Wed, 24 Apr 1996 16:54:48 +0000 (16:54 +0000)
committerMichael Meissner <meissner@gcc.gnu.org>
Wed, 24 Apr 1996 16:54:48 +0000 (16:54 +0000)
From-SVN: r11874

20 files changed:
gcc/config/rs6000/eabi-ci.asm
gcc/config/rs6000/eabi-cn.asm
gcc/config/rs6000/eabi-ctors.c
gcc/config/rs6000/eabi.h
gcc/config/rs6000/eabiaix.h
gcc/config/rs6000/eabile.h
gcc/config/rs6000/eabilesim.h
gcc/config/rs6000/eabisim.h
gcc/config/rs6000/rs6000.c
gcc/config/rs6000/rs6000.h
gcc/config/rs6000/rs6000.md
gcc/config/rs6000/sol-c0.c [new file with mode: 0644]
gcc/config/rs6000/sol-ci.asm [new file with mode: 0644]
gcc/config/rs6000/sol-cn.asm [new file with mode: 0644]
gcc/config/rs6000/sol2.h [new file with mode: 0644]
gcc/config/rs6000/sysv4.h
gcc/config/rs6000/sysv4le.h
gcc/config/rs6000/t-ppc
gcc/config/rs6000/t-ppcgas
gcc/config/rs6000/xm-sysv4.h

index ff214cca772072787ae7cafe72dd47942ee79ec7..872a9e66565dec27c5756e27f30672b25854f372 100644 (file)
@@ -39,7 +39,9 @@
        .file   "crti.s"
        .ident  "GNU C crti.s"
 
-       .section ".got","w"
+#include <ppc-asm.h>
+
+       .section ".got","aw"
        .globl  __GOT_START__
        .type   __GOT_START__,@object
        .weak   _GLOBAL_OFFSET_TABLE_
@@ -102,3 +104,19 @@ __SBSS2_START__:
        .globl  __EXCEPT_START__
        .type   __EXCEPT_START__,@object
 __EXCEPT_START__:
+
+# Head of __init function used for static constructors in Solaris
+       .section ".init","ax"
+       .align 2
+FUNC_START(__init)
+       stwu 1,-8(1)
+       mflr 0
+       stw 0,12(1)
+
+# Head of __fini function used for static destructors in Solaris
+       .section ".fini","ax"
+       .align 2
+FUNC_START(__fini)
+       stwu 1,-8(1)
+       mflr 0
+       stw 0,12(1)
index fdcfb62ae2dcb54c775c1cb109dbf17b2ce1fb35..06e895638dc744df10c2f072eb8a0b265d7848f1 100644 (file)
@@ -93,3 +93,17 @@ __SBSS2_END__:
        .globl  __EXCEPT_END__
        .type   __EXCEPT_END__,@object
 __EXCEPT_END__:
+
+# Tail of __init used for static constructors in Solaris
+       .section ".init","ax"
+       lwz 0,12(1)
+       mtlr 0
+       addi 1,1,8
+       blr
+
+# Tail of __fini used for static destructors in Solaris
+       .section ".fini","ax"
+       lwz 0,12(1)
+       mtlr 0
+       addi 1,1,8
+       blr
index 69a78af7cc4ac35212fbbe928c9ef896f293b8b2..ebc23ded35cec0a961283d546f952f08baba0a16 100644 (file)
@@ -21,6 +21,13 @@ along with GNU CC; see the file COPYING.  If not, write to
 the Free Software Foundation, 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.  */
 
+/* As a special exception, if you link this library with other files,
+   some of which are compiled with GCC, to produce an executable,
+   this library does not by itself cause the resulting executable
+   to be covered by the GNU General Public License.
+   This exception does not however invalidate any other reasons why
+   the executable file might be covered by the GNU General Public License.  */
+
 
 /*  Declare a pointer to void function type.  */
 
@@ -37,6 +44,14 @@ extern func_ptr __DTOR_END__ [];
 extern void __do_global_ctors (void);
 extern void __do_global_dtors (void);
 
+extern void __init (), __fini ();
+
+/* The Solaris linker seems to incorrectly relocate PC relative relocations
+   to a different section (ie, calls to __init, __fini), so avoid it by
+   using a function pointer.  */
+static void (*init_ptr) (void) = __init;
+static void (*fini_ptr) (void) = __fini;
+
 void (*__atexit)(func_ptr);
 
 /* Call all global constructors */
@@ -49,19 +64,28 @@ __do_global_ctors (void)
   if (__atexit)
     __atexit (__do_global_dtors);
 
+  /* Call the constructors collected in the .ctors section.  */
   for ( ; ptr != end; ptr++)
     if (*ptr)
       (*ptr)();
+
+  /* Call the initialization function in the .init section.  */
+  (*init_ptr) ();
 }
 
 /* Call all global destructors */
 void
 __do_global_dtors (void)
 {
-  func_ptr *ptr = &__DTOR_LIST__[0];
-  func_ptr *end = &__DTOR_END__[0];
+  func_ptr *ptr   = &__DTOR_END__[0] - 1;
+  func_ptr *start = &__DTOR_LIST__[0];
 
-  for ( ; ptr != end; ptr++)
+  /* Call the termination function in the .fini section.  */
+  (*fini_ptr) ();
+
+  /* Call the  destructors collected in the .dtors section.  Run
+     the destructors in reverse order.  */
+  for ( ; ptr >= start; ptr--)
     if (*ptr)
       (*ptr)();
 }
index 7c20972e3e53f7a34629a65928fb67e0af4c4e3d..926e314ca76b8e108f569ba6eeaa9bcaab578b65 100644 (file)
@@ -22,41 +22,9 @@ Boston, MA 02111-1307, USA.  */
 
 #include "rs6000/sysv4.h"
 
-/* For now, make stabs the default debugging type, not dwarf. */
-#undef PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-
-/* Make int foo : 8 not cause structures to be aligned to an int boundary */
-
-#undef PCC_BITFIELD_TYPE_MATTERS
-#define        PCC_BITFIELD_TYPE_MATTERS (TARGET_BITFIELD_TYPE)
-
-/* Define this macro to be the value 1 if instructions will fail to
-   work if given data not on the nominal alignment.  If instructions
-   will merely go slower in that case, define this macro as 0.
-
-   Note, little endian systems trap on unaligned addresses, so never
-   turn off strict alignment in that case. */
-#undef STRICT_ALIGNMENT
-#define        STRICT_ALIGNMENT (TARGET_STRICT_ALIGN || TARGET_LITTLE_ENDIAN)
-
-/* Align stack to 8 byte boundaries, rather than 16 bytes Sys V.4 uses */
-#undef STACK_BOUNDARY
-#define        STACK_BOUNDARY  64
-
-/* No data type wants to be aligned rounder than this.  */
-#undef BIGGEST_ALIGNMENT
-#define BIGGEST_ALIGNMENT 64
-
-/* Put PC relative got entries in .got2 */
-#undef MINIMAL_TOC_SECTION_ASM_OP
-#define MINIMAL_TOC_SECTION_ASM_OP \
-  ((TARGET_RELOCATABLE) ? "\t.section\t\".got2\",\"aw\"" : "\t.section\t\".got1\",\"aw\"")
-
-/* Put relocatable data in .data, not .rodata so initialized pointers can be updated */
-#undef CONST_SECTION_ASM_OP
-#define CONST_SECTION_ASM_OP \
-  ((TARGET_RELOCATABLE) ? "\t.section\t\".data\"\t# .rodata" : "\t.section\t\".rodata\"")
+/* Add -meabi to target flags */
+#undef TARGET_DEFAULT
+#define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS | MASK_EABI)
 
 /* Invoke an initializer function to set up the GOT */
 #define NAME__MAIN "__eabi"
@@ -68,23 +36,5 @@ Boston, MA 02111-1307, USA.  */
 #define CPP_PREDEFINES \
   "-DPPC -D__embedded__ -Asystem(embedded) -Acpu(powerpc) -Amachine(powerpc)"
 
-/* Clue the simulator in to use netbsd */
-#undef LINK_START_SPEC
-#define LINK_START_SPEC "%{msim: %{!Ttext*: -Ttext 0x10000074}}"
-
-/* Use the simulator crt0 or mvme and libgloss/newlib libraries if desired */
-#undef  STARTFILE_SPEC
-#define        STARTFILE_SPEC "crti.o%s \
-%{mmvme: mvme-crt0.o%s} \
-%{msim:  sim-crt0.o%s}"
-
-#undef LIB_SPEC
-#define        LIB_SPEC "\
-%{mmvme: -lmvme -lc -lmvme} \
-%{msim: -lsim -lc -lsim}"
-
-#undef LIBGCC_SPEC
-#define        LIBGCC_SPEC "libgcc.a%s"
-
-#undef ENDFILE_SPEC
-#define        ENDFILE_SPEC "crtn.o%s"
+#undef MULTILIB_DEFAULTS
+#define        MULTILIB_DEFAULTS { "mbig", "mbig-endian", "mcall-sysv-eabi", "mno-sdata" }
index 4ac15453ba3eb34f99d1780fcc5bbc899d360f46..c38ddb354b4c859487c79b735d399599d54b829f 100644 (file)
@@ -21,8 +21,9 @@ Boston, MA 02111-1307, USA.  */
 
 #include "rs6000/eabi.h"
 
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS | MASK_AIX_CALLS)
+/* Default ABI to use */
+#undef RS6000_ABI_NAME
+#define RS6000_ABI_NAME "aix"
 
 #undef CPP_SYSV_DEFAULT_SPEC
 #define        CPP_SYSV_DEFAULT_SPEC "-D_CALL_AIX"
index cf1a6afbecdcf4e0c43bc94ef643e45e4dcca661..5b8e70dccd951ad5dc17e3b9c2c9d946aa7d6acc 100644 (file)
@@ -23,13 +23,10 @@ Boston, MA 02111-1307, USA.  */
 #include "rs6000/eabi.h"
 
 #undef TARGET_DEFAULT
-#define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS | MASK_LITTLE_ENDIAN)
+#define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS | MASK_LITTLE_ENDIAN | MASK_EABI)
 
-#undef CPP_ENDIAN_SPEC
-#define        CPP_ENDIAN_SPEC \
-"%{mbig: -D_BIG_ENDIAN -Amachine(bigendian)} \
-%{mbig-endian: -D_BIG_ENDIAN -Amachine(bigendian)} \
-%{!mbig: %{!mbig-endian: -D_LITTLE_ENDIAN -Amachine(littleendian)}}"
+#undef CPP_ENDIAN_DEFAULT_SPEC
+#define        CPP_ENDIAN_DEFAULT_SPEC "-D_LITTLE_ENDIAN -Amachine(littleendian)"
 
 /* Define this macro as a C expression for the initializer of an
    array of string to tell the driver program which options are
@@ -41,4 +38,4 @@ Boston, MA 02111-1307, USA.  */
    `MULTILIB_OPTIONS' are set by default.  *Note Target Fragment::.  */
 
 #undef MULTILIB_DEFAULTS
-#define        MULTILIB_DEFAULTS { "mlittle", "mlittle-endian", "mcall-sysv", "mno-sdata" }
+#define        MULTILIB_DEFAULTS { "mlittle", "mlittle-endian", "mcall-sysv-eabi", "mno-sdata" }
index 4df32f777424c8277beef342d84c245b3e99d112..a0ba5c7c8a0e6e2bbda4bfffdc37c9063afa0da1 100644 (file)
@@ -29,19 +29,15 @@ Boston, MA 02111-1307, USA.  */
 #define CPP_PREDEFINES \
   "-DPPC -D__embedded__ -D__simulator__ -Asystem(embedded) -Asystem(simulator) -Acpu(powerpc) -Amachine(powerpc)"
 
-/* Use the simulator crt0 or mvme and libgloss/newlib libraries if desired */
-#undef  STARTFILE_SPEC
-#define        STARTFILE_SPEC "\
-%{mmvme: mvme-crt0.o%s} \
-%{!mmvme: sim-crt0.o%s}"
-
-#undef LIB_SPEC
-#define        LIB_SPEC "\
-%{mmvme: -lmvme -lc -lmvme} \
-%{!mmvme: -lsim -lc -lsim}"
-
-#undef LIBGCC_SPEC
-#define        LIBGCC_SPEC "libgcc.a%s"
-
-#undef ENDFILE_SPEC
-#define        ENDFILE_SPEC ""
+/* Make the simulator the default */
+#undef LIB_DEFAULT_SPEC
+#define LIB_DEFAULT_SPEC LIB_SIM_SPEC
+
+#undef STARTFILE_DEFAULT_SPEC
+#define STARTFILE_DEFAULT_SPEC STARTFILE_SIM_SPEC
+
+#undef ENDFILE_DEFAULT_SPEC
+#define ENDFILE_DEFAULT_SPEC ENDFILE_SIM_SPEC
+
+#undef LINK_START_DEFAULT_SPEC
+#define LINK_START_DEFAULT_SPEC LINK_START_SIM_SPEC
index 5989942cca93f5048444e2cb5be1e94061858f47..96b61c3df14120fb303b728b4eba7ab03a47a586 100644 (file)
@@ -29,23 +29,15 @@ Boston, MA 02111-1307, USA.  */
 #define CPP_PREDEFINES \
   "-DPPC -D__embedded__ -D__simulator__ -Asystem(embedded) -Asystem(simulator) -Acpu(powerpc) -Amachine(powerpc)"
 
-/* Clue the simulator in to use netbsd */
-#undef LINK_START_SPEC
-#define LINK_START_SPEC "%{!mmvme: %{!Ttext*: -Ttext 0x10000074}}"
-
-/* Use the simulator crt0 or mvme and libgloss/newlib libraries if desired */
-#undef  STARTFILE_SPEC
-#define        STARTFILE_SPEC "crti.o%s \
-%{mmvme: mvme-crt0.o%s} \
-%{!mmvme: sim-crt0.o%s}"
-
-#undef LIB_SPEC
-#define        LIB_SPEC "\
-%{mmvme: -lmvme -lc -lmvme} \
-%{!mmvme: -lsim -lc -lsim}"
-
-#undef LIBGCC_SPEC
-#define        LIBGCC_SPEC "libgcc.a%s"
-
-#undef ENDFILE_SPEC
-#define        ENDFILE_SPEC "crtn.o%s"
+/* Make the simulator the default */
+#undef LIB_DEFAULT_SPEC
+#define LIB_DEFAULT_SPEC LIB_SIM_SPEC
+
+#undef STARTFILE_DEFAULT_SPEC
+#define STARTFILE_DEFAULT_SPEC STARTFILE_SIM_SPEC
+
+#undef ENDFILE_DEFAULT_SPEC
+#define ENDFILE_DEFAULT_SPEC ENDFILE_SIM_SPEC
+
+#undef LINK_START_DEFAULT_SPEC
+#define LINK_START_DEFAULT_SPEC LINK_START_SIM_SPEC
index cd3f675d73b296662a19725de95fb96114a4eb0f..08f71deac83c5e4e26415a29143a4883d00534dd 100644 (file)
@@ -69,9 +69,9 @@ static int trunc_defined;
 
 /* Set to non-zero once AIX common-mode calls have been defined.  */
 static int common_mode_defined;
+
 /* Save information from a "cmpxx" operation until the branch or scc is
    emitted.  */
-
 rtx rs6000_compare_op0, rs6000_compare_op1;
 int rs6000_compare_fp_p;
 
@@ -79,6 +79,9 @@ int rs6000_compare_fp_p;
 /* Label number of label created for -mrelocatable, to call to so we can
    get the address of the GOT section */
 int rs6000_pic_labelno;
+
+/* Which abi to adhere to */
+char *rs6000_abi_name = RS6000_ABI_NAME;
 #endif
 
 /* Whether a System V.4 varargs area was created.  */
@@ -96,6 +99,39 @@ static rtx stack_temps[NUM_MACHINE_MODES];
 /* Current PIC register used by the V4 code */
 struct rtx_def *rs6000_pic_register = (struct rtx_def *)0;
 
+\f
+/* Default register names.  */
+char rs6000_reg_names[][8] =
+{
+   "0",  "1",  "2",  "3",  "4",  "5",  "6",  "7",
+   "8",  "9", "10", "11", "12", "13", "14", "15",
+  "16", "17", "18", "19", "20", "21", "22", "23",
+  "24", "25", "26", "27", "28", "29", "30", "31",
+   "0",  "1",  "2",  "3",  "4",  "5",  "6",  "7",
+   "8",  "9", "10", "11", "12", "13", "14", "15",
+  "16", "17", "18", "19", "20", "21", "22", "23",
+  "24", "25", "26", "27", "28", "29", "30", "31",
+  "mq", "lr", "ctr","ap",
+   "0",  "1",  "2",  "3",  "4",  "5",  "6",  "7"
+};
+
+#ifdef TARGET_REGNAMES
+static char alt_reg_names[][8] =
+{
+   "%r0",  "%r1",  "%r2",  "%r3",  "%r4",  "%r5",  "%r6",  "%r7",
+   "%r8",  "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15",
+  "%r16", "%r17", "%r18", "%r19", "%r20", "%r21", "%r22", "%r23",
+  "%r24", "%r25", "%r26", "%r27", "%r28", "%r29", "%r30", "%r31",
+   "%f0",  "%f1",  "%f2",  "%f3",  "%f4",  "%f5",  "%f6",  "%f7",
+   "%f8",  "%f9", "%f10", "%f11", "%f12", "%f13", "%f14", "%f15",
+  "%f16", "%f17", "%f18", "%f19", "%f20", "%f21", "%f22", "%f23",
+  "%f24", "%f25", "%f26", "%f27", "%f28", "%f29", "%f30", "%f31",
+    "mq",   "lr",  "ctr",   "ap",
+  "%cr0", "%cr1", "%cr2", "%cr3", "%cr4", "%cr5", "%cr6", "%cr7"
+};
+#endif
+
+
 \f
 /* Print the options used in the assembly file.  */
 
@@ -338,6 +374,13 @@ rs6000_override_options (default_cpu)
        }
     }
 
+#ifdef TARGET_REGNAMES
+  /* If the user desires alternate register names, copy in the alternate names
+     now.  */
+  if (TARGET_REGNAMES)
+    bcopy ((char *)alt_reg_names, (char *)rs6000_reg_names, sizeof (rs6000_reg_names));
+#endif
+
 #ifdef SUBTARGET_OVERRIDE_OPTIONS
   SUBTARGET_OVERRIDE_OPTIONS;
 #endif
@@ -956,7 +999,7 @@ input_operand (op, mode)
 
   /* V.4 allows SYMBOL_REFs and CONSTs that are in the small data region
      to be valid.  */
-  if (DEFAULT_ABI == ABI_V4
+  if ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
       && (GET_CODE (op) == SYMBOL_REF || GET_CODE (op) == CONST)
       && small_data_operand (op, Pmode))
     return 1;
@@ -978,7 +1021,7 @@ small_data_operand (op, mode)
     return 0;
 #endif
 
-  if (DEFAULT_ABI != ABI_V4)
+  if (DEFAULT_ABI != ABI_V4 /* && DEFAULT_ABI != ABI_SOLARIS */)
     return 0;
 
   if (GET_CODE (op) == SYMBOL_REF)
@@ -1026,7 +1069,7 @@ init_cumulative_args (cum, fntype, libname, incoming)
   if (incoming)
     {
       cum->nargs_prototype = 1000;             /* don't return an EXPR_LIST */
-      if (abi == ABI_V4)
+      if (abi == ABI_V4 || abi == ABI_SOLARIS)
        cum->varargs_offset = RS6000_VARARGS_OFFSET;
     }
 
@@ -1060,7 +1103,7 @@ init_cumulative_args (cum, fntype, libname, incoming)
                   tree_code_name[ (int)TREE_CODE (ret_type) ]);
        }
 
-      if (abi == ABI_V4 && incoming)
+      if ((abi == ABI_V4 || abi == ABI_SOLARIS) && incoming)
        fprintf (stderr, " varargs = %d, ", cum->varargs_offset);
 
       if (cum->call_cookie & CALL_NT_DLLIMPORT)
@@ -1087,7 +1130,7 @@ function_arg_boundary (mode, type)
      enum machine_mode mode;
      tree type;
 {
-  if (DEFAULT_ABI == ABI_V4 && mode == DImode)
+  if ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) && mode == DImode)
     return 64;
 
   if (DEFAULT_ABI != ABI_NT || TARGET_64BIT)
@@ -1114,7 +1157,7 @@ function_arg_advance (cum, mode, type, named)
   cum->words += align;
   cum->nargs_prototype--;
 
-  if (DEFAULT_ABI == ABI_V4)
+  if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
     {
       /* Long longs must not be split between registers and stack */
       if ((GET_MODE_CLASS (mode) != MODE_FLOAT || TARGET_SOFT_FLOAT)
@@ -1198,7 +1241,7 @@ function_arg (cum, mode, type, named)
     {
       enum rs6000_abi abi = DEFAULT_ABI;
 
-      if (abi == ABI_V4
+      if ((abi == ABI_V4 || abi == ABI_SOLARIS)
          && TARGET_HARD_FLOAT
          && cum->nargs_prototype < 0
          && type && (cum->prototype || TARGET_NO_PROTOTYPE))
@@ -1214,7 +1257,7 @@ function_arg (cum, mode, type, named)
 
   if (!named)
     {
-      if (DEFAULT_ABI != ABI_V4)
+      if (DEFAULT_ABI != ABI_V4 && DEFAULT_ABI != ABI_SOLARIS)
        return NULL_RTX;
     }
 
@@ -1224,7 +1267,8 @@ function_arg (cum, mode, type, named)
   if (USE_FP_FOR_ARG_P (*cum, mode, type))
     {
       if ((cum->nargs_prototype > 0)
-         || (DEFAULT_ABI == ABI_V4)    /* V.4 never passes FP values in GP registers */
+         || DEFAULT_ABI == ABI_V4      /* V.4 never passes FP values in GP registers */
+         || DEFAULT_ABI == ABI_SOLARIS
          || !type)
        return gen_rtx (REG, mode, cum->fregno);
 
@@ -1236,7 +1280,7 @@ function_arg (cum, mode, type, named)
     }
 
   /* Long longs won't be split between register and stack */
-  else if (DEFAULT_ABI == ABI_V4 &&
+  else if ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) &&
           align_words + RS6000_ARG_SIZE (mode, type, named) > GP_ARG_NUM_REG)
     {
       return NULL_RTX;
@@ -1262,7 +1306,7 @@ function_arg_partial_nregs (cum, mode, type, named)
   if (! named)
     return 0;
 
-  if (DEFAULT_ABI == ABI_V4)
+  if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
     return 0;
 
   if (USE_FP_FOR_ARG_P (*cum, mode, type))
@@ -1299,7 +1343,8 @@ function_arg_pass_by_reference (cum, mode, type, named)
      tree type;
      int named;
 {
-  if (DEFAULT_ABI == ABI_V4 && type && AGGREGATE_TYPE_P (type))
+  if ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
+      && type && AGGREGATE_TYPE_P (type))
     {
       if (TARGET_DEBUG_ARG)
        fprintf (stderr, "function_arg_pass_by_reference: aggregate\n");
@@ -1342,7 +1387,7 @@ setup_incoming_varargs (cum, mode, type, pretend_size, no_rtl)
             "setup_vararg: words = %2d, fregno = %2d, nargs = %4d, proto = %d, mode = %4s, no_rtl= %d\n",
             cum->words, cum->fregno, cum->nargs_prototype, cum->prototype, GET_MODE_NAME (mode), no_rtl);
 
-  if (DEFAULT_ABI == ABI_V4 && !no_rtl)
+  if ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) && !no_rtl)
     {
       rs6000_sysv_varargs_p = 1;
       save_area = plus_constant (frame_pointer_rtx, RS6000_VARARGS_OFFSET);
@@ -1370,7 +1415,7 @@ setup_incoming_varargs (cum, mode, type, pretend_size, no_rtl)
     }
 
   /* Save FP registers if needed.  */
-  if (DEFAULT_ABI == ABI_V4 && TARGET_HARD_FLOAT && !no_rtl)
+  if ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) && TARGET_HARD_FLOAT && !no_rtl)
     {
       int fregno     = cum->fregno;
       int num_fp_reg = FP_ARG_V4_MAX_REG + 1 - fregno;
@@ -2065,6 +2110,12 @@ print_operand (file, x, code)
       fputs (TARGET_MINIMAL_TOC ? reg_names[30] : reg_names[2], file);
       return;
 
+    case '$':
+      /* Write out either a '.' or '$' for the current location, depending
+        on whether this is Solaris or not.  */
+      putc ((DEFAULT_ABI == ABI_SOLARIS) ? '.' : '$', file);
+      return;
+
     case 'A':
       /* If X is a constant integer whose low-order 5 bits are zero,
         write 'l'.  Otherwise, write 'r'.  This is a kludge to fix a bug
@@ -2225,7 +2276,7 @@ print_operand (file, x, code)
          else
            output_address (plus_constant (XEXP (x, 0), 4));
          if (DEFAULT_ABI == ABI_V4 && small_data_operand (x, GET_MODE (x)))
-           fprintf (file, "@sda21(%s)", reg_names[0]);
+           fprintf (file, "@%s(%s)", (TARGET_EABI) ? "sda21" : "sdarel", reg_names[0]);
        }
       return;
                            
@@ -2437,7 +2488,7 @@ print_operand (file, x, code)
          else
            output_address (plus_constant (XEXP (x, 0), 8));
          if (DEFAULT_ABI == ABI_V4 && small_data_operand (x, GET_MODE (x)))
-           fprintf (file, "@sda21(%s)", reg_names[0]);
+           fprintf (file, "@%s(%s)", (TARGET_EABI) ? "sda21" : "sdarel", reg_names[0]);
        }
       return;
                            
@@ -2463,6 +2514,7 @@ print_operand (file, x, code)
 
            case ABI_V4:
            case ABI_AIX_NODESC:
+           case ABI_SOLARIS:
              break;
 
            case ABI_NT:
@@ -2485,7 +2537,7 @@ print_operand (file, x, code)
          else
            output_address (plus_constant (XEXP (x, 0), 12));
          if (DEFAULT_ABI == ABI_V4 && small_data_operand (x, GET_MODE (x)))
-           fprintf (file, "@sda21(%s)", reg_names[0]);
+           fprintf (file, "@%s(%s)", (TARGET_EABI) ? "sda21" : "sdarel", reg_names[0]);
        }
       return;
                            
@@ -2527,7 +2579,7 @@ print_operand_address (file, x)
     {
       output_addr_const (file, x);
       if (DEFAULT_ABI == ABI_V4 && small_data_operand (x, GET_MODE (x)))
-       fprintf (file, "@sda21(%s)", reg_names[0]);
+       fprintf (file, "@%s(%s)", (TARGET_EABI) ? "sda21" : "sdarel", reg_names[0]);
 
 #ifdef TARGET_NO_TOC
       else if (TARGET_NO_TOC)
@@ -2752,31 +2804,37 @@ rs6000_stack_info ()
 
   /* If this is main and we need to call a function to set things up,
      save main's arguments around the call.  */
-  if (strcmp (IDENTIFIER_POINTER (DECL_NAME (current_function_decl)), "main") == 0)
+#ifdef TARGET_EABI
+  if (TARGET_EABI)
+#endif
     {
-      info_ptr->main_p = 1;
-
-#ifdef NAME__MAIN
-      info_ptr->calls_p = 1;
-
-      if (DECL_ARGUMENTS (current_function_decl))
+      if (strcmp (IDENTIFIER_POINTER (DECL_NAME (current_function_decl)), "main") == 0)
        {
-         int i;
-         tree arg;
+         info_ptr->main_p = 1;
 
-         info_ptr->main_save_p = 1;
-         info_ptr->main_size = 0;
+#ifdef NAME__MAIN
+         info_ptr->calls_p = 1;
 
-         for ((i = 0), (arg = DECL_ARGUMENTS (current_function_decl));
-              arg != NULL_TREE && i < 8;
-              (arg = TREE_CHAIN (arg)), i++)
+         if (DECL_ARGUMENTS (current_function_decl))
            {
-             info_ptr->main_size += reg_size;
+             int i;
+             tree arg;
+
+             info_ptr->main_save_p = 1;
+             info_ptr->main_size = 0;
+
+             for ((i = 0), (arg = DECL_ARGUMENTS (current_function_decl));
+                  arg != NULL_TREE && i < 8;
+                  (arg = TREE_CHAIN (arg)), i++)
+               {
+                 info_ptr->main_size += reg_size;
+               }
            }
-       }
 #endif
+       }
     }
 
+
   /* Determine if we need to save the link register */
   if (regs_ever_live[65] || profile_flag
 #ifdef TARGET_RELOCATABLE
@@ -2785,6 +2843,7 @@ rs6000_stack_info ()
       || (info_ptr->first_fp_reg_save != 64
          && !FP_SAVE_INLINE (info_ptr->first_fp_reg_save))
       || (abi == ABI_V4 && current_function_calls_alloca)
+      || (abi == ABI_SOLARIS && current_function_calls_alloca)
       || info_ptr->calls_p)
     {
       info_ptr->lr_save_p = 1;
@@ -2797,7 +2856,7 @@ rs6000_stack_info ()
   if (regs_ever_live[70] || regs_ever_live[71] || regs_ever_live[72])
     {
       info_ptr->cr_save_p = 1;
-      if (abi == ABI_V4 || abi == ABI_NT)
+      if (abi == ABI_V4 || abi == ABI_NT || abi == ABI_SOLARIS)
        info_ptr->cr_size = reg_size;
     }
 
@@ -2833,7 +2892,7 @@ rs6000_stack_info ()
   if (info_ptr->calls_p)
     info_ptr->push_p = 1;
 
-  else if (abi == ABI_V4 || abi == ABI_NT)
+  else if (abi == ABI_V4 || abi == ABI_NT || abi == ABI_SOLARIS)
     info_ptr->push_p = (total_raw_size > info_ptr->fixed_size
                        || info_ptr->lr_save_p);
 
@@ -2859,6 +2918,7 @@ rs6000_stack_info ()
       break;
 
     case ABI_V4:
+    case ABI_SOLARIS:
       info_ptr->fp_save_offset   = - info_ptr->fp_size;
       info_ptr->gp_save_offset   = info_ptr->fp_save_offset - info_ptr->gp_size;
       info_ptr->cr_save_offset   = info_ptr->gp_save_offset - reg_size;
@@ -2923,6 +2983,7 @@ debug_stack_info (info)
     case ABI_AIX:       abi_string = "AIX";            break;
     case ABI_AIX_NODESC: abi_string = "AIX";           break;
     case ABI_V4:        abi_string = "V.4";            break;
+    case ABI_SOLARIS:   abi_string = "Solaris";        break;
     case ABI_NT:        abi_string = "NT";             break;
     }
 
@@ -3074,7 +3135,7 @@ output_prolog (file, size)
     }
 
   /* For V.4, update stack before we do any saving and set back pointer.  */
-  if (info->push_p && DEFAULT_ABI == ABI_V4)
+  if (info->push_p && (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS))
     {
       if (info->total_size < 32767)
        {
@@ -3213,7 +3274,7 @@ output_prolog (file, size)
     }
 
   /* Update stack and set back pointer and we have already done so for V.4.  */
-  if (info->push_p && DEFAULT_ABI != ABI_V4)
+  if (info->push_p && DEFAULT_ABI != ABI_V4 && DEFAULT_ABI != ABI_SOLARIS)
     {
       if (info->total_size < 32767)
        asm_fprintf (file,
@@ -3324,6 +3385,7 @@ output_prolog (file, size)
        switch (DEFAULT_ABI)
          {
          case ABI_V4:
+         case ABI_SOLARIS:
          case ABI_AIX_NODESC:
            if (TARGET_32BIT)
              {
@@ -3398,14 +3460,14 @@ output_epilog (file, size)
        {
          /* Under V.4, don't reset the stack pointer until after we're done
             loading the saved registers.  */
-         if (DEFAULT_ABI == ABI_V4)
+         if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
            sp_reg = 11;
 
          asm_fprintf (file, load_reg, reg_names[sp_reg], 0, reg_names[1]);
        }
       else if (info->push_p)
        {
-         if (DEFAULT_ABI == ABI_V4)
+         if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
            sp_offset = info->total_size;
          else if (TARGET_NEW_MNEMONICS)
            asm_fprintf (file, "\taddi %s,%s,%d\n", reg_names[1], reg_names[1], info->total_size);
@@ -4161,6 +4223,7 @@ rs6000_trampoline_template (file)
     /* V.4/eabi function pointers are just a single pointer, so we need to
        do the full gory code to load up the static chain.  */
     case ABI_V4:
+    case ABI_SOLARIS:
     case ABI_AIX_NODESC:
       if (STATIC_CHAIN_REGNUM == 0 || !TARGET_NEW_MNEMONICS)
        abort ();
@@ -4238,6 +4301,7 @@ rs6000_trampoline_size ()
       break;
 
     case ABI_V4:
+    case ABI_SOLARIS:
     case ABI_AIX_NODESC:
       ret = (TARGET_32BIT) ? 40 : 48;
       break;
@@ -4289,6 +4353,7 @@ rs6000_initialize_trampoline (addr, fnaddr, cxt)
     /* Under V.4/eabi, update the two words after the bl to have the real
        function address and the static chain.  */
     case ABI_V4:
+    case ABI_SOLARIS:
     case ABI_AIX_NODESC:
       {
        rtx reg = gen_reg_rtx (pmode);
@@ -4546,7 +4611,12 @@ rs6000_select_section (decl, reloc)
       else
        {
          if (TARGET_SDATA && (size > 0) && (size <= g_switch_value))
-           sdata2_section ();
+           {
+             if (TARGET_EABI)
+               sdata2_section ();
+             else
+               sdata_section ();       /* System V doesn't have .sdata2/.sbss2 */
+           }
          else
            const_section ();
        }
index 5582f412e17646fedf0dc7b429e55f4fbbe49edc..18d0e7b497676ab284c3c5a21cd108808175d5bc 100644 (file)
@@ -93,6 +93,10 @@ Boston, MA 02111-1307, USA.  */
 #define CPP_ENDIAN_SPEC ""
 #endif
 
+#ifndef CPP_ENDIAN_DEFAULT_SPEC
+#define CPP_ENDIAN_DEFAULT_SPEC ""
+#endif
+
 #ifndef CPP_SYSV_DEFAULT_SPEC
 #define CPP_SYSV_DEFAULT_SPEC ""
 #endif
@@ -144,25 +148,19 @@ Boston, MA 02111-1307, USA.  */
 #define SUBTARGET_EXTRA_SPECS
 #endif
 
-#define EXTRA_SPECS                                    \
-  { "cpp_cpu",         CPP_CPU_SPEC },                 \
-  { "cpp_default",     CPP_DEFAULT_SPEC },             \
-  { "cpp_sysv",                CPP_SYSV_SPEC },                \
-  { "cpp_sysv_default",        CPP_SYSV_DEFAULT_SPEC },        \
-  { "cpp_endian",      CPP_ENDIAN_SPEC },              \
-  { "asm_cpu",         ASM_CPU_SPEC },                 \
-  { "asm_default",     ASM_DEFAULT_SPEC },             \
-  { "link_syscalls",   LINK_SYSCALLS_SPEC },           \
-  { "link_libg",       LINK_LIBG_SPEC },               \
-  { "link_path",       LINK_PATH_SPEC },               \
-  { "link_start",      LINK_START_SPEC },              \
+#define EXTRA_SPECS                                                    \
+  { "cpp_cpu",                 CPP_CPU_SPEC },                         \
+  { "cpp_default",             CPP_DEFAULT_SPEC },                     \
+  { "cpp_sysv",                        CPP_SYSV_SPEC },                        \
+  { "cpp_sysv_default",                CPP_SYSV_DEFAULT_SPEC },                \
+  { "cpp_endian_default",      CPP_ENDIAN_DEFAULT_SPEC },              \
+  { "cpp_endian",              CPP_ENDIAN_SPEC },                      \
+  { "asm_cpu",                 ASM_CPU_SPEC },                         \
+  { "asm_default",             ASM_DEFAULT_SPEC },                     \
+  { "link_syscalls",           LINK_SYSCALLS_SPEC },                   \
+  { "link_libg",               LINK_LIBG_SPEC },                       \
   SUBTARGET_EXTRA_SPECS
 
-/* Default paths to give linker under V.4 */
-#ifndef LINK_PATH_SPEC
-#define LINK_PATH_SPEC ""
-#endif
-
 /* Default location of syscalls.exp under AIX */
 #ifndef CROSS_COMPILE
 #define LINK_SYSCALLS_SPEC "-bI:/lib/syscalls.exp"
@@ -177,11 +175,6 @@ Boston, MA 02111-1307, USA.  */
 #define LINK_LIBG_SPEC ""
 #endif
 
-/* Default starting address if specified */
-#ifndef LINK_START_SPEC
-#define LINK_START_SPEC ""
-#endif
-
 /* Define the options for the binder: Start text at 512, align all segments
    to 512 bytes, and warn if there is text relocation.
 
@@ -463,7 +456,7 @@ extern struct rs6000_cpu_select rs6000_select[];
 #define REAL_ARITHMETIC
 
 /* Define this macro if it is advisable to hold scalars in registers
-   in a wider mode than that declared by the program.  In such cases, 
+   in a wider mode than that declared by the program.  In such cases,
    the value is constrained to be within the bounds of the declared
    type, but kept valid in the wider mode.  The signedness of the
    extension may differ from that of the type.  */
@@ -483,7 +476,7 @@ extern struct rs6000_cpu_select rs6000_select[];
 #define BYTES_BIG_ENDIAN 1
 
 /* Define this if most significant word of a multiword number is lowest
-   numbered. 
+   numbered.
 
    For RS/6000 we can decide arbitrarily since there are no machine
    instructions for them.  Might as well be consistent with bits and bytes. */
@@ -632,7 +625,7 @@ extern struct rs6000_cpu_select rs6000_select[];
 /* 1 for registers that have pervasive standard uses
    and are not available for the register allocator.
 
-   On RS/6000, r1 is used for the stack and r2 is used as the TOC pointer.  
+   On RS/6000, r1 is used for the stack and r2 is used as the TOC pointer.
 
    cr5 is not supposed to be used.
 
@@ -865,7 +858,7 @@ extern struct rs6000_cpu_select rs6000_select[];
 
    For any two classes, it is very desirable that there be another
    class that represents their union.  */
-   
+
 /* The RS/6000 has three types of registers, fixed-point, floating-point,
    and condition registers, plus three special registers, MQ, CTR, and the
    link register.
@@ -982,7 +975,7 @@ enum reg_class
    C is the letter, and VALUE is a constant value.
    Return 1 if VALUE is in the range specified by C.
 
-   `I' is signed 16-bit constants 
+   `I' is signed 16-bit constants
    `J' is a constant with only the high-order 16 bits non-zero
    `K' is a constant with only the low-order 16 bits non-zero
    `L' is a constant that can be placed into a mask operand
@@ -1028,13 +1021,14 @@ enum reg_class
    : (C) == 'R' ? LEGITIMATE_CONSTANT_POOL_ADDRESS_P (OP)              \
    : (C) == 'S' ? (TARGET_WINDOWS_NT && DEFAULT_ABI == ABI_NT && GET_CODE (OP) == SYMBOL_REF)\
    : (C) == 'T' ? (TARGET_WINDOWS_NT && DEFAULT_ABI == ABI_NT && GET_CODE (OP) == LABEL_REF) \
-   : (C) == 'U' ? (DEFAULT_ABI == ABI_V4 && small_data_operand (OP, GET_MODE (OP))) \
+   : (C) == 'U' ? ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) \
+                  && small_data_operand (OP, GET_MODE (OP)))           \
    : 0)
 
 /* Given an rtx X being reloaded into a reg required to be
    in class CLASS, return the class of reg to actually use.
    In general this is just CLASS; but on some machines
-   in some cases it is preferable to use a more restrictive class. 
+   in some cases it is preferable to use a more restrictive class.
 
    On the RS/6000, we have to return NO_REGS when we want to reload a
    floating-point CONST_DOUBLE to force it to be copied to memory.  */
@@ -1043,7 +1037,7 @@ enum reg_class
   ((GET_CODE (X) == CONST_DOUBLE                       \
     && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT)    \
    ? NO_REGS : (CLASS))
-   
+
 /* Return the register class of a scratch register needed to copy IN into
    or out of a register in CLASS in MODE.  If it can be done directly,
    NO_REGS is returned.  */
@@ -1080,7 +1074,8 @@ enum rs6000_abi {
   ABI_AIX,                     /* IBM's AIX */
   ABI_AIX_NODESC,              /* AIX calling sequence minus function descriptors */
   ABI_V4,                      /* System V.4/eabi */
-  ABI_NT                       /* Windows/NT */
+  ABI_NT,                      /* Windows/NT */
+  ABI_SOLARIS                  /* Solaris */
 };
 
 extern enum rs6000_abi rs6000_current_abi;     /* available for use by subtarget */
@@ -1169,7 +1164,7 @@ extern int rs6000_sysv_varargs_p;
 /* Offset within stack frame to start allocating local variables at.
    If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
    first local allocated.  Otherwise, it is the offset to the BEGINNING
-   of the first local allocated. 
+   of the first local allocated.
 
    On the RS/6000, the frame pointer is the same as the stack pointer,
    except for dynamic allocations.  So we start after the fixed area and
@@ -1222,7 +1217,7 @@ extern int rs6000_sysv_varargs_p;
    If the precise function being called is known, FUNC is its FUNCTION_DECL;
    otherwise, FUNC is 0.
 
-   On RS/6000 an integer value is in r3 and a floating-point value is in 
+   On RS/6000 an integer value is in r3 and a floating-point value is in
    fp1, unless -msoft-float.  */
 
 #define FUNCTION_VALUE(VALTYPE, FUNC)  \
@@ -1238,10 +1233,12 @@ extern int rs6000_sysv_varargs_p;
 /* The definition of this macro implies that there are cases where
    a scalar value cannot be returned in registers.
 
-   For the RS/6000, any structure or union type is returned in memory.  */
+   For the RS/6000, any structure or union type is returned in memory, except for
+   Solaris, which returns structures <= 8 bytes in registers.  */
 
-#define RETURN_IN_MEMORY(TYPE) \
-  (TYPE_MODE (TYPE) == BLKmode)
+#define RETURN_IN_MEMORY(TYPE)                                         \
+  (TYPE_MODE (TYPE) == BLKmode                                         \
+   && (DEFAULT_ABI != ABI_SOLARIS || int_size_in_bytes (TYPE) > 8))
 
 /* Minimum and maximum general purpose registers used to hold arguments.  */
 #define GP_ARG_MIN_REG 3
@@ -1385,14 +1382,14 @@ typedef struct rs6000_args
   function_arg_pass_by_reference(&CUM, MODE, TYPE, NAMED)
 
 /* If defined, a C expression that gives the alignment boundary, in bits,
-   of an argument with the specified mode and type.  If it is not defined, 
+   of an argument with the specified mode and type.  If it is not defined,
    PARM_BOUNDARY is used for all arguments.  */
 
 #define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \
   function_arg_boundary (MODE, TYPE)
 
 /* Perform any needed actions needed for a function that is receiving a
-   variable number of arguments. 
+   variable number of arguments.
 
    CUM is as above.
 
@@ -1522,7 +1519,8 @@ typedef struct rs6000_args
 #define RETURN_ADDRESS_OFFSET                                          \
  ((DEFAULT_ABI == ABI_AIX                                              \
    || DEFAULT_ABI == ABI_AIX_NODESC)   ? 8 :                           \
-  (DEFAULT_ABI == ABI_V4)              ? (TARGET_32BIT ? 4 : 8) :      \
+  (DEFAULT_ABI == ABI_V4                                               \
+   || DEFAULT_ABI == ABI_SOLARIS)      ? (TARGET_32BIT ? 4 : 8) :      \
   (DEFAULT_ABI == ABI_NT)              ? -4 :                          \
   (fatal ("RETURN_ADDRESS_OFFSET not supported"), 0))
 
@@ -1704,7 +1702,7 @@ typedef struct rs6000_args
        && LEGITIMATE_CONSTANT_POOL_BASE_P (XEXP (XEXP (X, 0), 0))))
 
 #define LEGITIMATE_SMALL_DATA_P(MODE, X)                               \
-  (DEFAULT_ABI == ABI_V4                                               \
+  ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)               \
    && (GET_CODE (X) == SYMBOL_REF || GET_CODE (X) == CONST)            \
    && small_data_operand (X, MODE))
 
@@ -1787,7 +1785,7 @@ typedef struct rs6000_args
    integer that is out of range.  If so, generate code to add the
    constant with the low-order 16 bits masked to the register and force
    this result into another register (this can be done with `cau').
-   Then generate an address of REG+(CONST&0xffff), allowing for the 
+   Then generate an address of REG+(CONST&0xffff), allowing for the
    possibility of bit 16 being a one.
 
    Then check for the sum of a register and something not constant, try to
@@ -1969,7 +1967,7 @@ extern struct rtx_def *rs6000_pic_register;
 
 /* We don't have GAS for the RS/6000 yet, so don't write out special
    .stabs in cc1plus.  */
-   
+
 #define FASCIST_ASSEMBLER
 
 #ifndef ASM_OUTPUT_CONSTRUCTOR
@@ -2179,7 +2177,7 @@ extern int rs6000_trunc_used;
    [RW] section emitted.
 
    We then switch back to text to force the gcc2_compiled. label and the space
-   allocated after it (when profiling) into the text section.  
+   allocated after it (when profiling) into the text section.
 
    Finally, declare mcount when profiling to make the assembler happy.  */
 
@@ -2324,7 +2322,7 @@ toc_section ()                                            \
 
 /* This macro produces the initial definition of a function name.
    On the RS/6000, we need to place an extra '.' in the function name and
-   output the function descriptor.  
+   output the function descriptor.
 
    The csect for the function will have already been created by the
    `text_section' call previously done.  We do have to go back to that
@@ -2467,7 +2465,7 @@ toc_section ()                                            \
   while (0)
 
 /* Output something to declare an external symbol to the assembler.  Most
-   assemblers don't need this.  
+   assemblers don't need this.
 
    If we haven't already, add "[RW]" (or "[DS]" for a function) to the
    name.  Normally we write this out along with the name.  In the few cases
@@ -2524,17 +2522,108 @@ toc_section ()                                         \
 /* How to refer to registers in assembler output.
    This sequence is indexed by compiler's hard-register-number (see above).  */
 
-#define REGISTER_NAMES \
- {"0", "1", "2", "3", "4", "5", "6", "7",              \
-  "8", "9", "10", "11", "12", "13", "14", "15",                \
-  "16", "17", "18", "19", "20", "21", "22", "23",      \
-  "24", "25", "26", "27", "28", "29", "30", "31",      \
-  "0", "1", "2", "3", "4", "5", "6", "7",              \
-  "8", "9", "10", "11", "12", "13", "14", "15",                \
-  "16", "17", "18", "19", "20", "21", "22", "23",      \
-  "24", "25", "26", "27", "28", "29", "30", "31",      \
-  "mq", "lr", "ctr", "ap",                             \
-  "0", "1", "2", "3", "4", "5", "6", "7" }
+extern char rs6000_reg_names[][8];     /* register names (a0 vs. $4). */
+
+#define REGISTER_NAMES                                                 \
+{                                                                      \
+  &rs6000_reg_names[ 0][0],    /* r0   */                              \
+  &rs6000_reg_names[ 1][0],    /* r1   */                              \
+  &rs6000_reg_names[ 2][0],     /* r2  */                              \
+  &rs6000_reg_names[ 3][0],    /* r3   */                              \
+  &rs6000_reg_names[ 4][0],    /* r4   */                              \
+  &rs6000_reg_names[ 5][0],    /* r5   */                              \
+  &rs6000_reg_names[ 6][0],    /* r6   */                              \
+  &rs6000_reg_names[ 7][0],    /* r7   */                              \
+  &rs6000_reg_names[ 8][0],    /* r8   */                              \
+  &rs6000_reg_names[ 9][0],    /* r9   */                              \
+  &rs6000_reg_names[10][0],    /* r10  */                              \
+  &rs6000_reg_names[11][0],    /* r11  */                              \
+  &rs6000_reg_names[12][0],    /* r12  */                              \
+  &rs6000_reg_names[13][0],    /* r13  */                              \
+  &rs6000_reg_names[14][0],    /* r14  */                              \
+  &rs6000_reg_names[15][0],    /* r15  */                              \
+  &rs6000_reg_names[16][0],    /* r16  */                              \
+  &rs6000_reg_names[17][0],    /* r17  */                              \
+  &rs6000_reg_names[18][0],    /* r18  */                              \
+  &rs6000_reg_names[19][0],    /* r19  */                              \
+  &rs6000_reg_names[20][0],    /* r20  */                              \
+  &rs6000_reg_names[21][0],    /* r21  */                              \
+  &rs6000_reg_names[22][0],    /* r22  */                              \
+  &rs6000_reg_names[23][0],    /* r23  */                              \
+  &rs6000_reg_names[24][0],    /* r24  */                              \
+  &rs6000_reg_names[25][0],    /* r25  */                              \
+  &rs6000_reg_names[26][0],    /* r26  */                              \
+  &rs6000_reg_names[27][0],    /* r27  */                              \
+  &rs6000_reg_names[28][0],    /* r28  */                              \
+  &rs6000_reg_names[29][0],    /* r29  */                              \
+  &rs6000_reg_names[30][0],    /* r30  */                              \
+  &rs6000_reg_names[31][0],    /* r31  */                              \
+                                                                       \
+  &rs6000_reg_names[32][0],     /* fr0  */                             \
+  &rs6000_reg_names[33][0],    /* fr1  */                              \
+  &rs6000_reg_names[34][0],    /* fr2  */                              \
+  &rs6000_reg_names[35][0],    /* fr3  */                              \
+  &rs6000_reg_names[36][0],    /* fr4  */                              \
+  &rs6000_reg_names[37][0],    /* fr5  */                              \
+  &rs6000_reg_names[38][0],    /* fr6  */                              \
+  &rs6000_reg_names[39][0],    /* fr7  */                              \
+  &rs6000_reg_names[40][0],    /* fr8  */                              \
+  &rs6000_reg_names[41][0],    /* fr9  */                              \
+  &rs6000_reg_names[42][0],    /* fr10 */                              \
+  &rs6000_reg_names[43][0],    /* fr11 */                              \
+  &rs6000_reg_names[44][0],    /* fr12 */                              \
+  &rs6000_reg_names[45][0],    /* fr13 */                              \
+  &rs6000_reg_names[46][0],    /* fr14 */                              \
+  &rs6000_reg_names[47][0],    /* fr15 */                              \
+  &rs6000_reg_names[48][0],    /* fr16 */                              \
+  &rs6000_reg_names[49][0],    /* fr17 */                              \
+  &rs6000_reg_names[50][0],    /* fr18 */                              \
+  &rs6000_reg_names[51][0],    /* fr19 */                              \
+  &rs6000_reg_names[52][0],    /* fr20 */                              \
+  &rs6000_reg_names[53][0],    /* fr21 */                              \
+  &rs6000_reg_names[54][0],    /* fr22 */                              \
+  &rs6000_reg_names[55][0],    /* fr23 */                              \
+  &rs6000_reg_names[56][0],    /* fr24 */                              \
+  &rs6000_reg_names[57][0],    /* fr25 */                              \
+  &rs6000_reg_names[58][0],    /* fr26 */                              \
+  &rs6000_reg_names[59][0],    /* fr27 */                              \
+  &rs6000_reg_names[60][0],    /* fr28 */                              \
+  &rs6000_reg_names[61][0],    /* fr29 */                              \
+  &rs6000_reg_names[62][0],    /* fr30 */                              \
+  &rs6000_reg_names[63][0],    /* fr31 */                              \
+                                                                       \
+  &rs6000_reg_names[64][0],     /* mq   */                             \
+  &rs6000_reg_names[65][0],    /* lr   */                              \
+  &rs6000_reg_names[66][0],    /* ctr  */                              \
+  &rs6000_reg_names[67][0],    /* ap   */                              \
+                                                                       \
+  &rs6000_reg_names[68][0],    /* cr0  */                              \
+  &rs6000_reg_names[69][0],    /* cr1  */                              \
+  &rs6000_reg_names[70][0],    /* cr2  */                              \
+  &rs6000_reg_names[71][0],    /* cr3  */                              \
+  &rs6000_reg_names[72][0],    /* cr4  */                              \
+  &rs6000_reg_names[73][0],    /* cr5  */                              \
+  &rs6000_reg_names[74][0],    /* cr6  */                              \
+  &rs6000_reg_names[75][0],    /* cr7  */                              \
+}
+
+/* print-rtl can't handle the above REGISTER_NAMES, so define the
+   following for it.  Switch to use the alternate names since
+   they are more mnemonic.  */
+
+#define DEBUG_REGISTER_NAMES                                           \
+{                                                                      \
+   "r0", "r1",   "r2",  "r3",  "r4",  "r5",  "r6",  "r7",              \
+   "r8", "r9",  "r10", "r11", "r12", "r13", "r14", "r15",              \
+  "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",              \
+  "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",              \
+   "f0",  "f1",  "f2",  "f3",  "f4",  "f5",  "f6",  "f7",              \
+   "f8",  "f9", "f10", "f11", "f12", "f13", "f14", "f15",              \
+  "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",              \
+  "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31",              \
+  "mq",   "lr", "ctr",  "ap",                                          \
+  "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7"               \
+}
 
 /* Table of additional register names to use in user input.  */
 
@@ -2558,7 +2647,7 @@ toc_section ()                                            \
   /* no additional names for: mq, lr, ctr, ap */       \
   "cr0",  68, "cr1",  69, "cr2",  70, "cr3",  71,      \
   "cr4",  72, "cr5",  73, "cr6",  74, "cr7",  75,      \
-  "cc",   68 }
+  "cc",   68, "sp",    1, "toc",   2 }
 
 /* How to renumber registers for dbx and gdb.  */
 
@@ -2722,7 +2811,7 @@ do {                                                                      \
               reg_names[1]);                                           \
 } while (0)
 
-/* This is how to output an element of a case-vector that is absolute. 
+/* This is how to output an element of a case-vector that is absolute.
    (RS/6000 does not use such vectors, but we must define this macro
    anyway.)   */
 
@@ -2810,7 +2899,8 @@ do {                                                                      \
 
 /* Define which CODE values are valid.  */
 
-#define PRINT_OPERAND_PUNCT_VALID_P(CODE)  ((CODE) == '.' || (CODE) == '*')
+#define PRINT_OPERAND_PUNCT_VALID_P(CODE)  \
+  ((CODE) == '.' || (CODE) == '*' || (CODE) == '$')
 
 /* Print a memory address as an operand to reference that memory location.  */
 
index 6608156d77eb02eef61aa7c9595221827610bf37..2b2d971784f75cd6ca420a00c40d66347ac01b76 100644 (file)
   [(set (match_operand:SI 0 "register_operand" "")
        (unspec [(match_operand:SI 1 "got_operand" "")
                 (match_dup 2)] 8))]
-  "DEFAULT_ABI == ABI_V4 && flag_pic"
+  "(DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) && flag_pic"
   "
 {
   if (!rs6000_pic_register)
   [(set (match_operand:SI 0 "register_operand" "=r")
        (unspec [(match_operand:SI 1 "got_operand" "")
                 (match_operand:SI 2 "register_operand" "b")] 8))]
-  "DEFAULT_ABI == ABI_V4 && flag_pic == 1"
+  "(DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) && flag_pic == 1"
   "{l|lwz} %0,%a1@got(%2)"
   [(set_attr "type" "load")])
 
    (set (match_operand:SI 0 "register_operand" "")
        (mem:SI (plus:SI (match_dup 3)
                         (match_operand:SI 2 "register_operand" ""))))]
-  "DEFAULT_ABI == ABI_V4 && flag_pic > 1"
+  "(DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) && flag_pic > 1"
   "
 {
   if (reload_completed || reload_in_progress)
 (define_insn "*movsi_got_internal2_high"
   [(set (match_operand:SI 0 "register_operand" "=b")
        (unspec [(match_operand:SI 1 "got_operand" "")] 9))]
-  "DEFAULT_ABI == ABI_V4 && flag_pic > 1"
+  "(DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) && flag_pic > 1"
   "{cau|addis} %0,0,%1@got@ha")
 
 (define_insn "*movsi_got_internal2_losum"
   [(set (match_operand:SI 0 "register_operand" "=r")
        (unspec [(match_operand:SI 1 "got_operand" "")
                 (match_operand:SI 2 "register_operand" "b")] 10))]
-  "DEFAULT_ABI == ABI_V4 && flag_pic > 1"
+  "(DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) && flag_pic > 1"
   "{cal %0,%a1@got@l(%2)|addi %0,%2,%a1@got@l}")
 
 ;; For SI, we special-case integers that can't be loaded in one insn.  We
 
   /* Use default pattern for address of ELF small data */
   if (TARGET_ELF
-      && DEFAULT_ABI == ABI_V4
+      && (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
       && (GET_CODE (operands[1]) == SYMBOL_REF || GET_CODE (operands[1]) == CONST)
       && small_data_operand (operands[1], SImode))
     {
       DONE;
     }
 
-  if (DEFAULT_ABI == ABI_V4 && flag_pic && got_operand (operands[1], SImode))
+  if ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
+      && flag_pic && got_operand (operands[1], SImode))
     {
       emit_insn (gen_movsi_got (operands[0], operands[1]));
       DONE;
         (match_operand 1 "const_int_operand" "n,n"))
    (use (match_operand 2 "const_int_operand" "O,n"))
    (clobber (match_scratch:SI 3 "=l,l"))]
-  "DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_AIX_NODESC"
+  "DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS || DEFAULT_ABI == ABI_AIX_NODESC"
   "*
 {
   if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
              (match_operand 2 "const_int_operand" "n,n")))
    (use (match_operand 3 "const_int_operand" "O,n"))
    (clobber (match_scratch:SI 4 "=l,l"))]
-  "DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_AIX_NODESC"
+  "DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS || DEFAULT_ABI == ABI_AIX_NODESC"
   "*
 {
   if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
       if (INTVAL (operands[2]) & CALL_LONG)
        operands[0] = rs6000_longcall_ref (operands[0]);
 
-      if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_AIX_NODESC)
+      if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_AIX_NODESC || DEFAULT_ABI == ABI_SOLARIS)
        emit_call_insn (gen_call_indirect_sysv (force_reg (Pmode, operands[0]),
                                                operands[1], operands[2]));
       else
       if (INTVAL (operands[2]) & CALL_LONG)
        operands[1] = rs6000_longcall_ref (operands[1]);
 
-      if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_AIX_NODESC)
+      if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_AIX_NODESC || DEFAULT_ABI == ABI_SOLARIS)
        emit_call_insn (gen_call_value_indirect_sysv (operands[0], operands[1],
                                                      operands[2], operands[3]));
       else
         (match_operand 1 "" "fg,fg"))
    (use (match_operand:SI 2 "immediate_operand" "O,n"))
    (clobber (match_scratch:SI 3 "=l,l"))]
-  "(DEFAULT_ABI == ABI_AIX_NODESC || DEFAULT_ABI == ABI_V4)
+  "(DEFAULT_ABI == ABI_AIX_NODESC || DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
    && (INTVAL (operands[2]) & CALL_LONG) == 0"
   "*
 {
              (match_operand 2 "" "fg,fg")))
    (use (match_operand:SI 3 "immediate_operand" "O,n"))
    (clobber (match_scratch:SI 4 "=l,l"))]
-  "(DEFAULT_ABI == ABI_AIX_NODESC || DEFAULT_ABI == ABI_V4)
+  "(DEFAULT_ABI == ABI_AIX_NODESC || DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
    && (INTVAL (operands[3]) & CALL_LONG) == 0"
   "*
 {
 (define_insn "init_v4_pic"
   [(set (match_operand:SI 0 "register_operand" "=l")
        (unspec [(const_int 0)] 7))]
-  "DEFAULT_ABI == ABI_V4"
+  "DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS"
   "bl _GLOBAL_OFFSET_TABLE_-4"
   [(set_attr "type" "branch")])
 
   if (get_attr_length (insn) == 8)
     return \"%C1bc %t1,%j1,%l0\";
   else
-    return \"%C1bc %T1,%j1,$+8\;b %l0\";
+    return \"%C1bc %T1,%j1,%$+8\;b %l0\";
+
 }"
   [(set_attr "type" "branch")])
 
   if (get_attr_length (insn) == 8)
     return \"%C1bc %T1,%j1,%l0\";
   else
-    return \"%C1bc %t1,%j1,$+8\;b %l0\";
+    return \"%C1bc %t1,%j1,%$+8\;b %l0\";
 }"
   [(set_attr "type" "branch")])
 
   else if (get_attr_length (insn) == 8)
     return \"{bdn|bdnz} %l0\";
   else
-    return \"bdz $+8\;b %l0\";
+    return \"bdz %$+8\;b %l0\";
 }"
   [(set_attr "type" "branch")
    (set_attr "length" "*,12,16")])
   else if (get_attr_length (insn) == 8)
     return \"bdz %l0\";
   else
-    return \"{bdn|bdnz} $+8\;b %l0\";
+    return \"{bdn|bdnz} %$+8\;b %l0\";
 }"
   [(set_attr "type" "branch")
    (set_attr "length" "*,12,16")])
   else if (get_attr_length (insn) == 8)
     return \"{bdn|bdnz} %l0\";
   else
-    return \"bdz $+8\;b %l0\";
+    return \"bdz %$+8\;b %l0\";
 }"
   [(set_attr "type" "branch")
    (set_attr "length" "*,12,16")])
   else if (get_attr_length (insn) == 8)
     return \"bdz %l0\";
   else
-    return \"{bdn|bdnz} $+8\;b %l0\";
+    return \"{bdn|bdnz} %$+8\;b %l0\";
 }"
   [(set_attr "type" "branch")
    (set_attr "length" "*,12,16")])
   else if (get_attr_length (insn) == 8)
     return \"bdz %l0\";
   else
-    return \"{bdn|bdnz} $+8\;b %l0\";
+    return \"{bdn|bdnz} %$+8\;b %l0\";
 }"
   [(set_attr "type" "branch")
    (set_attr "length" "*,12,16")])
   else if (get_attr_length (insn) == 8)
     return \"{bdn|bdnz} %l0\";
   else
-    return \"bdz $+8\;b %l0\";
+    return \"bdz %$+8\;b %l0\";
 }"
   [(set_attr "type" "branch")
    (set_attr "length" "*,12,16")])
diff --git a/gcc/config/rs6000/sol-c0.c b/gcc/config/rs6000/sol-c0.c
new file mode 100644 (file)
index 0000000..c42498a
--- /dev/null
@@ -0,0 +1,65 @@
+/* Solaris PowerPC startfile.  */
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+
+This file is part of GNU CC.
+
+GNU CC 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,
+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
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+/* As a special exception, if you link this library with other files,
+   some of which are compiled with GCC, to produce an executable,
+   this library does not by itself cause the resulting executable
+   to be covered by the GNU General Public License.
+   This exception does not however invalidate any other reasons why
+   the executable file might be covered by the GNU General Public License.  */
+
+extern char **_environ;
+
+extern int atexit (void (*__func) (void));
+extern void __init (void);
+extern void __fini (void);
+extern void __do_global_ctors (void);
+
+typedef void (*func_ptr) (void);
+int (*__atexit)(func_ptr) = atexit;
+
+/* Start function.  */
+
+void
+_start(int argc, char *argv[], char *envp[], void *auxp, void (*termfunc)())
+{
+  int ret;
+
+  _environ = envp;
+
+  /* Register loader termination function */
+  if (termfunc)
+    atexit (termfunc);
+
+  /* Call any global constructors and destructors.  */
+  __do_global_ctors ();
+
+  /* Call the main program now */
+  ret = main (argc, argv, envp, auxp);
+
+  /* Return to the os */
+  exit (ret);
+}
+
+/* Provide a dummy __eabi in case main got compiled without -mcall-solaris.  */
+void
+__eabi ()
+{
+}
diff --git a/gcc/config/rs6000/sol-ci.asm b/gcc/config/rs6000/sol-ci.asm
new file mode 100644 (file)
index 0000000..71a3315
--- /dev/null
@@ -0,0 +1,70 @@
+# crti.s for solaris
+
+#   Copyright (C) 1996 Free Software Foundation, Inc.
+#   Written By Michael Meissner
+# 
+# This file 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.
+# 
+# In addition to the permissions in the GNU General Public License, the
+# Free Software Foundation gives you unlimited permission to link the
+# compiled version of this file with other programs, and to distribute
+# those programs without any restriction coming from the use of this
+# file.  (The General Public License restrictions do apply in other
+# respects; for example, they cover modification of the file, and
+# distribution when not linked into another program.)
+# 
+# This file 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 this program; see the file COPYING.  If not, write to
+# the Free Software Foundation, 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+# 
+#    As a special exception, if you link this library with files
+#    compiled with GCC to produce an executable, this does not cause
+#    the resulting executable to be covered by the GNU General Public License.
+#    This exception does not however invalidate any other reasons why
+#    the executable file might be covered by the GNU General Public License.
+# 
+
+# This file just supplies labeled starting points for the .got* and other
+# special sections.  It is linked in first before other modules.
+       .file   "scrti.s"
+       .ident  "GNU C scrti.s"
+
+# List of C++ constructors
+       .section ".ctors","aw"
+       .globl  __CTOR_LIST__
+       .type   __CTOR_LIST__,@object
+__CTOR_LIST__:
+
+# List of C++ destructors
+       .section ".dtors","aw"
+       .globl  __DTOR_LIST__
+       .type   __DTOR_LIST__,@object
+__DTOR_LIST__:
+
+# Head of __init function used for static constructors in Solaris
+       .section ".init","ax"
+       .align 2
+       .globl __init
+       .type __init,@function
+__init:        stwu %r1,-16(%r1)
+       mflr %r0
+       stw %r0,12(%r1)
+
+# Head of __fini function used for static destructors in Solaris
+       .section ".fini","ax"
+       .align 2
+       .globl __fini
+       .type __fini,@function
+__fini:        stwu %r1,-16(%r1)
+       mflr %r0
+       stw %r0,12(%r1)
diff --git a/gcc/config/rs6000/sol-cn.asm b/gcc/config/rs6000/sol-cn.asm
new file mode 100644 (file)
index 0000000..d3a6083
--- /dev/null
@@ -0,0 +1,66 @@
+# crtn.s for solaris
+
+#   Copyright (C) 1996 Free Software Foundation, Inc.
+#   Written By Michael Meissner
+# 
+# This file 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.
+# 
+# In addition to the permissions in the GNU General Public License, the
+# Free Software Foundation gives you unlimited permission to link the
+# compiled version of this file with other programs, and to distribute
+# those programs without any restriction coming from the use of this
+# file.  (The General Public License restrictions do apply in other
+# respects; for example, they cover modification of the file, and
+# distribution when not linked into another program.)
+# 
+# This file 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 this program; see the file COPYING.  If not, write to
+# the Free Software Foundation, 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+# 
+#    As a special exception, if you link this library with files
+#    compiled with GCC to produce an executable, this does not cause
+#    the resulting executable to be covered by the GNU General Public License.
+#    This exception does not however invalidate any other reasons why
+#    the executable file might be covered by the GNU General Public License.
+# 
+
+# This file just supplies labeled ending points for the .got* and other
+# special sections.  It is linked in last after other modules.
+       .file   "scrtn.s"
+       .ident  "GNU C scrtn.s"
+
+# End list of C++ constructors
+       .section ".ctors","aw"
+       .globl  __CTOR_END__
+       .type   __CTOR_END__,@object
+__CTOR_END__:
+
+# End list of C++ destructors
+       .section ".dtors","aw"
+       .globl  __DTOR_END__
+       .type   __DTOR_END__,@object
+__DTOR_END__:
+
+# Tail of __init used for static constructors in Solaris
+       .section ".init","ax"
+       lwz %r0,12(%r1)
+       mtlr %r0
+       addi %r1,%r1,16
+       blr
+
+# Tail of __fini used for static destructors in Solaris
+       .section ".fini","ax"
+       lwz %r0,12(%r1)
+       mtlr %r0
+       addi %r1,%r1,16
+       blr
diff --git a/gcc/config/rs6000/sol2.h b/gcc/config/rs6000/sol2.h
new file mode 100644 (file)
index 0000000..700640b
--- /dev/null
@@ -0,0 +1,175 @@
+/* Definitions of target machine for GNU compiler,
+   for IBM RS/6000 running AIX version 3.1.
+   Copyright (C) 1993 Free Software Foundation, Inc.
+   Contributed by Richard Kenner (kenner@nyu.edu)
+
+This file is part of GNU CC.
+
+GNU CC 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,
+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
+the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+
+#include "rs6000/sysv4le.h"
+
+#undef CPP_PREDEFINES
+#define CPP_PREDEFINES \
+ "-Dsun=1 -Dunix -D__svr4__ -DSVR4 -DPPC \
+  -D__ppc -Asystem(unix) -Asystem(svr4) -Acpu(powerpc) -Amachine(prep)"
+
+#undef ASM_CPU_SPEC
+#define ASM_CPU_SPEC "%{fpic:-K PIC} %{fPIC:-K PIC} -le -s"
+
+/* This should be the same as in svr4.h, except with -R added.  */
+#undef LINK_SPEC
+#define LINK_SPEC \
+  "%{h*} %{v:-V} %{G*} \
+   %{b} %{Wl,*:%*} \
+   %{static:-dn -Bstatic} \
+   %{shared:-G -dy -z text %{!h*:%{o*:-h %*}}} \
+   %{symbolic:-Bsymbolic -G -dy -z text %{!h*:%{o*:-h %*}}} \
+   %{G:-G} \
+   %{YP,*} \
+   %{R*} %{!static:%{!R*:%{L*:-R %*}}} \
+   %{compat-bsd: \
+     %{!YP,*:%{p:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
+       %{!p:-Y P,/usr/ucblib:/usr/ccs/lib:/usr/lib}} \
+     -R /usr/ucblib} \
+   %{!compat-bsd: \
+     %{!YP,*:%{p:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
+       %{!p:-Y P,/usr/ccs/lib:/usr/lib}}} \
+   %{Qy:} %{!Qn:-Qy}"
+
+/* This defines which switch letters take arguments.
+   It is as in svr4.h but with -R added.  */
+
+#undef TARGET_DEFAULT
+#define TARGET_DEFAULT (MASK_POWERPC | \
+                       MASK_NEW_MNEMONICS | \
+                       MASK_LITTLE_ENDIAN | \
+                       MASK_NO_MAIN_INIT | \
+                       MASK_REGNAMES)
+
+#undef LIB_DEFAULT_SPEC
+#define LIB_DEFAULT_SPEC LIB_SOLARIS_SPEC
+
+#undef STARTFILE_DEFAULT_SPEC
+#define STARTFILE_DEFAULT_SPEC STARTFILE_SOLARIS_SPEC
+
+#undef ENDFILE_DEFAULT_SPEC
+#define ENDFILE_DEFAULT_SPEC ENDFILE_SOLARIS_SPEC
+
+#undef LINK_START_DEFAULT_SPEC
+#define LINK_START_DEFAULT_SPEC LINK_START_SOLARIS_SPEC
+
+/* Don't turn -B into -L if the argument specifies a relative file name.  */
+#undef RELATIVE_PREFIX_NOT_LINKDIR
+
+#define        DEFAULT_PCC_STRUCT_RETURN 0
+
+#undef TARGET_VERSION
+#define TARGET_VERSION fprintf (stderr, " (PowerPC Solaris)");
+
+\f
+/* Macros to check register numbers against specific register classes.  */
+
+#undef PREFERRED_DEBUGGING_TYPE
+#define        PREFERRED_DEBUGGING_TYPE DBX_DEBUG
+
+
+#undef ASM_OUTPUT_ALIGNED_LOCAL
+#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN)              \
+do {                                                                   \
+  fprintf ((FILE), "\t%s\t", ".lcomm");                                        \
+  assemble_name ((FILE), (NAME));                                      \
+  fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT);       \
+} while (0)
+
+
+/* Like block addresses, stabs line numbers are relative to the
+   current function.  */
+
+/* use .stabd instead of .stabn */
+
+#define        ASM_STABN_OP    ".stabd"
+
+#undef SKIP_ASM_OP
+#define        SKIP_ASM_OP     ".skip"
+
+#undef  ASM_OUTPUT_SOURCE_LINE
+#define ASM_OUTPUT_SOURCE_LINE(file, line)                             \
+do                                                                     \
+  {                                                                    \
+    static int sym_lineno = 1;                                         \
+    char *_p;                                                          \
+    fprintf (file, "\t.stabd 68,0,%d,.LM%d-",                          \
+            line, sym_lineno);                                         \
+    STRIP_NAME_ENCODING (_p, XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \
+    assemble_name (file, _p);                                          \
+    fprintf (file, "\n.LM%d:\n", sym_lineno);                          \
+    sym_lineno += 1;                                                   \
+  }                                                                    \
+while (0)
+
+/* This is how to output an assembler line defining a `double' constant.  */
+
+#undef ASM_OUTPUT_DOUBLE
+#define ASM_OUTPUT_DOUBLE(FILE, VALUE)                                 \
+  {                                                                    \
+    if (REAL_VALUE_ISINF (VALUE)                                       \
+        || REAL_VALUE_ISNAN (VALUE)                                    \
+       || REAL_VALUE_MINUS_ZERO (VALUE))                               \
+      {                                                                        \
+       long t[2];                                                      \
+       REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), t);                       \
+       fprintf (FILE, "\t.long 0x%lx\n\t.long 0x%lx\n",                \
+               t[0] & 0xffffffff, t[1] & 0xffffffff);                  \
+      }                                                                        \
+    else                                                               \
+      {                                                                        \
+       char str[30];                                                   \
+       REAL_VALUE_TO_DECIMAL (VALUE, "%.20e", str);                    \
+       fprintf (FILE, "\t.double %s\n", str);                          \
+      }                                                                        \
+  }
+
+/* This is how to output an assembler line defining a `float' constant.  */
+
+#undef ASM_OUTPUT_FLOAT
+#define ASM_OUTPUT_FLOAT(FILE, VALUE)                                  \
+  {                                                                    \
+    if (REAL_VALUE_ISINF (VALUE)                                       \
+        || REAL_VALUE_ISNAN (VALUE)                                    \
+       || REAL_VALUE_MINUS_ZERO (VALUE))                               \
+      {                                                                        \
+       long t;                                                         \
+       REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t);                       \
+       fprintf (FILE, "\t.long 0x%lx\n", t & 0xffffffff);              \
+      }                                                                        \
+    else                                                               \
+      {                                                                        \
+       char str[30];                                                   \
+       REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", str);                  \
+       fprintf (FILE, "\t.float %s\n", str);                           \
+      }                                                                        \
+  }
+
+\f
+/* Sun-ppc assembler does not permit '.' in some symbol names.
+   Use 'name_.labelno' instead. */
+#undef ASM_FORMAT_PRIVATE_NAME
+#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
+( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10),   \
+  sprintf ((OUTPUT), "%s_.%d", (NAME), (LABELNO))) 
+
+#define ASM_RELOCATION_EXPRESSIONS 1
+
index d071ba8c3ffbbb7c52ba5970e65353ae121941b4..0b3de6093a6dd2f3e553c13acb0fd929f6b8be7f 100644 (file)
@@ -27,22 +27,18 @@ Boston, MA 02111-1307, USA.  */
 #define MASK_RELOCATABLE       0x10000000      /* GOT pointers are PC relative */
 #define        MASK_SDATA              0x08000000      /* use eabi .sdata/.sdata2/.sbss relocations */
 #define MASK_LITTLE_ENDIAN     0x04000000      /* target is little endian */
-#define MASK_CALLS_1           0x02000000      /* First ABI bit (AIX, AIXDESC) */
+#define MASK_REGNAMES          0x02000000      /* use alternate register names.  */
 #define MASK_PROTOTYPE         0x01000000      /* Only prototyped fcns pass variable args */
-#define        MASK_CALLS_2            0x00800000      /* Second ABI bit (NT) */
-
-#define        MASK_CALLS              (MASK_CALLS_1 | MASK_CALLS_2)
-#define        MASK_CALLS_V4           0
-#define        MASK_CALLS_AIX          MASK_CALLS_1
-#define        MASK_CALLS_NT           MASK_CALLS_2
-#define        MASK_CALLS_AIXDESC      MASK_CALLS
+#define        MASK_EABI               0x00800000      /* Adhere to eabi, not System V spec */
 
 #define        TARGET_NO_BITFIELD_TYPE (target_flags & MASK_NO_BITFIELD_TYPE)
 #define TARGET_STRICT_ALIGN    (target_flags & MASK_STRICT_ALIGN)
 #define TARGET_RELOCATABLE     (target_flags & MASK_RELOCATABLE)
 #define TARGET_SDATA           (target_flags & MASK_SDATA)
 #define TARGET_LITTLE_ENDIAN   (target_flags & MASK_LITTLE_ENDIAN)
+#define TARGET_REGNAMES                (target_flags & MASK_REGNAMES)
 #define        TARGET_PROTOTYPE        (target_flags & MASK_PROTOTYPE)
+#define TARGET_EABI            (target_flags & MASK_EABI)
 #define        TARGET_TOC              ((target_flags & (MASK_64BIT            \
                                                 | MASK_RELOCATABLE     \
                                                 | MASK_MINIMAL_TOC))   \
@@ -53,11 +49,7 @@ Boston, MA 02111-1307, USA.  */
 #define TARGET_BIG_ENDIAN      (! TARGET_LITTLE_ENDIAN)
 #define        TARGET_NO_PROTOTYPE     (! TARGET_PROTOTYPE)
 #define        TARGET_NO_TOC           (! TARGET_TOC)
-
-#define TARGET_AIX_CALLS       (target_flags & MASK_CALLS_1)   /* either -mcall-aix or -mcall-aixdesc */
-#define TARGET_V4_CALLS                ((target_flags & MASK_CALLS) == MASK_CALLS_V4)
-#define TARGET_NT_CALLS                ((target_flags & MASK_CALLS) == MASK_CALLS_NT)
-#define TARGET_AIXDESC_CALLS   ((target_flags & MASK_CALLS) == MASK_CALLS_AIXDESC)
+#define TARGET_NO_EABI         (! TARGET_EABI)
 
 /* Pseudo target to indicate whether the object format is ELF
    (to get around not having conditional compilation in the md file)  */
@@ -85,19 +77,25 @@ Boston, MA 02111-1307, USA.  */
   { "no-toc",           0 },                                           \
   { "toc",              MASK_MINIMAL_TOC },                            \
   { "full-toc",                 MASK_MINIMAL_TOC },                            \
-  { "call-aix",                 MASK_CALLS_AIX },                              \
-  { "call-aix",                -MASK_CALLS_NT },                               \
-  { "call-aixdesc",     MASK_CALLS_AIXDESC },                          \
-  { "call-aixdesc",    -MASK_LITTLE_ENDIAN },                          \
-  { "call-sysv",       -MASK_CALLS },                                  \
-  { "call-nt",          MASK_CALLS_NT | MASK_LITTLE_ENDIAN },          \
-  { "call-nt",         -MASK_CALLS_AIX },                              \
   { "prototype",        MASK_PROTOTYPE },                              \
   { "no-prototype",    -MASK_PROTOTYPE },                              \
   { "no-traceback",     0 },                                           \
+  { "eabi",             MASK_EABI },                                   \
+  { "no-eabi",         -MASK_EABI },                                   \
+  { "regnames",                  MASK_REGNAMES },                              \
+  { "no-regnames",      -MASK_REGNAMES },                              \
   { "sim",              0 },                                           \
   { "mvme",             0 },                                           \
   { "emb",              0 },                                           \
+  { "newlib",           0 },
+
+/* Which abi to adhere to */
+extern char *rs6000_abi_name;
+
+/* Default ABI to use */
+#define RS6000_ABI_NAME "sysv"
+
+#define SUBTARGET_OPTIONS {"call-",  &rs6000_abi_name}
 
 /* Max # of bytes for variables to automatically be put into the .sdata
    or .sdata2 sections.  */
@@ -122,10 +120,34 @@ do {                                                                      \
   if (!g_switch_set)                                                   \
     g_switch_value = SDATA_DEFAULT_SIZE;                               \
                                                                        \
-  rs6000_current_abi = ((TARGET_AIXDESC_CALLS) ? ABI_AIX :             \
-                       (TARGET_NT_CALLS)      ? ABI_NT :               \
-                       (TARGET_AIX_CALLS)     ? ABI_AIX_NODESC :       \
-                                                ABI_V4);               \
+  if (!strcmp (rs6000_abi_name, "sysv"))                               \
+    rs6000_current_abi = ABI_V4;                                       \
+  else if (!strcmp (rs6000_abi_name, "sysv-noeabi"))                   \
+    {                                                                  \
+      rs6000_current_abi = ABI_V4;                                     \
+      target_flags &= ~ MASK_EABI;                                     \
+    }                                                                  \
+  else if (!strcmp (rs6000_abi_name, "sysv-eabi")                      \
+          || !strcmp (rs6000_abi_name, "eabi"))                        \
+    {                                                                  \
+      rs6000_current_abi = ABI_V4;                                     \
+      target_flags |= MASK_EABI;                                       \
+    }                                                                  \
+  else if (!strcmp (rs6000_abi_name, "aix"))                           \
+    rs6000_current_abi = ABI_AIX_NODESC;                               \
+  else if (!strcmp (rs6000_abi_name, "aixdesc"))                       \
+    rs6000_current_abi = ABI_AIX;                                      \
+  else if (!strcmp (rs6000_abi_name, "nt"))                            \
+    rs6000_current_abi = ABI_NT;                                       \
+  else if (!strcmp (rs6000_abi_name, "linux"))                         \
+    rs6000_current_abi = ABI_V4;                                       \
+  else if (!strcmp (rs6000_abi_name, "solaris"))                       \
+    rs6000_current_abi = ABI_SOLARIS;                                  \
+  else                                                                 \
+    {                                                                  \
+      rs6000_current_abi = ABI_V4;                                     \
+      error ("Bad value for -mcall-%s", rs6000_abi_name);              \
+    }                                                                  \
                                                                        \
   if (TARGET_RELOCATABLE && TARGET_SDATA)                              \
     {                                                                  \
@@ -133,7 +155,8 @@ do {                                                                        \
       error ("-mrelocatable and -msdata are incompatible.");           \
     }                                                                  \
                                                                        \
-  if (TARGET_SDATA && DEFAULT_ABI != ABI_V4)                           \
+  if (TARGET_SDATA && DEFAULT_ABI != ABI_V4                            \
+      && DEFAULT_ABI != ABI_SOLARIS)                                   \
     {                                                                  \
       target_flags &= ~MASK_SDATA;                                     \
       error ("-msdata and -mcall-aix are incompatible.");              \
@@ -145,25 +168,21 @@ do {                                                                      \
       error ("-mrelocatable and -mno-minimal-toc are incompatible.");  \
     }                                                                  \
                                                                        \
-  if (TARGET_RELOCATABLE && TARGET_AIXDESC_CALLS)                      \
+  if (TARGET_RELOCATABLE &&                                            \
+      (rs6000_current_abi == ABI_AIX || rs6000_current_abi == ABI_NT)) \
     {                                                                  \
       target_flags &= ~MASK_RELOCATABLE;                               \
-      error ("-mrelocatable and -mcall-aixdesc are incompatible.");    \
+      error ("-mrelocatable and -mcall-%s are incompatible.",          \
+            rs6000_abi_name);                                          \
     }                                                                  \
                                                                        \
-  if (TARGET_RELOCATABLE && TARGET_NT_CALLS)                           \
-    {                                                                  \
-      target_flags &= ~MASK_MINIMAL_TOC;                               \
-      error ("-mrelocatable and -mcall-nt are incompatible.");         \
-    }                                                                  \
-                                                                       \
-  if (TARGET_AIXDESC_CALLS && TARGET_LITTLE_ENDIAN)                    \
+  if (rs6000_current_abi == ABI_AIX && TARGET_LITTLE_ENDIAN)           \
     {                                                                  \
       target_flags &= ~MASK_LITTLE_ENDIAN;                             \
       error ("-mcall-aixdesc must be big endian");                     \
     }                                                                  \
                                                                        \
-  if (TARGET_NT_CALLS && TARGET_BIG_ENDIAN)                            \
+  if (rs6000_current_abi == ABI_NT && TARGET_BIG_ENDIAN)               \
     {                                                                  \
       target_flags |= MASK_LITTLE_ENDIAN;                              \
       error ("-mcall-nt must be little endian");                       \
@@ -184,7 +203,8 @@ do {                                                                        \
 /* System V.4 passes the first 8 floating arguments in registers,
    instead of the first 13 like AIX does.  */
 #undef FP_ARG_MAX_REG
-#define        FP_ARG_MAX_REG ((TARGET_AIX_CALLS) ? FP_ARG_AIX_MAX_REG : FP_ARG_V4_MAX_REG)
+#define        FP_ARG_MAX_REG ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_AIX_NODESC) \
+                       ? FP_ARG_AIX_MAX_REG : FP_ARG_V4_MAX_REG)
 
 /* Size of the V.4 varargs area if needed */
 #undef RS6000_VARARGS_AREA
@@ -206,13 +226,16 @@ do {                                                                      \
 
 /* Size of the outgoing register save area */
 #undef RS6000_REG_SAVE
-#define RS6000_REG_SAVE (TARGET_AIX_CALLS ? (TARGET_64BIT ? 64 : 32) : 0)
+#define RS6000_REG_SAVE ((DEFAULT_ABI == ABI_AIX                       \
+                         || DEFAULT_ABI == ABI_AIX_NODESC)             \
+                        ? (TARGET_64BIT ? 64 : 32)                     \
+                        : 0)
 
 /* Size of the fixed area on the stack.  For AIX, use the standard 6 word
    area, otherwise use 2 words to store back chain & LR.  */
 #undef RS6000_SAVE_AREA
 #define RS6000_SAVE_AREA \
-  ((TARGET_AIX_CALLS ? 24 : 8) << (TARGET_64BIT ? 1 : 0))
+  (((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_AIX_NODESC) ? 24 : 8) << (TARGET_64BIT ? 1 : 0))
 
 /* Define cutoff for using external functions to save floating point.
    Currently on V.4, always use inline stores */
@@ -270,16 +293,31 @@ do {                                                                      \
 #undef WCHAR_TYPE_SIZE
 #define WCHAR_TYPE_SIZE 16
 
-/* Align stack to 16 byte boundaries */
+/* Make int foo : 8 not cause structures to be aligned to an int boundary */
+
+#undef PCC_BITFIELD_TYPE_MATTERS
+#define        PCC_BITFIELD_TYPE_MATTERS (TARGET_BITFIELD_TYPE)
+
+/* Define this macro to be the value 1 if instructions will fail to
+   work if given data not on the nominal alignment.  If instructions
+   will merely go slower in that case, define this macro as 0.
+
+   Note, little endian systems trap on unaligned addresses, so never
+   turn off strict alignment in that case. */
+#undef STRICT_ALIGNMENT
+#define        STRICT_ALIGNMENT (TARGET_STRICT_ALIGN || TARGET_LITTLE_ENDIAN)
+
+/* Align stack to 8 byte boundaries for eabi, 16 byte boundaries for System V.4  */
 #undef STACK_BOUNDARY
-#define        STACK_BOUNDARY  128
+#define        STACK_BOUNDARY  ((TARGET_EABI) ? 64 : 128)
 
 /* No data type wants to be aligned rounder than this.  */
 #undef BIGGEST_ALIGNMENT
+#define BIGGEST_ALIGNMENT ((TARGET_EABI) ? 64 : 128)
+
 #undef  BIGGEST_FIELD_ALIGNMENT
 #undef  ADJUST_FIELD_ALIGN
 #undef  ROUND_TYPE_ALIGN
-#define BIGGEST_ALIGNMENT 128
 
 /* Use ELF style section commands.  */
 
@@ -292,9 +330,32 @@ do {                                                                       \
 #undef BSS_SECTION_ASM_OP
 #define BSS_SECTION_ASM_OP     "\t.section \".bss\""
 
+#undef INIT_SECTION_ASM_OP
+#define INIT_SECTION_ASM_OP "\t.section \".init\",\"ax\""
+
+#undef FINI_SECTION_ASM_OP
+#define FINI_SECTION_ASM_OP "\t.section \".fini\",\"ax\""
+
+#define TOC_SECTION_ASM_OP "\t.section \".got\",\"aw\""
+
+/* Put PC relative got entries in .got2 */
+#define MINIMAL_TOC_SECTION_ASM_OP \
+  ((TARGET_RELOCATABLE) ? "\t.section\t\".got2\",\"aw\"" : "\t.section\t\".got1\",\"aw\"")
+
+/* Put relocatable data in .data, not .rodata so initialized pointers can be updated */
+#undef CONST_SECTION_ASM_OP
+#define CONST_SECTION_ASM_OP \
+  ((TARGET_RELOCATABLE) ? "\t.section\t\".data\"\t# .rodata" : "\t.section\t\".rodata\"")
+
+
+#define SDATA_SECTION_ASM_OP "\t.section \".sdata\",\"aw\""
+#define SDATA2_SECTION_ASM_OP "\t.section \".sdata2\",\"a\""
+#define SBSS_SECTION_ASM_OP "\t.section \".sbss\",\"aw\",@nobits"
+
+
 /* Besides the usual ELF sections, we need a toc section.  */
 #undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_const, in_ctors, in_dtors, in_toc, in_sdata, in_sdata2, in_sbss
+#define EXTRA_SECTIONS in_const, in_ctors, in_dtors, in_toc, in_sdata, in_sdata2, in_sbss, in_init, in_fini
 
 #undef EXTRA_SECTION_FUNCTIONS
 #define EXTRA_SECTION_FUNCTIONS                                                \
@@ -304,7 +365,9 @@ do {                                                                        \
   TOC_SECTION_FUNCTION                                                 \
   SDATA_SECTION_FUNCTION                                               \
   SDATA2_SECTION_FUNCTION                                              \
-  SBSS_SECTION_FUNCTION
+  SBSS_SECTION_FUNCTION                                                        \
+  INIT_SECTION_FUNCTION                                                        \
+  FINI_SECTION_FUNCTION
 
 extern void toc_section (), sdata_section (), sdata2_section ();
 extern void sbss_section ();
@@ -355,13 +418,6 @@ toc_section ()                                                             \
     }                                                                  \
 }
 
-#define TOC_SECTION_ASM_OP "\t.section \".got\",\"aw\""
-#define MINIMAL_TOC_SECTION_ASM_OP "\t.section \".got1\",\"aw\""
-
-#define SDATA_SECTION_ASM_OP "\t.section \".sdata\",\"aw\""
-#define SDATA2_SECTION_ASM_OP "\t.section \".sdata2\",\"a\""
-#define SBSS_SECTION_ASM_OP "\t.section \".sbss\",\"aw\",@nobits"
-
 #define SDATA_SECTION_FUNCTION                                         \
 void                                                                   \
 sdata_section ()                                                       \
@@ -395,6 +451,28 @@ sbss_section ()                                                            \
     }                                                                  \
 }
 
+#define INIT_SECTION_FUNCTION                                          \
+void                                                                   \
+init_section ()                                                                \
+{                                                                      \
+  if (in_section != in_init)                                           \
+    {                                                                  \
+      in_section = in_init;                                            \
+      fprintf (asm_out_file, "%s\n", INIT_SECTION_ASM_OP);             \
+    }                                                                  \
+}
+
+#define FINI_SECTION_FUNCTION                                          \
+void                                                                   \
+fini_section ()                                                                \
+{                                                                      \
+  if (in_section != in_fini)                                           \
+    {                                                                  \
+      in_section = in_fini;                                            \
+      fprintf (asm_out_file, "%s\n", FINI_SECTION_ASM_OP);             \
+    }                                                                  \
+}
+
 /* A C statement or statements to switch to the appropriate section
    for output of RTX in mode MODE.  You can assume that RTX is some
    kind of constant in RTL.  The argument MODE is redundant except in
@@ -509,6 +587,13 @@ extern int rs6000_pic_labelno;
 #define ASM_OUTPUT_INTERNAL_LABEL_PREFIX(FILE,PREFIX)  \
   fprintf (FILE, ".%s", PREFIX)
 
+/* This is how to allocate empty space in some section.  Use .space
+   instead of .zero because the Solaris PowerPC assembler doesn't
+   like it, and gas accepts either syntax.  */
+
+#undef SKIP_ASM_OP
+#define SKIP_ASM_OP    ".space"
+
 /* This says how to output assembler code to declare an
    uninitialized internal linkage data object.  Under SVR4,
    the linker seems to want the alignment of data objects
@@ -538,17 +623,6 @@ do {                                                                       \
   ASM_OUTPUT_ALIGNED_LOCAL (FILE, NAME, SIZE, ALIGN);                  \
 } while (0)
 
-/* Pass various options to the assembler */
-#undef ASM_SPEC
-#define ASM_SPEC "-u %(asm_cpu) \
-%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \
-%{mrelocatable} %{mrelocatable-lib} %{memb} %{msdata: -memb} \
-%{mlittle} %{mlittle-endian} %{mbig} %{mbig-endian}"
-
-#undef CC1_SPEC
-/* Pass -G xxx to the compiler */
-#define CC1_SPEC "%{G*}"
-
 /* Switch  Recognition by gcc.c.  Add -G xx support */
 
 #undef SWITCH_TAKES_ARG
@@ -624,8 +698,11 @@ do {                                                                       \
 
 /* This is the end of what might become sysv4.h.  */
 
-/* Allow stabs and dwarf, prefer dwarf.  */
-#define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG
+/* Allow stabs and dwarf, for now, make stabs the default debugging type,
+   not dwarf since G++ doesn't support dwarf. */
+#undef PREFERRED_DEBUGGING_TYPE
+#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
+
 #define        DBX_DEBUGGING_INFO
 #define        DWARF_DEBUGGING_INFO
 
@@ -656,7 +733,8 @@ do {                                                                        \
            XSTR (sym_ref, 0) = str;                                    \
          }                                                             \
       }                                                                        \
-    else if (TARGET_SDATA && DEFAULT_ABI == ABI_V4                     \
+    else if (TARGET_SDATA                                              \
+            && (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)   \
             && TREE_CODE (DECL) == VAR_DECL)                           \
       {                                                                        \
        int size = int_size_in_bytes (TREE_TYPE (DECL));                \
@@ -707,6 +785,31 @@ do {                                                                       \
   fputs (_name, FILE);                                                 \
 } while (0)
 
+#if 0
+/* The Solaris 2.51 linker has a bug in that it doesn't properly
+   resolve references from the .init and .fini sections.  So fall
+   back to the old way of handling constructors and destructors.  */
+#undef ASM_OUTPUT_CONSTRUCTOR
+#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME)                              \
+  do {                                                                 \
+    init_section ();                                                   \
+    fputs ("\tbl ", FILE);                                             \
+    assemble_name (FILE, NAME);                                                \
+    fputs ((flag_pic) ? "@plt\n" : "\n", FILE);                                \
+  } while (0)
+
+/* A C statement (sans semicolon) to output an element in the table of
+   global destructors.  */
+#undef ASM_OUTPUT_DESTRUCTOR
+#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME)                                       \
+  do {                                                                 \
+    fini_section ();                                                   \
+    fputs ("\tbl ", FILE);                                             \
+    assemble_name (FILE, NAME);                                                \
+    fputs ((flag_pic) ? "@plt\n" : "\n", FILE);                                \
+  } while (0)
+#endif
+
 /* But, to make this work, we have to output the stabs for the function
    name *first*...  */
 
@@ -721,6 +824,29 @@ do {                                                                       \
 #define CPP_PREDEFINES \
   "-DPPC -Dunix -D__svr4__ -Asystem(unix) -Asystem(svr4) -Acpu(powerpc) -Amachine(powerpc)"
 
+/* Pass various options to the assembler */
+#undef ASM_SPEC
+#define ASM_SPEC "-u %(asm_cpu) %{mregnames} \
+%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \
+%{mrelocatable} %{mrelocatable-lib} %{memb} %{msdata: -memb} \
+%{mlittle} %{mlittle-endian} %{mbig} %{mbig-endian} \
+%{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
+    %{mcall-solaris: -mlittle} %{mcall-linux: -mbig} }}}}"
+
+#undef CC1_SPEC
+/* Pass -G xxx to the compiler and set correct endian mode */
+#define CC1_SPEC "%{G*} \
+%{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
+    %{mcall-nt: -mlittle } \
+    %{mcall-aixdesc: -mbig } \
+    %{mcall-solaris: -mlittle } \
+    %{mcall-linux: -mbig} }}}} \
+%{mcall-solaris: -mno-main-init -mregnames } \
+%{meabi: %{!mcall-*: -mcall-sysv }} \
+%{!meabi: %{!mno-eabi: \
+    %{mcall-solaris: -mno-eabi } \
+    %{mcall-linux: -mno-eabi }}}"
+
 /* Don't put -Y P,<path> for cross compilers */
 #undef LINK_PATH_SPEC
 #ifndef CROSS_COMPILE
@@ -732,6 +858,20 @@ do {                                                                       \
 #define LINK_PATH_SPEC ""
 #endif
 
+/* Default starting address if specified */
+#ifndef LINK_START_SPEC
+#define LINK_START_SPEC "\
+%{mmvme: %(link_start_mvme) } \
+%{msim: %(link_start_sim) } \
+%{mcall-linux: %(link_start_linux) } \
+%{mcall-solaris: %(link_start_solaris) } \
+%{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-solaris: %(link_start_default) }}}}"
+#endif
+
+#ifndef        LINK_START_DEFUALT_SPEC
+#define LINK_START_DEFUALT_SPEC ""
+#endif
+
 #undef LINK_SPEC
 #define LINK_SPEC "\
 %{h*} %{v:-V} %{G*} \
@@ -741,10 +881,15 @@ do {                                                                      \
 %{symbolic:-Bsymbolic -G -dy -z text %{!h*:%{o*:-h %*}}} \
 %{G:-G} \
 %{YP,*} \
-%(link_path) %(link_start) \
+%(link_path) \
+%{!Ttext*: %(link_start) } \
 %{Qy:} %{!Qn:-Qy} \
 %{mlittle: -oformat elf32-powerpcle } %{mlittle-endian: -oformat elf32-powerpcle } \
-%{mbig: -oformat elf32-powerpc } %{mbig-endian: -oformat elf32-powerpc }"
+%{mbig: -oformat elf32-powerpc } %{mbig-endian: -oformat elf32-powerpc } \
+%{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
+    %{mcall-solaris: -oformat elf32-powerpcle} \
+    %{mcall-linux: -oformat elf32-powerpc} }}}}"
+
 
 #undef CPP_SYSV_SPEC
 #define CPP_SYSV_SPEC \
@@ -757,14 +902,212 @@ do {                                                                     \
 #undef CPP_SYSV_DEFAULT_SPEC
 #define        CPP_SYSV_DEFAULT_SPEC "-D_CALL_SYSV"
 
+/* For solaris, don't define _LITTLE_ENDIAN, it conflicts with a header file.  */
 #undef CPP_ENDIAN_SPEC
 #define        CPP_ENDIAN_SPEC \
 "%{mlittle: -D_LITTLE_ENDIAN -Amachine(littleendian)} \
 %{mlittle-endian: -D_LITTLE_ENDIAN -Amachine(littleendian)} \
-%{!mlittle: %{!mlittle-endian: -D_BIG_ENDIAN -Amachine(bigendian)}}"
+%{mbig: -D_BIG_ENDIAN -Amachine(bigendian)} \
+%{mbig-endian: -D_BIG_ENDIAN -Amachine(bigendian)} \
+%{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
+    %{mcall-solaris: -Amachine(littleendian)} \
+    %{mcall-nt: -D_LITTLE_ENDIAN -Amachine(littleendian)} \
+    %{mcall-linux: -D_BIG_ENDIAN -Amachine(bigendian)} \
+    %{mcall-aixdesc:  -D_BIG_ENDIAN -Amachine(bigendian)} \
+    %{!mcall-solaris: %{!mcall-linux: %{!mcall-nt: %{!mcall-aixdesc: %(cpp_endian_default_spec) }}}}}}}}"
+
+#undef CPP_ENDIAN_DEFAULT_SPEC
+#define        CPP_ENDIAN_DEFAULT_SPEC "-D_BIG_ENDIAN -Amachine(bigendian)"
 
 #undef CPP_SPEC
-#define CPP_SPEC "%{posix: -D_POSIX_SOURCE} %(cpp_sysv) %(cpp_endian) %(cpp_cpu)"
+#define CPP_SPEC "%{posix: -D_POSIX_SOURCE} %(cpp_sysv) %(cpp_endian) %(cpp_cpu) \
+%{mmvme: %(cpp_os_mvme) } \
+%{msim: %(cpp_os_sim) } \
+%{mcall-linux: %(cpp_os_linux) } \
+%{mcall-solaris: %(cpp_os_solaris) } \
+%{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-solaris: %(cpp_os_default) }}}}"
+
+#ifndef CPP_OS_DEFAULT_SPEC
+#define CPP_OS_DEFAULT_SPEC ""
+#endif
+
+#undef  STARTFILE_SPEC
+#define        STARTFILE_SPEC "\
+%{mmvme: %(startfile_mvme) } \
+%{msim: %(startfile_sim) } \
+%{mcall-linux: %(startfile_linux) } \
+%{mcall-solaris: %(startfile_solaris) } \
+%{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-solaris: %(startfile_default) }}}}"
+
+#undef STARTFILE_DEFAULT_SPEC
+#define        STARTFILE_DEFAULT_SPEC ""
+
+#undef LIB_SPEC
+#define        LIB_SPEC "\
+%{mmvme: %(lib_mvme) } \
+%{msim: %(lib_sim) } \
+%{mcall-linux: %(lib_linux) } \
+%{mcall-solaris: %(lib_solaris) } \
+%{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-solaris: %(lib_default) }}}}"
+
+#undef LIBGCC_SPEC
+#define        LIBGCC_SPEC "libgcc.a%s"
+
+#undef ENDFILE_SPEC
+#define        ENDFILE_SPEC "\
+%{mmvme: ecrtn.o%s} \
+%{msim: ecrtn.o%s} \
+%{mcall-linux: } \
+%{mcall-solaris: scrtn.o%s} \
+%{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-solaris: %(endfile_default) }}}}"
+
+#undef ENDFILE_DEFAULT_SPEC
+#define        ENDFILE_DEFAULT_SPEC ""
+
+/* Motorola MVME support.  */
+#ifndef        LIB_MVME_SPEC
+#define LIB_MVME_SPEC "-( -lmvme -lc -) }"
+#endif
+
+#ifndef        STARTFILE_MVME_SPEC
+#define        STARTFILE_MVME_SPEC "ecrti.o%s mvme-crt0.o%s"
+#endif
+
+#ifndef        ENDFILE_MVME_SPEC
+#define        ENDFILE_MVME_SPEC "ecrtn.o%s"
+#endif
+
+#ifndef LINK_START_MVME_SPEC
+#define LINK_START_MVME_SPEC ""
+#endif
+
+#ifndef CPP_OS_MVME_SPEC
+#define CPP_OS_MVME_SPEC ""
+#endif
+
+/* PowerPC simulator based on netbsd system calls support.  */
+#ifndef        LIB_SIM_SPEC
+#define LIB_SIM_SPEC "-( -lsim -lc -) }"
+#endif
+
+#ifndef        STARTFILE_SIM_SPEC
+#define        STARTFILE_SIM_SPEC "ecrti.o%s sim-crt0.o%s"
+#endif
+
+#ifndef        ENDFILE_SIM_SPEC
+#define        ENDFILE_SIM_SPEC "ecrtn.o%s"
+#endif
+
+#ifndef LINK_START_SIM_SPEC
+#define LINK_START_SIM_SPEC "-Ttext 0x10000074"
+#endif
+
+#ifndef CPP_OS_SIM_SPEC
+#define CPP_OS_SIM_SPEC ""
+#endif
+
+/* Linux support.  */
+#ifndef        LIB_LINUX_SPEC
+#define LIB_LINUX_SPEC "%{mnewlib: -( -llinux -lc -) } %{!mnewlib: -lc }"
+#endif
+
+#ifndef        STARTFILE_LINUX_SPEC
+#define        STARTFILE_LINUX_SPEC "crt0.o%s"
+#endif
+
+#ifndef        ENDFILE_LINUX_SPEC
+#define        ENDFILE_LINUX_SPEC ""
+#endif
+
+#ifndef LINK_START_LINUX_SPEC
+#define LINK_START_LINUX_SPEC "-Ttext 0x400074"
+#endif
+
+#ifndef CPP_OS_LINUX_SPEC
+#define CPP_OS_LINUX_SPEC "-D__unix__ -D__linux__ \
+%{!ansi: -Dunix -Dlinux } \
+-Asystem(unix) -Asystem(linux)"
+#endif
+
+#ifndef CPP_OS_LINUX_SPEC
+#define CPP_OS_LINUX_SPEC ""
+#endif
+
+/* Solaris support.  */
+/* For Solaris, Gcc automatically adds in one of the files
+   /usr/ccs/lib/values-Xc.o, /usr/ccs/lib/values-Xa.o, or
+   /usr/ccs/lib/values-Xt.o for each final link step (depending upon the other
+   gcc options selected, such as -traditional and -ansi).  These files each
+   contain one (initialized) copy of a special variable called `_lib_version'.
+   Each one of these files has `_lib_version' initialized to a different (enum)
+   value.  The SVR4 library routines query the value of `_lib_version' at run
+   to decide how they should behave.  Specifically, they decide (based upon the
+   value of `_lib_version') if they will act in a strictly ANSI conforming
+   manner or not.  */
+
+#ifndef        LIB_SOLARIS_SPEC
+#define LIB_SOLARIS_SPEC "\
+%{mnewlib: -( -lsolaris -lc -) } \
+%{!mnewlib: \
+    %{ansi:values-Xc.o%s} \
+    %{!ansi: \
+       %{traditional:values-Xt.o%s} \
+       %{!traditional:values-Xa.o%s}} \
+       %{compat-bsd:-lucb -lsocket -lnsl -lelf -laio} \
+    %{!shared: %{!symbolic: -lc }}}"
+#endif
+
+#ifndef        STARTFILE_SOLARIS_SPEC
+#define        STARTFILE_SOLARIS_SPEC "scrti.o%s scrt0.o%s"
+#endif
+
+#ifndef        ENDFILE_SOLARIS_SPEC
+#define        ENDFILE_SOLARIS_SPEC "scrtn.o%s"
+#endif
+
+#ifndef LINK_START_SOLARIS_SPEC
+#ifdef CROSS_COMPILER
+#define LINK_START_SOLARIS_SPEC "-Ttext 0x2000074"
+#else
+#define LINK_START_SOLARIS_SPEC ""
+#endif
+#endif
+
+#ifndef CPP_OS_SOLARIS_SPEC
+#define CPP_OS_SOLARIS_SPEC "-D__ppc -D__sun__=1 -D__unix__ -D__svr4__  -D__SVR4__ \
+%{!ansi: -Dsun=1 -Dunix -DSVR4 -D__EXTENSIONS__ } \
+-Asystem(unix) -Asystem(svr4) -Amachine(prep)"
+#endif
+
+/* Define any extra SPECS that the compiler needs to generate.  */
+#undef SUBTARGET_EXTRA_SPECS
+#define SUBTARGET_EXTRA_SPECS                                          \
+  { "lib_mvme",                        LIB_MVME_SPEC },                        \
+  { "lib_sim",                 LIB_SIM_SPEC },                         \
+  { "lib_linux",               LIB_LINUX_SPEC },                       \
+  { "lib_solaris",             LIB_SOLARIS_SPEC },                     \
+  { "lib_default",             LIB_DEFAULT_SPEC },                     \
+  { "startfile_mvme",          STARTFILE_MVME_SPEC },                  \
+  { "startfile_sim",           STARTFILE_SIM_SPEC },                   \
+  { "startfile_linux",         STARTFILE_LINUX_SPEC },                 \
+  { "startfile_solaris",       STARTFILE_SOLARIS_SPEC },               \
+  { "startfile_default",       STARTFILE_DEFAULT_SPEC },               \
+  { "endfile_mvme",            ENDFILE_MVME_SPEC },                    \
+  { "endfile_sim",             ENDFILE_SIM_SPEC },                     \
+  { "endfile_linux",           ENDFILE_LINUX_SPEC },                   \
+  { "endfile_solaris",         ENDFILE_SOLARIS_SPEC },                 \
+  { "endfile_default",         ENDFILE_DEFAULT_SPEC },                 \
+  { "link_start_mvme",         LINK_START_MVME_SPEC },                 \
+  { "link_start_sim",          LINK_START_SIM_SPEC },                  \
+  { "link_start_linux",                LINK_START_LINUX_SPEC },                \
+  { "link_start_solaris",      LINK_START_SOLARIS_SPEC },              \
+  { "link_start_default",      LINK_START_DEFAULT_SPEC },              \
+  { "cpp_os_mvme",             CPP_OS_MVME_SPEC },                     \
+  { "cpp_os_sim",              CPP_OS_SIM_SPEC },                      \
+  { "cpp_os_linux",            CPP_OS_LINUX_SPEC },                    \
+  { "cpp_os_solaris",          CPP_OS_SOLARIS_SPEC },                  \
+  { "cpp_os_default",          CPP_OS_DEFAULT_SPEC },                  \
+  { "link_path",               LINK_PATH_SPEC },
 
 /* Define this macro as a C expression for the initializer of an
    array of string to tell the driver program which options are
@@ -776,4 +1119,4 @@ do {                                                                       \
    `MULTILIB_OPTIONS' are set by default.  *Note Target Fragment::.  */
 
 #undef MULTILIB_DEFAULTS
-#define        MULTILIB_DEFAULTS { "mbig", "mbig-endian", "mcall-sysv", "mno-sdata" }
+#define        MULTILIB_DEFAULTS { "mbig", "mbig-endian", "mcall-sysv-noeabi", "mno-sdata" }
index 3eeb803e167b67ab5fef2edcb2cea873a673ae26..941ab7b0d3e08dd9575e13bcf4efe581465ef7d2 100644 (file)
@@ -25,12 +25,8 @@ Boston, MA 02111-1307, USA.  */
 #undef TARGET_DEFAULT
 #define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS | MASK_LITTLE_ENDIAN)
 
-#undef CPP_ENDIAN_SPEC
-#define        CPP_ENDIAN_SPEC \
-"%{mbig: -D_BIG_ENDIAN -Amachine(bigendian)} \
-%{mbig-endian: -D_BIG_ENDIAN -Amachine(bigendian)} \
-%{!mbig: %{!mbig-endian: -D_LITTLE_ENDIAN -Amachine(littleendian)}}"
-
+#undef CPP_ENDIAN_DEFAULT_SPEC
+#define        CPP_ENDIAN_DEFAULT_SPEC "-D_LITTLE_ENDIAN -Amachine(littleendian)"
 
 /* Define this macro as a C expression for the initializer of an
    array of string to tell the driver program which options are
@@ -42,4 +38,4 @@ Boston, MA 02111-1307, USA.  */
    `MULTILIB_OPTIONS' are set by default.  *Note Target Fragment::.  */
 
 #undef MULTILIB_DEFAULTS
-#define        MULTILIB_DEFAULTS { "mlittle", "mlittle-endian", "mcall-sysv", "mno-sdata" }
+#define        MULTILIB_DEFAULTS { "mlittle", "mlittle-endian", "mcall-sysv-noeabi", "mno-sdata" }
index a42ee771b05633307dfc1ce139ab687deee87af3..bee27ad51150de82652303a53cd49624ed5bf5a9 100644 (file)
@@ -6,7 +6,7 @@ EXTRA_HEADERS = $(srcdir)/ginclude/ppc-asm.h
 
 # These are really part of libgcc1, but this will cause them to be
 # built correctly, so... [taken from t-sparclite]
-LIB2FUNCS_EXTRA = fp-bit.c dp-bit.c
+LIB2FUNCS_EXTRA = fp-bit.c dp-bit.c eabi.S eabi-ctors.c
 
 dp-bit.c: $(srcdir)/config/fp-bit.c
        cat $(srcdir)/config/fp-bit.c > dp-bit.c
@@ -15,15 +15,87 @@ fp-bit.c: $(srcdir)/config/fp-bit.c
        echo '#define FLOAT' > fp-bit.c
        cat $(srcdir)/config/fp-bit.c >> fp-bit.c
 
+eabi.S: $(srcdir)/config/rs6000/eabi.asm
+       cat $(srcdir)/config/rs6000/eabi.asm > eabi.S
+
+eabi-ctors.c: $(srcdir)/config/rs6000/eabi-ctors.c
+       cat $(srcdir)/config/rs6000/eabi-ctors.c > eabi-ctors.c
+
 # Build libgcc.a with different options.  If no gas support, don't build
 # explicit little endian or big endian libraries, since it depends on the
-# -mbig/-mlittle switches passed to gas.
+# -mbig/-mlittle switches passed to gas.  The -mrelocatable support also needs
+# -mrelocatable passed to gas, so don't use it either.
+MULTILIB_OPTIONS       = msoft-float \
+                         mcall-sysv-noeabi/mcall-sysv-eabi/mcall-aix
 
-MULTILIB_OPTIONS       = msoft-float
-MULTILIB_DIRNAMES      = soft-float
-MULTILIB_MATCHES       = msoft-float=mcpu?403 \
+MULTILIB_DIRNAMES      = nof \
+                         le be \
+                         cs ce ca
+
+MULTILIB_MATCHES       = mlittle=mlittle-endian \
+                         mbig=mbig-endian \
+                         mlittle=mcall-solaris \
+                         mbig=mcall-linux \
+                         msoft-float=mcpu?403 \
                          msoft-float=mcpu?821 \
-                         msoft-float=mcpu?860
+                         msoft-float=mcpu?860 \
+                         mcall-sysv-noeabi=mcall-solaris \
+                         mcall-sysv-noeabi=mcall-linux \
+                         mcall-sysv-eabi=meabi \
+                         mcall-sysv-noeabi=mno-eabi
+
+MULTILIB_EXCEPTIONS    =
+
+LIBGCC = stmp-multilib stmp-crt
+INSTALL_LIBGCC = install-multilib install-crt
+
+# For eabi we build crti.o and crtn.o which serve to add begin and
+# end labels to all of the special sections used when we link using gcc.
+
+# Assemble startup files.
+ecrti.S: $(srcdir)/config/rs6000/eabi-ci.asm
+       cat $(srcdir)/config/rs6000/eabi-ci.asm >ecrti.S
+
+ecrtn.S: $(srcdir)/config/rs6000/eabi-cn.asm
+       cat $(srcdir)/config/rs6000/eabi-cn.asm >ecrtn.S
+
+scrti.S: $(srcdir)/config/rs6000/sol-ci.asm
+       cat $(srcdir)/config/rs6000/sol-ci.asm >scrti.S
+
+scrtn.S: $(srcdir)/config/rs6000/sol-cn.asm
+       cat $(srcdir)/config/rs6000/sol-cn.asm >scrtn.S
+
+scrt0.c: $(srcdir)/config/rs6000/sol-c0.c
+       cat $(srcdir)/config/rs6000/sol-c0.c >scrt0.c
+
+# Build multiple copies of crt{i,n}.o, one for each target switch.
+stmp-crt: ecrti.S ecrtn.S scrti.S scrtn.S scrt0.c $(GCC_PASSES) $(EXTRA_HEADERS) stmp-multilib config.status
+       for i in `$(GCC_FOR_TARGET) --print-multi-lib`; do \
+         dir=`echo $$i | sed -e 's/;.*$$//'`; \
+         flags=`echo $$i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \
+         $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
+           LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS) $${flags}" \
+           dir="$${dir}" stmp-crt-sub; \
+         if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
+       done
+       touch stmp-crt
+
+# Subroutine of stmp-crt so make -n works.
+stmp-crt-sub:
+       $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -c -o $(dir)/ecrti.o ecrti.S
+       $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -c -o $(dir)/ecrtn.o ecrtn.S
+       $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -c -o $(dir)/scrti.o scrti.S
+       $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -c -o $(dir)/scrtn.o scrtn.S
+       $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -c -o $(dir)/scrt0.o scrt0.c
 
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
+# Install multiple versions of crt[in].o
+install-crt: stmp-crt install-dir install-multilib
+       for i in `$(GCC_FOR_TARGET) --print-multi-lib`; do \
+         dir=`echo $$i | sed -e 's/;.*$$//'`; \
+         rm -f $(libsubdir)/$${dir}/[es]crt[in0].o; \
+         $(INSTALL_DATA) $${dir}/ecrti.o $(libsubdir)/$${dir}/ecrti.o; \
+         $(INSTALL_DATA) $${dir}/ecrtn.o $(libsubdir)/$${dir}/ecrtn.o; \
+         $(INSTALL_DATA) $${dir}/scrti.o $(libsubdir)/$${dir}/scrti.o; \
+         $(INSTALL_DATA) $${dir}/scrtn.o $(libsubdir)/$${dir}/scrtn.o; \
+         $(INSTALL_DATA) $${dir}/scrt0.o $(libsubdir)/$${dir}/scrt0.o; \
+       done
index 8cca77ba95051db760c6ab96d5f8e847c52457c4..9984d89e6cb9fdbe56983da3f917310c6e2383d3 100644 (file)
@@ -6,7 +6,7 @@ EXTRA_HEADERS = $(srcdir)/ginclude/ppc-asm.h
 
 # These are really part of libgcc1, but this will cause them to be
 # built correctly, so... [taken from t-sparclite]
-LIB2FUNCS_EXTRA = fp-bit.c dp-bit.c
+LIB2FUNCS_EXTRA = fp-bit.c dp-bit.c eabi.S eabi-ctors.c
 
 dp-bit.c: $(srcdir)/config/fp-bit.c
        cat $(srcdir)/config/fp-bit.c > dp-bit.c
@@ -15,23 +15,88 @@ fp-bit.c: $(srcdir)/config/fp-bit.c
        echo '#define FLOAT' > fp-bit.c
        cat $(srcdir)/config/fp-bit.c >> fp-bit.c
 
+eabi.S: $(srcdir)/config/rs6000/eabi.asm
+       cat $(srcdir)/config/rs6000/eabi.asm > eabi.S
+
+eabi-ctors.c: $(srcdir)/config/rs6000/eabi-ctors.c
+       cat $(srcdir)/config/rs6000/eabi-ctors.c > eabi-ctors.c
+
 # Build libgcc.a with different options.
 
 MULTILIB_OPTIONS       = msoft-float \
+                         mrelocatable \
                          mlittle/mbig \
-                         mcall-sysv/mcall-aix  # /mcall-aixdesc
+                         mcall-sysv-noeabi/mcall-sysv-eabi/mcall-aix
 
-MULTILIB_DIRNAMES      = soft-float \
-                         little big \
-                         sysv aix # aixdesc
+MULTILIB_DIRNAMES      = nof \
+                         rel \
+                         le be \
+                         cs ce ca
 
 MULTILIB_MATCHES       = mlittle=mlittle-endian \
                          mbig=mbig-endian \
+                         mlittle=mcall-solaris \
+                         mbig=mcall-linux \
                          msoft-float=mcpu?403 \
                          msoft-float=mcpu?821 \
-                         msoft-float=mcpu?860
+                         msoft-float=mcpu?860 \
+                         mcall-sysv-noeabi=mcall-solaris \
+                         mcall-sysv-noeabi=mcall-linux \
+                         mcall-sysv-eabi=meabi \
+                         mcall-sysv-noeabi=mno-eabi
+
+MULTILIB_EXCEPTIONS    =
+
+LIBGCC = stmp-multilib stmp-crt
+INSTALL_LIBGCC = install-multilib install-crt
+
+# For eabigas we build {e,s}crti.o and {e,s}crtn.o which serve to add begin and
+# end labels to all of the special sections used when we link using gcc.
+
+# Assemble startup files.
+ecrti.S: $(srcdir)/config/rs6000/eabi-ci.asm
+       cat $(srcdir)/config/rs6000/eabi-ci.asm >ecrti.S
+
+ecrtn.S: $(srcdir)/config/rs6000/eabi-cn.asm
+       cat $(srcdir)/config/rs6000/eabi-cn.asm >ecrtn.S
+
+scrti.S: $(srcdir)/config/rs6000/sol-ci.asm
+       cat $(srcdir)/config/rs6000/sol-ci.asm >scrti.S
+
+scrtn.S: $(srcdir)/config/rs6000/sol-cn.asm
+       cat $(srcdir)/config/rs6000/sol-cn.asm >scrtn.S
+
+scrt0.c: $(srcdir)/config/rs6000/sol-c0.c
+       cat $(srcdir)/config/rs6000/sol-c0.c >scrt0.c
+
+# Build multiple copies of crt{i,n}.o, one for each target switch.
+stmp-crt: ecrti.S ecrtn.S scrti.S scrtn.S scrt0.c $(GCC_PASSES) $(EXTRA_HEADERS) stmp-multilib config.status
+       for i in `$(GCC_FOR_TARGET) --print-multi-lib`; do \
+         dir=`echo $$i | sed -e 's/;.*$$//'`; \
+         flags=`echo $$i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \
+         $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
+           LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS) $${flags}" \
+           dir="$${dir}" stmp-crt-sub; \
+         if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
+       done
+       touch stmp-crt
 
-#MULTILIB_EXCEPTIONS   = *mlittle/*mcall-aixdesc*
+# Subroutine of stmp-crt so make -n works.
+stmp-crt-sub:
+       $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -c -o $(dir)/ecrti.o ecrti.S
+       $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -c -o $(dir)/ecrtn.o ecrtn.S
+       $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -c -o $(dir)/scrti.o scrti.S
+       $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -c -o $(dir)/scrtn.o scrtn.S
+       $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -c -o $(dir)/scrt0.o scrt0.c
 
-LIBGCC = stmp-multilib
-INSTALL_LIBGCC = install-multilib
+# Install multiple versions of crt[in].o
+install-crt: stmp-crt install-dir install-multilib
+       for i in `$(GCC_FOR_TARGET) --print-multi-lib`; do \
+         dir=`echo $$i | sed -e 's/;.*$$//'`; \
+         rm -f $(libsubdir)/$${dir}/[es]crt[in0].o; \
+         $(INSTALL_DATA) $${dir}/ecrti.o $(libsubdir)/$${dir}/ecrti.o; \
+         $(INSTALL_DATA) $${dir}/ecrtn.o $(libsubdir)/$${dir}/ecrtn.o; \
+         $(INSTALL_DATA) $${dir}/scrti.o $(libsubdir)/$${dir}/scrti.o; \
+         $(INSTALL_DATA) $${dir}/scrtn.o $(libsubdir)/$${dir}/scrtn.o; \
+         $(INSTALL_DATA) $${dir}/scrt0.o $(libsubdir)/$${dir}/scrt0.o; \
+       done
index d67ae662e23007ce22861eb5c74cfc6455d2ddda..5d654f4a156b280dd970d835ac2296ed43952ee4 100644 (file)
@@ -48,6 +48,13 @@ Boston, MA 02111-1307, USA.  */
 
 #include "xm-svr4.h"
 
+/* if not compiled with GNU C, use the C alloca and use only int bitfields. */
 #ifndef __GNUC__
+#define        USE_C_ALLOCA
+extern char *alloca ();
+#undef ONLY_INT_FIELDS
 #define ONLY_INT_FIELDS
 #endif
+
+/* Solaris has a different declaration of sys_siglist than collect uses.  */
+#define DONT_DECLARE_SYS_SIGLIST