OSDN Git Service

* simplify-rtx.c (simplify_subreg): Fix verification of
[pf3gnuchains/gcc-fork.git] / gcc / gcc.c
index 967bbba..505f9ab 100644 (file)
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -92,18 +92,26 @@ compilation is specified by a string called a "spec".  */
 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
-#define EXECUTABLE_SUFFIX ""
+#define TARGET_EXECUTABLE_SUFFIX ""
 #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
-#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
@@ -639,7 +647,7 @@ static const char *cpp_options =
  %{!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}}\
@@ -721,7 +729,7 @@ static struct user_specs *user_specs_head, *user_specs_tail;
 #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')
@@ -1050,7 +1058,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,
-                                              NULL_PTR);
+                                              NULL);
                  else if (arg != 0)
                    {
                      newv[newindex++] = option_map[j].equivalent;
@@ -1249,7 +1257,7 @@ struct spec_list
 };
 
 #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[] =
@@ -1315,15 +1323,15 @@ init_gcc_specs (obstack, shared_name, static_name)
   char buffer[128];
 
   /* If we see -shared-libgcc, then use the shared version.  */
-  sprintf (buffer, "%%{shared-libgcc:%s}", shared_name);
+  sprintf (buffer, "%%{shared-libgcc:%s %s}", shared_name, static_name);
   obstack_grow (obstack, buffer, strlen (buffer));
-  /* If we see -static-libgcc, then use the shared version.  */
+  /* 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}}}", 
-          shared_name);
+          "%%{!shared-libgcc:%%{!static-libgcc:%%{shared:%s %s}}}", 
+          shared_name, static_name);
   obstack_grow (obstack, buffer, strlen (buffer));
   /* Otherwise, use the static version.  */
   sprintf (buffer, 
@@ -1446,6 +1454,15 @@ init_spec ()
     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;
 }
@@ -1497,7 +1514,7 @@ set_spec (name, spec)
 
   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
@@ -2009,60 +2026,6 @@ clear_failure_queue ()
   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.
@@ -2206,7 +2169,7 @@ split_directories (name, ptr_num_dirs)
   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;
 
@@ -2221,7 +2184,7 @@ free_split_directories (dirs)
 {
   int i = 0;
 
-  while (dirs[i] != NULL_PTR)
+  while (dirs[i] != NULL)
     free (dirs[i++]);
 
   free ((char *) dirs);
@@ -2286,8 +2249,8 @@ make_relative_prefix (progname, bin_prefix, prefix)
                    }
                  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
                      )
                    {
@@ -2328,7 +2291,7 @@ make_relative_prefix (progname, bin_prefix, prefix)
          free_split_directories (prog_dirs);
          free_split_directories (bin_dirs);
          prog_dirs = bin_dirs = (char **) 0;
-         return NULL_PTR;
+         return NULL;
        }
     }
 
@@ -2348,7 +2311,7 @@ make_relative_prefix (progname, bin_prefix, prefix)
       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].  */
@@ -2406,7 +2369,7 @@ find_a_file (pprefix, name, mode)
      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;
 
@@ -2841,7 +2804,7 @@ struct infile
 
 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.  */
@@ -2850,7 +2813,7 @@ static int added_libraries;
 
 /* 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;
@@ -2861,7 +2824,7 @@ static int warn_std;
 /* 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.  */
@@ -2879,22 +2842,22 @@ convert_filename (name, do_exe)
 
   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);
-      obstack_grow0 (&obstack, OBJECT_SUFFIX, strlen (OBJECT_SUFFIX));
+      obstack_grow0 (&obstack, TARGET_OBJECT_SUFFIX, strlen (TARGET_OBJECT_SUFFIX));
       name = obstack_finish (&obstack);
     }
 #endif
 
-#if defined(HAVE_EXECUTABLE_SUFFIX) && !defined(NO_AUTO_EXE_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 (! 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--)
@@ -2906,7 +2869,8 @@ convert_filename (name, do_exe)
       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
 
@@ -3076,7 +3040,7 @@ process_command (argc, argv)
       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
 
