OSDN Git Service

* config/i386/i386.c (ix86_expand_setcc): Don't use method 0
[pf3gnuchains/gcc-fork.git] / gcc / config / i386 / osfrose.h
index 46ae32a..7d74f7a 100644 (file)
@@ -1,6 +1,7 @@
 /* Definitions of target machine for GNU compiler.
    Intel 386 (OSF/1 with OSF/rose) version.
-   Copyright (C) 1991 Free Software Foundation, Inc.
+   Copyright (C) 1991, 1992, 1993, 1996, 1998, 1999, 2000
+   Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -16,45 +17,67 @@ 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.  */
-
-/* Put leading underscores in front of names. */
-#define YES_UNDERSCORES
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
 
 #include "halfpic.h"
 #include "i386/gstabs.h"
 
-/* Get perform_* macros to build libgcc.a.  */
-#include "i386/perform.h"
-
 #define OSF_OS
 
 #undef  WORD_SWITCH_TAKES_ARG
 #define WORD_SWITCH_TAKES_ARG(STR)                                     \
  (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) || !strcmp (STR, "pic-names"))
 
-#define MASK_HALF_PIC          0x40000000      /* Mask for half-pic code */
-#define MASK_HALF_PIC_DEBUG    0x20000000      /* Debug flag */
-#define MASK_ELF               0x10000000      /* ELF not rose */
-#define MASK_NO_IDENT          0x08000000      /* suppress .ident */
-
-#define TARGET_HALF_PIC        (target_flags & MASK_HALF_PIC)
-#define TARGET_DEBUG   (target_flags & MASK_HALF_PIC_DEBUG)
-#define HALF_PIC_DEBUG TARGET_DEBUG
-#define TARGET_ELF     (target_flags & MASK_ELF)
-#define TARGET_ROSE    ((target_flags & MASK_ELF) == 0)
-#define TARGET_IDENT   ((target_flags & MASK_NO_IDENT) == 0)
+/* This defines which switch letters take arguments.  On svr4, most of
+   the normal cases (defined in gcc.c) apply, and we also have -h* and
+   -z* options (for the linker).  */
+
+#define SWITCH_TAKES_ARG(CHAR) \
+  (DEFAULT_SWITCH_TAKES_ARG(CHAR) \
+   || (CHAR) == 'h' \
+   || (CHAR) == 'z')
+
+#define MASK_HALF_PIC          010000000000    /* Mask for half-pic code */
+#define MASK_HALF_PIC_DEBUG     004000000000   /* Debug flag */
+#define MASK_ELF               002000000000    /* ELF not rose */
+#define MASK_NO_UNDERSCORES    000400000000    /* suppress leading _ */
+#define MASK_LARGE_ALIGN       000200000000    /* align to >word boundaries */
+#define MASK_NO_MCOUNT         000100000000    /* profiling uses mcount_ptr */
+
+#define TARGET_HALF_PIC                (target_flags & MASK_HALF_PIC)
+#define TARGET_DEBUG           (target_flags & MASK_HALF_PIC_DEBUG)
+#define HALF_PIC_DEBUG         TARGET_DEBUG
+#define TARGET_ELF             (target_flags & MASK_ELF)
+#define TARGET_ROSE            ((target_flags & MASK_ELF) == 0)
+#define TARGET_UNDERSCORES     ((target_flags & MASK_NO_UNDERSCORES) == 0)
+#define TARGET_LARGE_ALIGN     (target_flags & MASK_LARGE_ALIGN)
+#define TARGET_MCOUNT          ((target_flags & MASK_NO_MCOUNT) == 0)
 
 #undef SUBTARGET_SWITCHES
-#define SUBTARGET_SWITCHES \
-     { "half-pic",      MASK_HALF_PIC},                                \
-     { "no-half-pic",  -MASK_HALF_PIC},                                \
-     { "debugb",        MASK_HALF_PIC_DEBUG},                          \
-     { "elf",           MASK_ELF},                                     \
-     { "no-elf",       -MASK_ELF},                                     \
-     { "rose",         -MASK_ELF},                                     \
-     { "ident",                -MASK_NO_IDENT},                                \
-     { "no-ident",      MASK_NO_IDENT},
+#define SUBTARGET_SWITCHES                                             \
+     { "half-pic",              MASK_HALF_PIC,                         \
+       N_("Emit half-PIC code") },                                     \
+     { "no-half-pic",          -MASK_HALF_PIC, "" }                    \
+     { "debug-half-pic",        MASK_HALF_PIC_DEBUG,                   \
+       0 /* intentionally undoc */ },                                  \
+     { "debugb",                MASK_HALF_PIC_DEBUG,                   \
+       0 /* intentionally undoc */ },                                  \
+     { "elf",                   MASK_ELF,                              \
+       N_("Emit ELF object code") },                                   \
+     { "rose",                 -MASK_ELF,                              \
+       N_("Emit ROSE object code") },                                  \
+     { "underscores",          -MASK_NO_UNDERSCORES,                   \
+       N_("Symbols have a leading underscore") },                      \
+     { "no-underscores",        MASK_NO_UNDERSCORES, "" },             \
+     { "large-align",           MASK_LARGE_ALIGN,                      \
+       N_("Align to >word boundaries") },                              \
+     { "no-large-align",       -MASK_LARGE_ALIGN, "" },                \
+     { "mcount",               -MASK_NO_MCOUNT,                        \
+       N_("Use mcount for profiling") },                               \
+     { "mcount-ptr",            MASK_NO_MCOUNT,                        \
+       N_("Use mcount_ptr for profiling") },                           \
+     { "no-mcount",             MASK_NO_MCOUNT, "" },
 
 /* OSF/rose uses stabs, not dwarf.  */
 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
