OSDN Git Service

add sparc64-*-solaris2 support just like sparcv9-*-solaris2
[pf3gnuchains/gcc-fork.git] / gcc / gcc.c
index 9d73608..cbf62f8 100644 (file)
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -2,22 +2,22 @@
    Copyright (C) 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
    1999, 2000, 2001 Free Software Foundation, Inc.
 
    Copyright (C) 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
    1999, 2000, 2001 Free Software Foundation, Inc.
 
-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
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
+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) any later
+version.
 
 
-GNU CC 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.
+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
 
 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.
+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.
 
 This paragraph is here to try to keep Sun CC from dying.
 The number of chars here seems crucial!!!!  */
 
 This paragraph is here to try to keep Sun CC from dying.
 The number of chars here seems crucial!!!!  */
@@ -32,9 +32,50 @@ CC recognizes how to compile each input file by suffixes in the file names.
 Once it knows which kind of compilation to perform, the procedure for
 compilation is specified by a string called a "spec".  */
 
 Once it knows which kind of compilation to perform, the procedure for
 compilation is specified by a string called a "spec".  */
 
+/* A Short Introduction to Adding a Command-Line Option.
+
+   Before adding a command-line option, consider if it is really
+   necessary.  Each additional command-line option adds complexity and
+   is difficult to remove in subsequent versions.
+
+   In the following, consider adding the command-line argument
+   `--bar'.
+
+   1. Each command-line option is specified in the specs file.  The
+   notation is described below in the comment entitled "The Specs
+   Language".  Read it.
+
+   2. In this file, add an entry to "option_map" equating the long
+   `--' argument version and any shorter, single letter version.  Read
+   the comments in the declaration of "struct option_map" for an
+   explanation.  Do not omit the first `-'.
+
+   3. Look in the "specs" file to determine which program or option
+   list should be given the argument, e.g., "cc1_options".  Add the
+   appropriate syntax for the shorter option version to the
+   corresponding "const char *" entry in this file.  Omit the first
+   `-' from the option.  For example, use `-bar', rather than `--bar'.
+
+   4. If the argument takes an argument, e.g., `--baz argument1',
+   modify either DEFAULT_SWITCH_TAKES_ARG or
+   DEFAULT_WORD_SWITCH_TAKES_ARG in this file.  Omit the first `-'
+   from `--baz'.
+
+   5. Document the option in this file's display_help().  If the
+   option is passed to a subprogram, modify its corresponding
+   function, e.g., cppinit.c:print_help() or toplev.c:display_help(),
+   instead.
+
+   6. Compile and test.  Make sure that your new specs file is being
+   read.  For example, use a debugger to investigate the value of
+   "specs_file" in main().  */
+
 #include "config.h"
 #include "system.h"
 #include <signal.h>
 #include "config.h"
 #include "system.h"
 #include <signal.h>
+#if ! defined( SIGCHLD ) && defined( SIGCLD )
+#  define SIGCHLD SIGCLD
+#endif
 #include "obstack.h"
 #include "intl.h"
 #include "prefix.h"
 #include "obstack.h"
 #include "intl.h"
 #include "prefix.h"
@@ -51,18 +92,26 @@ compilation is specified by a string called a "spec".  */
 extern int getrusage PARAMS ((int, struct rusage *));
 #endif
 
 extern int getrusage PARAMS ((int, struct rusage *));
 #endif
 
-/* By default there is no special suffix for executables.  */
-#ifdef EXECUTABLE_SUFFIX
-#define HAVE_EXECUTABLE_SUFFIX
+/* By default there is no special suffix for target executables.  */
+/* FIXME: when autoconf is fixed, remove the host check - dj */
+#if defined(TARGET_EXECUTABLE_SUFFIX) && defined(HOST_EXECUTABLE_SUFFIX)
+#define HAVE_TARGET_EXECUTABLE_SUFFIX
 #else
 #else
-#define EXECUTABLE_SUFFIX ""
+#define TARGET_EXECUTABLE_SUFFIX ""
 #endif
 
 #endif
 
-/* By default, the suffix for object files is ".o".  */
-#ifdef OBJECT_SUFFIX
-#define HAVE_OBJECT_SUFFIX
+/* By default there is no special suffix for host executables.  */
+#ifdef HOST_EXECUTABLE_SUFFIX
+#define HAVE_HOST_EXECUTABLE_SUFFIX
 #else
 #else
-#define OBJECT_SUFFIX ".o"
+#define HOST_EXECUTABLE_SUFFIX ""
+#endif
+
+/* By default, the suffix for target object files is ".o".  */
+#ifdef TARGET_OBJECT_SUFFIX
+#define HAVE_TARGET_OBJECT_SUFFIX
+#else
+#define TARGET_OBJECT_SUFFIX ".o"
 #endif
 
 #ifndef VMS
 #endif
 
 #ifndef VMS
@@ -136,7 +185,7 @@ static int print_help_list;
 
 static int verbose_flag;
 
 
 static int verbose_flag;
 
-/* Flag indicating to print target specific command line options. */
+/* Flag indicating to print target specific command line options.  */
 
 static int target_help_flag;
 
 
 static int target_help_flag;
 
@@ -233,7 +282,6 @@ static void add_prefix              PARAMS ((struct path_prefix *, const char *,
                                         const char *, int, int, int *));
 static void translate_options  PARAMS ((int *, const char *const **));
 static char *skip_whitespace   PARAMS ((char *));
                                         const char *, int, int, int *));
 static void translate_options  PARAMS ((int *, const char *const **));
 static char *skip_whitespace   PARAMS ((char *));
-static void record_temp_file   PARAMS ((const char *, int, int));
 static void delete_if_ordinary PARAMS ((const char *));
 static void delete_temp_files  PARAMS ((void));
 static void delete_failure_queue PARAMS ((void));
 static void delete_if_ordinary PARAMS ((const char *));
 static void delete_temp_files  PARAMS ((void));
 static void delete_failure_queue PARAMS ((void));
@@ -251,12 +299,9 @@ static int used_arg                PARAMS ((const char *, int));
 static int default_arg         PARAMS ((const char *, int));
 static void set_multilib_dir   PARAMS ((void));
 static void print_multilib_info        PARAMS ((void));
 static int default_arg         PARAMS ((const char *, int));
 static void set_multilib_dir   PARAMS ((void));
 static void print_multilib_info        PARAMS ((void));
-static void pfatal_with_name   PARAMS ((const char *)) ATTRIBUTE_NORETURN;
 static void perror_with_name   PARAMS ((const char *));
 static void pfatal_pexecute    PARAMS ((const char *, const char *))
   ATTRIBUTE_NORETURN;
 static void perror_with_name   PARAMS ((const char *));
 static void pfatal_pexecute    PARAMS ((const char *, const char *))
   ATTRIBUTE_NORETURN;
-static void error              PARAMS ((const char *, ...))
-  ATTRIBUTE_PRINTF_1;
 static void notice             PARAMS ((const char *, ...))
   ATTRIBUTE_PRINTF_1;
 static void display_help       PARAMS ((void));
 static void notice             PARAMS ((const char *, ...))
   ATTRIBUTE_PRINTF_1;
 static void display_help       PARAMS ((void));
@@ -268,8 +313,13 @@ static int execute                 PARAMS ((void));
 static void clear_args                 PARAMS ((void));
 static void fatal_error                        PARAMS ((int));
 static void set_input                  PARAMS ((const char *));
 static void clear_args                 PARAMS ((void));
 static void fatal_error                        PARAMS ((int));
 static void set_input                  PARAMS ((const char *));
+static void init_gcc_specs              PARAMS ((struct obstack *,
+                                                const char *,
+                                                const char *));
 \f
 \f
-/* Specs are strings containing lines, each of which (if not blank)
+/* The Specs Language
+
+Specs are strings containing lines, each of which (if not blank)
 is made up of a program name, and arguments separated by spaces.
 The program name must be exact and start from root, since no path
 is searched and it is unreliable to depend on the current working directory.
 is made up of a program name, and arguments separated by spaces.
 The program name must be exact and start from root, since no path
 is searched and it is unreliable to depend on the current working directory.
@@ -318,6 +368,10 @@ or with constant text in a single argument.
         of a temporary file, just like %u.  This temporary file is not
         meant for communication between processes, but rather as a junk
         disposal mechanism.
         of a temporary file, just like %u.  This temporary file is not
         meant for communication between processes, but rather as a junk
         disposal mechanism.
+ %.SUFFIX
+        substitutes .SUFFIX for the suffixes of a matched switch's args when
+        it is subsequently output with %*. SUFFIX is terminated by the next
+        space or %.
  %d    marks the argument containing or following the %d as a
        temporary file name, so that that file will be deleted if CC exits
        successfully.  Unlike %g, this contributes no text to the argument.
  %d    marks the argument containing or following the %d as a
        temporary file name, so that that file will be deleted if CC exits
        successfully.  Unlike %g, this contributes no text to the argument.
@@ -353,6 +407,7 @@ or with constant text in a single argument.
        and substitute the full name found.
  %eSTR  Print STR as an error message.  STR is terminated by a newline.
         Use this when inconsistent options are detected.
        and substitute the full name found.
  %eSTR  Print STR as an error message.  STR is terminated by a newline.
         Use this when inconsistent options are detected.
+ %nSTR  Print STR as an notice.  STR is terminated by a newline.
  %x{OPTION}    Accumulate an option for %X.
  %X    Output the accumulated linker options specified by compilations.
  %Y    Output the accumulated assembler options specified by compilations.
  %x{OPTION}    Accumulate an option for %X.
  %X    Output the accumulated linker options specified by compilations.
  %Y    Output the accumulated assembler options specified by compilations.
@@ -586,19 +641,21 @@ static const char *cpp_options =
 "%{C:%{!E:%eGNU C does not support -C without using -E}}\
  %{std*} %{nostdinc*}\
  %{C} %{v} %{I*} %{P} %{$} %I\
 "%{C:%{!E:%eGNU C does not support -C without using -E}}\
  %{std*} %{nostdinc*}\
  %{C} %{v} %{I*} %{P} %{$} %I\
- %{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG} %{MP} %{MQ} %{MT}\
+ %{MD:-M -MF %W{!o: %b.d}%W{o*:%.d%*}}\
+ %{MMD:-MM -MF %W{!o: %b.d}%W{o*:%.d%*}}\
+ %{M} %{MM} %W{MF*} %{MG} %{MP} %{MQ*} %{MT*} %{M|MD|MM|MMD:%{o*:-MQ %*}}\
  %{!no-gcc:-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2 -D__GNUC_PATCHLEVEL__=%v3}\
  %{!undef:%{!ansi:%{!std=*:%p}%{std=gnu*:%p}} %P} %{trigraphs}\
  %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\
  %{!no-gcc:-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2 -D__GNUC_PATCHLEVEL__=%v3}\
  %{!undef:%{!ansi:%{!std=*:%p}%{std=gnu*:%p}} %P} %{trigraphs}\
  %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\
- %{ffast-math:-D__FAST_MATH__}\
+ %{fno-inline|O0|!O*:-D__NO_INLINE__} %{ffast-math:-D__FAST_MATH__}\
  %{fshort-wchar:-U__WCHAR_TYPE__ -D__WCHAR_TYPE__=short\\ unsigned\\ int}\
  %{ffreestanding:-D__STDC_HOSTED__=0} %{fno-hosted:-D__STDC_HOSTED__=0}\
  %{!ffreestanding:%{!fno-hosted:-D__STDC_HOSTED__=1}}\
  %{fshow-column} %{fno-show-column}\
  %{fleading-underscore} %{fno-leading-underscore}\
  %{fno-operator-names} %{ftabstop=*} %{remap}\
  %{fshort-wchar:-U__WCHAR_TYPE__ -D__WCHAR_TYPE__=short\\ unsigned\\ int}\
  %{ffreestanding:-D__STDC_HOSTED__=0} %{fno-hosted:-D__STDC_HOSTED__=0}\
  %{!ffreestanding:%{!fno-hosted:-D__STDC_HOSTED__=1}}\
  %{fshow-column} %{fno-show-column}\
  %{fleading-underscore} %{fno-leading-underscore}\
  %{fno-operator-names} %{ftabstop=*} %{remap}\
- %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*&U*&A*} %{i*} %Z %i\
- %{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}}";
+ %{g3:-dD} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*&U*&A*} %{i*} %Z %i\
+ %{E:%{!M*:%W{o*}}}";
 
 /* NB: This is shared amongst all front-ends.  */
 static const char *cc1_options =
 
 /* NB: This is shared amongst all front-ends.  */
 static const char *cc1_options =
@@ -606,10 +663,10 @@ static const char *cc1_options =
  %1 %{!Q:-quiet} -dumpbase %B %{d*} %{m*} %{a*}\
  %{g*} %{O*} %{W*} %{w} %{pedantic*} %{std*} %{ansi}\
  %{traditional} %{v:-version} %{pg:-p} %{p} %{f*}\
  %1 %{!Q:-quiet} -dumpbase %B %{d*} %{m*} %{a*}\
  %{g*} %{O*} %{W*} %{w} %{pedantic*} %{std*} %{ansi}\
  %{traditional} %{v:-version} %{pg:-p} %{p} %{f*}\