@@ -3097,9 +3061,9 @@ process_command (argc, argv)
 
       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",
-                 PREFIX_PRIORITY_LAST, 0, NULL_PTR);
+                 PREFIX_PRIORITY_LAST, 0, NULL);
     }
 
   /* COMPILER_PATH and LIBRARY_PATH have values
@@ -3118,7 +3082,7 @@ process_command (argc, argv)
            {
              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;
@@ -3127,10 +3091,10 @@ process_command (argc, argv)
              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,
-                         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;
@@ -3153,7 +3117,7 @@ process_command (argc, argv)
            {
              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;
@@ -3161,8 +3125,8 @@ process_command (argc, argv)
                }
              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;
@@ -3186,7 +3150,7 @@ process_command (argc, argv)
            {
              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;
@@ -3194,8 +3158,8 @@ process_command (argc, argv)
                }
              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;
@@ -3333,6 +3297,14 @@ process_command (argc, argv)
          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)
@@ -3412,26 +3384,24 @@ process_command (argc, argv)
                      && (IS_DIR_SEPARATOR (value[len - 1])))
                    {
                      if (len == 7)
-                       add_prefix (&include_prefixes, "include", NULL_PTR,
-                                   PREFIX_PRIORITY_B_OPT, 0, NULL_PTR);
+                       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_PTR,
-                                     PREFIX_PRIORITY_B_OPT, 0, NULL_PTR);
+                         add_prefix (&include_prefixes, string, NULL,
+                                     PREFIX_PRIORITY_B_OPT, 0, NULL);
                        }
                    }
                }
-               add_prefix (&exec_prefixes, value, NULL_PTR,
+               add_prefix (&exec_prefixes, value, NULL,
                            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);
-               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;
@@ -3499,7 +3469,7 @@ process_command (argc, argv)
 
            case 'o':
              have_o = 1;
-#if defined(HAVE_EXECUTABLE_SUFFIX)
+#if defined(HAVE_TARGET_EXECUTABLE_SUFFIX)
              if (! have_c)
                {
                  int skip;
@@ -3528,7 +3498,7 @@ process_command (argc, argv)
                    }
                }
 #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
@@ -3617,7 +3587,7 @@ process_command (argc, argv)
              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.
@@ -3632,29 +3602,29 @@ process_command (argc, argv)
        {
          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",
-                             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",
-                             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,
-                              dir_separator_str, tooldir_prefix, NULL_PTR);
+                              dir_separator_str, tooldir_prefix, NULL);
     }
 
   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,
-             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.  */
@@ -3774,6 +3744,12 @@ process_command (argc, argv)
          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 = "*";
