osf.h: Standarize copyright statement.
[gcc.git] / gcc / config / arm / coff.h
index 44108ce28e592b7d8f25ef4f3b24b929eca46a0b..6884029b5c45d44d4e1d66169dc08e17b5b63dec 100644 (file)
@@ -1,7 +1,8 @@
-/* Definitions of target machine for GNU compiler,
-   for ARM with COFF obj format.
-   Copyright (C) 1995, 1996 Free Software Foundation, Inc.
-   Contributed by Doug Evans (dje@cygnus.com).
+/* Definitions of target machine for GNU compiler.
+   For ARM with COFF object format.
+   Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000
+   Free Software Foundation, Inc.
+   Contributed by Doug Evans (devans@cygnus.com).
    
 This file is part of GNU CC.
 
@@ -20,35 +21,31 @@ 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.  */
 
-#include "arm/semi.h"
+#include "semi.h"
+#include "aout.h"
+
+/* Note - it is important that this definition matches the one in tcoff.h */
+#undef  USER_LABEL_PREFIX
+#define USER_LABEL_PREFIX "_"
+
 \f
 /* Run-time Target Specification.  */
-#undef TARGET_VERSION
+#undef  TARGET_VERSION
 #define TARGET_VERSION fputs (" (ARM/coff)", stderr)
 
-/* ??? Maybe use --with{enable?}-fpu or some such to make hardware floating
-   point the default.  NOT --nfp!  --with{enable?} is supposed to replace it
-   (right?), so let's stop using it.  */
-#undef TARGET_DEFAULT
-#define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT /*+ TARGET_CPU_DEFAULT*/)
-
-/* ??? Is a big-endian default intended to be supported?  */
-#if 0 /*TARGET_CPU_DEFAULT & ARM_FLAG_BIG_END*/
-#define MULTILIB_DEFAULTS { "mbe", "mbig-endian" }
-#else
-#define MULTILIB_DEFAULTS { "mle", "mlittle-endian" }
+#undef  TARGET_DEFAULT
+#define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32 | ARM_FLAG_APCS_FRAME)
+
+#ifndef MULTILIB_DEFAULTS
+#define MULTILIB_DEFAULTS \
+  { "marm", "mlittle-endian", "msoft-float", "mapcs-32", "mno-thumb-interwork" }
 #endif
 \f
-/* ??? Does arm.h really need to set this to 32?  */
-#undef STRUCTURE_SIZE_BOUNDARY
-#define STRUCTURE_SIZE_BOUNDARY 8
-\f
 /* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS
    is a valid machine specific attribute for DECL.
    The attributes in ATTRIBUTES have previously been assigned to DECL.  */
-extern int arm_valid_machine_decl_attribute ();
 #define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) \
-arm_valid_machine_decl_attribute (DECL, ATTRIBUTES, IDENTIFIER, ARGS)
+  arm_valid_machine_decl_attribute (DECL, IDENTIFIER, ARGS)
 \f
 /* This is COFF, but prefer stabs.  */
 #define SDB_DEBUGGING_INFO
@@ -57,9 +54,6 @@ arm_valid_machine_decl_attribute (DECL, ATTRIBUTES, IDENTIFIER, ARGS)
 
 #include "dbxcoff.h"
 \f
-#undef LOCAL_LABEL_PREFIX
-#define LOCAL_LABEL_PREFIX "."
-
 /* A C statement to output assembler commands which will identify the
    object file as having been compiled with GNU CC (or another GNU
    compiler).  */
@@ -68,31 +62,36 @@ arm_valid_machine_decl_attribute (DECL, ATTRIBUTES, IDENTIFIER, ARGS)
    Also, when using stabs, gcc2_compiled must be a stabs entry, not an
    ordinary symbol, or gdb won't see it.  The stabs entry must be
    before the N_SO in order for gdb to find it.  */
-#define ASM_IDENTIFY_GCC(STREAM)
+#define ASM_IDENTIFY_GCC(STREAM)                               \
+  fprintf (STREAM, "%sgcc2_compiled.:\n", LOCAL_LABEL_PREFIX )
 
 /* This outputs a lot of .req's to define alias for various registers.
    Let's try to avoid this.  */
 #undef ASM_FILE_START