@@ -66,14 +89,18 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 /* Handle #pragma weak and #pragma pack.  */
 
 #define HANDLE_SYSV_PRAGMA
+#define SUPPORTS_WEAK  TARGET_ELF
 
 /* Change default predefines.  */
 #undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-DOSF -DOSF1 -Dunix -Di386 -Asystem(unix) -Acpu(i386) -Amachine(i386)"
+#define CPP_PREDEFINES "-DOSF -DOSF1 -Dunix -Asystem=xpg4"
 
 #undef  CPP_SPEC
-#define CPP_SPEC "\
-%{!melf: -D__ROSE__} %{melf: -D__ELF__} \
+#define CPP_SPEC "%(cpp_cpu) \
+%{!melf: -D__ROSE__ %{!pic-none: -D__SHARED__}} \
+%{melf: -D__ELF__ %{fpic: -D__SHARED__}} \
+%{mno-underscores: -D__NO_UNDERSCORES__} \
+%{melf: %{!munderscores: -D__NO_UNDERSCORES__}} \
 %{.S:  %{!ansi:%{!traditional:%{!traditional-cpp:%{!ftraditional: -traditional}}}}} \
 %{.S:  -D__LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \
 %{.cc: -D__LANGUAGE_C_PLUS_PLUS} \
@@ -82,27 +109,35 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 %{.m:  -D__LANGUAGE_OBJECTIVE_C} \
 %{!.S: -D__LANGUAGE_C %{!ansi:-DLANGUAGE_C}}"
 
-/* Turn on -mpic-extern by default.  */
+/* Turn on -pic-extern by default for OSF/rose, -fpic for ELF.  */
 #undef  CC1_SPEC
-#define CC1_SPEC "\
-%{!melf: %{!mrose: %{!mno-elf: -mrose }}} \
+#define CC1_SPEC "%(cc1_cpu) \
 %{gline:%{!g:%{!g0:%{!g1:%{!g2: -g1}}}}} \
-%{pic-none:   -mno-half-pic} \
-%{fpic:              -mno-half-pic} \
-%{fPIC:              -mno-half-pic} \
-%{pic-lib:    -mhalf-pic} \
-%{pic-extern: -mhalf-pic} \
-%{pic-calls:  -mhalf-pic} \
-%{pic-names*: -mhalf-pic} \
-%{!pic-*: %{!fpic: %{!fPIC: -mhalf-pic}}}"
+%{!melf: %{!mrose: -mrose }} \
+%{melf: %{!munderscores: %{!mno-underscores: -mno-underscores }} \
+       %{!mmcount: %{!mno-mcount: %{!mmcount-ptr: -mmcount-ptr }}}} \
+%{!melf: %{!munderscores: %{!mno-underscores: -munderscores }} \
+        %{!mmcount: %{!mno-mcount: %{!mmcount-ptr: -mmcount }}} \
+        %{pic-extern: -mhalf-pic } %{pic-lib: -mhalf-pic } \
+        %{!pic-extern: %{!pic-lib: %{pic-none: -mno-half-pic} %{!pic-none: -mhalf-pic}}} \
+        %{pic-calls: } %{pic-names*: }}"
 
 #undef ASM_SPEC
 #define ASM_SPEC       "%{v*: -v}"
 
 #undef  LINK_SPEC
-#define LINK_SPEC      "%{v*: -v}                           \
-                      %{!noshrlib: %{pic-none: -noshrlib} %{!pic-none: -warn_nopic}} \
-                      %{nostdlib} %{noshrlib} %{glue}"
+#define LINK_SPEC      "%{v*: -v} \
+%{!melf:       %{!noshrlib: %{pic-none: -noshrlib} %{!pic-none: -warn_nopic}} \
+               %{nostdlib} %{noshrlib} %{glue}} \
+%{melf:                %{dy} %{dn} %{glue: } \
+               %{h*} %{z*} \
+               %{static:-dn -Bstatic} \
+               %{shared:-G -dy} \
+               %{symbolic:-Bsymbolic -G -dy} \
+               %{G:-G} \
+               %{!dy: %{!dn: %{!static: %{!shared: %{!symbolic: \
+                       %{noshrlib: -dn } %{pic-none: -dn } \
+                       %{!noshrlib: %{!pic-none: -dy}}}}}}}}"
 
 #undef  LIB_SPEC
 #define LIB_SPEC "-lc"
@@ -138,14 +173,200 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #define WCHAR_TYPE     "unsigned int"
 #define WCHAR_TYPE_SIZE BITS_PER_WORD
 
-/* Temporarily turn off long double being 96 bits.  */
-#undef LONG_DOUBLE_TYPE_SIZE
+/* Define this macro if the system header files support C++ as well
+   as C.  This macro inhibits the usual method of using system header
+   files in C++, which is to pretend that the file's contents are
+   enclosed in `extern "C" {...}'. */
+#define NO_IMPLICIT_EXTERN_C
 
-/* Tell final.c we don't need a label passed to mcount.  */
-#define NO_PROFILE_DATA
+/* Turn off long double being 96 bits.  */
+#undef LONG_DOUBLE_TYPE_SIZE
+#define LONG_DOUBLE_TYPE_SIZE 64
+
+#define OSF_PROFILE_BEFORE_PROLOGUE                                    \
+  (!TARGET_MCOUNT                                                      \
+   && !current_function_needs_context                                  \
+   && (!flag_pic                                                       \
+       || !frame_pointer_needed                                                \
+       || (!current_function_uses_pic_offset_table                     \
+          && !current_function_uses_const_pool)))
+
+/* A C statement or compound statement to output to FILE some assembler code to
+   call the profiling subroutine `mcount'.  Before calling, the assembler code
+   must load the address of a counter variable into a register where `mcount'
+   expects to find the address.  The name of this variable is `LP' followed by
+   the number LABELNO, so you would generate the name using `LP%d' in a
+   `fprintf'.
+
+   The details of how the address should be passed to `mcount' are determined
+   by your operating system environment, not by GNU CC.  To figure them out,
+   compile a small program for profiling using the system's installed C
+   compiler and look at the assembler code that results. */
 
 #undef  FUNCTION_PROFILER
-#define FUNCTION_PROFILER(FILE, LABELNO) fprintf (FILE, "\tcall _mcount\n")
+#define FUNCTION_PROFILER(FILE, LABELNO)                               \
+do                                                                     \
+  {                                                                    \
+    if (!OSF_PROFILE_BEFORE_PROLOGUE)                                  \
+      {                                                                        \
+       char *prefix = (TARGET_UNDERSCORES) ? "_" : "";                 \
+       char *lprefix = LPREFIX;                                        \
+       int labelno = LABELNO;                                          \
+                                                                       \
+       /* Note that OSF/rose blew it in terms of calling mcount,       \
+          since OSF/rose prepends a leading underscore, but mcount's   \
+          doesn't.  At present, we keep this kludge for ELF as well    \
+          to allow old kernels to build profiling.  */                 \
+                                                                       \
+       if (flag_pic                                                    \
+           && !current_function_uses_pic_offset_table                  \
+           && !current_function_uses_const_pool)                       \
+         abort ();                                                     \
+                                                                       \
+       if (TARGET_MCOUNT && flag_pic)                                  \
+         {                                                             \
+           fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n",        \
+                    lprefix, labelno);                                 \
+           fprintf (FILE, "\tcall *%smcount@GOT(%%ebx)\n", prefix);    \
+         }                                                             \
+                                                                       \
+       else if (TARGET_MCOUNT && HALF_PIC_P ())                        \
+         {                                                             \
+           rtx symdef;                                                 \
+                                                                       \
+           HALF_PIC_EXTERNAL ("mcount");                               \
+           symdef = HALF_PIC_PTR (gen_rtx_SYMBOL_REF (Pmode, "mcount")); \
+           fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno);  \
+           fprintf (FILE, "\tcall *%s%s\n", prefix, XSTR (symdef, 0)); \
+         }                                                             \
+                                                                       \
+       else if (TARGET_MCOUNT)                                         \
+         {                                                             \
+           fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno);  \
+           fprintf (FILE, "\tcall %smcount\n", prefix);                \
+         }                                                             \
+                                                                       \
+       else if (flag_pic && frame_pointer_needed)                      \
+         {                                                             \
+           fprintf (FILE, "\tmovl 4(%%ebp),%%ecx\n");                  \
+           fprintf (FILE, "\tpushl %%ecx\n");                          \
+           fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n",        \
+                    lprefix, labelno);                                 \
+           fprintf (FILE, "\tmovl _mcount_ptr@GOT(%%ebx),%%eax\n");    \
+           fprintf (FILE, "\tcall *(%%eax)\n");                        \
+           fprintf (FILE, "\tpopl %%eax\n");                           \
+         }                                                             \
+                                                                       \
+       else if (frame_pointer_needed)                                  \
+         {                                                             \
+           fprintf (FILE, "\tmovl 4(%%ebp),%%ecx\n");                  \
+           fprintf (FILE, "\tpushl %%ecx\n");                          \
+           fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno);  \
+           fprintf (FILE, "\tcall *_mcount_ptr\n");                    \
+           fprintf (FILE, "\tpopl %%eax\n");                           \
+         }                                                             \
+                                                                       \
+       else                                                            \
+         abort ();                                                     \
+      }                                                                        \
+  }                                                                    \
+while (0)
+
+/* A C function or functions which are needed in the library to
+   support block profiling.  When support goes into libc, undo
+   the #if 0.  */
+
+#if 0
+#undef BLOCK_PROFILING_CODE
+#define        BLOCK_PROFILING_CODE
+#endif
+
+/* Prefix for internally generated assembler labels.  If we aren't using
+   underscores, we are using prefix `.'s to identify labels that should
+   be ignored, as in `i386/gas.h' --karl@cs.umb.edu  */
+#undef LPREFIX
+#define        LPREFIX ((TARGET_UNDERSCORES) ? "L" : ".L")
+
+/* This is how to store into the string BUF
+   the symbol_ref name of an internal numbered label where
+   PREFIX is the class of label and NUM is the number within the class.
+   This is suitable for output with `assemble_name'.  */
+
+#undef ASM_GENERATE_INTERNAL_LABEL
+#define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER)                 \
+    sprintf ((BUF), "*%s%s%d", (TARGET_UNDERSCORES) ? "" : ".",                \
+            (PREFIX), (NUMBER))
+
+/* This is how to output an internal numbered label where
+   PREFIX is the class of label and NUM is the number within the class.  */
+
+#undef ASM_OUTPUT_INTERNAL_LABEL
+#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM)                     \
+  fprintf (FILE, "%s%s%d:\n", (TARGET_UNDERSCORES) ? "" : ".",         \
+          PREFIX, NUM)
+
+/* The prefix to add to user-visible assembler symbols. */
+
+/* target_flags is not accessible by the preprocessor */
+#undef USER_LABEL_PREFIX
+#define USER_LABEL_PREFIX "_"
+
+/* This is how to output a reference to a user-level label named NAME.  */
+
+#undef ASM_OUTPUT_LABELREF
+#define ASM_OUTPUT_LABELREF(FILE,NAME)                                 \
+  fprintf (FILE, "%s%s", (TARGET_UNDERSCORES) ? "_" : "", NAME)
+
+/* This is how to output an element of a case-vector that is relative.
+   This is only used for PIC code.  See comments by the `casesi' insn in
+   i386.md for an explanation of the expression this outputs. */
+
+#undef ASM_OUTPUT_ADDR_DIFF_ELT
+#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
+  fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE)
+
+/* Output a definition */
+#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2)                             \
+do                                                                     \
+{                                                                      \
+    fprintf ((FILE), "%s", SET_ASM_OP);                                        \
+    assemble_name (FILE, LABEL1);                                      \
+    fprintf (FILE, ",");                                               \
+    assemble_name (FILE, LABEL2);                                      \
+    fprintf (FILE, "\n");                                              \
+    }                                                                  \
+while (0)
+
+/* A C expression to output text to align the location counter in the
+   way that is desirable at a point in the code that is reached only
+   by jumping.
+
+   This macro need not be defined if you don't want any special
+   alignment to be done at such a time.  Most machine descriptions do
+   not currently define the macro.  */
+
+#undef LABEL_ALIGN_AFTER_BARRIER
+#define LABEL_ALIGN_AFTER_BARRIER(LABEL) \
+  ((!TARGET_LARGE_ALIGN && i386_align_jumps > 2) ? 2 : i386_align_jumps)
+
+/* A C expression to output text to align the location counter in the
+   way that is desirable at the beginning of a loop.
+
+   This macro need not be defined if you don't want any special
+   alignment to be done at such a time.  Most machine descriptions do
+   not currently define the macro.  */
+
+#undef LOOP_ALIGN
+#define LOOP_ALIGN(LABEL) (i386_align_loops)
+
+/* A C statement to output to the stdio stream STREAM an assembler
+   command to advance the location counter to a multiple of 2 to the
+   POWER bytes.  POWER will be a C expression of type `int'.  */
+
+#undef ASM_OUTPUT_ALIGN
+#define ASM_OUTPUT_ALIGN(STREAM, POWER)                                        \
+  fprintf (STREAM, "\t.align\t%d\n",                                   \
+          (!TARGET_LARGE_ALIGN && (POWER) > 2) ? 2 : (POWER))
 
 /* A C expression that is 1 if the RTX X is a constant which is a
    valid address.  On most machines, this can be defined as
@@ -176,67 +397,14 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
    || GET_CODE (X) == CONST_INT                                                \
    || !HALF_PIC_ADDRESS_P (X))
 
-/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
-   that is a valid memory address for an instruction.
-   The MODE argument is the machine mode for the MEM expression
-   that wants to use this address. */
-
-#define GO_IF_LEGITIMATE_ADDRESS_ORIG(MODE, X, ADDR)                   \
-{                                                                      \
-  if (CONSTANT_ADDRESS_P (X)                                           \
-      && (! flag_pic || LEGITIMATE_PIC_OPERAND_P (X)))                 \
-    goto ADDR;                                                         \
-  GO_IF_INDEXING (X, ADDR);                                            \
-  if (GET_CODE (X) == PLUS && CONSTANT_ADDRESS_P (XEXP (X, 1)))                \
-    {                                                                  \
-      rtx x0 = XEXP (X, 0);                                            \
-      if (! flag_pic || ! SYMBOLIC_CONST (XEXP (X, 1)))                        \
-       { GO_IF_INDEXING (x0, ADDR); }                                  \
-      else if (x0 == pic_offset_table_rtx)                             \
-       goto ADDR;                                                      \
-      else if (GET_CODE (x0) == PLUS)                                  \
-       {                                                               \
-         if (XEXP (x0, 0) == pic_offset_table_rtx)                     \
-           { GO_IF_INDEXABLE_BASE (XEXP (x0, 1), ADDR); }              \
-         if (XEXP (x0, 1) == pic_offset_table_rtx)                     \
-           { GO_IF_INDEXABLE_BASE (XEXP (x0, 0), ADDR); }              \
-       }                                                               \
-    }                                                                  \
-}
-
-#undef GO_IF_LEGITIMATE_ADDRESS
-#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR)                                \
-{                                                                      \
-  if (! HALF_PIC_P ())                                                 \
-    {                                                                  \
-      GO_IF_LEGITIMATE_ADDRESS_ORIG(MODE, X, ADDR);                    \
-    }                                                                  \
-  else                                                                 \
-    {                                                                  \
-      if (CONSTANT_P (X) && ! HALF_PIC_ADDRESS_P (X))                  \
-       goto ADDR;                                                      \
-                                                                       \
-      GO_IF_INDEXING (X, ADDR);                                                \
-      if (GET_CODE (X) == PLUS)                                                \
-       {                                                               \
-         rtx x1 = XEXP (X, 1);                                         \
-                                                                       \
-         if (CONSTANT_P (x1) && ! HALF_PIC_ADDRESS_P (x1))             \
-           {                                                           \
-             rtx x0 = XEXP (X, 0);                                     \
-             GO_IF_INDEXING (x0, ADDR);                                \
-           }                                                           \
-       }                                                               \
-    }                                                                  \
-}
-
 /* Sometimes certain combinations of command options do not make sense
    on a particular target machine.  You can define a macro
    `OVERRIDE_OPTIONS' to take account of this.  This macro, if
    defined, is executed once just after all the command options have
    been parsed.  */
 
