]> Git Repo - binutils.git/blobdiff - binutils/objdump.c
misc fixes
[binutils.git] / binutils / objdump.c
index 1c1c58954ec5d3622b2bd59eb234e307fd1577b7..80d259d54a7aa3ab8fd94111b82af570ea9e7d5e 100644 (file)
@@ -39,7 +39,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #define        BYTES_IN_WORD   32
 #include "aout/aout64.h"
 #include "elf/internal.h"
-extern Elf_Internal_Shdr *bfd_elf_find_section();
+extern Elf32_Internal_Shdr *bfd_elf32_find_section();
 #endif /* ELF_STAB_DISPLAY */
 
 extern char *xmalloc ();
@@ -89,9 +89,8 @@ void
 usage ()
 {
   fprintf (stderr, "\
-usage: %s [-ahifdrtxsl] [-m machine] [-j section_name]\n\
-         [--syms] [--reloc] [--header] [--version] obj ...\n",
-          program_name);
+Usage: %s [-ahifdrtxsl] [-m machine] [-j section_name] [-b bfdname]\n\
+       [--syms] [--reloc] [--header] [--version] objfile...\n", program_name);
   exit (1);
 }
 
@@ -104,7 +103,8 @@ static struct option long_options[]=
 #ifdef ELF_STAB_DISPLAY
   {"stabs", no_argument, &dump_stab_section_info, 1},
 #endif
-  {0, no_argument, 0, 0}};
+  {0, no_argument, 0, 0}
+};
 
 
 static void
@@ -171,6 +171,12 @@ DEFUN (slurp_symtab, (abfd),
        }
     }
   symcount = bfd_canonicalize_symtab (abfd, sy);
+  if (symcount <= 0)
+    {
+      fprintf (stderr, "%s: Bad symbol table in \"%s\".\n",
+              program_name, bfd_get_filename (abfd));
+      exit (1);
+    }
   return sy;
 }
 
@@ -581,20 +587,20 @@ dump_elf_stabs_1 (abfd, name1, name2)
      char *name1;              /* Section name of .stab */
      char *name2;              /* Section name of its string section */
 {
-  Elf_Internal_Shdr *stab_hdr, *stabstr_hdr;
+  Elf32_Internal_Shdr *stab_hdr, *stabstr_hdr;
   char *strtab;
   struct internal_nlist *stabs, *stabs_end;
   int i;
   unsigned file_string_table_offset, next_file_string_table_offset;
 
-  stab_hdr = bfd_elf_find_section (abfd, name1);
+  stab_hdr = bfd_elf32_find_section (abfd, name1);
   if (0 == stab_hdr)
     {
       printf ("Contents of %s section:  none.\n\n", name1);
       return;
     }
 
-  stabstr_hdr = bfd_elf_find_section (abfd, name2);
+  stabstr_hdr = bfd_elf32_find_section (abfd, name2);
   if (0 == stabstr_hdr)
     {
       fprintf (stderr, "%s: %s has no %s section.\n", program_name,
@@ -745,6 +751,7 @@ display_file (filename, target)
   file = bfd_openr (filename, target);
   if (file == NULL)
     {
+      fprintf (stderr, "%s: ", program_name);
       bfd_perror (filename);
       return;
     }
@@ -760,7 +767,10 @@ display_file (filename, target)
          if (arfile == NULL)
            {
              if (bfd_error != no_more_archived_files)
-               bfd_perror (bfd_get_filename (file));
+               {
+                 fprintf (stderr, "%s: ", program_name);
+                 bfd_perror (bfd_get_filename (file));
+               }
              return;
            }
 
@@ -1052,12 +1062,12 @@ main (argc, argv)
   extern char *optarg;
   char *target = default_target;
   boolean seenflag = false;
-  int ind = 0;
 
   bfd_init ();
   program_name = *argv;
 
-  while ((c = getopt_long (argc, argv, "ib:m:Vdlfahrtxsj:", long_options, &ind))
+  while ((c = getopt_long (argc, argv, "ib:m:Vdlfahrtxsj:", long_options,
+                          (int *) 0))
         != EOF)
     {
       seenflag = true;
This page took 0.025274 seconds and 4 git commands to generate.