OSDN Git Service

2003-01-26 Steven Bosscher <s.bosscher@student.tudelft.nl>
[pf3gnuchains/gcc-fork.git] / gcc / config / elfos.h
index ea11b65..5925d25 100644 (file)
@@ -1,6 +1,6 @@
 /* elfos.h  --  operating system specific defines to be used when
    targeting GCC for some generic ELF system
-   Copyright (C) 1991, 1994, 1995, 1999, 2000, 2001, 2002
+   Copyright (C) 1991, 1994, 1995, 1999, 2000, 2001, 2002, 2003
    Free Software Foundation, Inc.
    Based on svr4.h contributed by Ron Guilmette (rfg@netcom.com).
 
@@ -46,9 +46,11 @@ Boston, MA 02111-1307, USA.  */
 
 #define NO_DOLLAR_IN_LABEL
 
-/* Writing `int' for a bitfield forces int alignment for the structure.  */
+/* Writing `int' for a bit-field forces int alignment for the structure.  */
 
+#ifndef PCC_BITFIELD_TYPE_MATTERS
 #define PCC_BITFIELD_TYPE_MATTERS 1
+#endif
 
 /* Implicit library calls should use memcpy, not bcopy, etc.  */
 
@@ -56,19 +58,15 @@ Boston, MA 02111-1307, USA.  */
 
 /* Handle #pragma weak and #pragma pack.  */
 
-#define HANDLE_SYSV_PRAGMA
+#define HANDLE_SYSV_PRAGMA 1
 
 /* System V Release 4 uses DWARF debugging info.  */
 
-#ifndef DWARF_DEBUGGING_INFO
 #define DWARF_DEBUGGING_INFO 1
-#endif
 
 /* All ELF targets can support DWARF-2.  */
 
-#ifndef DWARF2_DEBUGGING_INFO
 #define DWARF2_DEBUGGING_INFO 1
-#endif
 
 /* The GNU tools operate better with dwarf2, and it is required by some
    psABI's.  Since we don't have any native tools to be compatible with,
@@ -112,20 +110,6 @@ Boston, MA 02111-1307, USA.  */
 #define ASM_OUTPUT_SKIP(FILE, SIZE) \
   fprintf (FILE, "%s%u\n", SKIP_ASM_OP, (SIZE))
 
-/* This is how to output an internal numbered label where
-   PREFIX is the class of label and NUM is the number within the class.
-
-   For most svr4 systems, the convention is that any symbol which begins
-   with a period is not put into the linker symbol table by the assembler.  */
-
-#undef  ASM_OUTPUT_INTERNAL_LABEL
-#define ASM_OUTPUT_INTERNAL_LABEL(FILE, PREFIX, NUM)           \
-  do                                                           \
-    {                                                          \
-      fprintf (FILE, ".%s%u:\n", PREFIX, (unsigned) (NUM));    \
-    }                                                          \
-  while (0)
-
 /* This is how to store into the string LABEL
    the symbol_ref name of an internal numbered label where
    PREFIX is the class of label and NUM is the number within the class.
@@ -163,7 +147,7 @@ Boston, MA 02111-1307, USA.  */
   do                                                                   \
     {                                                                  \
       ASM_OUTPUT_BEFORE_CASE_LABEL (FILE, PREFIX, NUM, JUMPTABLE)      \
-       ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM);                  \
+       (*targetm.asm_out.internal_label) (FILE, PREFIX, NUM);                  \
     }                                                                  \
   while (0)
 
@@ -172,7 +156,7 @@ Boston, MA 02111-1307, USA.  */
    in each assembly file where they are referenced.  */
 
 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