- %{aux-info*} %{Qn:-fno-ident} %{--help:--help}\
+ %{Qn:-fno-ident} %{--help:--help}\
  %{--target-help:--target-help}\
  %{!fsyntax-only:%{S:%W{o*}%{!o*:-o %b.s}}}\
  %{--target-help:--target-help}\
  %{!fsyntax-only:%{S:%W{o*}%{!o*:-o %b.s}}}\
- %{fsyntax-only:-o %j}";
+ %{fsyntax-only:-o %j} %{-param*}";
 
 static const char *asm_options =
 "%a %Y %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}";
 
 static const char *asm_options =
 "%a %Y %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}";
@@ -664,14 +721,15 @@ static struct user_specs *user_specs_head, *user_specs_tail;
   || !strcmp (STR, "imacros") || !strcmp (STR, "aux-info") \
   || !strcmp (STR, "idirafter") || !strcmp (STR, "iprefix") \
   || !strcmp (STR, "iwithprefix") || !strcmp (STR, "iwithprefixbefore") \
   || !strcmp (STR, "imacros") || !strcmp (STR, "aux-info") \
   || !strcmp (STR, "idirafter") || !strcmp (STR, "iprefix") \
   || !strcmp (STR, "iwithprefix") || !strcmp (STR, "iwithprefixbefore") \
-  || !strcmp (STR, "isystem") || !strcmp (STR, "specs") \
+  || !strcmp (STR, "isystem") || !strcmp (STR, "-param") \
+  || !strcmp (STR, "specs") \
   || !strcmp (STR, "MF") || !strcmp (STR, "MT") || !strcmp (STR, "MQ"))
 
 #ifndef WORD_SWITCH_TAKES_ARG
 #define WORD_SWITCH_TAKES_ARG(STR) DEFAULT_WORD_SWITCH_TAKES_ARG (STR)
 #endif
 \f
   || !strcmp (STR, "MF") || !strcmp (STR, "MT") || !strcmp (STR, "MQ"))
 
 #ifndef WORD_SWITCH_TAKES_ARG
 #define WORD_SWITCH_TAKES_ARG(STR) DEFAULT_WORD_SWITCH_TAKES_ARG (STR)
 #endif
 \f
-#ifdef HAVE_EXECUTABLE_SUFFIX
+#ifdef HAVE_TARGET_EXECUTABLE_SUFFIX
 /* This defines which switches stop a full compilation.  */
 #define DEFAULT_SWITCH_CURTAILS_COMPILATION(CHAR) \
   ((CHAR) == 'c' || (CHAR) == 'S')
 /* This defines which switches stop a full compilation.  */
 #define DEFAULT_SWITCH_CURTAILS_COMPILATION(CHAR) \
   ((CHAR) == 'c' || (CHAR) == 'S')
@@ -690,6 +748,10 @@ struct compiler
                                   whose names end in this suffix.  */
 
   const char *spec;            /* To use this compiler, run this spec.  */
                                   whose names end in this suffix.  */
 
   const char *spec;            /* To use this compiler, run this spec.  */
+
+  const char *cpp_spec;         /* If non-NULL, substitute this spec
+                                  for `%C', rather than the usual
+                                  cpp_spec.  */
 };
 
 /* Pointer to a vector of `struct compiler' that gives the spec for
 };
 
 /* Pointer to a vector of `struct compiler' that gives the spec for
@@ -715,19 +777,20 @@ static struct compiler default_compilers[] =
      were not present when we built the driver, we will hit these copies
      and be given a more meaningful error than "file not used since
      linking is not done".  */
      were not present when we built the driver, we will hit these copies
      and be given a more meaningful error than "file not used since
      linking is not done".  */
-  {".m",  "#Objective-C"}, {".mi",  "#Objective-C"},
-  {".cc", "#C++"}, {".cxx", "#C++"}, {".cpp", "#C++"}, {".cp", "#C++"},
-  {".c++", "#C++"}, {".C", "#C++"}, {".ii", "#C++"},
-  {".ads", "#Ada"}, {".adb", "#Ada"}, {".ada", "#Ada"},
-  {".f", "#Fortran"}, {".for", "#Fortran"}, {".fpp", "#Fortran"},
-  {".F", "#Fortran"}, {".FOR", "#Fortran"}, {".FPP", "#Fortran"},
-  {".r", "#Ratfor"},
-  {".p", "#Pascal"}, {".pas", "#Pascal"},
-  {".ch", "#Chill"}, {".chi", "#Chill"},
-  {".java", "#Java"}, {".class", "#Java"},
-  {".zip", "#Java"}, {".jar", "#Java"},
+  {".m",  "#Objective-C", 0}, {".mi",  "#Objective-C", 0},
+  {".cc", "#C++", 0}, {".cxx", "#C++", 0}, {".cpp", "#C++", 0},
+  {".cp", "#C++", 0}, {".c++", "#C++", 0}, {".C", "#C++", 0},
+  {".ii", "#C++", 0},
+  {".ads", "#Ada", 0}, {".adb", "#Ada", 0}, {".ada", "#Ada", 0},
+  {".f", "#Fortran", 0}, {".for", "#Fortran", 0}, {".fpp", "#Fortran", 0},
+  {".F", "#Fortran", 0}, {".FOR", "#Fortran", 0}, {".FPP", "#Fortran", 0},
+  {".r", "#Ratfor", 0},
+  {".p", "#Pascal", 0}, {".pas", "#Pascal", 0},
+  {".ch", "#Chill", 0}, {".chi", "#Chill", 0},
+  {".java", "#Java", 0}, {".class", "#Java", 0},
+  {".zip", "#Java", 0}, {".jar", "#Java", 0},
   /* Next come the entries for C.  */
   /* Next come the entries for C.  */
-  {".c", "@c"},
+  {".c", "@c", 0},
   {"@c",
    /* cc1 has an integrated ISO C preprocessor.  We should invoke the
       external preprocessor if -save-temps or -traditional is given.  */
   {"@c",
    /* cc1 has an integrated ISO C preprocessor.  We should invoke the
       external preprocessor if -save-temps or -traditional is given.  */
@@ -742,27 +805,27 @@ static struct compiler default_compilers[] =
                    cc1 -fpreprocessed %{!pipe:%g.i} %(cc1_options)}\
            %{!traditional:%{!ftraditional:%{!traditional-cpp:\
                cc1 -lang-c %{ansi:-std=c89} %(cpp_options) %(cc1_options)}}}}\
                    cc1 -fpreprocessed %{!pipe:%g.i} %(cc1_options)}\
            %{!traditional:%{!ftraditional:%{!traditional-cpp:\
                cc1 -lang-c %{ansi:-std=c89} %(cpp_options) %(cc1_options)}}}}\
-        %{!fsyntax-only:%(invoke_as)}}}}"},
+        %{!fsyntax-only:%(invoke_as)}}}}", 0},
   {"-",
    "%{!E:%e-E required when input is from standard input}\
   {"-",
    "%{!E:%e-E required when input is from standard input}\
-    %(trad_capable_cpp) -lang-c %{ansi:-std=c89} %(cpp_options)"},
-  {".h", "@c-header"},
+    %(trad_capable_cpp) -lang-c %{ansi:-std=c89} %(cpp_options)", 0},
+  {".h", "@c-header", 0},
   {"@c-header",
    "%{!E:%eCompilation of header file requested} \
   {"@c-header",
    "%{!E:%eCompilation of header file requested} \
-    %(trad_capable_cpp) -lang-c %{ansi:-std=c89} %(cpp_options)"},
-  {".i", "@cpp-output"},
+    %(trad_capable_cpp) -lang-c %{ansi:-std=c89} %(cpp_options)", 0},
+  {".i", "@cpp-output", 0},
   {"@cpp-output",
   {"@cpp-output",
-   "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}"},
-  {".s", "@assembler"},
+   "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0},
+  {".s", "@assembler", 0},
   {"@assembler",
   {"@assembler",
-   "%{!M:%{!MM:%{!E:%{!S:as %(asm_options) %i %A }}}}"},
-  {".S", "@assembler-with-cpp"},
+   "%{!M:%{!MM:%{!E:%{!S:as %(asm_options) %i %A }}}}", 0},
+  {".S", "@assembler-with-cpp", 0},
   {"@assembler-with-cpp",
    "%(trad_capable_cpp) -lang-asm %(cpp_options)\
   {"@assembler-with-cpp",
    "%(trad_capable_cpp) -lang-asm %(cpp_options)\
-       %{!M:%{!MM:%{!E:%(invoke_as)}}}"},
+       %{!M:%{!MM:%{!E:%(invoke_as)}}}", 0},
 #include "specs.h"
   /* Mark end of table */
 #include "specs.h"
   /* Mark end of table */
-  {0, 0}
+  {0, 0, 0}
 };
 
 /* Number of elements in default_compilers, not counting the terminator.  */
 };
 
 /* Number of elements in default_compilers, not counting the terminator.  */
@@ -849,6 +912,7 @@ struct option_map option_map[] =
    {"--optimize", "-O", "oj"},
    {"--output", "-o", "a"},
    {"--output-class-directory", "-foutput-class-dir=", "ja"},
    {"--optimize", "-O", "oj"},
    {"--output", "-o", "a"},
    {"--output-class-directory", "-foutput-class-dir=", "ja"},
+   {"--param", "--param", "a"},
    {"--pedantic", "-pedantic", 0},
    {"--pedantic-errors", "-pedantic-errors", 0},
    {"--pipe", "-pipe", 0},
    {"--pedantic", "-pedantic", 0},
    {"--pedantic-errors", "-pedantic-errors", 0},
    {"--pipe", "-pipe", 0},
@@ -888,6 +952,18 @@ struct option_map option_map[] =
    {"--", "-f", "*j"}
  };
 \f
    {"--", "-f", "*j"}
  };
 \f
+
+#ifdef TARGET_OPTION_TRANSLATE_TABLE
+static struct {
+  const char *option_found;
+  const char *replacements;
+} target_option_translations[] =
+{
+  TARGET_OPTION_TRANSLATE_TABLE,
+  { 0, 0 }
+};
+#endif
+
 /* Translate the options described by *ARGCP and *ARGVP.
    Make a new vector and store it back in *ARGVP,
    and store its length in *ARGVC.  */
 /* Translate the options described by *ARGCP and *ARGVP.
    Make a new vector and store it back in *ARGVP,
    and store its length in *ARGVC.  */
@@ -900,8 +976,9 @@ translate_options (argcp, argvp)
   int i;
   int argc = *argcp;
   const char *const *argv = *argvp;
   int i;
   int argc = *argcp;
   const char *const *argv = *argvp;
+  int newvsize = (argc + 2) * 2 * sizeof (const char *);
   const char **newv =
   const char **newv =
-    (const char **) xmalloc ((argc + 2) * 2 * sizeof (const char *));
+    (const char **) xmalloc (newvsize);
   int newindex = 0;
 
   i = 0;
   int newindex = 0;
 
   i = 0;