-#define ASM_FILE_START(STREAM) \
-do {                                                           \
-  extern char *version_string;                                 \
-  fprintf (STREAM, "%s Generated by gcc %s for ARM/coff\n",    \
-          ASM_COMMENT_START, version_string);                  \
-} while (0)
-
-/* A C statement to output something to the assembler file to switch to section
-   NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
+#define ASM_FILE_START(STREAM)                                 \
+  do                                                           \
+    {                                                          \
+      fprintf (STREAM, "%s Generated by gcc %s for ARM/coff\n",        \
+              ASM_COMMENT_START, version_string);              \
+      fprintf (STREAM, ASM_APP_OFF);                           \
+    }                                                          \
+  while (0)
+
+/* A C statement to output something to the assembler file to switch to
+   section NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
    NULL_TREE.  Some target formats do not support arbitrary sections.  Do not
    define this macro in such cases.  */
-#define ASM_OUTPUT_SECTION_NAME(STREAM, DECL, NAME) \
-do {                                                           \
-  if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL)             \
-    fprintf (STREAM, "\t.section %s,\"x\"\n", (NAME));         \
-  else if ((DECL) && TREE_READONLY (DECL))                     \
-    fprintf (STREAM, "\t.section %s,\"\"\n", (NAME));          \
-  else                                                         \
-    fprintf (STREAM, "\t.section %s,\"w\"\n", (NAME));         \
-} while (0)
+#define ASM_OUTPUT_SECTION_NAME(STREAM, DECL, NAME, RELOC)     \
+  do                                                           \
+    {                                                          \
+      if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL)         \
+        fprintf (STREAM, "\t.section %s,\"x\"\n", (NAME));     \
+      else if ((DECL) && DECL_READONLY_SECTION (DECL, RELOC))  \
+        fprintf (STREAM, "\t.section %s,\"\"\n", (NAME));      \
+      else                                                     \
+        fprintf (STREAM, "\t.section %s,\"w\"\n", (NAME));     \
+    }                                                          \
+  while (0)
 \f
 /* Support the ctors/dtors and other sections.  */
 