-#define OVERRIDE_OPTIONS                                               \
+#undef  SUBTARGET_OVERRIDE_OPTIONS
+#define SUBTARGET_OVERRIDE_OPTIONS                                     \
 {                                                                      \
   /*                                                                   \
   if (TARGET_ELF && TARGET_HALF_PIC)                                   \
@@ -261,7 +429,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
    function named by the symbol (such as what section it is in).
 
    The macro definition, if any, is executed immediately after the
-   rtl for DECL has been created and stored in `DECL_RTL (DECL)'. 
+   rtl for DECL has been created and stored in `DECL_RTL (DECL)'.
    The value of the rtl will be a `mem' whose address is a
    `symbol_ref'.
 
@@ -271,7 +439,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
    information).
 
    The best way to modify the name string is by adding text to the
-   beginning, with suitable punctuation to prevent any ambiguity. 
+   beginning, with suitable punctuation to prevent any ambiguity.
    Allocate the new name in `saveable_obstack'.  You will have to
    modify `ASM_OUTPUT_LABELREF' to remove and decode the added text
    and output the name accordingly.
@@ -284,12 +452,56 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #define ENCODE_SECTION_INFO(DECL)                                      \
 do                                                                     \
   {                                                                    \
-   if (HALF_PIC_P ())                                                  \
+   if (HALF_PIC_P ())                                                  \
       HALF_PIC_ENCODE (DECL);                                          \
+                                                                       \
+   else if (flag_pic)                                                  \
+     {                                                                 \
+       rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd'            \
+                 ? TREE_CST_RTL (DECL) : DECL_RTL (DECL));             \
+       SYMBOL_REF_FLAG (XEXP (rtl, 0))                                 \
+        = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd'                   \
+           || ! TREE_PUBLIC (DECL));                                   \
+      }                                                                        \
   }                                                                    \
 while (0)
 
 
+/* On most machines, read-only variables, constants, and jump tables
+   are placed in the text section.  If this is not the case on your
+   machine, this macro should be defined to be the name of a function
+   (either `data_section' or a function defined in `EXTRA_SECTIONS')
+   that switches to the section to be used for read-only items.
+
+   If these items should be placed in the text section, this macro
+   should not be defined.  */
+
+#if 0
+#undef READONLY_DATA_SECTION
+#define READONLY_DATA_SECTION()                                                \
+do                                                                     \
+  {                                                                    \
+    if (TARGET_ELF)                                                    \
+      {                                                                        \
+       if (in_section != in_rodata)                                    \
+         {                                                             \
+           fprintf (asm_out_file, "\t.section \"rodata\"\n");          \
+           in_section = in_rodata;                                     \
+         }                                                             \
+      }                                                                        \
+    else                                                               \
+      text_section ();                                                 \
+  }                                                                    \
+while (0)
+#endif
+
+/* A list of names for sections other than the standard two, which are
+   `in_text' and `in_data'.  You need not define this macro on a
+   system with no other sections (that GCC needs to use).  */
+
+#undef EXTRA_SECTIONS
+#define        EXTRA_SECTIONS in_rodata, in_data1
+
 /* Given a decl node or constant node, choose the section to output it in
    and select that section.  */
 
@@ -321,7 +533,10 @@ while (0)
   else if (TREE_CODE (DECL) != VAR_DECL)                               \
     readonly_data_section ();                                          \
                                                                        \
-  else if (!TREE_READONLY (DECL))                                      \
+  else if (!TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL)           \
+          || !DECL_INITIAL (DECL)                                      \
+          || (DECL_INITIAL (DECL) != error_mark_node                   \
+              && !TREE_CONSTANT (DECL_INITIAL (DECL))))                \
     data_section ();                                                   \
                                                                        \
   else                                                                 \