@@ -909,6 +986,56 @@ translate_options (argcp, argvp)
 
   while (i < argc)
     {
 
   while (i < argc)
     {
+#ifdef TARGET_OPTION_TRANSLATE_TABLE
+      int tott_idx;
+
+      for (tott_idx = 0;
+          target_option_translations[tott_idx].option_found;
+          tott_idx++)
+       {
+         if (strcmp (target_option_translations[tott_idx].option_found,
+                     argv[i]) == 0)
+           {
+             int spaces = 1;
+             const char *sp;
+             char *np;
+
+             for (sp = target_option_translations[tott_idx].replacements;
+                  *sp; sp++)
+               {
+                 if (*sp == ' ')
+                   spaces ++;
+               }
+
+             newvsize += spaces * sizeof (const char *);
+             newv = (const char **) xrealloc (newv, newvsize);
+
+             sp = target_option_translations[tott_idx].replacements;
+             np = (char *) xmalloc (strlen (sp) + 1);
+             strcpy (np, sp);
+
+             while (1)
+               {
+                 while (*np == ' ')
+                   np++;
+                 if (*np == 0)
+                   break;
+                 newv[newindex++] = np;
+                 while (*np != ' ' && *np)
+                   np++;
+                 if (*np == 0)
+                   break;
+                 *np++ = 0;
+               }
+
+             i ++;
+             break;
+           }
+       }
+      if (target_option_translations[tott_idx].option_found)
+       continue;
+#endif
+
       /* Translate -- options.  */
       if (argv[i][0] == '-' && argv[i][1] == '-')
        {
       /* Translate -- options.  */
       if (argv[i][0] == '-' && argv[i][1] == '-')
        {
@@ -994,7 +1121,7 @@ translate_options (argcp, argvp)
                  /* Store the translation as one argv elt or as two.  */
                  if (arg != 0 && strchr (arginfo, 'j') != 0)
                    newv[newindex++] = concat (option_map[j].equivalent, arg,
                  /* Store the translation as one argv elt or as two.  */
                  if (arg != 0 && strchr (arginfo, 'j') != 0)
                    newv[newindex++] = concat (option_map[j].equivalent, arg,
-                                              NULL_PTR);
+                                              NULL);
                  else if (arg != 0)
                    {
                      newv[newindex++] = option_map[j].equivalent;
                  else if (arg != 0)
                    {
                      newv[newindex++] = option_map[j].equivalent;
@@ -1078,7 +1205,7 @@ skip_whitespace (p)
 
 struct prefix_list
 {
 
 struct prefix_list
 {
-  char *prefix;               /* String to prepend to the path.  */
+  const char *prefix;        /* String to prepend to the path.  */
   struct prefix_list *next;   /* Next in linked list.  */
   int require_machine_suffix; /* Don't use without machine_suffix.  */
   /* 2 means try both machine_suffix and just_machine_suffix.  */
   struct prefix_list *next;   /* Next in linked list.  */
   int require_machine_suffix; /* Don't use without machine_suffix.  */
   /* 2 means try both machine_suffix and just_machine_suffix.  */
@@ -1193,7 +1320,7 @@ struct spec_list
 };
 
 #define INIT_STATIC_SPEC(NAME,PTR) \
 };
 
 #define INIT_STATIC_SPEC(NAME,PTR) \
-{ NAME, NULL_PTR, PTR, (struct spec_list *) 0, sizeof (NAME) - 1, 0 }
+{ NAME, NULL, PTR, (struct spec_list *) 0, sizeof (NAME) - 1, 0 }
 
 /* List of statically defined specs.  */
 static struct spec_list static_specs[] =
 
 /* List of statically defined specs.  */
 static struct spec_list static_specs[] =
@@ -1247,6 +1374,35 @@ static struct spec_list *extra_specs = (struct spec_list *) 0;
 
 static struct spec_list *specs = (struct spec_list *) 0;
 \f
 
 static struct spec_list *specs = (struct spec_list *) 0;
 \f
+/* Add appropriate libgcc specs to OBSTACK, taking into account
+   various permutations of -shared-libgcc, -shared, and such.  */
+
+static void
+init_gcc_specs (obstack, shared_name, static_name)
+     struct obstack *obstack;
+     const char *shared_name;
+     const char *static_name;
+{
+  char buffer[128];
+
+  /* If we see -shared-libgcc, then use the shared version.  */
+  sprintf (buffer, "%%{shared-libgcc:%s %s}", shared_name, static_name);
+  obstack_grow (obstack, buffer, strlen (buffer));
+  /* If we see -static-libgcc, then use the static version.  */
+  sprintf (buffer, "%%{static-libgcc:%s}", static_name);
+  obstack_grow (obstack, buffer, strlen (buffer));
+  /* Otherwise, if we see -shared, then use the shared version.  */
+  sprintf (buffer,
+          "%%{!shared-libgcc:%%{!static-libgcc:%%{shared:%s %s}}}", 
+          shared_name, static_name);
+  obstack_grow (obstack, buffer, strlen (buffer));
+  /* Otherwise, use the static version.  */
+  sprintf (buffer, 
+          "%%{!shared-libgcc:%%{!static-libgcc:%%{!shared:%s}}}", 
+          static_name);
+  obstack_grow (obstack, buffer, strlen (buffer));
+}
+
 /* Initialize the specs lookup routines.  */
 
 static void
 /* Initialize the specs lookup routines.  */
 
 static void
@@ -1321,15 +1477,16 @@ init_spec ()
        when given the proper command line arguments.  */
     while (*p)
       {
        when given the proper command line arguments.  */
     while (*p)
       {
-       const char *r;
         if (in_sep && *p == '-' && strncmp (p, "-lgcc", 5) == 0)
          {
         if (in_sep && *p == '-' && strncmp (p, "-lgcc", 5) == 0)
          {
+           init_gcc_specs (&obstack,
 #ifdef NO_SHARED_LIBGCC_MULTILIB
 #ifdef NO_SHARED_LIBGCC_MULTILIB
-           r = "%{shared-libgcc:-lgcc_s}%{!shared-libgcc:-lgcc}";
+                           "-lgcc_s"
 #else
 #else
-           r = "%{shared-libgcc:-lgcc_s%M}%{!shared-libgcc:-lgcc}";
+                           "-lgcc_s%M"
 #endif
 #endif
-           obstack_grow (&obstack, r, strlen(r));
+                           ,
+                           "-lgcc");
            p += 5;
            in_sep = 0;
          }
            p += 5;
            in_sep = 0;
          }
@@ -1337,12 +1494,14 @@ init_spec ()
          {
            /* Ug.  We don't know shared library extensions.  Hope that
               systems that use this form don't do shared libraries.  */
          {
            /* Ug.  We don't know shared library extensions.  Hope that
               systems that use this form don't do shared libraries.  */
+           init_gcc_specs (&obstack,
 #ifdef NO_SHARED_LIBGCC_MULTILIB
 #ifdef NO_SHARED_LIBGCC_MULTILIB
-           r = "%{shared-libgcc:-lgcc_s}%{!shared-libgcc:libgcc.a%s}";
+                           "-lgcc_s"
 #else
 #else
-           r = "%{shared-libgcc:-lgcc_s%M}%{!shared-libgcc:libgcc.a%s}";
+                           "-lgcc_s%M"
 #endif
 #endif
-           obstack_grow (&obstack, r, strlen(r));
+                           ,
+                           "libgcc.a%s");
            p += 10;
            in_sep = 0;
          }
            p += 10;
            in_sep = 0;
          }
@@ -1358,6 +1517,15 @@ init_spec ()
     libgcc_spec = obstack_finish (&obstack);
   }
 #endif
     libgcc_spec = obstack_finish (&obstack);
   }
 #endif
+#ifdef USE_AS_TRADITIONAL_FORMAT
+  /* Prepend "--traditional-format" to whatever asm_spec we had before.  */
+  {
+    static char tf[] = "--traditional-format ";
+    obstack_grow (&obstack, tf, sizeof(tf) - 1);
+    obstack_grow0 (&obstack, asm_spec, strlen (asm_spec));
+    asm_spec = obstack_finish (&obstack);
+  }
+#endif
 
   specs = sl;
 }
 
   specs = sl;
 }
@@ -1409,7 +1577,7 @@ set_spec (name, spec)
 
   old_spec = *(sl->ptr_spec);
   *(sl->ptr_spec) = ((spec[0] == '+' && ISSPACE ((unsigned char)spec[1]))
 
   old_spec = *(sl->ptr_spec);
   *(sl->ptr_spec) = ((spec[0] == '+' && ISSPACE ((unsigned char)spec[1]))
-                    ? concat (old_spec, spec + 1, NULL_PTR)
+                    ? concat (old_spec, spec + 1, NULL)
                     : xstrdup (spec));
 
 #ifdef DEBUG_SPECS
                     : xstrdup (spec));
 
 #ifdef DEBUG_SPECS
@@ -1830,7 +1998,7 @@ static struct temp_file *failure_delete_queue;
    FAIL_DELETE nonzero means delete it if a compilation step fails;
    otherwise delete it in any case.  */
 
    FAIL_DELETE nonzero means delete it if a compilation step fails;
    otherwise delete it in any case.  */
 
-static void
+void
 record_temp_file (filename, always_delete, fail_delete)
      const char *filename;
      int always_delete;
 record_temp_file (filename, always_delete, fail_delete)
      const char *filename;
      int always_delete;
@@ -1921,60 +2089,6 @@ clear_failure_queue ()
   failure_delete_queue = 0;
 }
 \f
   failure_delete_queue = 0;
 }
 \f
-/* Routine to add variables to the environment.  We do this to pass
-   the pathname of the gcc driver, and the directories search to the
-   collect2 program, which is being run as ld.  This way, we can be
-   sure of executing the right compiler when collect2 wants to build
-   constructors and destructors.  Since the environment variables we
-   use come from an obstack, we don't have to worry about allocating
-   space for them.  */
-
-#ifndef HAVE_PUTENV
-
-void
-putenv (str)
-     char *str;
-{
-#ifndef VMS                    /* nor about VMS */
-
-  extern char **environ;
-  char **old_environ = environ;
-  char **envp;
-  int num_envs = 0;
-  int name_len = 1;
-  int str_len = strlen (str);
-  char *p = str;
-  int ch;
-
-  while ((ch = *p++) != '\0' && ch != '=')
-    name_len++;
-
-  if (!ch)
-    abort ();
-
-  /* Search for replacing an existing environment variable, and
-     count the number of total environment variables.  */
-  for (envp = old_environ; *envp; envp++)
-    {
-      num_envs++;
-      if (!strncmp (str, *envp, name_len))
-       {
-         *envp = str;
-         return;
-       }
-    }
-
-  /* Add a new environment variable */
-  environ = (char **) xmalloc (sizeof (char *) * (num_envs + 2));
-  *environ = str;
-  memcpy ((char *) (environ + 1), (char *) old_environ,
-         sizeof (char *) * (num_envs + 1));
-
-#endif /* VMS */
-}
-
-#endif /* HAVE_PUTENV */
-\f
 /* Build a list of search directories from PATHS.
    PREFIX is a string to prepend to the list.
    If CHECK_DIR_P is non-zero we ensure the directory exists.
 /* Build a list of search directories from PATHS.
    PREFIX is a string to prepend to the list.
    If CHECK_DIR_P is non-zero we ensure the directory exists.
@@ -2118,7 +2232,7 @@ split_directories (name, ptr_num_dirs)
   if (p - 1 - q > 0)
     dirs[num_dirs++] = save_string (q, p - 1 - q);
 
   if (p - 1 - q > 0)
     dirs[num_dirs++] = save_string (q, p - 1 - q);
 
-  dirs[num_dirs] = NULL_PTR;
+  dirs[num_dirs] = NULL;
   if (ptr_num_dirs)
     *ptr_num_dirs = num_dirs;
 
   if (ptr_num_dirs)
     *ptr_num_dirs = num_dirs;
 
@@ -2133,7 +2247,7 @@ free_split_directories (dirs)
 {
   int i = 0;
 
 {
   int i = 0;
 
-  while (dirs[i] != NULL_PTR)
+  while (dirs[i] != NULL)
     free (dirs[i++]);
 
   free ((char *) dirs);
     free (dirs[i++]);
 
   free ((char *) dirs);
@@ -2171,8 +2285,12 @@ make_relative_prefix (progname, bin_prefix, prefix)
       GET_ENV_PATH_LIST (temp, "PATH");
       if (temp)
        {
       GET_ENV_PATH_LIST (temp, "PATH");
       if (temp)
        {
-         char *startp, *endp;
-         char *nstore = (char *) alloca (strlen (temp) + strlen (progname) + 1);
+         char *startp, *endp, *nstore;
+         size_t prefixlen = strlen (temp) + 1;
+         if (prefixlen < 2)
+           prefixlen = 2;
+
+         nstore = (char *) alloca (prefixlen + strlen (progname) + 1);
 
          startp = endp = temp;
          while (1)
 
          startp = endp = temp;
          while (1)
@@ -2198,8 +2316,8 @@ make_relative_prefix (progname, bin_prefix, prefix)
                    }
                  strcat (nstore, progname);
                  if (! access (nstore, X_OK)
                    }
                  strcat (nstore, progname);
                  if (! access (nstore, X_OK)
-#ifdef HAVE_EXECUTABLE_SUFFIX
-                      || ! access (strcat (nstore, EXECUTABLE_SUFFIX), X_OK)
+#ifdef HAVE_HOST_EXECUTABLE_SUFFIX
+                      || ! access (strcat (nstore, HOST_EXECUTABLE_SUFFIX), X_OK)
 #endif
                      )
                    {
 #endif
                      )
                    {
@@ -2240,7 +2358,7 @@ make_relative_prefix (progname, bin_prefix, prefix)
          free_split_directories (prog_dirs);
          free_split_directories (bin_dirs);
          prog_dirs = bin_dirs = (char **) 0;
          free_split_directories (prog_dirs);
          free_split_directories (bin_dirs);
          prog_dirs = bin_dirs = (char **) 0;
-         return NULL_PTR;
+         return NULL;
        }
     }
 
        }
     }
 
@@ -2260,7 +2378,7 @@ make_relative_prefix (progname, bin_prefix, prefix)
       free_split_directories (prog_dirs);
       free_split_directories (bin_dirs);
       free_split_directories (prefix_dirs);
       free_split_directories (prog_dirs);
       free_split_directories (bin_dirs);
       free_split_directories (prefix_dirs);
-      return NULL_PTR;
+      return NULL;
     }
 
   /* Build up the pathnames in argv[0].  */
     }
 
   /* Build up the pathnames in argv[0].  */
@@ -2318,7 +2436,7 @@ find_a_file (pprefix, name, mode)
      int mode;
 {
   char *temp;
      int mode;
 {
   char *temp;
-  const char *file_suffix = ((mode & X_OK) != 0 ? EXECUTABLE_SUFFIX : "");
+  const char *file_suffix = ((mode & X_OK) != 0 ? HOST_EXECUTABLE_SUFFIX : "");
   struct prefix_list *pl;
   int len = pprefix->max_len + strlen (name) + strlen (file_suffix) + 1;
 
   struct prefix_list *pl;
   int len = pprefix->max_len + strlen (name) + strlen (file_suffix) + 1;
 
@@ -2493,7 +2611,7 @@ add_prefix (pprefix, prefix, component, priority, require_machine_suffix, warn)
     pprefix->max_len = len;
 
   pl = (struct prefix_list *) xmalloc (sizeof (struct prefix_list));
     pprefix->max_len = len;
 
   pl = (struct prefix_list *) xmalloc (sizeof (struct prefix_list));
-  pl->prefix = save_string (prefix, len);
+  pl->prefix = prefix;
   pl->require_machine_suffix = require_machine_suffix;
   pl->used_flag_ptr = warn;
   pl->priority = priority;
   pl->require_machine_suffix = require_machine_suffix;
   pl->used_flag_ptr = warn;
   pl->priority = priority;
@@ -2753,7 +2871,7 @@ struct infile
 
 static struct infile *infiles;
 
 
 static struct infile *infiles;
 
-static int n_infiles;
+int n_infiles;
 
 /* This counts the number of libraries added by lang_specific_driver, so that
    we can tell if there were any user supplied any files or libraries.  */
 
 /* This counts the number of libraries added by lang_specific_driver, so that
    we can tell if there were any user supplied any files or libraries.  */
@@ -2762,7 +2880,7 @@ static int added_libraries;
 
 /* And a vector of corresponding output files is made up later.  */
 
 
 /* And a vector of corresponding output files is made up later.  */
 
-static const char **outfiles;
+const char **outfiles;
 
 /* Used to track if none of the -B paths are used.  */
 static int warn_B;
 
 /* Used to track if none of the -B paths are used.  */
 static int warn_B;
@@ -2773,7 +2891,7 @@ static int warn_std;
 /* Gives value to pass as "warn" to add_prefix for standard prefixes.  */
 static int *warn_std_ptr = 0;
 \f
 /* Gives value to pass as "warn" to add_prefix for standard prefixes.  */
 static int *warn_std_ptr = 0;
 \f
-#if defined(HAVE_OBJECT_SUFFIX) || defined(HAVE_EXECUTABLE_SUFFIX)
+#if defined(HAVE_TARGET_OBJECT_SUFFIX) || defined(HAVE_TARGET_EXECUTABLE_SUFFIX)
 
 /* Convert NAME to a new name if it is the standard suffix.  DO_EXE
    is true if we should look for an executable suffix as well.  */
 
 /* Convert NAME to a new name if it is the standard suffix.  DO_EXE
    is true if we should look for an executable suffix as well.  */
@@ -2791,22 +2909,22 @@ convert_filename (name, do_exe)
 
   len = strlen (name);
 
 
   len = strlen (name);
 
-#ifdef HAVE_OBJECT_SUFFIX
-  /* Convert x.o to x.obj if OBJECT_SUFFIX is ".obj".  */
+#ifdef HAVE_TARGET_OBJECT_SUFFIX
+  /* Convert x.o to x.obj if TARGET_OBJECT_SUFFIX is ".obj".  */
   if (len > 2
       && name[len - 2] == '.'
       && name[len - 1] == 'o')
     {
       obstack_grow (&obstack, name, len - 2);
   if (len > 2
       && name[len - 2] == '.'
       && name[len - 1] == 'o')
     {
       obstack_grow (&obstack, name, len - 2);
-      obstack_grow0 (&obstack, OBJECT_SUFFIX, strlen (OBJECT_SUFFIX));
+      obstack_grow0 (&obstack, TARGET_OBJECT_SUFFIX, strlen (TARGET_OBJECT_SUFFIX));
       name = obstack_finish (&obstack);
     }
 #endif
 
       name = obstack_finish (&obstack);
     }
 #endif
 
-#ifdef HAVE_EXECUTABLE_SUFFIX
+#if defined(HAVE_TARGET_EXECUTABLE_SUFFIX)
   /* If there is no filetype, make it the executable suffix (which includes
      the ".").  But don't get confused if we have just "-o".  */
   /* If there is no filetype, make it the executable suffix (which includes
      the ".").  But don't get confused if we have just "-o".  */
-  if (! do_exe || EXECUTABLE_SUFFIX[0] == 0 || (len == 2 && name[0] == '-'))
+  if (! do_exe || TARGET_EXECUTABLE_SUFFIX[0] == 0 || (len == 2 && name[0] == '-'))
     return name;
 
   for (i = len - 1; i >= 0; i--)
     return name;
 
   for (i = len - 1; i >= 0; i--)
@@ -2818,7 +2936,8 @@ convert_filename (name, do_exe)
       return name;
 
   obstack_grow (&obstack, name, len);
       return name;
 
   obstack_grow (&obstack, name, len);
-  obstack_grow0 (&obstack, EXECUTABLE_SUFFIX, strlen (EXECUTABLE_SUFFIX));
+  obstack_grow0 (&obstack, TARGET_EXECUTABLE_SUFFIX,
+                strlen (TARGET_EXECUTABLE_SUFFIX));
   name = obstack_finish (&obstack);
 #endif
 
   name = obstack_finish (&obstack);
 #endif
 
@@ -2874,9 +2993,9 @@ display_help ()
 "), stdout);
 
   printf (_("\
 "), stdout);
 
   printf (_("\
-\nOptions starting with -g, -f, -m, -O or -W are automatically passed on to\n\
-the various sub-processes invoked by %s.  In order to pass other options\n\
-on to these processes the -W<letter> options must be used.\n\
+\nOptions starting with -g, -f, -m, -O, -W, or --param are automatically\n\
+ passed on to the various sub-processes invoked by %s.  In order to pass\n\
+ other options on to these processes the -W<letter> options must be used.\n\
 "), programname);
 
   /* The rest of the options are displayed by invocations of the various
 "), programname);
 
   /* The rest of the options are displayed by invocations of the various
@@ -2988,7 +3107,7 @@ process_command (argc, argv)
       gcc_exec_prefix = make_relative_prefix (argv[0], standard_bindir_prefix,
                                              standard_exec_prefix);
       if (gcc_exec_prefix)
       gcc_exec_prefix = make_relative_prefix (argv[0], standard_bindir_prefix,
                                              standard_exec_prefix);
       if (gcc_exec_prefix)
-       putenv (concat ("GCC_EXEC_PREFIX=", gcc_exec_prefix, NULL_PTR));
+       putenv (concat ("GCC_EXEC_PREFIX=", gcc_exec_prefix, NULL));
     }
 #endif
 
     }
 #endif
 
@@ -3009,9 +3128,9 @@ process_command (argc, argv)
 
       set_std_prefix (gcc_exec_prefix, len);
       add_prefix (&exec_prefixes, gcc_exec_prefix, "GCC",
 
       set_std_prefix (gcc_exec_prefix, len);
       add_prefix (&exec_prefixes, gcc_exec_prefix, "GCC",
-                 PREFIX_PRIORITY_LAST, 0, NULL_PTR);
+                 PREFIX_PRIORITY_LAST, 0, NULL);
       add_prefix (&startfile_prefixes, gcc_exec_prefix, "GCC",
       add_prefix (&startfile_prefixes, gcc_exec_prefix, "GCC",
-                 PREFIX_PRIORITY_LAST, 0, NULL_PTR);
+                 PREFIX_PRIORITY_LAST, 0, NULL);
     }
 
   /* COMPILER_PATH and LIBRARY_PATH have values
     }
 
   /* COMPILER_PATH and LIBRARY_PATH have values
@@ -3030,7 +3149,7 @@ process_command (argc, argv)
            {
              strncpy (nstore, startp, endp - startp);
              if (endp == startp)
            {
              strncpy (nstore, startp, endp - startp);
              if (endp == startp)
-               strcpy (nstore, concat (".", dir_separator_str, NULL_PTR));
+               strcpy (nstore, concat (".", dir_separator_str, NULL));
              else if (!IS_DIR_SEPARATOR (endp[-1]))
                {
                  nstore[endp - startp] = DIR_SEPARATOR;
              else if (!IS_DIR_SEPARATOR (endp[-1]))
                {
                  nstore[endp - startp] = DIR_SEPARATOR;
@@ -3039,10 +3158,10 @@ process_command (argc, argv)
              else
                nstore[endp - startp] = 0;
              add_prefix (&exec_prefixes, nstore, 0,
              else
                nstore[endp - startp] = 0;
              add_prefix (&exec_prefixes, nstore, 0,
-                         PREFIX_PRIORITY_LAST, 0, NULL_PTR);
+                         PREFIX_PRIORITY_LAST, 0, NULL);
              add_prefix (&include_prefixes,
              add_prefix (&include_prefixes,
-                         concat (nstore, "include", NULL_PTR),
-                         0, PREFIX_PRIORITY_LAST, 0, NULL_PTR);
+                         concat (nstore, "include", NULL),
+                         0, PREFIX_PRIORITY_LAST, 0, NULL);
              if (*endp == 0)
                break;
              endp = startp = endp + 1;
              if (*endp == 0)
                break;
              endp = startp = endp + 1;
@@ -3065,7 +3184,7 @@ process_command (argc, argv)
            {
              strncpy (nstore, startp, endp - startp);
              if (endp == startp)
            {
              strncpy (nstore, startp, endp - startp);
              if (endp == startp)
-               strcpy (nstore, concat (".", dir_separator_str, NULL_PTR));
+               strcpy (nstore, concat (".", dir_separator_str, NULL));
              else if (!IS_DIR_SEPARATOR (endp[-1]))
                {
                  nstore[endp - startp] = DIR_SEPARATOR;
              else if (!IS_DIR_SEPARATOR (endp[-1]))
                {
                  nstore[endp - startp] = DIR_SEPARATOR;
@@ -3073,8 +3192,8 @@ process_command (argc, argv)
                }
              else
                nstore[endp - startp] = 0;
                }
              else
                nstore[endp - startp] = 0;
-             add_prefix (&startfile_prefixes, nstore, NULL_PTR,
-                         PREFIX_PRIORITY_LAST, 0, NULL_PTR);
+             add_prefix (&startfile_prefixes, nstore, NULL,
+                         PREFIX_PRIORITY_LAST, 0, NULL);
              if (*endp == 0)
                break;
              endp = startp = endp + 1;
              if (*endp == 0)
                break;
              endp = startp = endp + 1;
@@ -3098,7 +3217,7 @@ process_command (argc, argv)
            {
              strncpy (nstore, startp, endp - startp);
              if (endp == startp)
            {
              strncpy (nstore, startp, endp - startp);
              if (endp == startp)
-               strcpy (nstore, concat (".", dir_separator_str, NULL_PTR));
+               strcpy (nstore, concat (".", dir_separator_str, NULL));
              else if (!IS_DIR_SEPARATOR (endp[-1]))
                {
                  nstore[endp - startp] = DIR_SEPARATOR;
              else if (!IS_DIR_SEPARATOR (endp[-1]))
                {
                  nstore[endp - startp] = DIR_SEPARATOR;
@@ -3106,8 +3225,8 @@ process_command (argc, argv)
                }
              else
                nstore[endp - startp] = 0;
                }
              else
                nstore[endp - startp] = 0;
-             add_prefix (&startfile_prefixes, nstore, NULL_PTR,
-                         PREFIX_PRIORITY_LAST, 0, NULL_PTR);
+             add_prefix (&startfile_prefixes, nstore, NULL,
+                         PREFIX_PRIORITY_LAST, 0, NULL);
              if (*endp == 0)
                break;
              endp = startp = endp + 1;
              if (*endp == 0)
                break;
              endp = startp = endp + 1;
@@ -3165,7 +3284,7 @@ process_command (argc, argv)
        }
       else if (strcmp (argv[i], "-ftarget-help") == 0)
         {
        }
       else if (strcmp (argv[i], "-ftarget-help") == 0)
         {
-          /* translate_options() has turned --target-help into -ftarget-help. */
+          /* translate_options() has turned --target-help into -ftarget-help.  */
           target_help_flag = 1;
 
           /* We will be passing a dummy file on to the sub-processes.  */
           target_help_flag = 1;
 
           /* We will be passing a dummy file on to the sub-processes.  */
@@ -3245,6 +3364,14 @@ process_command (argc, argv)
          n_infiles++;
          i++;
        }
          n_infiles++;
          i++;
        }
+      else if (strcmp (argv[i], "-l") == 0)
+       {
+         if (i + 1 == argc)
+           fatal ("argument to `-l' is missing");
+
+         n_infiles++;
+         i++;
+       }
       else if (strncmp (argv[i], "-l", 2) == 0)
        n_infiles++;
       else if (strcmp (argv[i], "-save-temps") == 0)
       else if (strncmp (argv[i], "-l", 2) == 0)
        n_infiles++;
       else if (strcmp (argv[i], "-save-temps") == 0)
@@ -3306,44 +3433,63 @@ process_command (argc, argv)
            case 'B':
              {
                const char *value;
            case 'B':
              {
                const char *value;
+               int len;
+
                if (p[1] == 0 && i + 1 == argc)
                  fatal ("argument to `-B' is missing");
                if (p[1] == 0)
                  value = argv[++i];
                else
                  value = p + 1;
                if (p[1] == 0 && i + 1 == argc)
                  fatal ("argument to `-B' is missing");
                if (p[1] == 0)
                  value = argv[++i];
                else
                  value = p + 1;
-               {
-                 /* As a kludge, if the arg is "[foo/]stageN/", just
-                    add "[foo/]include" to the include prefix.  */
-                 int len = strlen (value);
-                 if ((len == 7
-                      || (len > 7
-                          && (IS_DIR_SEPARATOR (value[len - 8]))))
-                     && strncmp (value + len - 7, "stage", 5) == 0
-                     && ISDIGIT (value[len - 2])
-                     && (IS_DIR_SEPARATOR (value[len - 1])))
-                   {
-                     if (len == 7)
-                       add_prefix (&include_prefixes, "include", NULL_PTR,
-                                   PREFIX_PRIORITY_B_OPT, 0, NULL_PTR);
-                     else
-                       {
-                         char *string = xmalloc (len + 1);
-                         strncpy (string, value, len-7);
-                         strcpy (string+len-7, "include");
-                         add_prefix (&include_prefixes, string, NULL_PTR,
-                                     PREFIX_PRIORITY_B_OPT, 0, NULL_PTR);
-                       }
-                   }
-               }
-               add_prefix (&exec_prefixes, value, NULL_PTR,
+
+               len = strlen (value);
+
+               /* Catch the case where the user has forgotten to append a
+                  directory seperator to the path.  Note, they may be using
+                  -B to add an executable name prefix, eg "i386-elf-", in
+                  order to distinguish between multiple installations of
+                  GCC in the same directory.  Hence we must check to see
+                  if appending a directory separator actually makes a
+                  valid directory name.  */
+               if (! IS_DIR_SEPARATOR (value [len - 1])
+                   && is_directory (value, "", 0))
+                 {
+                   char *tmp = xmalloc (len + 2);
+                   strcpy (tmp, value);
+                   tmp[len] = DIR_SEPARATOR;
+                   tmp[++ len] = 0;
+                   value = tmp;
+                 }
+               
+               /* As a kludge, if the arg is "[foo/]stageN/", just
+                  add "[foo/]include" to the include prefix.  */
+               if ((len == 7
+                    || (len > 7
+                        && (IS_DIR_SEPARATOR (value[len - 8]))))
+                   && strncmp (value + len - 7, "stage", 5) == 0
+                   && ISDIGIT (value[len - 2])
+                   && (IS_DIR_SEPARATOR (value[len - 1])))
+                 {
+                   if (len == 7)
+                     add_prefix (&include_prefixes, "include", NULL,
+                                 PREFIX_PRIORITY_B_OPT, 0, NULL);
+                   else
+                     {
+                       char * string = xmalloc (len + 1);
+
+                       strncpy (string, value, len - 7);
+                       strcpy (string + len - 7, "include");
+                       add_prefix (&include_prefixes, string, NULL,
+                                   PREFIX_PRIORITY_B_OPT, 0, NULL);
+                     }
+                 }
+
+               add_prefix (&exec_prefixes, value, NULL,
                            PREFIX_PRIORITY_B_OPT, 0, &warn_B);
                            PREFIX_PRIORITY_B_OPT, 0, &warn_B);
-               add_prefix (&startfile_prefixes, value, NULL_PTR,
+               add_prefix (&startfile_prefixes, value, NULL,
                            PREFIX_PRIORITY_B_OPT, 0, &warn_B);
                            PREFIX_PRIORITY_B_OPT, 0, &warn_B);
-               add_prefix (&include_prefixes, concat (value, "include",
-                                                      NULL_PTR),
-                           NULL_PTR,
-                           PREFIX_PRIORITY_B_OPT, 0, NULL_PTR);
+               add_prefix (&include_prefixes, concat (value, "include", NULL),
+                           NULL, PREFIX_PRIORITY_B_OPT, 0, NULL);
                n_switches++;
              }
              break;
                n_switches++;
              }
              break;
@@ -3411,7 +3557,7 @@ process_command (argc, argv)
 
            case 'o':
              have_o = 1;
 
            case 'o':
              have_o = 1;
-#if defined(HAVE_EXECUTABLE_SUFFIX)
+#if defined(HAVE_TARGET_EXECUTABLE_SUFFIX)
              if (! have_c)
                {
                  int skip;
              if (! have_c)
                {
                  int skip;
@@ -3431,16 +3577,16 @@ process_command (argc, argv)
                              have_c = 1;
                              break;
                            }
                              have_c = 1;
                              break;
                            }
-                         else if (skip = SWITCH_TAKES_ARG (argv[j][1]))
+                         else if ((skip = SWITCH_TAKES_ARG (argv[j][1])))
                            j += skip - (argv[j][2] != 0);
                            j += skip - (argv[j][2] != 0);
-                         else if (skip = WORD_SWITCH_TAKES_ARG (argv[j] + 1))
+                         else if ((skip = WORD_SWITCH_TAKES_ARG (argv[j] + 1)))
                            j += skip;
                        }
                      j++;
                    }
                }
 #endif
                            j += skip;
                        }
                      j++;
                    }
                }
 #endif
