OSDN Git Service

* pa64-hpux.h (LIB_SPEC): Handle -rdynamic.
[pf3gnuchains/gcc-fork.git] / gcc / config / elfos.h
index cd20878..56d7b40 100644 (file)
@@ -1,26 +1,36 @@
 /* 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
-   Free Software Foundation, Inc.
+   Copyright (C) 1991, 1994, 1995, 1999, 2000, 2001, 2002, 2003, 2004,
+   2007, 2009 Free Software Foundation, Inc.
    Based on svr4.h contributed by Ron Guilmette (rfg@netcom.com).
 
-This file is part of GNU CC.
+This file is part of GCC.
 
-GNU CC is free software; you can redistribute it and/or modify
+GCC is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
+the Free Software Foundation; either version 3, or (at your option)
 any later version.
 
-GNU CC is distributed in the hope that it will be useful,
+GCC is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING.  If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
 
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+<http://www.gnu.org/licenses/>.  */
+
+#define TARGET_OBJFMT_CPP_BUILTINS()           \
+  do                                           \
+    {                                          \
+       builtin_define ("__ELF__");             \
+    }                                          \
+  while (0)
 
 /* Define a symbol indicating that we are using elfos.h.
    Some CPU specific configuration files use this.  */
@@ -34,33 +44,30 @@ Boston, MA 02111-1307, USA.  */
 #undef  USER_LABEL_PREFIX
 #define USER_LABEL_PREFIX ""
 
-/* Biggest alignment supported by the object file format of this
-   machine.  Use this macro to limit the alignment which can be
-   specified using the `__attribute__ ((aligned (N)))' construct.  If
-   not defined, the default value is `BIGGEST_ALIGNMENT'.  */
+/* The biggest alignment supported by ELF in bits. 32-bit ELF 
+   supports section alignment up to (0x80000000 * 8), while 
+   64-bit ELF supports (0x8000000000000000 * 8). If this macro 
+   is not defined, the default is the largest alignment supported 
+   by 32-bit ELF and representable on a 32-bit host. Use this
+   macro to limit the alignment which can be specified using
+   the `__attribute__ ((aligned (N)))' construct.  */
 #ifndef MAX_OFILE_ALIGNMENT
-#define MAX_OFILE_ALIGNMENT (32768 * 8)
+#define MAX_OFILE_ALIGNMENT (((unsigned int) 1 << 28) * 8)
 #endif
 
 /* Use periods rather than dollar signs in special g++ assembler names.  */
 
 #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
-
-/* Implicit library calls should use memcpy, not bcopy, etc.  */
-
-#define TARGET_MEM_FUNCTIONS
+#endif
 
 /* Handle #pragma weak and #pragma pack.  */
 
-#define HANDLE_SYSV_PRAGMA
-
-/* System V Release 4 uses DWARF debugging info.  */
-
-#define DWARF_DEBUGGING_INFO 1
+#define HANDLE_SYSV_PRAGMA 1
 
 /* All ELF targets can support DWARF-2.  */
 
@@ -88,16 +95,9 @@ Boston, MA 02111-1307, USA.  */
 #undef  SET_ASM_OP
 #define SET_ASM_OP     "\t.set\t"
 
-/* This is how to begin an assembly language file.  Most svr4 assemblers want
-   at least a .file directive to come first, and some want to see a .version
-   directive come right after that.  Here we just establish a default
-   which generates only the .file directive.  If you need a .version
-   directive for any specific target, you should override this definition
-   in the target-specific file which includes this one.  */
-
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE)                            \
-  output_file_directive ((FILE), main_input_filename)
+/* Most svr4 assemblers want a .file directive at the beginning of
+   their input file.  */
+#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
 
 /* This is how to allocate empty space in some section.  The .zero
    pseudo-op is used for this on most svr4 assemblers.  */
@@ -106,21 +106,8 @@ Boston, MA 02111-1307, USA.  */
 
 #undef  ASM_OUTPUT_SKIP
 #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)
+   fprintf ((FILE), "%s"HOST_WIDE_INT_PRINT_UNSIGNED"\n",\
+           SKIP_ASM_OP, (SIZE))
 
 /* This is how to store into the string LABEL
    the symbol_ref name of an internal numbered label where
@@ -159,7 +146,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)
 
@@ -183,7 +170,8 @@ Boston, MA 02111-1307, USA.  */
     {                                                                  \
       fprintf ((FILE), "%s", COMMON_ASM_OP);                           \
       assemble_name ((FILE), (NAME));                                  \
-      fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT);   \
+      fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n",         \
+              (SIZE), (ALIGN) / BITS_PER_UNIT);                        \
     }                                                                  \
   while (0)
 
@@ -232,7 +220,7 @@ Boston, MA 02111-1307, USA.  */
 #endif
 
 #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
 
@@ -240,6 +228,8 @@ Boston, MA 02111-1307, USA.  */
 #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
+#undef  TARGET_HAVE_SWITCHABLE_BSS_SECTIONS
+#define TARGET_HAVE_SWITCHABLE_BSS_SECTIONS true
 
 /* Define the strings used for the special svr4 .type and .size directives.
    These strings generally do not vary from one system running svr4 to
@@ -252,11 +242,11 @@ Boston, MA 02111-1307, USA.  */
 
 /* 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)
@@ -299,24 +289,37 @@ Boston, MA 02111-1307, USA.  */
 
 /* Write the extra assembler code needed to declare an object properly.  */
 
