OSDN Git Service

gcc/
[pf3gnuchains/gcc-fork.git] / gcc / config / rs6000 / sysv4.h
index 238b497..6d88e32 100644 (file)
@@ -1,13 +1,13 @@
 /* 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, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
    Contributed by Cygnus Support.
 
    This file is part of GCC.
 
    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
+   by the Free Software Foundation; either version 3, or (at your
    option) any later version.
 
    GCC is distributed in the hope that it will be useful, but WITHOUT
    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 GCC; see the file COPYING.  If not, write to the
-   Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
-   MA 02110-1301, 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/>.  */
 
 /* Header files should be C++ aware in general.  */
 #undef  NO_IMPLICIT_EXTERN_C
@@ -55,9 +59,11 @@ extern enum rs6000_sdata_type rs6000_sdata;
 
 #define        TARGET_BITFIELD_TYPE    (! TARGET_NO_BITFIELD_TYPE)
 #define        TARGET_BIG_ENDIAN       (! TARGET_LITTLE_ENDIAN)
+#define        TARGET_PROTOTYPE        target_prototype
 #define        TARGET_NO_PROTOTYPE     (! TARGET_PROTOTYPE)
 #define        TARGET_NO_TOC           (! TARGET_TOC)
 #define        TARGET_NO_EABI          (! TARGET_EABI)
+#define        TARGET_REGNAMES         rs6000_regnames
 
 #ifdef HAVE_AS_REL16
 #undef TARGET_SECURE_PLT
@@ -70,18 +76,12 @@ extern const char *rs6000_tls_size_string; /* For -mtls-size= */
 
 #define SDATA_DEFAULT_SIZE 8
 