-#if defined(HAVE_EXECUTABLE_SUFFIX) || defined(HAVE_OBJECT_SUFFIX)
+#if defined(HAVE_TARGET_EXECUTABLE_SUFFIX) || defined(HAVE_TARGET_OBJECT_SUFFIX)
              if (p[1] == 0)
                argv[i + 1] = convert_filename (argv[i + 1], ! have_c);
              else
              if (p[1] == 0)
                argv[i + 1] = convert_filename (argv[i + 1], ! have_c);
              else
@@ -3529,7 +3675,7 @@ process_command (argc, argv)
              PREFIX_PRIORITY_LAST, 1, warn_std_ptr);
 
   tooldir_prefix = concat (tooldir_base_prefix, spec_machine,
              PREFIX_PRIORITY_LAST, 1, warn_std_ptr);
 
   tooldir_prefix = concat (tooldir_base_prefix, spec_machine,
-                          dir_separator_str, NULL_PTR);
+                          dir_separator_str, NULL);
 
   /* If tooldir is relative, base it on exec_prefixes.  A relative
      tooldir lets us move the installed tree as a unit.
 
   /* If tooldir is relative, base it on exec_prefixes.  A relative
      tooldir lets us move the installed tree as a unit.
@@ -3544,29 +3690,29 @@ process_command (argc, argv)
        {
          char *gcc_exec_tooldir_prefix
            = concat (gcc_exec_prefix, spec_machine, dir_separator_str,
        {
          char *gcc_exec_tooldir_prefix
            = concat (gcc_exec_prefix, spec_machine, dir_separator_str,
-                     spec_version, dir_separator_str, tooldir_prefix, NULL_PTR);
+                     spec_version, dir_separator_str, tooldir_prefix, NULL);
 
          add_prefix (&exec_prefixes,
                      concat (gcc_exec_tooldir_prefix, "bin",
 
          add_prefix (&exec_prefixes,
                      concat (gcc_exec_tooldir_prefix, "bin",
-                             dir_separator_str, NULL_PTR),
-                     NULL_PTR, PREFIX_PRIORITY_LAST, 0, NULL_PTR);
+                             dir_separator_str, NULL),
+                     NULL, PREFIX_PRIORITY_LAST, 0, NULL);
          add_prefix (&startfile_prefixes,
                      concat (gcc_exec_tooldir_prefix, "lib",
          add_prefix (&startfile_prefixes,
                      concat (gcc_exec_tooldir_prefix, "lib",
-                             dir_separator_str, NULL_PTR),
-                     NULL_PTR, PREFIX_PRIORITY_LAST, 0, NULL_PTR);
+                             dir_separator_str, NULL),
+                     NULL, PREFIX_PRIORITY_LAST, 0, NULL);
        }
 
       tooldir_prefix = concat (standard_exec_prefix, spec_machine,
                               dir_separator_str, spec_version,
        }
 
       tooldir_prefix = concat (standard_exec_prefix, spec_machine,
                               dir_separator_str, spec_version,
-                              dir_separator_str, tooldir_prefix, NULL_PTR);
+                              dir_separator_str, tooldir_prefix, NULL);
     }
 
   add_prefix (&exec_prefixes,
     }
 
   add_prefix (&exec_prefixes,
-             concat (tooldir_prefix, "bin", dir_separator_str, NULL_PTR),
-             "BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL_PTR);
+             concat (tooldir_prefix, "bin", dir_separator_str, NULL),
+             "BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL);
   add_prefix (&startfile_prefixes,
   add_prefix (&startfile_prefixes,
-             concat (tooldir_prefix, "lib", dir_separator_str, NULL_PTR),
-             "BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL_PTR);
+             concat (tooldir_prefix, "lib", dir_separator_str, NULL),
+             "BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL);
 
   /* More prefixes are enabled in main, after we read the specs file
      and determine whether this is cross-compilation or not.  */
 
   /* More prefixes are enabled in main, after we read the specs file
      and determine whether this is cross-compilation or not.  */
