Add is_generic_elf to ld/ld-lib.exp
[deliverable/binutils-gdb.git] / ld / ldmisc.c
index 21e6f4f84ae855f9862ea1041a1b01d36a4d2763..5efff74feef0e7636b8c1f95065960e70c824c1d 100644 (file)
@@ -1,7 +1,5 @@
 /* ldmisc.c
-   Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2011, 2012
-   Free Software Foundation, Inc.
+   Copyright (C) 1991-2016 Free Software Foundation, Inc.
    Written by Steve Chamberlain of Cygnus Support.
 
    This file is part of the GNU Binutils.
@@ -37,6 +35,7 @@
 #include "ldmain.h"
 #include "ldfile.h"
 #include "elf-bfd.h"
+#include "coff-bfd.h"
 
 /*
  %% literal %
@@ -72,11 +71,14 @@ vfinfo (FILE *fp, const char *fmt, va_list arg, bfd_boolean is_warning)
 
   while (*fmt != '\0')
     {
+      const char *str = fmt;
       while (*fmt != '%' && *fmt != '\0')
-       {
-         putc (*fmt, fp);
-         fmt++;
-       }
+       fmt++;
+      if (fmt != str)
+       if (fwrite (str, 1, fmt - str, fp))
+         {
+           /* Ignore.  */
+         }
 
       if (*fmt == '%')
        {
@@ -199,7 +201,8 @@ vfinfo (FILE *fp, const char *fmt, va_list arg, bfd_boolean is_warning)
 
                if (abfd == NULL)
                  fprintf (fp, "%s generated", program_name);
-               else if (abfd->my_archive)
+               else if (abfd->my_archive != NULL
+                        && !bfd_is_thin_archive (abfd->my_archive))
                  fprintf (fp, "%s(%s)", abfd->my_archive->filename,
                           abfd->filename);
                else
@@ -228,11 +231,13 @@ vfinfo (FILE *fp, const char *fmt, va_list arg, bfd_boolean is_warning)
                lang_input_statement_type *i;
 
                i = va_arg (arg, lang_input_statement_type *);
-               if (bfd_my_archive (i->the_bfd) != NULL)
+               if (i->the_bfd->my_archive != NULL
+                   && !bfd_is_thin_archive (i->the_bfd->my_archive))
                  fprintf (fp, "(%s)",
-                          bfd_get_filename (bfd_my_archive (i->the_bfd)));
+                          bfd_get_filename (i->the_bfd->my_archive));
                fprintf (fp, "%s", i->local_sym_name);
-               if (bfd_my_archive (i->the_bfd) == NULL
+               if ((i->the_bfd->my_archive == NULL
+                    || bfd_is_thin_archive (i->the_bfd->my_archive))
                    && filename_cmp (i->local_sym_name, i->filename) != 0)
                  fprintf (fp, " (%s)", i->filename);
              }
@@ -241,12 +246,12 @@ vfinfo (FILE *fp, const char *fmt, va_list arg, bfd_boolean is_warning)
            case 'S':
              /* Print script file and linenumber.  */
              {
-               node_type node;
+               etree_type node;
                etree_type *tp = va_arg (arg, etree_type *);
 
                if (tp == NULL)
                  {
-                   tp = (etree_type *) &node;
+                   tp = &node;
                    tp->type.filename = ldlex_filename ();
                    tp->type.lineno = lineno;
                  }
@@ -301,7 +306,7 @@ vfinfo (FILE *fp, const char *fmt, va_list arg, bfd_boolean is_warning)
 
                /* The GNU Coding Standard requires that error messages
                   be of the form:
-                  
+
                     source-file-name:lineno: message
 
                   We do not always have a line number available so if
@@ -358,7 +363,7 @@ vfinfo (FILE *fp, const char *fmt, va_list arg, bfd_boolean is_warning)
                    if (functionname != NULL && fmt[-1] == 'G')
                      lfinfo (fp, "%T", functionname);
                    else if (filename != NULL && linenumber != 0)
-                     fprintf (fp, "%u%s", linenumber, ":" + done);
+                     fprintf (fp, "%u%s", linenumber, done ? "" : ":");
                    else
                      done = FALSE;
                  }
@@ -481,7 +486,22 @@ minfo (const char *fmt, ...)
       va_list arg;
 
       va_start (arg, fmt);
-      vfinfo (config.map_file, fmt, arg, FALSE);
+      if (fmt[0] == '%' && fmt[1] == '!' && fmt[2] == 0)
+       {
+         /* Stash info about --as-needed shared libraries.  Print
+            later so they don't appear intermingled with archive
+            library info.  */
+         struct asneeded_minfo *m = xmalloc (sizeof *m);
+
+         m->next = NULL;
+         m->soname = va_arg (arg, const char *);
+         m->ref = va_arg (arg, bfd *);
+         m->name = va_arg (arg, const char *);
+         *asneeded_list_tail = m;
+         asneeded_list_tail = &m->next;
+       }
+      else
+       vfinfo (config.map_file, fmt, arg, FALSE);
       va_end (arg);
     }
 }
@@ -517,10 +537,10 @@ void
 ld_abort (const char *file, int line, const char *fn)
 {
   if (fn != NULL)
-    einfo (_("%P: internal error: aborting at %s line %d in %s\n"),
+    einfo (_("%P: internal error: aborting at %s:%d in %s\n"),
           file, line, fn);
   else
-    einfo (_("%P: internal error: aborting at %s line %d\n"),
+    einfo (_("%P: internal error: aborting at %s:%d\n"),
           file, line);
   einfo (_("%P%F: please report this bug\n"));
   xexit (1);
This page took 0.025059 seconds and 4 git commands to generate.