@@ -335,9 +550,15 @@ while (0)
    different pseudo-op names for these, they may be overridden in the
    file which includes this one.  */
 
-#define TYPE_ASM_OP    ".type"
-#define SIZE_ASM_OP    ".size"
-#define WEAK_ASM_OP    ".weak"
+#define TYPE_ASM_OP    "\t.type\t"
+#define SIZE_ASM_OP    "\t.size\t"
+#define SET_ASM_OP     "\t.set\t"
+
+/* This is how we tell the assembler that a symbol is weak.  */
+
+#define ASM_WEAKEN_LABEL(FILE,NAME) \
+  do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
+       fputc ('\n', FILE); } while (0)
 
 /* The following macro defines the format used to output the second
    operand of the .type assembler directive.  Different svr4 assemblers
@@ -350,7 +571,7 @@ while (0)
 /* A C statement (sans semicolon) to output to the stdio stream
    STREAM any text necessary for declaring the name NAME of an
    initialized variable which is being defined.  This macro must
-   output the label definition (perhaps using `ASM_OUTPUT_LABEL'). 
+   output the label definition (perhaps using `ASM_OUTPUT_LABEL').
    The argument DECL is the `VAR_DECL' tree node representing the
    variable.
 
@@ -358,28 +579,51 @@ while (0)
    in the usual manner as a label (by means of `ASM_OUTPUT_LABEL').  */
 
 #undef ASM_DECLARE_OBJECT_NAME