@@ -3686,6 +3832,12 @@ process_command (argc, argv)
          infiles[n_infiles].language = "*";
          infiles[n_infiles++].name = argv[++i];
        }
          infiles[n_infiles].language = "*";
          infiles[n_infiles++].name = argv[++i];
        }
+      else if (strcmp (argv[i], "-l") == 0)
+       { /* POSIX allows separation of -l and the lib arg;
+            canonicalize by concatenating -l with its arg */
+         infiles[n_infiles].language = "*";
+         infiles[n_infiles++].name = concat ("-l", argv[++i], NULL);
+       }
       else if (strncmp (argv[i], "-l", 2) == 0)
        {
          infiles[n_infiles].language = "*";
       else if (strncmp (argv[i], "-l", 2) == 0)
        {
          infiles[n_infiles].language = "*";
@@ -3773,6 +3925,7 @@ process_command (argc, argv)
 
          switches[n_switches].live_cond = SWITCH_OK;
          switches[n_switches].validated = 0;
 
          switches[n_switches].live_cond = SWITCH_OK;
          switches[n_switches].validated = 0;
+         switches[n_switches].ordering = 0;
          /* These are always valid, since gcc.c itself understands it.  */
          if (!strcmp (p, "save-temps")
              || !strcmp (p, "static-libgcc")
          /* These are always valid, since gcc.c itself understands it.  */
          if (!strcmp (p, "save-temps")
              || !strcmp (p, "static-libgcc")
@@ -3788,7 +3941,7 @@ process_command (argc, argv)
        }
       else
        {
        }
       else
        {
-#ifdef HAVE_OBJECT_SUFFIX
+#ifdef HAVE_TARGET_OBJECT_SUFFIX
          argv[i] = convert_filename (argv[i], 0);
 #endif
 
          argv[i] = convert_filename (argv[i], 0);
 #endif
 
@@ -3829,6 +3982,9 @@ static int suffixed_basename_length;
 static const char *input_basename;
 static const char *input_suffix;
 
 static const char *input_basename;
 static const char *input_suffix;
 
+/* The compiler used to process the current input file.  */
+static struct compiler *input_file_compiler;
+
 /* These are variables used within do_spec and do_spec_1.  */
 
 /* Nonzero if an arg has been started and not yet terminated
 /* These are variables used within do_spec and do_spec_1.  */
 
 /* Nonzero if an arg has been started and not yet terminated
@@ -3851,6 +4007,10 @@ static int this_is_library_file;
 /* Nonzero means that the input of this command is coming from a pipe.  */
 static int input_from_pipe;
 
 /* Nonzero means that the input of this command is coming from a pipe.  */
 static int input_from_pipe;
 
+/* Nonnull means substitute this for any suffix when outputting a switches
+   arguments.  */
+static const char *suffix_subst;
+
 /* Process the spec SPEC and run the commands specified therein.
    Returns 0 if the spec is successfully processed; -1 if failed.  */
 
 /* Process the spec SPEC and run the commands specified therein.
    Returns 0 if the spec is successfully processed; -1 if failed.  */
 
@@ -3866,8 +4026,9 @@ do_spec (spec)
   this_is_output_file = 0;
   this_is_library_file = 0;
   input_from_pipe = 0;
   this_is_output_file = 0;
   this_is_library_file = 0;
   input_from_pipe = 0;
+  suffix_subst = NULL;
 
 
-  value = do_spec_1 (spec, 0, NULL_PTR);
+  value = do_spec_1 (spec, 0, NULL);
 
   /* Force out any unfinished command.
      If -pipe, this forces out the last command if it ended in `|'.  */
 
   /* Force out any unfinished command.
      If -pipe, this forces out the last command if it ended in `|'.  */
@@ -4054,28 +4215,28 @@ do_spec_1 (spec, inswitch, soft_matched_part)
                          strcat (buffer, machine_suffix);
                          if (is_directory (buffer, multilib_dir, 1))
                            {
                          strcat (buffer, machine_suffix);
                          if (is_directory (buffer, multilib_dir, 1))
                            {
-                             do_spec_1 ("-L", 0, NULL_PTR);
+                             do_spec_1 ("-L", 0, NULL);
 #ifdef SPACE_AFTER_L_OPTION
 #ifdef SPACE_AFTER_L_OPTION
-                             do_spec_1 (" ", 0, NULL_PTR);
+                             do_spec_1 (" ", 0, NULL);
 #endif
 #endif
-                             do_spec_1 (buffer, 1, NULL_PTR);
-                             do_spec_1 (multilib_dir, 1, NULL_PTR);
+                             do_spec_1 (buffer, 1, NULL);
+                             do_spec_1 (multilib_dir, 1, NULL);
                              /* Make this a separate argument.  */
                              /* Make this a separate argument.  */
-                             do_spec_1 (" ", 0, NULL_PTR);
+                             do_spec_1 (" ", 0, NULL);
                            }
                        }
                      if (!pl->require_machine_suffix)
                        {
                          if (is_directory (pl->prefix, multilib_dir, 1))
                            {
                            }
                        }
                      if (!pl->require_machine_suffix)
                        {
                          if (is_directory (pl->prefix, multilib_dir, 1))
                            {
-                             do_spec_1 ("-L", 0, NULL_PTR);
+                             do_spec_1 ("-L", 0, NULL);
 #ifdef SPACE_AFTER_L_OPTION
 #ifdef SPACE_AFTER_L_OPTION
-                             do_spec_1 (" ", 0, NULL_PTR);
+                             do_spec_1 (" ", 0, NULL);
 #endif
 #endif
-                             do_spec_1 (pl->prefix, 1, NULL_PTR);
-                             do_spec_1 (multilib_dir, 1, NULL_PTR);
+                             do_spec_1 (pl->prefix, 1, NULL);
+                             do_spec_1 (multilib_dir, 1, NULL);
                              /* Make this a separate argument.  */
                              /* Make this a separate argument.  */
-                             do_spec_1 (" ", 0, NULL_PTR);
+                             do_spec_1 (" ", 0, NULL);
                            }
                        }
                    }
                            }
                        }
                    }