-  ASM_GLOBALIZE_LABEL (FILE, XSTR (FUN, 0))
+  (*targetm.asm_out.globalize_label) (FILE, XSTR (FUN, 0))
 
 /* This says how to output assembler code to declare an
    uninitialized external linkage data object.  Under SVR4,
@@ -216,10 +200,8 @@ Boston, MA 02111-1307, USA.  */
 #undef  ASCII_DATA_ASM_OP
 #define ASCII_DATA_ASM_OP      "\t.ascii\t"
 
-/* Support const sections and the ctors and dtors sections for g++.  */
-
-#define USE_CONST_SECTION      1
-#define CONST_SECTION_ASM_OP   "\t.section\t.rodata"
+/* Support a read-only data section.  */
+#define READONLY_DATA_SECTION_ASM_OP   "\t.section\t.rodata"
 
 /* On svr4, we *do* have support for the .init and .fini sections, and we
    can put stuff in there to be executed before and after `main'.  We let
@@ -230,64 +212,20 @@ Boston, MA 02111-1307, USA.  */
 #define INIT_SECTION_ASM_OP    "\t.section\t.init"
 #define FINI_SECTION_ASM_OP    "\t.section\t.fini"
 
-#ifdef HAVE_GAS_SUBSECTION_ORDERING
-
-#define ASM_SECTION_START_OP   "\t.subsection\t-1"
-
 /* Output assembly directive to move to the beginning of current section.  */
-#define ASM_OUTPUT_SECTION_START(FILE) \
+#ifdef HAVE_GAS_SUBSECTION_ORDERING
+# define ASM_SECTION_START_OP  "\t.subsection\t-1"
+# define ASM_OUTPUT_SECTION_START(FILE)        \
   fprintf ((FILE), "%s\n", ASM_SECTION_START_OP)
-
 #endif
 
-/* A default list of other sections which we might be "in" at any given
-   time.  For targets that use additional sections (e.g. .tdesc) you
-   should override this definition in the target-specific file which
-   includes this file.  */
-
-#undef  EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_const
-
-/* A default list of extra section function definitions.  For targets
-   that use additional sections (e.g. .tdesc) you should override this
-   definition in the target-specific file which includes this file.  */
-
-#undef  EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS                \
-  CONST_SECTION_FUNCTION
-
-#define READONLY_DATA_SECTION() const_section ()
-
-#define CONST_SECTION_FUNCTION                                 \
-void                                                           \
-const_section ()                                               \
-{                                                              \
-  if (!USE_CONST_SECTION)                                      \
-    text_section ();                                           \
-  else if (in_section != in_const)                             \
-    {                                                          \
-      fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP);    \
-      in_section = in_const;                                   \
-    }                                                          \
-}
-
 #define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
-     
+
 /* Switch into a generic section.  */
 #define TARGET_ASM_NAMED_SECTION  default_elf_asm_named_section
 
-/* A C statement or statements to switch to the appropriate
-   section for output of RTX in mode MODE.  RTX is some kind
-   of constant in RTL.  The argument MODE is redundant except
-   in the case of a `const_int' rtx.
-   If assembler supports SHF_MERGE sections, put it into
-   a .rodata.cstN section where N is size of the constant,
-   otherwise into const section.  */
-
-#undef  SELECT_RTX_SECTION
-#define SELECT_RTX_SECTION(MODE, RTX, ALIGN)   \
-  mergeable_constant_section ((MODE), (ALIGN), 0)
-
+#undef  TARGET_ASM_SELECT_RTX_SECTION
+#define TARGET_ASM_SELECT_RTX_SECTION default_elf_select_rtx_section
 #undef TARGET_ASM_SELECT_SECTION
 #define TARGET_ASM_SELECT_SECTION default_elf_select_section
 
@@ -302,11 +240,11 @@ const_section ()                                          \
 
 /* This is how we tell the assembler that a symbol is weak.  */
 
-#define ASM_WEAKEN_LABEL(FILE, NAME)   \
+#define ASM_WEAKEN_LABEL(FILE, NAME)   \
   do                                   \
     {                                  \
       fputs ("\t.weak\t", (FILE));     \
-      assemble_name ((FILE), (NAME));  \
+      assemble_name ((FILE), (NAME));  \
       fputc ('\n', (FILE));            \
     }                                  \
   while (0)