-#define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL)                    \
-do                                                                     \
- {                                                                     \
-   ASM_OUTPUT_LABEL(STREAM,NAME);                                       \
-   HALF_PIC_DECLARE (NAME);                                            \
-   if (TARGET_ELF)                                                     \
-     {                                                                 \
-       fprintf (STREAM, "\t%s\t ", TYPE_ASM_OP);                       \
-       assemble_name (STREAM, NAME);                                   \
-       putc (',', STREAM);                                             \
-       fprintf (STREAM, TYPE_OPERAND_FMT, "object");                   \
-       putc ('\n', STREAM);                                            \
-       if (!flag_inhibit_size_directive)                               \
-        {                                                              \
-          fprintf (STREAM, "\t%s\t ", SIZE_ASM_OP);                    \
-          assemble_name (STREAM, NAME);                                \
-          fprintf (STREAM, ",%d\n",  int_size_in_bytes (TREE_TYPE (decl))); \
-        }                                                              \
-     }                                                                 \
- }                                                                     \
+#define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL)                         \
+do                                                                          \
+ {                                                                          \
+   ASM_OUTPUT_LABEL(STREAM,NAME);                                           \
+   HALF_PIC_DECLARE (NAME);                                                 \
+   if (TARGET_ELF)                                                          \
+     {                                                                      \
+       fprintf (STREAM, "%s", TYPE_ASM_OP);                                \
+       assemble_name (STREAM, NAME);                                        \
+       putc (',', STREAM);                                                  \
+       fprintf (STREAM, TYPE_OPERAND_FMT, "object");                        \
+       putc ('\n', STREAM);                                                 \
+       size_directive_output = 0;                                           \
+       if (!flag_inhibit_size_directive && DECL_SIZE (DECL))                \
+        {                                                                   \
+           size_directive_output = 1;                                       \
+          fprintf (STREAM, "%s", SIZE_ASM_OP);                              \
+          assemble_name (STREAM, NAME);                                     \
+          fprintf (STREAM, ",%d\n",  int_size_in_bytes (TREE_TYPE (DECL))); \
+        }                                                                   \
+     }                                                                      \
+ }                                                                          \
 while (0)
 
