OSDN Git Service

* config/rs6000/rs6000.opt (no-fp-in-toc): Use Var not Mask.
[pf3gnuchains/gcc-fork.git] / gcc / config / rs6000 / sysv4.h
index a8b06ae..55cf9ce 100644 (file)
@@ -1,6 +1,6 @@
 /* Target definitions for GNU compiler for PowerPC running System V.4
    Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-   2004, 2005 Free Software Foundation, Inc.
+   2004, 2005, 2006 Free Software Foundation, Inc.
    Contributed by Cygnus Support.
 
    This file is part of GCC.
@@ -17,8 +17,8 @@
 
    You should have received a copy of the GNU General Public License
    along with GCC; see the file COPYING.  If not, write to the
-   Free Software Foundation, 59 Temple Place - Suite 330, Boston,
-   MA 02111-1307, USA.  */
+   Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 /* Header files should be C++ aware in general.  */
 #undef  NO_IMPLICIT_EXTERN_C
@@ -59,6 +59,11 @@ extern enum rs6000_sdata_type rs6000_sdata;
 #define        TARGET_NO_TOC           (! TARGET_TOC)
 #define        TARGET_NO_EABI          (! TARGET_EABI)
 
+#ifdef HAVE_AS_REL16
+#undef TARGET_SECURE_PLT
+#define TARGET_SECURE_PLT      secure_plt
+#endif
+
 extern const char *rs6000_abi_name;
 extern const char *rs6000_sdata_name;
 extern const char *rs6000_tls_size_string; /* For -mtls-size= */
@@ -205,9 +210,21 @@ do {                                                                       \
       error ("-mcall-aixdesc must be big endian");                     \
     }                                                                  \
                                                                        \
+  if (TARGET_SECURE_PLT != secure_plt)                                 \
+    {                                                                  \
+      error ("-msecure-plt not supported by your assembler");          \
+    }                                                                  \
+                                                                       \
+  if (TARGET_SOFT_FLOAT && TARGET_LONG_DOUBLE_128                      \
+      && rs6000_explicit_options.long_double)                          \
+    warning (0, "-msoft-float and -mlong-double-128 not supported");   \
+                                                                       \
   /* Treat -fPIC the same as -mrelocatable.  */                                \
   if (flag_pic > 1 && DEFAULT_ABI != ABI_AIX)                          \
-    target_flags |= MASK_RELOCATABLE | MASK_MINIMAL_TOC | MASK_NO_FP_IN_TOC; \
+    {                                                                  \
+      target_flags |= MASK_RELOCATABLE | MASK_MINIMAL_TOC;             \
+      TARGET_NO_FP_IN_TOC = 1;                                         \
+    }                                                                  \
                                                                        \
   else if (TARGET_RELOCATABLE)                                         \
     flag_pic = 2;                                                      \
@@ -239,11 +256,6 @@ do {                                                                       \
    so it is not available to the normal user.  */
 #define FIXED_R13 1
 
-/* Size of the V.4 varargs area if needed.  */
-/* Override rs6000.h definition.  */
-#undef RS6000_VARARGS_AREA
-#define RS6000_VARARGS_AREA (current_function_stdarg ? RS6000_VARARGS_SIZE : 0)
-
 /* Override default big endianism definitions in rs6000.h.  */
 #undef BYTES_BIG_ENDIAN
 #undef WORDS_BIG_ENDIAN
@@ -325,15 +337,6 @@ do {                                                                       \
        ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE)     \
         ? 128 : COMPUTED)
 
-/* Define this macro as an expression for the alignment of a type
-   (given by TYPE as a tree node) if the alignment computed in the
-   usual way is COMPUTED and the alignment explicitly specified was
-   SPECIFIED.  */
-#define ROUND_TYPE_ALIGN(TYPE, COMPUTED, SPECIFIED)                    \
-       ((TARGET_ALTIVEC  && TREE_CODE (TYPE) == VECTOR_TYPE)           \
-        ? MAX (MAX ((COMPUTED), (SPECIFIED)), 128)                     \
-        : MAX (COMPUTED, SPECIFIED))
-
 #undef  BIGGEST_FIELD_ALIGNMENT
 
 /* Use ELF style section commands.  */