@@ -4083,11 +4244,11 @@ do_spec_1 (spec, inswitch, soft_matched_part)
                    {
                      if (is_directory (pl->prefix, machine_suffix, 1))
                        {
                    {
                      if (is_directory (pl->prefix, machine_suffix, 1))
                        {
-                         do_spec_1 ("-L", 0, NULL_PTR);
+                         do_spec_1 ("-L", 0, NULL);
 #ifdef SPACE_AFTER_L_OPTION
 #ifdef SPACE_AFTER_L_OPTION
-                         do_spec_1 (" ", 0, NULL_PTR);
+                         do_spec_1 (" ", 0, NULL);
 #endif
 #endif
-                         do_spec_1 (pl->prefix, 1, NULL_PTR);
+                         do_spec_1 (pl->prefix, 1, NULL);
                          /* Remove slash from machine_suffix.  */
                          if (strlen (machine_suffix) >= bufsize)
                            bufsize = strlen (machine_suffix) * 2 + 1;
                          /* Remove slash from machine_suffix.  */
                          if (strlen (machine_suffix) >= bufsize)
                            bufsize = strlen (machine_suffix) * 2 + 1;
@@ -4096,18 +4257,18 @@ do_spec_1 (spec, inswitch, soft_matched_part)
                          idx = strlen (buffer);
                          if (IS_DIR_SEPARATOR (buffer[idx - 1]))
                            buffer[idx - 1] = 0;
                          idx = strlen (buffer);
                          if (IS_DIR_SEPARATOR (buffer[idx - 1]))
                            buffer[idx - 1] = 0;
-                         do_spec_1 (buffer, 1, NULL_PTR);
+                         do_spec_1 (buffer, 1, NULL);
                          /* Make this a separate argument.  */
                          /* Make this a separate argument.  */
-                         do_spec_1 (" ", 0, NULL_PTR);
+                         do_spec_1 (" ", 0, NULL);
                        }
                    }
                  if (!pl->require_machine_suffix)
                    {
                      if (is_directory (pl->prefix, "", 1))
                        {
                        }
                    }
                  if (!pl->require_machine_suffix)
                    {
                      if (is_directory (pl->prefix, "", 1))
                        {
-                         do_spec_1 ("-L", 0, NULL_PTR);
+                         do_spec_1 ("-L", 0, NULL);
 #ifdef SPACE_AFTER_L_OPTION
 #ifdef SPACE_AFTER_L_OPTION
-                         do_spec_1 (" ", 0, NULL_PTR);
+                         do_spec_1 (" ", 0, NULL);
 #endif
                          /* Remove slash from pl->prefix.  */
                          if (strlen (pl->prefix) >= bufsize)
 #endif
                          /* Remove slash from pl->prefix.  */
                          if (strlen (pl->prefix) >= bufsize)
@@ -4117,9 +4278,9 @@ do_spec_1 (spec, inswitch, soft_matched_part)
                          idx = strlen (buffer);
                          if (IS_DIR_SEPARATOR (buffer[idx - 1]))
                            buffer[idx - 1] = 0;
                          idx = strlen (buffer);
                          if (IS_DIR_SEPARATOR (buffer[idx - 1]))
                            buffer[idx - 1] = 0;
-                         do_spec_1 (buffer, 1, NULL_PTR);
+                         do_spec_1 (buffer, 1, NULL);
                          /* Make this a separate argument.  */
                          /* Make this a separate argument.  */
-                         do_spec_1 (" ", 0, NULL_PTR);
+                         do_spec_1 (" ", 0, NULL);
                        }
                    }
                }
                        }
                    }
                }
@@ -4142,6 +4303,21 @@ do_spec_1 (spec, inswitch, soft_matched_part)
              return -1;
            }
            break;
              return -1;
            }
            break;
+         case 'n':
+           /* %nfoo means report an notice with `foo' on stderr.  */
+           {
+             const char *q = p;
+             char *buf;
+             while (*p != 0 && *p != '\n')
+               p++;
+             buf = (char *) alloca (p - q + 1);
+             strncpy (buf, q, p - q);
+             buf[p - q] = 0;
+             notice ("%s\n", buf);
+             if (*p)
+               p++;
+           }
+           break;
 
          case 'j':
            {
 
          case 'j':
            {
@@ -4188,17 +4364,17 @@ do_spec_1 (spec, inswitch, soft_matched_part)
                    if (*p == '.' || ISALPHA ((unsigned char) *p))
                      abort ();
                    if (suffix_length == 0)
                    if (*p == '.' || ISALPHA ((unsigned char) *p))
                      abort ();
                    if (suffix_length == 0)
-                     suffix = OBJECT_SUFFIX;
+                     suffix = TARGET_OBJECT_SUFFIX;
                    else
                      {
                        saved_suffix
                          = (char *) xmalloc (suffix_length
                    else
                      {
                        saved_suffix
                          = (char *) xmalloc (suffix_length
-                                             + strlen (OBJECT_SUFFIX));
+                                             + strlen (TARGET_OBJECT_SUFFIX));
                        strncpy (saved_suffix, suffix, suffix_length);
                        strcpy (saved_suffix + suffix_length,
                        strncpy (saved_suffix, suffix, suffix_length);
                        strcpy (saved_suffix + suffix_length,
-                               OBJECT_SUFFIX);
+                               TARGET_OBJECT_SUFFIX);
                      }
                      }
-                   suffix_length += strlen (OBJECT_SUFFIX);
+                   suffix_length += strlen (TARGET_OBJECT_SUFFIX);
                  }
 
                /* See if we already have an association of %g/%u/%U and
                  }
 
                /* See if we already have an association of %g/%u/%U and
@@ -4209,7 +4385,8 @@ do_spec_1 (spec, inswitch, soft_matched_part)
                      && t->unique == (c != 'g'))
                    break;
 
                      && t->unique == (c != 'g'))
                    break;
 
-               /* Make a new association if needed.  %u and %j require one.  */
+               /* Make a new association if needed.  %u and %j
+                  require one.  */
                if (t == 0 || c == 'u' || c == 'j')
                  {
                    if (t == 0)
                if (t == 0 || c == 'u' || c == 'j')
                  {
                    if (t == 0)
@@ -4219,7 +4396,13 @@ do_spec_1 (spec, inswitch, soft_matched_part)
                        temp_names = t;
                      }
                    t->length = suffix_length;
                        temp_names = t;
                      }
                    t->length = suffix_length;
-                   t->suffix = save_string (suffix, suffix_length);
+                   if (saved_suffix)
+                     {
+                       t->suffix = saved_suffix;
+                       saved_suffix = NULL;
+                     }
+                   else
+                     t->suffix = save_string (suffix, suffix_length);
                    t->unique = (c != 'g');
                    temp_filename = make_temp_file (t->suffix);
                    temp_filename_length = strlen (temp_filename);
                    t->unique = (c != 'g');
                    temp_filename = make_temp_file (t->suffix);
                    temp_filename_length = strlen (temp_filename);
@@ -4247,20 +4430,20 @@ do_spec_1 (spec, inswitch, soft_matched_part)
 
              if (gcc_exec_prefix)
                {
 
              if (gcc_exec_prefix)
                {
-                 do_spec_1 ("-iprefix", 1, NULL_PTR);
+                 do_spec_1 ("-iprefix", 1, NULL);
                  /* Make this a separate argument.  */
                  /* Make this a separate argument.  */
-                 do_spec_1 (" ", 0, NULL_PTR);
-                 do_spec_1 (gcc_exec_prefix, 1, NULL_PTR);
-                 do_spec_1 (" ", 0, NULL_PTR);
+                 do_spec_1 (" ", 0, NULL);
+                 do_spec_1 (gcc_exec_prefix, 1, NULL);
+                 do_spec_1 (" ", 0, NULL);
                }
 
              for (; pl; pl = pl->next)
                {
                }
 
              for (; pl; pl = pl->next)
                {
-                 do_spec_1 ("-isystem", 1, NULL_PTR);
+                 do_spec_1 ("-isystem", 1, NULL);
                  /* Make this a separate argument.  */
                  /* Make this a separate argument.  */
-                 do_spec_1 (" ", 0, NULL_PTR);
-                 do_spec_1 (pl->prefix, 1, NULL_PTR);
-                 do_spec_1 (" ", 0, NULL_PTR);
+                 do_spec_1 (" ", 0, NULL);
+                 do_spec_1 (pl->prefix, 1, NULL);
+                 do_spec_1 (" ", 0, NULL);
                }
            }
            break;
                }
            }
            break;
@@ -4277,7 +4460,7 @@ do_spec_1 (spec, inswitch, soft_matched_part)
            }
 
          case 'O':
            }
 
          case 'O':
-           obstack_grow (&obstack, OBJECT_SUFFIX, strlen (OBJECT_SUFFIX));
+           obstack_grow (&obstack, TARGET_OBJECT_SUFFIX, strlen (TARGET_OBJECT_SUFFIX));
            arg_going = 1;
            break;
 
            arg_going = 1;
            break;
 
@@ -4335,9 +4518,9 @@ do_spec_1 (spec, inswitch, soft_matched_part)
          case 'X':
            for (i = 0; i < n_linker_options; i++)
              {
          case 'X':
            for (i = 0; i < n_linker_options; i++)
              {
-               do_spec_1 (linker_options[i], 1, NULL_PTR);
+               do_spec_1 (linker_options[i], 1, NULL);
                /* Make each accumulated option a separate argument.  */
                /* Make each accumulated option a separate argument.  */
-               do_spec_1 (" ", 0, NULL_PTR);
+               do_spec_1 (" ", 0, NULL);
              }
            break;
 
              }
            break;
 
@@ -4345,9 +4528,9 @@ do_spec_1 (spec, inswitch, soft_matched_part)
          case 'Y':
            for (i = 0; i < n_assembler_options; i++)
              {
          case 'Y':
            for (i = 0; i < n_assembler_options; i++)
              {
-               do_spec_1 (assembler_options[i], 1, NULL_PTR);
+               do_spec_1 (assembler_options[i], 1, NULL);
                /* Make each accumulated option a separate argument.  */
                /* Make each accumulated option a separate argument.  */
-               do_spec_1 (" ", 0, NULL_PTR);
+               do_spec_1 (" ", 0, NULL);
              }
            break;
 
              }
            break;
 
