OSDN Git Service

Various fixes to allow us to again build if --enable-mapped-location:
[pf3gnuchains/gcc-fork.git] / gcc / collect2.c
index 2edbea8..90ad456 100644 (file)
@@ -1,7 +1,7 @@
 /* Collect static initialization info into data structures that can be
    traversed by C++ initialization and finalization routines.
    Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+   1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
    Contributed by Chris Smith (csmith@convex.com).
    Heavily modified by Michael Meissner (meissner@cygnus.com),
    Per Bothner (bothner@cygnus.com), and John Gilmore (gnu@cygnus.com).
@@ -149,10 +149,6 @@ int do_collecting = 1;
 int do_collecting = 0;
 #endif
 
-#ifndef COLLECT_PARSE_FLAG
-#define COLLECT_PARSE_FLAG(FLAG)
-#endif
-
 /* Nonzero if we should suppress the automatic demangling of identifiers
    in linker error messages.  Set from COLLECT_NO_DEMANGLE.  */
 int no_demangle;
@@ -189,6 +185,7 @@ static const char *demangle_flag;
 #ifdef COLLECT_EXPORT_LIST
 static int export_flag;                 /* true if -bE */
 static int aix64_flag;                 /* true if -b64 */
+static int aixrtl_flag;                        /* true if -brtl */
 #endif
 
 int debug;                             /* true if -debug */
@@ -246,7 +243,6 @@ static struct path_prefix cmdline_lib_dirs; /* directories specified with -L */
 static struct path_prefix libpath_lib_dirs; /* directories in LIBPATH */
 static struct path_prefix *libpaths[3] = {&cmdline_lib_dirs,
                                          &libpath_lib_dirs, NULL};
-static const char *const libexts[3] = {"a", "so", NULL};  /* possible library extensions */
 #endif
 
 static void handler (int);
@@ -401,9 +397,9 @@ error (const char * msgid, ...)
    provide a default entry.  */
 
 void
-fancy_abort (void)
+fancy_abort (const char *file, int line, const char *func)
 {
-  fatal ("internal error");
+  fatal ("internal gcc abort in %s, at %s:%d", func, file, line);
 }
 \f
 static void
@@ -864,7 +860,6 @@ main (int argc, char **argv)
       {
        if (! strcmp (argv[i], "-debug"))
          debug = 1;
-       COLLECT_PARSE_FLAG (argv[i]);
       }
     vflag = debug;
   }
@@ -1092,6 +1087,8 @@ main (int argc, char **argv)
                 export_flag = 1;
              else if (arg[2] == '6' && arg[3] == '4')
                aix64_flag = 1;
+             else if (arg[2] == 'r' && arg[3] == 't' && arg[4] == 'l')
+               aixrtl_flag = 1;
              break;
 #endif
 
@@ -1102,6 +1099,11 @@ main (int argc, char **argv)
                  ld1--;
                  ld2--;
                }
+             if (!strcmp (arg, "-dynamic-linker") && argv[1])
+               {
+                 ++argv;
+                 *ld1++ = *ld2++ = *argv;
+               }
              break;
 
            case 'l':
@@ -1567,7 +1569,7 @@ collect_execute (const char *prog, char **argv, const char *redir)
      since we might not end up needing something that we could not find.  */
 
   if (argv[0] == 0)
-    fatal ("cannot find `%s'", prog);
+    fatal ("cannot find '%s'", prog);
 
   if (redir)
     {
@@ -2044,7 +2046,7 @@ scan_prog_file (const char *prog_name, enum pass which_pass)
 
   /* If we do not have an `nm', complain.  */
   if (nm_file_name == 0)
-    fatal ("cannot find `nm'");
+    fatal ("cannot find 'nm'");
 
   nm_argv[argc++] = nm_file_name;
   if (NM_FLAGS[0] != '\0')
@@ -2211,7 +2213,7 @@ scan_libraries (const char *prog_name)
   /* If we do not have an `ldd', complain.  */
   if (ldd_file_name == 0)
     {
-      error ("cannot find `ldd'");
+      error ("cannot find 'ldd'");
       return;
     }
 
@@ -2599,6 +2601,8 @@ resolve_lib_name (const char *name)
 {
   char *lib_buf;
   int i, j, l = 0;
+  /* Library extensions for AIX dynamic linking.  */
+  const char * const libexts[2] = {"a", "so"};
 
   for (i = 0; libpaths[i]; i++)
     if (libpaths[i]->max_len > l)
@@ -2617,14 +2621,15 @@ resolve_lib_name (const char *name)
          const char *p = "";
          if (list->prefix[strlen(list->prefix)-1] != '/')
            p = "/";
-         for (j = 0; libexts[j]; j++)
+         for (j = 0; j < 2; j++)
            {
              sprintf (lib_buf, "%s%slib%s.%s",
-                      list->prefix, p, name, libexts[j]);
-if (debug) fprintf (stderr, "searching for: %s\n", lib_buf);
+                      list->prefix, p, name,
+                      libexts[(j + aixrtl_flag) % 2]);
+             if (debug) fprintf (stderr, "searching for: %s\n", lib_buf);
              if (file_exists (lib_buf))
                {
-if (debug) fprintf (stderr, "found: %s\n", lib_buf);
+                 if (debug) fprintf (stderr, "found: %s\n", lib_buf);
                  return (lib_buf);
                }
            }