@@ -363,126 +366,8 @@ do {                                                                      \
 #define        SDATA2_SECTION_ASM_OP "\t.section\t\".sdata2\",\"a\""
 #define        SBSS_SECTION_ASM_OP "\t.section\t\".sbss\",\"aw\",@nobits"
 
-/* Besides the usual ELF sections, we need a toc section.  */
-/* Override elfos.h definition.  */
-#undef EXTRA_SECTIONS
-#define        EXTRA_SECTIONS in_toc, in_sdata, in_sdata2, in_sbss, in_init, in_fini
-
-/* Override elfos.h definition.  */
-#undef EXTRA_SECTION_FUNCTIONS
-#define        EXTRA_SECTION_FUNCTIONS                                         \
-  TOC_SECTION_FUNCTION                                                 \
-  SDATA_SECTION_FUNCTION                                               \
-  SDATA2_SECTION_FUNCTION                                              \
-  SBSS_SECTION_FUNCTION                                                        \
-  INIT_SECTION_FUNCTION                                                        \
-  FINI_SECTION_FUNCTION
-
-#define        TOC_SECTION_FUNCTION                                            \
-void                                                                   \
-toc_section (void)                                                     \
-{                                                                      \
-  if (in_section != in_toc)                                            \
-    {                                                                  \
-      in_section = in_toc;                                             \
-      if (DEFAULT_ABI == ABI_AIX                                       \
-         && TARGET_MINIMAL_TOC                                         \
-         && !TARGET_RELOCATABLE)                                       \
-       {                                                               \
-         if (! toc_initialized)                                        \
-           {                                                           \
-             toc_initialized = 1;                                      \
-             fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP);       \
-             (*targetm.asm_out.internal_label) (asm_out_file, "LCTOC", 0); \
-             fprintf (asm_out_file, "\t.tc ");                         \
-             ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1[TC],"); \
-             ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \
-             fprintf (asm_out_file, "\n");                             \
-                                                                       \
-             fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
-             ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \
-             fprintf (asm_out_file, " = .+32768\n");                   \
-           }                                                           \
-         else                                                          \
-           fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
-       }                                                               \
-      else if (DEFAULT_ABI == ABI_AIX && !TARGET_RELOCATABLE)          \
-       fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP);             \
-      else                                                             \
-       {                                                               \
-         fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP);   \
-         if (! toc_initialized)                                        \
-           {                                                           \
-             ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); \
-             fprintf (asm_out_file, " = .+32768\n");                   \
-             toc_initialized = 1;                                      \
-           }                                                           \
-       }                                                               \
-    }                                                                  \
-}                                                                      \
-                                                                       \
-extern int in_toc_section (void);                                      \
-int in_toc_section (void)                                              \
-{                                                                      \
-  return in_section == in_toc;                                         \
-}
-
-#define        SDATA_SECTION_FUNCTION                                          \
-void                                                                   \
-sdata_section (void)                                                   \
-{                                                                      \
-  if (in_section != in_sdata)                                          \
-    {                                                                  \
-      in_section = in_sdata;                                           \
-      fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP);            \
-    }                                                                  \
-}
-
-#define        SDATA2_SECTION_FUNCTION                                         \
-void                                                                   \
-sdata2_section (void)                                                  \
-{                                                                      \
-  if (in_section != in_sdata2)                                         \
-    {                                                                  \
-      in_section = in_sdata2;                                          \
-      fprintf (asm_out_file, "%s\n", SDATA2_SECTION_ASM_OP);           \
-    }                                                                  \
-}
-
-#define        SBSS_SECTION_FUNCTION                                           \
-void                                                                   \
-sbss_section (void)                                                    \
-{                                                                      \
-  if (in_section != in_sbss)                                           \
-    {                                                                  \
-      in_section = in_sbss;                                            \
-      fprintf (asm_out_file, "%s\n", SBSS_SECTION_ASM_OP);             \
-    }                                                                  \
-}
-
-#define        INIT_SECTION_FUNCTION                                           \
-void                                                                   \
-init_section (void)                                                    \
-{                                                                      \
-  if (in_section != in_init)                                           \
-    {                                                                  \
-      in_section = in_init;                                            \
-      fprintf (asm_out_file, "%s\n", INIT_SECTION_ASM_OP);             \
-    }                                                                  \
-}
-
-#define        FINI_SECTION_FUNCTION                                           \
-void                                                                   \
-fini_section (void)                                                    \
-{                                                                      \
-  if (in_section != in_fini)                                           \
-    {                                                                  \
-      in_section = in_fini;                                            \
-      fprintf (asm_out_file, "%s\n", FINI_SECTION_ASM_OP);             \
-    }                                                                  \
-}
-
 /* Override default elf definitions.  */