+/* Output the size directive for a decl in rest_of_decl_compilation
+   in the case where we did not do so before the initializer.
+   Once we find the error_mark_node, we know that the value of
+   size_directive_output was set
+   by ASM_DECLARE_OBJECT_NAME when it was run for the same decl.  */
+
+#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END)        \
+do {                                                                    \
+     const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0);            \
+     if (TARGET_ELF                                                     \
+        && !flag_inhibit_size_directive && DECL_SIZE (DECL)             \
+         && ! AT_END && TOP_LEVEL                                       \
+        && DECL_INITIAL (DECL) == error_mark_node                       \
+        && !size_directive_output)                                      \
+       {                                                                \
+        fprintf (FILE, "%s", SIZE_ASM_OP);                              \
+        assemble_name (FILE, name);                                     \
+        fprintf (FILE, ",%d\n",  int_size_in_bytes (TREE_TYPE (DECL))); \
+       }                                                                \
+   } while (0)
+
 /* This is how to declare a function name. */
 
 #undef ASM_DECLARE_FUNCTION_NAME
@@ -390,7 +634,7 @@ do                                                                  \
    HALF_PIC_DECLARE (NAME);                                            \
    if (TARGET_ELF)                                                     \
      {                                                                 \
-       fprintf (STREAM, "\t%s\t ", TYPE_ASM_OP);                       \
+       fprintf (STREAM, "%s", TYPE_ASM_OP);                            \
        assemble_name (STREAM, NAME);                                   \
        putc (',', STREAM);                                             \
        fprintf (STREAM, TYPE_OPERAND_FMT, "function");                 \
@@ -420,7 +664,7 @@ do                                                                  \
        labelno++;                                                      \
        ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno);            \
        ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno);               \
