Adjust the output section size to skip gap fills
[deliverable/binutils-gdb.git] / binutils / size.c
index d6c6dc21148f5687ce205139f215c1968e359239..dcfd9547b25cdd58db890f9fe0dc9a3ba9228d89 100644 (file)
@@ -1,12 +1,11 @@
 /* size.c -- report size of various sections of an executable file.
-   Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-   2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 1991-2015 Free Software Foundation, Inc.
 
    This file is part of GNU Binutils.
 
    This program 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 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
@@ -16,7 +15,8 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 \f
 /* Extensions/incompatibilities:
    o - BSD output has filenames at the end.
@@ -133,6 +133,7 @@ main (int argc, char **argv)
 
   program_name = *argv;
   xmalloc_set_program_name (program_name);
+  bfd_set_error_program_name (program_name);
 
   expandargv (&argc, &argv);
 
@@ -271,7 +272,7 @@ calculate_common_size (bfd *abfd)
   if (storage < 0)
     bfd_fatal (bfd_get_filename (abfd));
   if (storage)
-    syms = xmalloc (storage);
+    syms = (asymbol **) xmalloc (storage);
 
   symcount = bfd_canonicalize_symtab (abfd, syms);
   if (symcount < 0)
@@ -365,7 +366,14 @@ display_archive (bfd *file)
       display_bfd (arfile);
 
       if (last_arfile != NULL)
-       bfd_close (last_arfile);
+       {
+         bfd_close (last_arfile);
+
+         /* PR 17512: file: a244edbc.  */
+         if (last_arfile == arfile)
+           return;
+       }
+
       last_arfile = arfile;
     }
 
@@ -405,17 +413,15 @@ display_file (char *filename)
     }
 }
 \f
-/* This is what lexical functions are for.  */
-
 static int
 size_number (bfd_size_type num)
 {
   char buffer[40];
 
   sprintf (buffer,
-          (radix == decimal ? "%lu" :
-          ((radix == octal) ? "0%lo" : "0x%lx")),
-          (unsigned long) num);
+          (radix == decimal ? "%" BFD_VMA_FMT "u" :
+          ((radix == octal) ? "0%" BFD_VMA_FMT "o" : "0x%" BFD_VMA_FMT "x")),
+          num);
 
   return strlen (buffer);
 }
@@ -426,9 +432,9 @@ rprint_number (int width, bfd_size_type num)
   char buffer[40];
 
   sprintf (buffer,
-          (radix == decimal ? "%lu" :
-          ((radix == octal) ? "0%lo" : "0x%lx")),
-          (unsigned long) num);
+          (radix == decimal ? "%" BFD_VMA_FMT "u" :
+          ((radix == octal) ? "0%" BFD_VMA_FMT "o" : "0x%" BFD_VMA_FMT "x")),
+          num);
 
   printf ("%*s", width, buffer);
 }
This page took 0.024213 seconds and 4 git commands to generate.