+#define TARGET_ASM_INIT_SECTIONS rs6000_elf_asm_init_sections
 #undef TARGET_ASM_SELECT_RTX_SECTION
 #define        TARGET_ASM_SELECT_RTX_SECTION rs6000_elf_select_rtx_section
 #undef TARGET_ASM_SELECT_SECTION
@@ -512,7 +397,7 @@ fini_section (void)                                                 \
        || (!TARGET_NO_FP_IN_TOC                                                \
           && !TARGET_RELOCATABLE                                       \
           && GET_CODE (X) == CONST_DOUBLE                              \
-          && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT               \
+          && SCALAR_FLOAT_MODE_P (GET_MODE (X))                        \
           && BITS_PER_WORD == HOST_BITS_PER_INT)))
 
 /* These macros generate the special .type and .size directives which
@@ -554,14 +439,12 @@ extern int rs6000_pic_labelno;
 
 #define        LCOMM_ASM_OP    "\t.lcomm\t"
 
-/* Override elfos.h definition.  */
-#undef ASM_OUTPUT_ALIGNED_LOCAL
-#define        ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN)               \
+/* Describe how to emit uninitialized local items.  */
+#define        ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN)    \
 do {                                                                   \
-  if (rs6000_sdata != SDATA_NONE && (SIZE) > 0                         \
-      && (SIZE) <= g_switch_value)                                     \
+  if ((DECL) && rs6000_elf_in_small_data_p (DECL))                     \
     {                                                                  \
-      sbss_section ();                                                 \
+      switch_to_section (sbss_section);                                        \
       ASM_OUTPUT_ALIGN (FILE, exact_log2 (ALIGN / BITS_PER_UNIT));     \
       ASM_OUTPUT_LABEL (FILE, NAME);                                   \
       ASM_OUTPUT_SKIP (FILE, SIZE);                                    \
@@ -581,7 +464,7 @@ do {                                                                        \
 /* Describe how to emit uninitialized external linkage items.  */
 #define        ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN)           \
 do {                                                                   \
-  ASM_OUTPUT_ALIGNED_LOCAL (FILE, NAME, SIZE, ALIGN);                  \
+  ASM_OUTPUT_ALIGNED_DECL_LOCAL (FILE, DECL, NAME, SIZE, ALIGN);       \
 } while (0)
 
 #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
@@ -689,16 +572,6 @@ extern int fixuplabelno;
 #define TARGET_OS_SYSV_CPP_BUILTINS()          \
   do                                           \
     {                                          \
-      if (flag_pic == 1)                       \
-       {                                       \
-         builtin_define ("__pic__=1");         \
-         builtin_define ("__PIC__=1");         \
-       }                                       \
-      else if (flag_pic == 2)                  \
-       {                                       \
-         builtin_define ("__pic__=2");         \
-         builtin_define ("__PIC__=2");         \
-       }                                       \
       if (target_flags_explicit                        \
          & MASK_RELOCATABLE)                   \
        builtin_define ("_RELOCATABLE");        \
@@ -750,6 +623,10 @@ extern int fixuplabelno;
 
 #define        CC1_ENDIAN_DEFAULT_SPEC "%(cc1_endian_big)"
 
+#ifndef CC1_SECURE_PLT_DEFAULT_SPEC
+#define CC1_SECURE_PLT_DEFAULT_SPEC ""
+#endif
+
 /* Pass -G xxx to the compiler and set correct endian mode.  */
 #define        CC1_SPEC "%{G*} \
 %{mlittle|mlittle-endian: %(cc1_endian_little);           \
@@ -762,7 +639,6 @@ extern int fixuplabelno;
   mcall-gnu             : -mbig %(cc1_endian_big);        \
   mcall-i960-old        : -mlittle %(cc1_endian_little);  \
                         : %(cc1_endian_default)}          \
-%{mno-sdata: -msdata=none } \
 %{meabi: %{!mcall-*: -mcall-sysv }} \
 %{!meabi: %{!mno-eabi: \
     %{mrelocatable: -meabi } \
@@ -774,6 +650,7 @@ extern int fixuplabelno;
     %{mcall-openbsd: -mno-eabi }}} \
 %{msdata: -msdata=default} \
 %{mno-sdata: -msdata=none} \
+%{!mbss-plt: %{!msecure-plt: %(cc1_secure_plt_default)}} \
 %{profile: -p}"
 
 /* Don't put -Y P,<path> for cross compilers.  */
@@ -1002,7 +879,6 @@ extern int fixuplabelno;
 
 #define LINK_OS_FREEBSD_SPEC "\
   %{p:%nconsider using `-pg' instead of `-p' with gprof(1)} \
-  %{Wl,*:%*} \
   %{v:-V} \
   %{assert*} %{R*} %{rpath*} %{defsym*} \
   %{shared:-Bshareable %{h*} %{soname*}} \
@@ -1036,9 +912,19 @@ extern int fixuplabelno;
 
 #define LINK_START_LINUX_SPEC ""
 
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
+#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
+#if UCLIBC_DEFAULT
+#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:%{muclibc:%e-mglibc and -muclibc used together}" G ";:" U "}"
+#else
+#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:%{mglibc:%e-mglibc and -muclibc used together}" U ";:" G "}"
+#endif
+#define LINUX_DYNAMIC_LINKER \
+  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
+
 #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
   %{rdynamic:-export-dynamic} \
-  %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}"
+  %{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER "}}}"
 
 #if defined(HAVE_LD_EH_FRAME_HDR)
 # define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
@@ -1214,6 +1100,7 @@ ncrtn.o%s"
   { "cc1_endian_big",          CC1_ENDIAN_BIG_SPEC },                  \
   { "cc1_endian_little",       CC1_ENDIAN_LITTLE_SPEC },               \
   { "cc1_endian_default",      CC1_ENDIAN_DEFAULT_SPEC },              \
+  { "cc1_secure_plt_default",  CC1_SECURE_PLT_DEFAULT_SPEC },          \
   { "cpp_os_ads",              CPP_OS_ADS_SPEC },                      \
   { "cpp_os_yellowknife",      CPP_OS_YELLOWKNIFE_SPEC },              \
   { "cpp_os_mvme",             CPP_OS_MVME_SPEC },                     \
@@ -1269,8 +1156,6 @@ ncrtn.o%s"
    ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4) \
    : DW_EH_PE_absptr)
 
-#define TARGET_ASM_EXCEPTION_SECTION readonly_data_section
-
 #define DOUBLE_INT_ASM_OP "\t.quad\t"
 
 /* Generate entries in .fixup for relocatable addresses.  */