-       fprintf (FILE, "/\t%s\t ", SIZE_ASM_OP);                        \
+       fprintf (FILE, "%s", SIZE_ASM_OP);                              \
        assemble_name (FILE, (FNAME));                                  \
         fprintf (FILE, ",");                                           \
        assemble_name (FILE, label);                                    \
@@ -431,86 +675,20 @@ do                                                                        \
   }                                                                    \
 while (0)
 
-/* Attach a special .ident directive to the end of the file to identify
-   the version of GCC which compiled this code.  The format of the
-   .ident string is patterned after the ones produced by native svr4
-   C compilers.  */
-
-#define IDENT_ASM_OP ".ident"
+#define IDENT_ASM_OP "\t.ident\t"
 
 /* Allow #sccs in preprocessor.  */
 
 #define SCCS_DIRECTIVE
 
 /* This says what to print at the end of the assembly file */
+#undef ASM_FILE_END
 #define ASM_FILE_END(STREAM)                                           \
 do                                                                     \
   {                                                                    \
     if (HALF_PIC_P ())                                                 \
       HALF_PIC_FINISH (STREAM);                                                \
-                                                                       \
-    if (TARGET_IDENT)                                                  \
-      {                                                                        \
-       fprintf ((STREAM), "\t%s\t\"GCC: (GNU) %s -O%d",                \
-                IDENT_ASM_OP, version_string, optimize);               \
-                                                                       \
-       if (write_symbols == PREFERRED_DEBUGGING_TYPE)                  \
-         fprintf ((STREAM), " -g%d", (int)debug_info_level);           \
-                                                                       \
-       else if (write_symbols == DBX_DEBUG)                            \
-         fprintf ((STREAM), " -gstabs%d", (int)debug_info_level);      \
-                                                                       \
-       else if (write_symbols == DWARF_DEBUG)                          \
-         fprintf ((STREAM), " -gdwarf%d", (int)debug_info_level);      \
-                                                                       \
-       else if (write_symbols != NO_DEBUG)                             \
-         fprintf ((STREAM), " -g??%d", (int)debug_info_level);         \
-                                                                       \
-       if (flag_omit_frame_pointer)                                    \
-         fprintf ((STREAM), " -fomit-frame-pointer");                  \
-                                                                       \
-       if (flag_strength_reduce)                                       \
-         fprintf ((STREAM), " -fstrength-reduce");                     \
-                                                                       \
-       if (flag_unroll_loops)                                          \
-         fprintf ((STREAM), " -funroll-loops");                        \
-                                                                       \
-       if (flag_force_mem)                                             \
-         fprintf ((STREAM), " -fforce-mem");                           \
-                                                                       \
-       if (flag_force_addr)                                            \
-         fprintf ((STREAM), " -fforce-addr");                          \
-                                                                       \
-       if (flag_inline_functions)                                      \
-         fprintf ((STREAM), " -finline-functions");                    \
-                                                                       \
-       if (flag_caller_saves)                                          \
-         fprintf ((STREAM), " -fcaller-saves");                        \
-                                                                       \
-       if (flag_pic)                                                   \
-         fprintf ((STREAM), (flag_pic > 1) ? " -fPIC" : " -fpic");     \
-                                                                       \
-       if (flag_inhibit_size_directive)                                \
-         fprintf ((STREAM), " -finhibit-size-directive");              \
-                                                                       \
-       if (flag_gnu_linker)                                            \
-         fprintf ((STREAM), " -fgnu-linker");                          \
-                                                                       \
-       if (profile_flag)                                               \
-         fprintf ((STREAM), " -p");                                    \
-                                                                       \
-       if (profile_block_flag)                                         \
-         fprintf ((STREAM), " -a");                                    \
-                                                                       \
-       if (TARGET_IEEE_FP)                                             \
-         fprintf ((STREAM), " -mieee-fp");                             \
-                                                                       \
-       if (TARGET_HALF_PIC)                                            \
-         fprintf ((STREAM), " -mhalf-pic");                            \
-                                                                       \
-       fprintf ((STREAM), (TARGET_486) ? " -m486" : " -m386");         \
-       fprintf ((STREAM), (TARGET_ELF) ? " -melf\"\n" : " -mrose\"\n"); \
-      }                                                                        \
+    ix86_asm_file_end (STREAM);                                                \
   }                                                                    \
 while (0)
 
@@ -518,80 +696,14 @@ while (0)
 #define OBJECT_FORMAT_ROSE
 
 /* Tell collect where the appropriate binaries are.  */