-#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL)              \
-  do                                                           \
-    {                                                          \
-      HOST_WIDE_INT size;                                      \
-                                                               \
-      ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object");                \
-                                                               \
-      size_directive_output = 0;                               \
-      if (!flag_inhibit_size_directive                         \
-         && (DECL) && DECL_SIZE (DECL))                        \
-       {                                                       \
-         size_directive_output = 1;                            \
-         size = int_size_in_bytes (TREE_TYPE (DECL));          \
-         ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size);         \
-       }                                                       \
-                                                               \
-      ASM_OUTPUT_LABEL (FILE, NAME);                           \
-    }                                                          \
+#ifdef HAVE_GAS_GNU_UNIQUE_OBJECT
+#define USE_GNU_UNIQUE_OBJECT 1
+#else
+#define USE_GNU_UNIQUE_OBJECT 0
+#endif
+
+#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL)                      \
+  do                                                                   \
+    {                                                                  \
+      HOST_WIDE_INT size;                                              \
+                                                                       \
+      /* For template static data member instantiations or             \
+        inline fn local statics, use gnu_unique_object so that         \
+        they will be combined even under RTLD_LOCAL.  */               \
+      if (USE_GNU_UNIQUE_OBJECT                                                \
+         && !DECL_ARTIFICIAL (DECL) && DECL_ONE_ONLY (DECL))           \
+       ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "gnu_unique_object");    \
+      else                                                             \
+       ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object");               \
+                                                                       \
+      size_directive_output = 0;                                       \
+      if (!flag_inhibit_size_directive                                 \
+         && (DECL) && DECL_SIZE (DECL))                                \
+       {                                                               \
+         size_directive_output = 1;                                    \
+         size = int_size_in_bytes (TREE_TYPE (DECL));                  \
+         ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size);                 \
+       }                                                               \
+                                                                       \
+      ASM_OUTPUT_LABEL (FILE, NAME);                                   \
+    }                                                                  \
   while (0)
 
 /* Output the size directive for a decl in rest_of_decl_compilation
@@ -325,12 +328,13 @@ Boston, MA 02111-1307, USA.  */
    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                              \
@@ -400,7 +404,7 @@ Boston, MA 02111-1307, USA.  */
    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                                                   \
@@ -408,13 +412,13 @@ Boston, MA 02111-1307, USA.  */
       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:                                     \
@@ -429,7 +433,7 @@ Boston, MA 02111-1307, USA.  */
              break;                                    \
            }                                           \
         }                                              \
-                                                       \
+                                                       \
       fprintf ((FILE), "\"\n");                                \
     }                                                  \
   while (0)
@@ -445,24 +449,31 @@ Boston, MA 02111-1307, USA.  */
 #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH)                            \
   do                                                                   \
     {                                                                  \
-      register const unsigned char *_ascii_bytes =                     \
+      const unsigned char *_ascii_bytes =                              \
        (const unsigned char *) (STR);                                  \
-      register const unsigned char *limit = _ascii_bytes + (LENGTH);   \
-      register unsigned bytes_in_chunk = 0;                            \
+      const unsigned char *limit = _ascii_bytes + (LENGTH);            \
+      const unsigned char *last_null = NULL;                           \
+      unsigned bytes_in_chunk = 0;                                     \
                                                                        \
       for (; _ascii_bytes < limit; _ascii_bytes++)                     \
         {                                                              \
-         register const unsigned char *p;                              \
-                                                                       \
+         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 (_ascii_bytes > last_null)                                 \
+           {                                                           \
+             for (p = _ascii_bytes; p < limit && *p != '\0'; p++)      \
+               continue;                                               \
+             last_null = p;                                            \
+           }                                                           \
+         else                                                          \
+           p = last_null;                                              \
+                                                                       \
          if (p < limit && (p - _ascii_bytes) <= (long)STRING_LIMIT)    \
            {                                                           \
              if (bytes_in_chunk > 0)                                   \
@@ -470,7 +481,7 @@ Boston, MA 02111-1307, USA.  */
                  fprintf ((FILE), "\"\n");                             \
                  bytes_in_chunk = 0;                                   \
                }                                                       \
-                                                                       \
+                                                                       \
              ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes);         \
              _ascii_bytes = p;                                         \
            }                                                           \
@@ -478,10 +489,10 @@ Boston, MA 02111-1307, USA.  */
            {                                                           \
              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:                                                 \
@@ -500,8 +511,23 @@ Boston, MA 02111-1307, USA.  */
                }                                                       \
            }                                                           \
        }                                                               \
-                                                                       \
+                                                                       \
       if (bytes_in_chunk > 0)                                          \
         fprintf ((FILE), "\"\n");                                      \
     }                                                                  \
   while (0)
+
+/* Allow the use of the -frecord-gcc-switches switch via the
+   elf_record_gcc_switches function defined in varasm.c.  */
+#undef  TARGET_ASM_RECORD_GCC_SWITCHES
+#define TARGET_ASM_RECORD_GCC_SWITCHES elf_record_gcc_switches
+
+/* A C statement (sans semicolon) to output to the stdio stream STREAM
+   any text necessary for declaring the name of an external symbol
+   named NAME which is referenced in this compilation but not defined.
+   It is needed to properly support non-default visibility.  */
+
+#ifndef ASM_OUTPUT_EXTERNAL
+#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
+  default_elf_asm_output_external (FILE, DECL, NAME)
+#endif