@@ -3877,7 +3853,7 @@ process_command (argc, argv)
        }
       else
        {
-#ifdef HAVE_OBJECT_SUFFIX
+#ifdef HAVE_TARGET_OBJECT_SUFFIX
          argv[i] = convert_filename (argv[i], 0);
 #endif
 
@@ -3964,7 +3940,7 @@ do_spec (spec)
   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 `|'.  */
@@ -4151,28 +4127,28 @@ do_spec_1 (spec, inswitch, soft_matched_part)
                          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
-                             do_spec_1 (" ", 0, NULL_PTR);
+                             do_spec_1 (" ", 0, NULL);
 #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.  */
-                             do_spec_1 (" ", 0, NULL_PTR);
+                             do_spec_1 (" ", 0, NULL);
                            }
                        }
                      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
-                             do_spec_1 (" ", 0, NULL_PTR);
+                             do_spec_1 (" ", 0, NULL);
 #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.  */
-                             do_spec_1 (" ", 0, NULL_PTR);
+                             do_spec_1 (" ", 0, NULL);
                            }
                        }
                    }
@@ -4180,11 +4156,11 @@ do_spec_1 (spec, inswitch, soft_matched_part)
                    {
                      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
-                         do_spec_1 (" ", 0, NULL_PTR);
+                         do_spec_1 (" ", 0, NULL);
 #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;
@@ -4193,18 +4169,18 @@ do_spec_1 (spec, inswitch, soft_matched_part)
                          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.  */
-                         do_spec_1 (" ", 0, NULL_PTR);
+                         do_spec_1 (" ", 0, NULL);
                        }
                    }
                  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
-                         do_spec_1 (" ", 0, NULL_PTR);
+                         do_spec_1 (" ", 0, NULL);
 #endif
                          /* Remove slash from pl->prefix.  */
                          if (strlen (pl->prefix) >= bufsize)
@@ -4214,9 +4190,9 @@ do_spec_1 (spec, inswitch, soft_matched_part)
                          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.  */
-                         do_spec_1 (" ", 0, NULL_PTR);
+                         do_spec_1 (" ", 0, NULL);
                        }
                    }
                }
@@ -4300,17 +4276,17 @@ do_spec_1 (spec, inswitch, soft_matched_part)
                    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
-                                             + strlen (OBJECT_SUFFIX));
+                                             + strlen (TARGET_OBJECT_SUFFIX));
                        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
@@ -4321,7 +4297,8 @@ do_spec_1 (spec, inswitch, soft_matched_part)
                      && 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)
@@ -4331,7 +4308,13 @@ do_spec_1 (spec, inswitch, soft_matched_part)
                        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);
@@ -4359,20 +4342,20 @@ do_spec_1 (spec, inswitch, soft_matched_part)
 
              if (gcc_exec_prefix)
                {
-                 do_spec_1 ("-iprefix", 1, NULL_PTR);
+                 do_spec_1 ("-iprefix", 1, NULL);
                  /* 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)
                {
-                 do_spec_1 ("-isystem", 1, NULL_PTR);
+                 do_spec_1 ("-isystem", 1, NULL);
                  /* 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;
@@ -4389,7 +4372,7 @@ do_spec_1 (spec, inswitch, soft_matched_part)
            }
 
          case 'O':
-           obstack_grow (&obstack, OBJECT_SUFFIX, strlen (OBJECT_SUFFIX));
+           obstack_grow (&obstack, TARGET_OBJECT_SUFFIX, strlen (TARGET_OBJECT_SUFFIX));
            arg_going = 1;
            break;
 
@@ -4447,9 +4430,9 @@ do_spec_1 (spec, inswitch, soft_matched_part)
          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.  */
-               do_spec_1 (" ", 0, NULL_PTR);
+               do_spec_1 (" ", 0, NULL);
              }
            break;
 
@@ -4457,9 +4440,9 @@ do_spec_1 (spec, inswitch, soft_matched_part)
          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.  */
-               do_spec_1 (" ", 0, NULL_PTR);
+               do_spec_1 (" ", 0, NULL);
              }
            break;
 
@@ -4467,9 +4450,9 @@ do_spec_1 (spec, inswitch, soft_matched_part)
          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.  */
-               do_spec_1 (" ", 0, NULL_PTR);
+               do_spec_1 (" ", 0, NULL);
              }
            break;
 
@@ -4477,31 +4460,31 @@ do_spec_1 (spec, inswitch, soft_matched_part)
               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':
-           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':
-           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':
-           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':
-           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;
@@ -4512,32 +4495,32 @@ do_spec_1 (spec, inswitch, soft_matched_part)
                = (input_file_compiler->cpp_spec 
                   ? input_file_compiler->cpp_spec 
                   : cpp_spec);
-             value = do_spec_1 (spec, 0, NULL_PTR);
+             value = do_spec_1 (spec, 0, NULL);
              if (value != 0)
                return value;
            }
            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':
-           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':
-           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':
-           value = do_spec_1 (libgcc_spec, 0, NULL_PTR);
+           value = do_spec_1 (libgcc_spec, 0, NULL);
            if (value != 0)
              return value;
            break;
@@ -4583,7 +4566,7 @@ do_spec_1 (spec, inswitch, soft_matched_part)
 
              *x = 0;
 
-             value = do_spec_1 (buf, 0, NULL_PTR);
+             value = do_spec_1 (buf, 0, NULL);
              if (value != 0)
                return value;
            }
@@ -4714,14 +4697,14 @@ do_spec_1 (spec, inswitch, soft_matched_part)
 
              *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':
-           value = do_spec_1 (startfile_spec, 0, NULL_PTR);
+           value = do_spec_1 (startfile_spec, 0, NULL);
            if (value != 0)
              return value;
            break;
@@ -4752,8 +4735,8 @@ do_spec_1 (spec, inswitch, 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
@@ -4796,7 +4779,7 @@ do_spec_1 (spec, inswitch, soft_matched_part)
                {
                  if (c == '(')
                    {
-                     value = do_spec_1 (name, 0, NULL_PTR);
+                     value = do_spec_1 (name, 0, NULL);
                      if (value != 0)
                        return value;
                    }
@@ -4836,7 +4819,7 @@ do_spec_1 (spec, inswitch, soft_matched_part)
                        }
                      *x = 0;
 
-                     value = do_spec_1 (buf, 0, NULL_PTR);
+                     value = do_spec_1 (buf, 0, NULL);
                      if (value != 0)
                        return value;
                    }
@@ -4907,7 +4890,7 @@ do_spec_1 (spec, inswitch, soft_matched_part)
 
          case '|':
            if (input_from_pipe)
-             do_spec_1 ("-", 0, NULL_PTR);
+             do_spec_1 ("-", 0, NULL);
            break;
 
          default:
@@ -5040,7 +5023,7 @@ next_member:
        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] == '&'))
@@ -5162,7 +5145,7 @@ next_member:
        {
          /* 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;
        }
     }
@@ -5193,7 +5176,7 @@ next_member:
   else if (true_once)
     {
       if (do_spec_1 (save_string (body, endbody - body - 1),
-                    0, NULL_PTR) < 0)
+                    0, NULL) < 0)
        return 0;
     }
 
@@ -5298,8 +5281,8 @@ give_switch (switchnum, omit_first_word, include_blanks)
 
   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)
@@ -5310,30 +5293,30 @@ give_switch (switchnum, omit_first_word, include_blanks)
          const char *arg = *p;
 
          if (include_blanks)
-           do_spec_1 (" ", 0, 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_PTR);
-             if (!arg[length])
-               {
-                 ((char *)arg)[length] = '.';
-                 do_spec_1 (suffix_subst, 1, NULL_PTR);
-               }
+             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_PTR);
+           do_spec_1 (arg, 1, NULL);
        }
     }
 
-  do_spec_1 (" ", 0, NULL_PTR);
+  do_spec_1 (" ", 0, NULL);
   switches[switchnum].validated = 1;
 }
 \f
@@ -5406,11 +5389,11 @@ is_directory (path1, path2, linker)
   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",
-                                      dir_separator_str, ".", NULL_PTR)) == 0)))
+                                      dir_separator_str, ".", NULL)) == 0)))
     return 0;
 
   return (stat (path, &st) >= 0 && S_ISDIR (st.st_mode));
@@ -5649,8 +5632,8 @@ main (argc, argv)
   /* 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.  */
@@ -5677,18 +5660,18 @@ main (argc, argv)
       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",
-                     PREFIX_PRIORITY_LAST, 0, NULL_PTR);
+                     PREFIX_PRIORITY_LAST, 0, NULL);
        }
 
       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",
-                   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
@@ -5696,28 +5679,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",
-                   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,
-                               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,
-                             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,
-                 "BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL_PTR);
+                 "BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL);
       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.  */
-      add_prefix (&startfile_prefixes, "./", NULL_PTR,
-                 PREFIX_PRIORITY_LAST, 1, NULL_PTR);
+      add_prefix (&startfile_prefixes, "./", NULL,
+                 PREFIX_PRIORITY_LAST, 1, NULL);
 #endif
     }
   else
@@ -5726,8 +5709,8 @@ main (argc, argv)
          && 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
@@ -5835,9 +5818,24 @@ main (argc, argv)
   if (verbose_flag)
     {
       int n;
+      const char *thrmod;
 
       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.  */
@@ -6052,7 +6050,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.  */
-      return lookup_compiler (NULL_PTR, 0, cp->spec + 1);
+      return lookup_compiler (NULL, 0, cp->spec + 1);
     }
   return 0;
 }