ld testsuite fails with default-PIE compiler
[deliverable/binutils-gdb.git] / ld / ldmisc.c
index 2e53d645985d7d4775c53f10361671fffcbecb00..418e8d5c6eda8a3a570b90e39ce60eacd94939d4 100644 (file)
@@ -1,5 +1,5 @@
 /* ldmisc.c
-   Copyright (C) 1991-2019 Free Software Foundation, Inc.
+   Copyright (C) 1991-2020 Free Software Foundation, Inc.
    Written by Steve Chamberlain of Cygnus Support.
 
    This file is part of the GNU Binutils.
@@ -375,13 +375,11 @@ vfinfo (FILE *fp, const char *fmt, va_list ap, bfd_boolean is_warning)
                                    abfd, functionname);
 
                            last_bfd = abfd;
-                           if (last_file != NULL)
-                             free (last_file);
+                           free (last_file);
                            last_file = NULL;
                            if (filename)
                              last_file = xstrdup (filename);
-                           if (last_function != NULL)
-                             free (last_function);
+                           free (last_function);
                            last_function = xstrdup (functionname);
                          }
                        discard_last = FALSE;
@@ -412,16 +410,10 @@ vfinfo (FILE *fp, const char *fmt, va_list ap, bfd_boolean is_warning)
                if (discard_last)
                  {
                    last_bfd = NULL;
-                   if (last_file != NULL)
-                     {
-                       free (last_file);
-                       last_file = NULL;
-                     }
-                   if (last_function != NULL)
-                     {
-                       free (last_function);
-                       last_function = NULL;
-                     }
+                   free (last_file);
+                   last_file = NULL;
+                   free (last_function);
+                   last_function = NULL;
                  }
              }
              break;
@@ -456,10 +448,11 @@ vfinfo (FILE *fp, const char *fmt, va_list ap, bfd_boolean is_warning)
                    fprintf (fp, "%s generated", program_name);
                  else if (abfd->my_archive != NULL
                           && !bfd_is_thin_archive (abfd->my_archive))
-                   fprintf (fp, "%s(%s)", abfd->my_archive->filename,
-                            abfd->filename);
+                   fprintf (fp, "%s(%s)",
+                            bfd_get_filename (abfd->my_archive),
+                            bfd_get_filename (abfd));
                  else
-                   fprintf (fp, "%s", abfd->filename);
+                   fprintf (fp, "%s", bfd_get_filename (abfd));
                }
              else if (*fmt == 'I')
                {
@@ -472,7 +465,8 @@ vfinfo (FILE *fp, const char *fmt, va_list ap, bfd_boolean is_warning)
                  if (i->the_bfd != NULL
                      && i->the_bfd->my_archive != NULL
                      && !bfd_is_thin_archive (i->the_bfd->my_archive))
-                   fprintf (fp, "(%s)%s", i->the_bfd->my_archive->filename,
+                   fprintf (fp, "(%s)%s",
+                            bfd_get_filename (i->the_bfd->my_archive),
                             i->local_sym_name);
                  else
                    fprintf (fp, "%s", i->filename);
This page took 0.024122 seconds and 4 git commands to generate.