@@ -4355,9 +4538,9 @@ do_spec_1 (spec, inswitch, soft_matched_part)
          case 'Z':
            for (i = 0; i < n_preprocessor_options; i++)
              {
          case 'Z':
            for (i = 0; i < n_preprocessor_options; i++)
              {
-               do_spec_1 (preprocessor_options[i], 1, NULL_PTR);
+               do_spec_1 (preprocessor_options[i], 1, NULL);
                /* Make each accumulated option a separate argument.  */
                /* Make each accumulated option a separate argument.  */
-               do_spec_1 (" ", 0, NULL_PTR);
+               do_spec_1 (" ", 0, NULL);
              }
            break;
 
              }
            break;
 
@@ -4365,61 +4548,67 @@ do_spec_1 (spec, inswitch, soft_matched_part)
               a certain constant string as a spec.  */
 
          case '1':
               a certain constant string as a spec.  */
 
          case '1':
-           value = do_spec_1 (cc1_spec, 0, NULL_PTR);
+           value = do_spec_1 (cc1_spec, 0, NULL);
            if (value != 0)
              return value;
            break;
 
          case '2':
            if (value != 0)
              return value;
            break;
 
          case '2':
-           value = do_spec_1 (cc1plus_spec, 0, NULL_PTR);
+           value = do_spec_1 (cc1plus_spec, 0, NULL);
            if (value != 0)
              return value;
            break;
 
          case 'a':
            if (value != 0)
              return value;
            break;
 
          case 'a':
-           value = do_spec_1 (asm_spec, 0, NULL_PTR);
+           value = do_spec_1 (asm_spec, 0, NULL);
            if (value != 0)
              return value;
            break;
 
          case 'A':
            if (value != 0)
              return value;
            break;
 
          case 'A':
-           value = do_spec_1 (asm_final_spec, 0, NULL_PTR);
+           value = do_spec_1 (asm_final_spec, 0, NULL);
            if (value != 0)
              return value;
            break;
 
          case 'c':
            if (value != 0)
              return value;
            break;
 
          case 'c':
-           value = do_spec_1 (signed_char_spec, 0, NULL_PTR);
+           value = do_spec_1 (signed_char_spec, 0, NULL);
            if (value != 0)
              return value;
            break;
 
          case 'C':
            if (value != 0)
              return value;
            break;
 
          case 'C':
-           value = do_spec_1 (cpp_spec, 0, NULL_PTR);
-           if (value != 0)
-             return value;
+           {
+             const char* spec 
+               = (input_file_compiler->cpp_spec 
+                  ? input_file_compiler->cpp_spec 
+                  : cpp_spec);
+             value = do_spec_1 (spec, 0, NULL);
+             if (value != 0)
+               return value;
+           }
            break;
 
          case 'E':
            break;
 
          case 'E':
-           value = do_spec_1 (endfile_spec, 0, NULL_PTR);
+           value = do_spec_1 (endfile_spec, 0, NULL);
            if (value != 0)
              return value;
            break;
 
          case 'l':
            if (value != 0)
              return value;
            break;
 
          case 'l':
-           value = do_spec_1 (link_spec, 0, NULL_PTR);
+           value = do_spec_1 (link_spec, 0, NULL);
            if (value != 0)
              return value;
            break;
 
          case 'L':
            if (value != 0)
              return value;
            break;
 
          case 'L':
-           value = do_spec_1 (lib_spec, 0, NULL_PTR);
+           value = do_spec_1 (lib_spec, 0, NULL);
            if (value != 0)
              return value;
            break;
 
          case 'G':
            if (value != 0)
              return value;
            break;
 
          case 'G':
-           value = do_spec_1 (libgcc_spec, 0, NULL_PTR);
+           value = do_spec_1 (libgcc_spec, 0, NULL);
            if (value != 0)
              return value;
            break;
            if (value != 0)
              return value;
            break;
@@ -4433,7 +4622,7 @@ do_spec_1 (spec, inswitch, soft_matched_part)
 
                len = strlen (multilib_dir);
                obstack_blank (&obstack, len + 1);
 
                len = strlen (multilib_dir);
                obstack_blank (&obstack, len + 1);
-               p = obstack_next_free (&obstack) - len;
+               p = obstack_next_free (&obstack) - (len + 1);
 
                *p++ = '_';
                for (q = multilib_dir; *q ; ++q, ++p)
 
                *p++ = '_';
                for (q = multilib_dir; *q ; ++q, ++p)
@@ -4465,7 +4654,7 @@ do_spec_1 (spec, inswitch, soft_matched_part)
 
              *x = 0;
 
 
              *x = 0;
 
-             value = do_spec_1 (buf, 0, NULL_PTR);
+             value = do_spec_1 (buf, 0, NULL);
              if (value != 0)
                return value;
            }
              if (value != 0)
                return value;
            }
@@ -4596,14 +4785,14 @@ do_spec_1 (spec, inswitch, soft_matched_part)
 
              *x = 0;
 
 
              *x = 0;
 
-             value = do_spec_1 (buf, 0, NULL_PTR);
+             value = do_spec_1 (buf, 0, NULL);
              if (value != 0)
                return value;
            }
            break;
 
          case 'S':
              if (value != 0)
                return value;
            }
            break;
 
          case 'S':
-           value = do_spec_1 (startfile_spec, 0, NULL_PTR);
+           value = do_spec_1 (startfile_spec, 0, NULL);
            if (value != 0)
              return value;
            break;
            if (value != 0)
              return value;
            break;
@@ -4620,11 +4809,22 @@ do_spec_1 (spec, inswitch, soft_matched_part)
            obstack_1grow (&obstack, '%');
            break;
 
            obstack_1grow (&obstack, '%');
            break;
 
+         case '.':
+          {
+            unsigned len = 0;
+
+            while (p[len] && p[len] != ' ' && p[len] != '%')
+              len++;
+             suffix_subst = save_string (p - 1, len + 1);
+             p += len;
+           }
+          break;
+          
          case '*':
            if (soft_matched_part)
              {
          case '*':
            if (soft_matched_part)
              {
-               do_spec_1 (soft_matched_part, 1, NULL_PTR);
-               do_spec_1 (" ", 0, NULL_PTR);
+               do_spec_1 (soft_matched_part, 1, NULL);
+               do_spec_1 (" ", 0, NULL);
              }
            else
              /* Catch the case where a spec string contains something like
              }
            else
              /* Catch the case where a spec string contains something like
@@ -4667,7 +4867,7 @@ do_spec_1 (spec, inswitch, soft_matched_part)
                {
                  if (c == '(')
                    {
                {
                  if (c == '(')
                    {
-                     value = do_spec_1 (name, 0, NULL_PTR);
+                     value = do_spec_1 (name, 0, NULL);
                      if (value != 0)
                        return value;
                    }
                      if (value != 0)
                        return value;
                    }
@@ -4707,7 +4907,7 @@ do_spec_1 (spec, inswitch, soft_matched_part)
                        }
                      *x = 0;
 
                        }
                      *x = 0;
 
-                     value = do_spec_1 (buf, 0, NULL_PTR);
+                     value = do_spec_1 (buf, 0, NULL);
                      if (value != 0)
                        return value;
                    }
                      if (value != 0)
                        return value;
                    }
@@ -4778,7 +4978,7 @@ do_spec_1 (spec, inswitch, soft_matched_part)
 
          case '|':
            if (input_from_pipe)
 
          case '|':
            if (input_from_pipe)
-             do_spec_1 ("-", 0, NULL_PTR);
+             do_spec_1 ("-", 0, NULL);
            break;
 
          default:
            break;
 
          default:
@@ -4892,7 +5092,7 @@ next_member:
              else if (*q == '}')
                count--;
              else if (*q == 0)
              else if (*q == '}')
                count--;
              else if (*q == 0)
-               abort ();
+               fatal ("Mismatched braces in specs");
              q++;
            }
          endbody = q;
              q++;
            }
          endbody = q;
@@ -4911,7 +5111,7 @@ next_member:
        abort ();
 
       if (negate != found
        abort ();
 
       if (negate != found
-         && do_spec_1 (save_string (body, endbody-body-1), 0, NULL_PTR) < 0)
+         && do_spec_1 (save_string (body, endbody-body-1), 0, NULL) < 0)
        return 0;
     }
   else if (p[-1] == '*' && (p[0] == '}' || p[0] == '&'))
        return 0;
     }
   else if (p[-1] == '*' && (p[0] == '}' || p[0] == '&'))
@@ -4970,6 +5170,7 @@ next_member:
                    do_spec_1 (string, 0, &switches[i].part1[hard_match_len]);
                    /* Pass any arguments this switch has.  */
                    give_switch (i, 1, 1);
                    do_spec_1 (string, 0, &switches[i].part1[hard_match_len]);
                    /* Pass any arguments this switch has.  */
                    give_switch (i, 1, 1);
+                   suffix_subst = NULL;
                  }
 
              /* We didn't match.  Try again.  */
                  }
 
              /* We didn't match.  Try again.  */
@@ -5032,7 +5233,7 @@ next_member:
        {
          /* Here if a %{|...} conditional fails: output a minus sign,
             which means "standard output" or "standard input".  */
        {
          /* Here if a %{|...} conditional fails: output a minus sign,
             which means "standard output" or "standard input".  */
-         do_spec_1 ("-", 0, NULL_PTR);
+         do_spec_1 ("-", 0, NULL);
          return endbody;
        }
     }
          return endbody;
        }
     }
@@ -5063,7 +5264,7 @@ next_member:
   else if (true_once)
     {
       if (do_spec_1 (save_string (body, endbody - body - 1),
   else if (true_once)
     {
       if (do_spec_1 (save_string (body, endbody - body - 1),
-                    0, NULL_PTR) < 0)
+                    0, NULL) < 0)
        return 0;
     }
 
        return 0;
     }
 
@@ -5168,8 +5369,8 @@ give_switch (switchnum, omit_first_word, include_blanks)
 
   if (!omit_first_word)
     {
 
   if (!omit_first_word)
     {
-      do_spec_1 ("-", 0, NULL_PTR);
-      do_spec_1 (switches[switchnum].part1, 1, NULL_PTR);
+      do_spec_1 ("-", 0, NULL);
+      do_spec_1 (switches[switchnum].part1, 1, NULL);
     }
 
   if (switches[switchnum].args != 0)
     }
 
   if (switches[switchnum].args != 0)
@@ -5177,13 +5378,33 @@ give_switch (switchnum, omit_first_word, include_blanks)
       const char **p;
       for (p = switches[switchnum].args; *p; p++)
        {
       const char **p;
       for (p = switches[switchnum].args; *p; p++)
        {
+         const char *arg = *p;
+
          if (include_blanks)
          if (include_blanks)
-           do_spec_1 (" ", 0, NULL_PTR);
-         do_spec_1 (*p, 1, NULL_PTR);
+           do_spec_1 (" ", 0, NULL);
+         if (suffix_subst)
+           {
+             unsigned length = strlen (arg);
+             int dot = 0;
+
+             while (length-- && !IS_DIR_SEPARATOR (arg[length]))
+               if (arg[length] == '.')
+                 {
+                   ((char *)arg)[length] = 0;
+                   dot = 1;
+                   break;
+                 }
+             do_spec_1 (arg, 1, NULL);
+             if (dot)
+               ((char *)arg)[length] = '.';
+             do_spec_1 (suffix_subst, 1, NULL);
+           }
+         else
+           do_spec_1 (arg, 1, NULL);
        }
     }
 
        }
     }
 
-  do_spec_1 (" ", 0, NULL_PTR);
+  do_spec_1 (" ", 0, NULL);
   switches[switchnum].validated = 1;
 }
 \f
   switches[switchnum].validated = 1;
 }
 \f
@@ -5256,11 +5477,11 @@ is_directory (path1, path2, linker)
   if (linker
       && ((cp - path == 6
           && strcmp (path, concat (dir_separator_str, "lib",
   if (linker
       && ((cp - path == 6
           && strcmp (path, concat (dir_separator_str, "lib",
-                                   dir_separator_str, ".", NULL_PTR)) == 0)
+                                   dir_separator_str, ".", NULL)) == 0)
          || (cp - path == 10
              && strcmp (path, concat (dir_separator_str, "usr",
                                       dir_separator_str, "lib",
          || (cp - path == 10
              && strcmp (path, concat (dir_separator_str, "usr",
                                       dir_separator_str, "lib",
-                                      dir_separator_str, ".", NULL_PTR)) == 0)))
+                                      dir_separator_str, ".", NULL)) == 0)))
     return 0;
 
   return (stat (path, &st) >= 0 && S_ISDIR (st.st_mode));
     return 0;
 
   return (stat (path, &st) >= 0 && S_ISDIR (st.st_mode));
@@ -5370,6 +5591,11 @@ main (argc, argv)
   if (signal (SIGPIPE, SIG_IGN) != SIG_IGN)
     signal (SIGPIPE, fatal_error);
 #endif
   if (signal (SIGPIPE, SIG_IGN) != SIG_IGN)
     signal (SIGPIPE, fatal_error);
 #endif