@@ -101,16 +100,15 @@ do {                                                              \
 /* Define this macro if jump tables (for `tablejump' insns) should be
    output in the text section, along with the assembler instructions.
    Otherwise, the readonly data section is used.  */
-#define JUMP_TABLES_IN_TEXT_SECTION
+#define JUMP_TABLES_IN_TEXT_SECTION 1
 
-#undef READONLY_DATA_SECTION
+#undef  READONLY_DATA_SECTION
 #define READONLY_DATA_SECTION  rdata_section
-#undef RDATA_SECTION_ASM_OP
+#undef  RDATA_SECTION_ASM_OP
 #define RDATA_SECTION_ASM_OP   "\t.section .rdata"
-
-#undef CTORS_SECTION_ASM_OP
+#undef  CTORS_SECTION_ASM_OP
 #define CTORS_SECTION_ASM_OP   "\t.section .ctors,\"x\""
-#undef DTORS_SECTION_ASM_OP
+#undef  DTORS_SECTION_ASM_OP
 #define DTORS_SECTION_ASM_OP   "\t.section .dtors,\"x\""
 
 /* A list of other sections which the compiler might be "in" at any
@@ -133,63 +131,67 @@ do {                                                              \
 #define SUBTARGET_EXTRA_SECTION_FUNCTIONS
 
 #define RDATA_SECTION_FUNCTION \
-void                                                                   \
-rdata_section ()                                                       \
-{                                                                      \
-  if (in_section != in_rdata)                                          \
-    {                                                                  \
-      fprintf (asm_out_file, "%s\n", RDATA_SECTION_ASM_OP);            \
-      in_section = in_rdata;                                           \
-    }                                                                  \
+void                                                           \
+rdata_section ()                                               \
+{                                                              \
+  if (in_section != in_rdata)                                  \
+    {                                                          \
+      fprintf (asm_out_file, "%s\n", RDATA_SECTION_ASM_OP);    \
+      in_section = in_rdata;                                   \
+    }                                                          \
 }
 
 #define CTORS_SECTION_FUNCTION \
-void                                                                   \
-ctors_section ()                                                       \
-{                                                                      \
-  if (in_section != in_ctors)                                          \
-    {                                                                  \
-      fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP);            \
-      in_section = in_ctors;                                           \
-    }                                                                  \
+void                                                           \
+ctors_section ()                                               \
+{                                                              \
+  if (in_section != in_ctors)                                  \
+    {                                                          \
+      fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP);    \
+      in_section = in_ctors;                                   \
+    }                                                          \
 }
 
 #define DTORS_SECTION_FUNCTION \
-void                                                                   \
-dtors_section ()                                                       \
-{                                                                      \
-  if (in_section != in_dtors)                                          \
-    {                                                                  \
-      fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP);            \
-      in_section = in_dtors;                                           \
-    }                                                                  \
+void                                                           \
+dtors_section ()                                               \
+{                                                              \
+  if (in_section != in_dtors)                                  \
+    {                                                          \
+      fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP);    \
+      in_section = in_dtors;                                   \
+    }                                                          \
 }
 \f
 /* Support the ctors/dtors sections for g++.  */
 
-#define INT_ASM_OP ".word"
+#define INT_ASM_OP "\t.word\t"
 
 /* A C statement (sans semicolon) to output an element in the table of
    global constructors.  */
 #undef ASM_OUTPUT_CONSTRUCTOR
-#define ASM_OUTPUT_CONSTRUCTOR(STREAM,NAME) \
-do {                                           \
-  ctors_section ();                            \
-  fprintf (STREAM, "\t%s\t ", INT_ASM_OP);     \
-  assemble_name (STREAM, NAME);                        \
-  fprintf (STREAM, "\n");                      \
-} while (0)
+#define ASM_OUTPUT_CONSTRUCTOR(STREAM, NAME)   \
+  do                                           \
+    {                                          \
+      ctors_section ();                                \
+      fprintf (STREAM, "%s", INT_ASM_OP);      \
+      assemble_name (STREAM, NAME);            \
+      fprintf (STREAM, "\n");                  \
+    }                                          \
+  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(STREAM,NAME) \
-do {                                           \
-  dtors_section ();                            \
-  fprintf (STREAM, "\t%s\t ", INT_ASM_OP);     \
-  assemble_name (STREAM, NAME);                \
-  fprintf (STREAM, "\n");                      \
-} while (0)
+#define ASM_OUTPUT_DESTRUCTOR(STREAM, NAME)    \
+  do                                           \
+    {                                          \
+      dtors_section ();                                \
+      fprintf (STREAM, "%s", INT_ASM_OP);      \
+      assemble_name (STREAM, NAME);            \
+      fprintf (STREAM, "\n");                  \
+    }                                          \
+  while (0)
 
 /* __CTOR_LIST__ and __DTOR_LIST__ must be defined by the linker script.  */
 #define CTOR_LISTS_DEFINED_EXTERNALLY
@@ -197,10 +199,14 @@ do {                                              \
 #undef DO_GLOBAL_CTORS_BODY
 #undef DO_GLOBAL_DTORS_BODY
 
-/* The ARM development system has atexit and doesn't have _exit,
-   so define this for now.  */
+/* If you don't define HAVE_ATEXIT, and the object file format/OS/whatever 
+   does not support constructors/destructors, then gcc implements destructors
+   by defining its own exit function, which calls the destructors.  This gcc
+   exit function overrides the C library's exit function, and this can cause
+   all kinds of havoc if the C library has a non-trivial exit function.  You
+   really don't want to use the exit function in libgcc2.c.  */
 #define HAVE_ATEXIT
 
 /* The ARM development system defines __main.  */
-#define NAME__MAIN "__gccmain"
+#define NAME__MAIN  "__gccmain"
 #define SYMBOL__MAIN __gccmain