@@ -337,18 +275,13 @@ const_section ()                                          \
    function's return value.  We allow for that here.  */
 
 #ifndef ASM_DECLARE_FUNCTION_NAME
-#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)    \
-  do                                                   \
-    {                                                  \
-      fprintf (FILE, "%s", TYPE_ASM_OP);               \
-      assemble_name (FILE, NAME);                      \
-      putc (',', FILE);                                        \
-      fprintf (FILE, TYPE_OPERAND_FMT, "function");    \
-      putc ('\n', FILE);                               \
-                                                       \
-      ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL));   \
-      ASM_OUTPUT_LABEL(FILE, NAME);                    \
-    }                                                  \
+#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)            \
+  do                                                           \
+    {                                                          \
+      ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function");      \
+      ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL));           \
+      ASM_OUTPUT_LABEL (FILE, NAME);                           \
+    }                                                          \
   while (0)
 #endif
 
@@ -357,26 +290,19 @@ const_section ()                                          \
 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL)              \
   do                                                           \
     {                                                          \
-      fprintf (FILE, "%s", TYPE_ASM_OP);                       \
-      assemble_name (FILE, NAME);                              \
-      putc (',', FILE);                                                \
-      fprintf (FILE, TYPE_OPERAND_FMT, "object");              \
-      putc ('\n', FILE);                                       \
-                                                               \
+      HOST_WIDE_INT size;                                      \
+                                                               \
+      ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object");                \
+                                                               \
       size_directive_output = 0;                               \
-                                                               \
       if (!flag_inhibit_size_directive                         \
          && (DECL) && DECL_SIZE (DECL))                        \
        {                                                       \
          size_directive_output = 1;                            \
-         fprintf (FILE, "%s", SIZE_ASM_OP);                    \
-         assemble_name (FILE, NAME);                           \
-         putc (',', FILE);                                     \
-         fprintf (FILE, HOST_WIDE_INT_PRINT_DEC,               \
-                  int_size_in_bytes (TREE_TYPE (DECL)));       \
-         fputc ('\n', FILE);                                   \
+         size = int_size_in_bytes (TREE_TYPE (DECL));          \
+         ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size);         \
        }                                                       \
-                                                               \
+                                                               \
       ASM_OUTPUT_LABEL (FILE, NAME);                           \
     }                                                          \
   while (0)
@@ -387,11 +313,13 @@ const_section ()                                          \
    size_directive_output was set
    by ASM_DECLARE_OBJECT_NAME when it was run for the same decl.  */
 
+#undef ASM_FINISH_DECLARE_OBJECT
 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END)\
   do                                                           \
     {                                                          \
       const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0);  \
-                                                               \
+      HOST_WIDE_INT size;                                      \
+                                                               \
       if (!flag_inhibit_size_directive                         \
          && DECL_SIZE (DECL)                                   \
          && ! AT_END && TOP_LEVEL                              \
@@ -399,12 +327,8 @@ const_section ()                                           \
          && !size_directive_output)                            \
        {                                                       \
          size_directive_output = 1;                            \
-         fprintf (FILE, "%s", SIZE_ASM_OP);                    \
-         assemble_name (FILE, name);                           \
-         putc (',', FILE);                                     \
-         fprintf (FILE, HOST_WIDE_INT_PRINT_DEC,               \
-                  int_size_in_bytes (TREE_TYPE (DECL)));       \
-         fputc ('\n', FILE);                                   \
+         size = int_size_in_bytes (TREE_TYPE (DECL));          \
+         ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size);         \
        }                                                       \
     }                                                          \
   while (0)