+#ifdef SIGCHLD
+  /* We *MUST* set SIGCHLD to SIG_DFL so that the wait4() call will
+     receive the signal.  A different setting is inheritable */
+  signal (SIGCHLD, SIG_DFL);
+#endif
 
   argbuf_length = 10;
   argbuf = (const char **) xmalloc (argbuf_length * sizeof (const char *));
 
   argbuf_length = 10;
   argbuf = (const char **) xmalloc (argbuf_length * sizeof (const char *));
@@ -5494,8 +5720,8 @@ main (argc, argv)
   /* Read specs from a file if there is one.  */
 
   machine_suffix = concat (spec_machine, dir_separator_str,
   /* Read specs from a file if there is one.  */
 
   machine_suffix = concat (spec_machine, dir_separator_str,
-                          spec_version, dir_separator_str, NULL_PTR);
-  just_machine_suffix = concat (spec_machine, dir_separator_str, NULL_PTR);
+                          spec_version, dir_separator_str, NULL);
+  just_machine_suffix = concat (spec_machine, dir_separator_str, NULL);
 
   specs_file = find_a_file (&startfile_prefixes, "specs", R_OK);
   /* Read the specs file unless it is a default one.  */
 
   specs_file = find_a_file (&startfile_prefixes, "specs", R_OK);
   /* Read the specs file unless it is a default one.  */
@@ -5522,18 +5748,18 @@ main (argc, argv)
       if (*md_exec_prefix)
        {
          add_prefix (&exec_prefixes, md_exec_prefix, "GCC",
       if (*md_exec_prefix)
        {
          add_prefix (&exec_prefixes, md_exec_prefix, "GCC",
-                     PREFIX_PRIORITY_LAST, 0, NULL_PTR);
+                     PREFIX_PRIORITY_LAST, 0, NULL);
          add_prefix (&startfile_prefixes, md_exec_prefix, "GCC",
          add_prefix (&startfile_prefixes, md_exec_prefix, "GCC",
-                     PREFIX_PRIORITY_LAST, 0, NULL_PTR);
+                     PREFIX_PRIORITY_LAST, 0, NULL);
        }
 
       if (*md_startfile_prefix)
        add_prefix (&startfile_prefixes, md_startfile_prefix, "GCC",
        }
 
       if (*md_startfile_prefix)
        add_prefix (&startfile_prefixes, md_startfile_prefix, "GCC",
-                   PREFIX_PRIORITY_LAST, 0, NULL_PTR);
+                   PREFIX_PRIORITY_LAST, 0, NULL);
 
       if (*md_startfile_prefix_1)
        add_prefix (&startfile_prefixes, md_startfile_prefix_1, "GCC",
 
       if (*md_startfile_prefix_1)
        add_prefix (&startfile_prefixes, md_startfile_prefix_1, "GCC",
-                   PREFIX_PRIORITY_LAST, 0, NULL_PTR);
+                   PREFIX_PRIORITY_LAST, 0, NULL);
 
       /* If standard_startfile_prefix is relative, base it on
         standard_exec_prefix.  This lets us move the installed tree
 
       /* If standard_startfile_prefix is relative, base it on
         standard_exec_prefix.  This lets us move the installed tree
@@ -5541,28 +5767,28 @@ main (argc, argv)
         standard_startfile_prefix on that as well.  */
       if (IS_ABSOLUTE_PATHNAME (standard_startfile_prefix))
        add_prefix (&startfile_prefixes, standard_startfile_prefix, "BINUTILS",
         standard_startfile_prefix on that as well.  */
       if (IS_ABSOLUTE_PATHNAME (standard_startfile_prefix))
        add_prefix (&startfile_prefixes, standard_startfile_prefix, "BINUTILS",
-                   PREFIX_PRIORITY_LAST, 0, NULL_PTR);
+                   PREFIX_PRIORITY_LAST, 0, NULL);
       else
        {
          if (gcc_exec_prefix)
            add_prefix (&startfile_prefixes,
                        concat (gcc_exec_prefix, machine_suffix,
       else
        {
          if (gcc_exec_prefix)
            add_prefix (&startfile_prefixes,
                        concat (gcc_exec_prefix, machine_suffix,
-                               standard_startfile_prefix, NULL_PTR),
-                       NULL_PTR, PREFIX_PRIORITY_LAST, 0, NULL_PTR);
+                               standard_startfile_prefix, NULL),
+                       NULL, PREFIX_PRIORITY_LAST, 0, NULL);
          add_prefix (&startfile_prefixes,
                      concat (standard_exec_prefix,
                              machine_suffix,
          add_prefix (&startfile_prefixes,
                      concat (standard_exec_prefix,
                              machine_suffix,
-                             standard_startfile_prefix, NULL_PTR),
-                     NULL_PTR, PREFIX_PRIORITY_LAST, 0, NULL_PTR);
+                             standard_startfile_prefix, NULL),
+                     NULL, PREFIX_PRIORITY_LAST, 0, NULL);
        }
 
       add_prefix (&startfile_prefixes, standard_startfile_prefix_1,
        }
 
       add_prefix (&startfile_prefixes, standard_startfile_prefix_1,
-                 "BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL_PTR);
+                 "BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL);
       add_prefix (&startfile_prefixes, standard_startfile_prefix_2,
       add_prefix (&startfile_prefixes, standard_startfile_prefix_2,
-                 "BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL_PTR);
+                 "BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL);
 #if 0 /* Can cause surprises, and one can use -B./ instead.  */
 #if 0 /* Can cause surprises, and one can use -B./ instead.  */
-      add_prefix (&startfile_prefixes, "./", NULL_PTR,
-                 PREFIX_PRIORITY_LAST, 1, NULL_PTR);
+      add_prefix (&startfile_prefixes, "./", NULL,
+                 PREFIX_PRIORITY_LAST, 1, NULL);
 #endif
     }
   else
 #endif
     }
   else
@@ -5571,8 +5797,8 @@ main (argc, argv)
          && gcc_exec_prefix)
        add_prefix (&startfile_prefixes,
                    concat (gcc_exec_prefix, machine_suffix,
          && gcc_exec_prefix)
        add_prefix (&startfile_prefixes,
                    concat (gcc_exec_prefix, machine_suffix,
-                           standard_startfile_prefix, NULL_PTR),
-                   "BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL_PTR);
+                           standard_startfile_prefix, NULL),
+                   "BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL);
     }
 
   /* Process any user specified specs in the order given on the command
     }
 
   /* Process any user specified specs in the order given on the command
@@ -5657,7 +5883,7 @@ main (argc, argv)
       /* We do not exit here. Instead we have created a fake input file
          called 'target-dummy' which needs to be compiled, and we pass this
          on to the various sub-processes, along with the --target-help
       /* We do not exit here. Instead we have created a fake input file
          called 'target-dummy' which needs to be compiled, and we pass this
          on to the various sub-processes, along with the --target-help
-         switch. */
+         switch.  */
     }
 
   if (print_help_list)
     }
 
   if (print_help_list)
@@ -5680,9 +5906,24 @@ main (argc, argv)
   if (verbose_flag)
     {
       int n;
   if (verbose_flag)
     {
       int n;
+      const char *thrmod;
 
       notice ("Configured with: %s\n", configuration_arguments);
 
 
       notice ("Configured with: %s\n", configuration_arguments);
 
+#ifdef THREAD_MODEL_SPEC
+      /* We could have defined THREAD_MODEL_SPEC to "%*" by default,
+        but there's no point in doing all this processing just to get
+        thread_model back.  */
+      obstack_init (&obstack);
+      do_spec_1 (THREAD_MODEL_SPEC, 0, thread_model);
+      obstack_1grow (&obstack, '\0');
+      thrmod = obstack_finish (&obstack);
+#else
+      thrmod = thread_model;
+#endif
+
+      notice ("Thread model: %s\n", thrmod);
+
       /* compiler_version is truncated at the first space when initialized
         from version string, so truncate version_string at the first space
         before comparing.  */
       /* compiler_version is truncated at the first space when initialized
         from version string, so truncate version_string at the first space
         before comparing.  */
@@ -5717,7 +5958,6 @@ main (argc, argv)
 
   for (i = 0; (int) i < n_infiles; i++)
     {
 
   for (i = 0; (int) i < n_infiles; i++)
     {
-      register struct compiler *cp = 0;
       int this_file_error = 0;
 
       /* Tell do_spec what to substitute for %i.  */
       int this_file_error = 0;
 
       /* Tell do_spec what to substitute for %i.  */
@@ -5731,17 +5971,18 @@ main (argc, argv)
 
       /* Figure out which compiler from the file's suffix.  */
 
 
       /* Figure out which compiler from the file's suffix.  */
 
-      cp = lookup_compiler (infiles[i].name, input_filename_length,
-                           infiles[i].language);
-
-      if (cp)
+      input_file_compiler
+       = lookup_compiler (infiles[i].name, input_filename_length,
+                          infiles[i].language);
+      
+      if (input_file_compiler)
        {
          /* Ok, we found an applicable compiler.  Run its spec.  */
 
        {
          /* Ok, we found an applicable compiler.  Run its spec.  */
 
-         if (cp->spec[0] == '#')
+         if (input_file_compiler->spec[0] == '#')
            error ("%s: %s compiler not installed on this system",
            error ("%s: %s compiler not installed on this system",
-                  input_filename, &cp->spec[1]);
-         value = do_spec (cp->spec);
+                  input_filename, &input_file_compiler->spec[1]);
+         value = do_spec (input_file_compiler->spec);
          if (value < 0)
            this_file_error = 1;
        }
          if (value < 0)
            this_file_error = 1;
        }
@@ -5897,7 +6138,7 @@ lookup_compiler (name, length, language)
       /* An alias entry maps a suffix to a language.
         Search for the language; pass 0 for NAME and LENGTH
         to avoid infinite recursion if language not found.  */
       /* An alias entry maps a suffix to a language.
         Search for the language; pass 0 for NAME and LENGTH
         to avoid infinite recursion if language not found.  */
-      return lookup_compiler (NULL_PTR, 0, cp->spec + 1);
+      return lookup_compiler (NULL, 0, cp->spec + 1);
     }
   return 0;
 }
     }
   return 0;
 }
@@ -5914,7 +6155,7 @@ save_string (s, len)
   return result;
 }
 
   return result;
 }
 
-static void
+void
 pfatal_with_name (name)
      const char *name;
 {
 pfatal_with_name (name)
      const char *name;
 {
@@ -5963,42 +6204,26 @@ fancy_abort ()
 void
 fatal VPARAMS ((const char *msgid, ...))
 {
 void
 fatal VPARAMS ((const char *msgid, ...))
 {
-#ifndef ANSI_PROTOTYPES
-  const char *msgid;
-#endif
-  va_list ap;
-
-  VA_START (ap, msgid);
-
-#ifndef ANSI_PROTOTYPES
-  msgid = va_arg (ap, const char *);
-#endif
+  VA_OPEN (ap, msgid);
+  VA_FIXEDARG (ap, const char *, msgid);
 
   fprintf (stderr, "%s: ", programname);
   vfprintf (stderr, _(msgid), ap);
 
   fprintf (stderr, "%s: ", programname);
   vfprintf (stderr, _(msgid), ap);
-  va_end (ap);
+  VA_CLOSE (ap);
   fprintf (stderr, "\n");
   delete_temp_files ();
   exit (1);
 }
 
   fprintf (stderr, "\n");
   delete_temp_files ();
   exit (1);
 }
 
-static void
+void
 error VPARAMS ((const char *msgid, ...))
 {
 error VPARAMS ((const char *msgid, ...))
 {
-#ifndef ANSI_PROTOTYPES
-  const char *msgid;
-#endif
-  va_list ap;
-
-  VA_START (ap, msgid);
-
-#ifndef ANSI_PROTOTYPES
-  msgid = va_arg (ap, const char *);
-#endif
+  VA_OPEN (ap, msgid);
+  VA_FIXEDARG (ap, const char *, msgid);
 
   fprintf (stderr, "%s: ", programname);
   vfprintf (stderr, _(msgid), ap);
 
   fprintf (stderr, "%s: ", programname);
   vfprintf (stderr, _(msgid), ap);
-  va_end (ap);
+  VA_CLOSE (ap);
 
   fprintf (stderr, "\n");
 }
 
   fprintf (stderr, "\n");
 }
@@ -6006,19 +6231,11 @@ error VPARAMS ((const char *msgid, ...))
 static void
 notice VPARAMS ((const char *msgid, ...))
 {
 static void
 notice VPARAMS ((const char *msgid, ...))
 {
-#ifndef ANSI_PROTOTYPES
-  const char *msgid;
-#endif
-  va_list ap;
-
-  VA_START (ap, msgid);
-
-#ifndef ANSI_PROTOTYPES
-  msgid = va_arg (ap, const char *);
-#endif
+  VA_OPEN (ap, msgid);
+  VA_FIXEDARG (ap, const char *, msgid);
 
   vfprintf (stderr, _(msgid), ap);
 
   vfprintf (stderr, _(msgid), ap);
-  va_end (ap);
+  VA_CLOSE (ap);
 }
 \f
 static void
 }
 \f
 static void