-#define REAL_LD_FILE_NAME      "/usr/ccs/gcc/gld"
-#define REAL_NM_FILE_NAME      "/usr/ccs/bin/nm"
+#define REAL_NM_FILE_NAME      "/usr/ccs/gcc/bfd-nm"
 #define REAL_STRIP_FILE_NAME   "/usr/ccs/bin/strip"
 
-/* Use atexit for static constructors/destructors, instead of defining
-   our own exit function.  */
-#define HAVE_ATEXIT
-
 /* Define this macro meaning that gcc should find the library 'libgcc.a'
    by hand, rather than passing the argument '-lgcc' to tell the linker
    to do the search */
 #define LINK_LIBGCC_SPECIAL
 
-/* A C statement to output assembler commands which will identify the object
-  file as having been compile with GNU CC. We don't need or want this for
-  OSF1. GDB doesn't need it and kdb doesn't like it */
-#define ASM_IDENTIFY_GCC(FILE)
-
-/* Identify the front-end which produced this file.  To keep symbol
-   space down, and not confuse kdb, only do this if the language is
-   not C.  */
-
-#define ASM_IDENTIFY_LANGUAGE(STREAM)                                  \
-{                                                                      \
-  if (strcmp (lang_identify (), "c") != 0)                             \
-    output_lang_identify (STREAM);                                     \
-}
-
-/* This is how to output an assembler line defining a `double' constant.
-   Use "word" pseudos to avoid printing NaNs, infinity, etc.  */
-
-/* This is how to output an assembler line defining a `double' constant.  */
-
-#undef ASM_OUTPUT_DOUBLE
-
-#ifndef        CROSS_COMPILE
-#define        ASM_OUTPUT_DOUBLE(STREAM, VALUE)                                \
-do                                                                     \
-  {                                                                    \
-    long value_long[2];                                                        \
-    REAL_VALUE_TO_TARGET_DOUBLE (VALUE, value_long);                   \
-                                                                       \
-    fprintf (STREAM, "\t.long\t0x%08lx\t\t# %.20g\n\t.long\t0x%08lx\n",        \
-          value_long[0], VALUE, value_long[1]);                        \
-  }                                                                    \
-while (0)
-
-#else
-#define        ASM_OUTPUT_DOUBLE(STREAM, VALUE)                                \
-  fprintf (STREAM, "\t.double\t%.20g\n", VALUE)
-#endif
-
-/* This is how to output an assembler line defining a `float' constant.  */
-
-#undef ASM_OUTPUT_FLOAT
-
-#ifndef        CROSS_COMPILE
-#define        ASM_OUTPUT_FLOAT(STREAM, VALUE)                                 \
-do                                                                     \
-  {                                                                    \
-    long value_long;                                                   \
-    REAL_VALUE_TO_TARGET_SINGLE (VALUE, value_long);                   \
-                                                                       \
-    fprintf (STREAM, "\t.long\t0x%08lx\t\t# %.12g (float)\n",          \
-          value_long, VALUE);                                          \
-  }                                                                    \
-while (0)
-
-#else
-#define        ASM_OUTPUT_FLOAT(STREAM, VALUE)                                 \
-  fprintf (STREAM, "\t.float\t%.12g\n", VALUE)
-#endif
-
-
 /* Generate calls to memcpy, etc., not bcopy, etc. */
 #define TARGET_MEM_FUNCTIONS
 
@@ -599,34 +711,10 @@ while (0)
    we want to retain compatibility with older gcc versions.  */
 #define DEFAULT_PCC_STRUCT_RETURN 0
 
-/* Map i386 registers to the numbers dwarf expects.  Of course this is different
-   from what stabs expects.  */
-
-#define DWARF_DBX_REGISTER_NUMBER(n) \
-((n) == 0 ? 0 \
- : (n) == 1 ? 2 \
- : (n) == 2 ? 1 \
- : (n) == 3 ? 3 \
- : (n) == 4 ? 6 \
- : (n) == 5 ? 7 \
- : (n) == 6 ? 5 \
- : (n) == 7 ? 4 \
- : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n)+3 \
- : (-1))
-
-/* Now what stabs expects in the register.  */
-#define STABS_DBX_REGISTER_NUMBER(n) \
-((n) == 0 ? 0 : \
- (n) == 1 ? 2 : \
- (n) == 2 ? 1 : \
- (n) == 3 ? 3 : \
- (n) == 4 ? 6 : \
- (n) == 5 ? 7 : \
- (n) == 6 ? 4 : \
- (n) == 7 ? 5 : \
- (n) + 4)
+/* Map i386 registers to the numbers dwarf expects.  Of course this is
+   different from what stabs expects.  */
 
 #undef DBX_REGISTER_NUMBER
-#define DBX_REGISTER_NUMBER(n) ((write_symbols == DWARF_DEBUG)         \
-                               ? DWARF_DBX_REGISTER_NUMBER(n)          \
-                               : STABS_DBX_REGISTER_NUMBER(n))
+#define DBX_REGISTER_NUMBER(n)  ((write_symbols == DWARF_DEBUG)        \
+                                ? svr4_dbx_register_map[n]     \
+                                : dbx_register_map[n])