@@ -415,23 +339,7 @@ const_section ()                                           \
   do                                                           \
     {                                                          \
       if (!flag_inhibit_size_directive)                                \
-       {                                                       \
-         char label[256];                                      \
-         static int labelno;                                   \
-                                                               \
-         labelno++;                                            \
-                                                               \
-         ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno);  \
-         ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno);     \
-                                                               \
-         fprintf (FILE, "%s", SIZE_ASM_OP);                    \
-         assemble_name (FILE, (FNAME));                        \
-         fprintf (FILE, ",");                                  \
-         assemble_name (FILE, label);                          \
-         fprintf (FILE, "-");                                  \
-         assemble_name (FILE, (FNAME));                        \
-         putc ('\n', FILE);                                    \
-       }                                                       \
+       ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME);                 \
     }                                                          \
   while (0)
 #endif
@@ -481,7 +389,7 @@ const_section ()                                            \
    generated assembly code more compact (and thus faster to assemble)
    as well as more readable, especially for targets like the i386
    (where the only alternative is to output character sequences as
-   comma separated lists of numbers).   */
+   comma separated lists of numbers).  */
 
 #define ASM_OUTPUT_LIMITED_STRING(FILE, STR)           \
   do                                                   \
@@ -489,13 +397,13 @@ const_section ()                                          \
       register const unsigned char *_limited_str =     \
        (const unsigned char *) (STR);                  \
       register unsigned ch;                            \
-                                                       \
+                                                       \
       fprintf ((FILE), "%s\"", STRING_ASM_OP);         \
-                                                       \
+                                                       \
       for (; (ch = *_limited_str); _limited_str++)     \
         {                                              \
          register int escape;                          \
-                                                       \
+                                                       \
          switch (escape = ESCAPES[ch])                 \
            {                                           \
            case 0:                                     \
@@ -510,7 +418,7 @@ const_section ()                                            \
              break;                                    \
            }                                           \
         }                                              \
-                                                       \
+                                                       \
       fprintf ((FILE), "\"\n");                                \
     }                                                  \
   while (0)
@@ -534,16 +442,16 @@ const_section ()                                          \
       for (; _ascii_bytes < limit; _ascii_bytes++)                     \
         {                                                              \
          register const unsigned char *p;                              \
-                                                                       \
+                                                                       \
          if (bytes_in_chunk >= 60)                                     \
            {                                                           \
              fprintf ((FILE), "\"\n");                                 \
              bytes_in_chunk = 0;                                       \
            }                                                           \
-                                                                       \
+                                                                       \
          for (p = _ascii_bytes; p < limit && *p != '\0'; p++)          \
            continue;                                                   \
-                                                                       \
+                                                                       \
          if (p < limit && (p - _ascii_bytes) <= (long)STRING_LIMIT)    \
            {                                                           \
              if (bytes_in_chunk > 0)                                   \
@@ -551,7 +459,7 @@ const_section ()                                            \
                  fprintf ((FILE), "\"\n");                             \
                  bytes_in_chunk = 0;                                   \
                }                                                       \
-                                                                       \
+                                                                       \
              ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes);         \
              _ascii_bytes = p;                                         \
            }                                                           \
@@ -559,10 +467,10 @@ const_section ()                                          \
            {                                                           \
              register int escape;                                      \
              register unsigned ch;                                     \
-                                                                       \
+                                                                       \
              if (bytes_in_chunk == 0)                                  \
                fprintf ((FILE), "%s\"", ASCII_DATA_ASM_OP);            \
-                                                                       \
+                                                                       \
              switch (escape = ESCAPES[ch = *_ascii_bytes])             \
                {                                                       \
                case 0:                                                 \
@@ -581,7 +489,7 @@ const_section ()                                            \
                }                                                       \
            }                                                           \
        }                                                               \
-                                                                       \
+                                                                       \
       if (bytes_in_chunk > 0)                                          \
         fprintf ((FILE), "\"\n");                                      \
     }                                                                  \