-/* 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.
-
-   The macro SUBTARGET_OVERRIDE_OPTIONS is provided for subtargets, to
-   get control.  */
+/* The macro SUBTARGET_OVERRIDE_OPTIONS is provided for subtargets, to
+   get control in TARGET_OPTION_OVERRIDE.  */
 
 #define SUBTARGET_OVERRIDE_OPTIONS                                     \
 do {                                                                   \
-  if (!g_switch_set)                                                   \
+  if (!global_options_set.x_g_switch_value)                            \
     g_switch_value = SDATA_DEFAULT_SIZE;                               \
                                                                        \
   if (rs6000_abi_name == NULL)                                         \
@@ -120,9 +120,9 @@ do {                                                                        \
   else if (!strcmp (rs6000_abi_name, "i960-old"))                      \
     {                                                                  \
       rs6000_current_abi = ABI_V4;                                     \
-      target_flags |= (MASK_LITTLE_ENDIAN | MASK_EABI                  \
-                      | MASK_NO_BITFIELD_WORD);                        \
+      target_flags |= (MASK_LITTLE_ENDIAN | MASK_EABI);                        \
       target_flags &= ~MASK_STRICT_ALIGN;                              \
+      TARGET_NO_BITFIELD_WORD = 1;                                     \
     }                                                                  \
   else                                                                 \
     {                                                                  \
@@ -217,7 +217,10 @@ do {                                                                       \
                                                                        \
   /* 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;                                                      \
@@ -255,28 +258,26 @@ do {                                                                      \
 #define        BYTES_BIG_ENDIAN (TARGET_BIG_ENDIAN)
 #define        WORDS_BIG_ENDIAN (TARGET_BIG_ENDIAN)
 
-/* Define this to set the endianness to use in libgcc2.c, which can
-   not depend on target_flags.  */
-#if !defined(__LITTLE_ENDIAN__) && !defined(__sun__)
-#define LIBGCC2_WORDS_BIG_ENDIAN 1
-#else
-#define LIBGCC2_WORDS_BIG_ENDIAN 0
-#endif
-
 /* Define cutoff for using external functions to save floating point.
-   Currently on V.4, always use inline stores.  */
-#define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 64)
+   When optimizing for size, use external functions when profitable.  */
+#define FP_SAVE_INLINE(FIRST_REG) (optimize_size                       \
+                                  ? ((FIRST_REG) == 62                 \
+                                     || (FIRST_REG) == 63)             \
+                                  : (FIRST_REG) < 64)
+/* And similarly for general purpose registers.  */
+#define GP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 32    \
+                                  && !optimize_size)
 
 /* Put jump tables in read-only memory, rather than in .text.  */
 #define JUMP_TABLES_IN_TEXT_SECTION 0
 
 /* Prefix and suffix to use to saving floating point.  */
 #define        SAVE_FP_PREFIX "_savefpr_"
-#define SAVE_FP_SUFFIX "_l"
+#define SAVE_FP_SUFFIX ""
 
 /* Prefix and suffix to use to restoring floating point.  */
 #define        RESTORE_FP_PREFIX "_restfpr_"
-#define RESTORE_FP_SUFFIX "_l"
+#define RESTORE_FP_SUFFIX ""
 
 /* Type used for ptrdiff_t, as a string used in a declaration.  */
 #define PTRDIFF_TYPE "int"
@@ -359,139 +360,20 @@ 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_RELOC_RW_MASK
+#define TARGET_ASM_RELOC_RW_MASK rs6000_elf_reloc_rw_mask
 #undef TARGET_ASM_SELECT_RTX_SECTION
 #define        TARGET_ASM_SELECT_RTX_SECTION rs6000_elf_select_rtx_section
-#undef TARGET_ASM_SELECT_SECTION
-#define        TARGET_ASM_SELECT_SECTION  rs6000_elf_select_section
-#define TARGET_ASM_UNIQUE_SECTION  rs6000_elf_unique_section
 
 /* Return nonzero if this entry is to be written into the constant pool
    in a special way.  We do so if this is a SYMBOL_REF, LABEL_REF or a CONST
    containing one of them.  If -mfp-in-toc (the default), we also do
    this for floating-point constants.  We actually can only do this
    if the FP formats of the target and host machines are the same, but
-   we can't check that since not every file that uses
-   GO_IF_LEGITIMATE_ADDRESS_P includes real.h.
+   we can't check that since not every file that uses these target macros
+   includes real.h.
 
    Unlike AIX, we don't key off of -mminimal-toc, but instead do not
    allow floating point constants in the TOC if -mrelocatable.  */
@@ -550,14 +432,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);                                    \
@@ -577,7 +457,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
@@ -626,12 +506,8 @@ do {                                                                       \
 
 /* Override svr4.h definition.  */
 #undef SWITCH_TAKES_ARG
-#define        SWITCH_TAKES_ARG(CHAR)                                          \
-  ((CHAR) == 'D' || (CHAR) == 'U' || (CHAR) == 'o'                     \
-   || (CHAR) == 'e' || (CHAR) == 'T' || (CHAR) == 'u'                  \
-   || (CHAR) == 'I' || (CHAR) == 'm' || (CHAR) == 'x'                  \
-   || (CHAR) == 'L' || (CHAR) == 'A' || (CHAR) == 'V'                  \
-   || (CHAR) == 'B' || (CHAR) == 'b' || (CHAR) == 'G')
+#define SWITCH_TAKES_ARG(CHAR)                                         \
+  (DEFAULT_SWITCH_TAKES_ARG (CHAR) || (CHAR) == 'G')
 
 extern int fixuplabelno;
 
@@ -648,23 +524,8 @@ extern int fixuplabelno;
 /* Historically we have also supported stabs debugging.  */
 #define DBX_DEBUGGING_INFO 1
 
-#define DBX_REGISTER_NUMBER(REGNO) rs6000_dbx_register_number (REGNO)
-
-/* Map register numbers held in the call frame info that gcc has
-   collected using DWARF_FRAME_REGNUM to those that should be output in
-   .debug_frame and .eh_frame.  We continue to use gcc hard reg numbers
-   for .eh_frame, but use the numbers mandated by the various ABIs for
-   .debug_frame.  rs6000_emit_prologue has translated any combination of
-   CR2, CR3, CR4 saves to a save of CR2.  The actual code emitted saves
-   the whole of CR, so we map CR2_REGNO to the DWARF reg for CR.  */
-#define DWARF2_FRAME_REG_OUT(REGNO, FOR_EH)    \
-  ((FOR_EH) ? (REGNO)                          \
-   : (REGNO) == CR2_REGNO ? 64                 \
-   : DBX_REGISTER_NUMBER (REGNO))
-
 #define TARGET_ENCODE_SECTION_INFO  rs6000_elf_encode_section_info
 #define TARGET_IN_SMALL_DATA_P  rs6000_elf_in_small_data_p
-#define TARGET_SECTION_TYPE_FLAGS  rs6000_elf_section_type_flags
 
 /* The ELF version doesn't encode [DS] or whatever at the end of symbols.  */
 
@@ -711,10 +572,10 @@ extern int fixuplabelno;
 /* Override svr4.h definition.  */
 #undef ASM_SPEC
 #define        ASM_SPEC "%(asm_cpu) \
-%{.s: %{mregnames} %{mno-regnames}} %{.S: %{mregnames} %{mno-regnames}} \
-%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \
-%{mrelocatable} %{mrelocatable-lib} %{fpic|fpie|fPIC|fPIE:-K PIC} \
-%{memb|msdata|msdata=eabi: -memb} \
+%{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}}" \
+SVR4_ASM_SPEC \
+"%{mrelocatable} %{mrelocatable-lib} %{fpic|fpie|fPIC|fPIE:-K PIC} \
+%{memb|msdata=eabi: -memb} \
 %{mlittle|mlittle-endian:-mlittle; \
   mbig|mbig-endian      :-mbig;    \
   mcall-aixdesc |                 \
@@ -741,7 +602,7 @@ extern int fixuplabelno;
 #endif
 
 /* Pass -G xxx to the compiler and set correct endian mode.  */
-#define        CC1_SPEC "%{G*} \
+#define        CC1_SPEC "%{G*} %(cc1_cpu) \
 %{mlittle|mlittle-endian: %(cc1_endian_little);           \
   mbig   |mbig-endian   : %(cc1_endian_big);              \
   mcall-aixdesc |                                        \
@@ -767,7 +628,7 @@ extern int fixuplabelno;
 %{profile: -p}"
 
 /* Don't put -Y P,<path> for cross compilers.  */
-#ifndef CROSS_COMPILE
+#ifndef CROSS_DIRECTORY_STRUCTURE
 #define LINK_PATH_SPEC "\
 %{!R*:%{L*:-R %*}} \
 %{!nostdlib: %{!YP,*: \
@@ -789,7 +650,6 @@ extern int fixuplabelno;
   myellowknife : %(link_start_yellowknife) ; \
   mmvme        : %(link_start_mvme)        ; \
   msim         : %(link_start_sim)         ; \
-  mwindiss     : %(link_start_windiss)     ; \
   mcall-freebsd: %(link_start_freebsd)     ; \
   mcall-linux  : %(link_start_linux)       ; \
   mcall-gnu    : %(link_start_gnu)         ; \
@@ -847,7 +707,6 @@ extern int fixuplabelno;
   myellowknife : %(link_os_yellowknife) ; \
   mmvme        : %(link_os_mvme)        ; \
   msim         : %(link_os_sim)         ; \
-  mwindiss     : %(link_os_windiss)     ; \
   mcall-freebsd: %(link_os_freebsd)     ; \
   mcall-linux  : %(link_os_linux)       ; \
   mcall-gnu    : %(link_os_gnu)         ; \
@@ -857,6 +716,9 @@ extern int fixuplabelno;
 
 #define LINK_OS_DEFAULT_SPEC ""
 
+#define DRIVER_SELF_SPECS "%{mfpu=none: %<mfpu=* \
+       %<msingle-float %<mdouble-float}"
+
 /* Override rs6000.h definition.  */
 #undef CPP_SPEC
 #define        CPP_SPEC "%{posix: -D_POSIX_SOURCE} \
@@ -864,7 +726,6 @@ extern int fixuplabelno;
   myellowknife : %(cpp_os_yellowknife) ; \
   mmvme        : %(cpp_os_mvme)        ; \
   msim         : %(cpp_os_sim)         ; \
-  mwindiss     : %(cpp_os_windiss)     ; \
   mcall-freebsd: %(cpp_os_freebsd)     ; \
   mcall-linux  : %(cpp_os_linux)       ; \
   mcall-gnu    : %(cpp_os_gnu)         ; \
@@ -881,7 +742,6 @@ extern int fixuplabelno;
   myellowknife : %(startfile_yellowknife) ; \
   mmvme        : %(startfile_mvme)        ; \
   msim         : %(startfile_sim)         ; \
-  mwindiss     : %(startfile_windiss)     ; \
   mcall-freebsd: %(startfile_freebsd)     ; \
   mcall-linux  : %(startfile_linux)       ; \
   mcall-gnu    : %(startfile_gnu)         ; \
@@ -889,7 +749,7 @@ extern int fixuplabelno;
   mcall-openbsd: %(startfile_openbsd)     ; \
                : %(startfile_default)     }"
 
-#define        STARTFILE_DEFAULT_SPEC ""
+#define        STARTFILE_DEFAULT_SPEC "ecrti.o%s crtbegin.o%s"
 
 /* Override svr4.h definition.  */
 #undef LIB_SPEC
@@ -898,7 +758,6 @@ extern int fixuplabelno;
   myellowknife : %(lib_yellowknife) ; \
   mmvme        : %(lib_mvme)        ; \
   msim         : %(lib_sim)         ; \
-  mwindiss     : %(lib_windiss)     ; \
   mcall-freebsd: %(lib_freebsd)     ; \
   mcall-linux  : %(lib_linux)       ; \
   mcall-gnu    : %(lib_gnu)         ; \
@@ -906,26 +765,25 @@ extern int fixuplabelno;
   mcall-openbsd: %(lib_openbsd)     ; \
                : %(lib_default)     }"
 
-#define LIB_DEFAULT_SPEC ""
+#define LIB_DEFAULT_SPEC "-lc"
 
 /* Override svr4.h definition.  */
 #undef ENDFILE_SPEC
 #define        ENDFILE_SPEC "\
-%{mads         : crtsavres.o%s        %(endfile_ads)         ; \
-  myellowknife : crtsavres.o%s        %(endfile_yellowknife) ; \
-  mmvme        : crtsavres.o%s        %(endfile_mvme)        ; \
-  msim         : crtsavres.o%s        %(endfile_sim)         ; \
-  mwindiss     :                      %(endfile_windiss)     ; \
-  mcall-freebsd: crtsavres.o%s        %(endfile_freebsd)     ; \
-  mcall-linux  : crtsavres.o%s        %(endfile_linux)       ; \
-  mcall-gnu    : crtsavres.o%s        %(endfile_gnu)         ; \
-  mcall-netbsd : crtsavres.o%s        %(endfile_netbsd)      ; \
-  mcall-openbsd: crtsavres.o%s        %(endfile_openbsd)     ; \
+%{mads         : %(endfile_ads)         ; \
+  myellowknife : %(endfile_yellowknife) ; \
+  mmvme        : %(endfile_mvme)        ; \
+  msim         : %(endfile_sim)         ; \
+  mcall-freebsd: %(endfile_freebsd)     ; \
+  mcall-linux  : %(endfile_linux)       ; \
+  mcall-gnu    : %(endfile_gnu)         ; \
+  mcall-netbsd : %(endfile_netbsd)      ; \
+  mcall-openbsd: %(endfile_openbsd)     ; \
                : %(crtsavres_default) %(endfile_default)     }"
 
-#define CRTSAVRES_DEFAULT_SPEC "crtsavres.o%s"
+#define CRTSAVRES_DEFAULT_SPEC ""
 
-#define        ENDFILE_DEFAULT_SPEC ""
+#define        ENDFILE_DEFAULT_SPEC "crtend.o%s ecrtn.o%s"
 
 /* Motorola ADS support.  */
 #define LIB_ADS_SPEC "--start-group -lads -lc --end-group"
@@ -1025,9 +883,21 @@ 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 DEFAULT_LIBC == LIBC_UCLIBC
+#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
+#elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
+#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
+#else
+#error "Unsupported DEFAULT_LIBC"
+#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} "
@@ -1116,25 +986,6 @@ ncrtn.o%s"
 #define CPP_OS_OPENBSD_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}"
 #endif
 
-/* WindISS support.  */
-
-#define LIB_WINDISS_SPEC "--start-group -li -lcfp -lwindiss -lram -limpl -limpfp --end-group"
-
-#define CPP_OS_WINDISS_SPEC "\
--D__rtasim \
--D__EABI__ \
--D__ppc \
-%{!msoft-float: -D__hardfp} \
-"
-
-#define STARTFILE_WINDISS_SPEC "crt0.o%s crtbegin.o%s"
-
-#define ENDFILE_WINDISS_SPEC "crtend.o%s"
-
-#define LINK_START_WINDISS_SPEC ""
-
-#define LINK_OS_WINDISS_SPEC ""
-
 /* Define any extra SPECS that the compiler needs to generate.  */
 /* Override rs6000.h definition.  */
 #undef SUBTARGET_EXTRA_SPECS
@@ -1149,7 +1000,6 @@ ncrtn.o%s"
   { "lib_linux",               LIB_LINUX_SPEC },                       \
   { "lib_netbsd",              LIB_NETBSD_SPEC },                      \
   { "lib_openbsd",             LIB_OPENBSD_SPEC },                     \
-  { "lib_windiss",             LIB_WINDISS_SPEC },                     \
   { "lib_default",             LIB_DEFAULT_SPEC },                     \
   { "startfile_ads",           STARTFILE_ADS_SPEC },                   \
   { "startfile_yellowknife",   STARTFILE_YELLOWKNIFE_SPEC },           \
@@ -1160,7 +1010,6 @@ ncrtn.o%s"
   { "startfile_linux",         STARTFILE_LINUX_SPEC },                 \
   { "startfile_netbsd",                STARTFILE_NETBSD_SPEC },                \
   { "startfile_openbsd",       STARTFILE_OPENBSD_SPEC },               \
-  { "startfile_windiss",       STARTFILE_WINDISS_SPEC },               \
   { "startfile_default",       STARTFILE_DEFAULT_SPEC },               \
   { "endfile_ads",             ENDFILE_ADS_SPEC },                     \
   { "endfile_yellowknife",     ENDFILE_YELLOWKNIFE_SPEC },             \
@@ -1171,7 +1020,6 @@ ncrtn.o%s"
   { "endfile_linux",           ENDFILE_LINUX_SPEC },                   \
   { "endfile_netbsd",          ENDFILE_NETBSD_SPEC },                  \
   { "endfile_openbsd",         ENDFILE_OPENBSD_SPEC },                 \
-  { "endfile_windiss",         ENDFILE_WINDISS_SPEC },                 \
   { "endfile_default",         ENDFILE_DEFAULT_SPEC },                 \
   { "link_path",               LINK_PATH_SPEC },                       \
   { "link_shlib",              LINK_SHLIB_SPEC },                      \
@@ -1186,7 +1034,6 @@ ncrtn.o%s"
   { "link_start_linux",                LINK_START_LINUX_SPEC },                \
   { "link_start_netbsd",       LINK_START_NETBSD_SPEC },               \
   { "link_start_openbsd",      LINK_START_OPENBSD_SPEC },              \
-  { "link_start_windiss",      LINK_START_WINDISS_SPEC },              \
   { "link_start_default",      LINK_START_DEFAULT_SPEC },              \
   { "link_os",                 LINK_OS_SPEC },                         \
   { "link_os_ads",             LINK_OS_ADS_SPEC },                     \
@@ -1198,7 +1045,6 @@ ncrtn.o%s"
   { "link_os_gnu",             LINK_OS_GNU_SPEC },                     \
   { "link_os_netbsd",          LINK_OS_NETBSD_SPEC },                  \
   { "link_os_openbsd",         LINK_OS_OPENBSD_SPEC },                 \
-  { "link_os_windiss",         LINK_OS_WINDISS_SPEC },                 \
   { "link_os_default",         LINK_OS_DEFAULT_SPEC },                 \
   { "cc1_endian_big",          CC1_ENDIAN_BIG_SPEC },                  \
   { "cc1_endian_little",       CC1_ENDIAN_LITTLE_SPEC },               \
@@ -1213,7 +1059,6 @@ ncrtn.o%s"
   { "cpp_os_linux",            CPP_OS_LINUX_SPEC },                    \
   { "cpp_os_netbsd",           CPP_OS_NETBSD_SPEC },                   \
   { "cpp_os_openbsd",          CPP_OS_OPENBSD_SPEC },                  \
-  { "cpp_os_windiss",          CPP_OS_WINDISS_SPEC },                  \
   { "cpp_os_default",          CPP_OS_DEFAULT_SPEC },                  \
   { "fbsd_dynamic_linker",     FBSD_DYNAMIC_LINKER },                  \
   SUBSUBTARGET_EXTRA_SPECS