Fix typo in previous patch.
[deliverable/binutils-gdb.git] / binutils / readelf.c
index 25f5de67ea3c9e6851b6dce57a1dc2d5b1aa3bb6..fb8d80f83739589368c3042465e756a8d481971f 100644 (file)
@@ -310,7 +310,7 @@ byte_get_little_endian (unsigned char *field, int size)
       /* This is a special case, generated by the BYTE_GET8 macro.
         It means that we are loading an 8 byte value from a field
         in an external structure into an 8 byte value in a field
-        in an internal strcuture.  */
+        in an internal structure.  */
       return  ((bfd_vma) (field[0]))
        |    (((bfd_vma) (field[1])) << 8)
        |    (((bfd_vma) (field[2])) << 16)
@@ -536,7 +536,7 @@ byte_get_big_endian (unsigned char *field, int size)
       /* This is a special case, generated by the BYTE_GET8 macro.
         It means that we are loading an 8 byte value from a field
         in an external structure into an 8 byte value in a field
-        in an internal strcuture.  */
+        in an internal structure.  */
       return ((bfd_vma) (field[7]))
        |   (((bfd_vma) (field[6])) << 8)
        |   (((bfd_vma) (field[5])) << 16)
@@ -1194,6 +1194,10 @@ dump_relocations (FILE *file,
                        sec_name = "ABS";
                      else if (psym->st_shndx == SHN_COMMON)
                        sec_name = "COMMON";
+                     else if (elf_header.e_machine == EM_IA_64
+                              && elf_header.e_ident[EI_OSABI] == ELFOSABI_HPUX
+                              && psym->st_shndx == SHN_IA_64_ANSI_COMMON)
+                       sec_name = "ANSI_COM";
                      else
                        {
                          sprintf (name_buf, "<section 0x%x>",
@@ -1817,6 +1821,9 @@ get_machine_flags (unsigned e_flags, unsigned e_machine)
        case EM_CYGNUS_V850:
          switch (e_flags & EF_V850_ARCH)
            {
+           case E_V850E1_ARCH:
+             strcat (buf, ", v850e1");
+             break;
            case E_V850E_ARCH:
              strcat (buf, ", v850e");
              break;
@@ -1909,6 +1916,7 @@ get_machine_flags (unsigned e_flags, unsigned e_machine)
            case E_MIPS_ARCH_32: strcat (buf, ", mips32"); break;
            case E_MIPS_ARCH_32R2: strcat (buf, ", mips32r2"); break;
            case E_MIPS_ARCH_64: strcat (buf, ", mips64"); break;
+           case E_MIPS_ARCH_64R2: strcat (buf, ", mips64r2"); break;
            default: strcat (buf, ", unknown ISA"); break;
            }
 
@@ -5223,10 +5231,10 @@ process_version_sections (FILE *file)
                    aux.vna_next  = BYTE_GET (eaux->vna_next);
 
                    if (dynamic_strings)
-                     printf (_("  %#06x: Name: %s"),
+                     printf (_("  %#06x:   Name: %s"),
                              isum, dynamic_strings + aux.vna_name);
                    else
-                     printf (_("  %#06x: Name index: %lx"),
+                     printf (_("  %#06x:   Name index: %lx"),
                              isum, aux.vna_name);
 
                    printf (_("  Flags: %s  Version: %d\n"),
@@ -5547,7 +5555,11 @@ get_symbol_index_type (unsigned int type)
     case SHN_ABS:      return "ABS";
     case SHN_COMMON:   return "COM";
     default:
-      if (type >= SHN_LOPROC && type <= SHN_HIPROC)
+      if (type == SHN_IA_64_ANSI_COMMON
+         && elf_header.e_machine == EM_IA_64
+         && elf_header.e_ident[EI_OSABI] == ELFOSABI_HPUX)
+       return "ANSI_COM";
+      else if (type >= SHN_LOPROC && type <= SHN_HIPROC)
        sprintf (buff, "PRC[0x%04x]", type);
       else if (type >= SHN_LOOS && type <= SHN_HIOS)
        sprintf (buff, "OS [0x%04x]", type);
@@ -6043,7 +6055,7 @@ dump_section (Elf_Internal_Shdr *section, FILE *file)
 
   bytes = section->sh_size;
 
-  if (bytes == 0)
+  if (bytes == 0 || section->sh_type == SHT_NOBITS)
     {
       printf (_("\nSection '%s' has no data to dump.\n"),
              SECTION_NAME (section));
@@ -6103,7 +6115,7 @@ dump_section (Elf_Internal_Shdr *section, FILE *file)
       for (j = 0; j < lbytes; j++)
        {
          k = data[j];
-         if (k >= ' ' && k < 0x80)
+         if (k >= ' ' && k < 0x7f)
            printf ("%c", k);
          else
            printf (".");
@@ -6835,7 +6847,7 @@ get_FORM_name (unsigned long form)
     }
 }
 
-/* FIXME:  There are better and more effiecint ways to handle
+/* FIXME:  There are better and more efficient ways to handle
    these structures.  For now though, I just want something that
    is simple to implement.  */
 typedef struct abbrev_attr
@@ -7529,7 +7541,7 @@ display_debug_loc (Elf_Internal_Shdr *section,
          /* Normally, the lists in the debug_loc section are related to a
             given compilation unit, and thus, we would use the pointer size
             of that compilation unit.  However, since we are displaying it
-            seperately here, we either have to store pointer sizes of all
+            separately here, we either have to store pointer sizes of all
             compilation units, or assume they don't change.   We assume,
             like the debug_line display, that it doesn't change.  */
          begin = byte_get (start, debug_line_pointer_size);
@@ -7831,7 +7843,7 @@ read_and_display_attr_value (unsigned long attribute,
       break;
     }
 
-  /* For some attributes we can display futher information.  */
+  /* For some attributes we can display further information.  */
 
   printf ("\t");
 
@@ -10123,7 +10135,7 @@ get_file_header (FILE *file)
       /* If we have been compiled with sizeof (bfd_vma) == 4, then
         we will not be able to cope with the 64bit data found in
         64 ELF files.  Detect this now and abort before we start
-        overwritting things.  */
+        overwriting things.  */
       if (sizeof (bfd_vma) < 8)
        {
          error (_("This instance of readelf has been built without support for a\n\
@@ -10275,6 +10287,7 @@ process_archive (char *file_name, FILE *file)
   char *longnames = NULL;
   unsigned long longnames_size = 0;
   size_t file_name_size;
+  int ret;
 
   show_name = 1;
 
@@ -10326,6 +10339,7 @@ process_archive (char *file_name, FILE *file)
 
       if (fread (longnames, longnames_size, 1, file) != 1)
        {
+         free (longnames);
          error(_("%s: failed to read string table\n"), file_name);
          return 1;
        }
@@ -10336,6 +10350,8 @@ process_archive (char *file_name, FILE *file)
       got = fread (&arhdr, 1, sizeof arhdr, file);
       if (got != sizeof arhdr)
        {
+         free (longnames);
+
          if (got == 0)
            return 0;
 
@@ -10345,6 +10361,7 @@ process_archive (char *file_name, FILE *file)
     }
 
   file_name_size = strlen (file_name);
+  ret = 0;
 
   while (1)
     {
@@ -10360,7 +10377,8 @@ process_archive (char *file_name, FILE *file)
          if (off >= longnames_size)
            {
              error (_("%s: invalid archive string table offset %lu\n"), off);
-             return 1;
+             ret = 1;
+             break;
            }
 
          name = longnames + off;
@@ -10375,14 +10393,16 @@ process_archive (char *file_name, FILE *file)
       if (nameend == NULL)
        {
          error (_("%s: bad archive file name\n"));
-         return 1;
+         ret = 1;
+         break;
        }
 
       namealc = malloc (file_name_size + (nameend - name) + 3);
       if (namealc == NULL)
        {
          error (_("Out of memory\n"));
-         return 1;
+         ret = 1;
+         break;
        }
 
       memcpy (namealc, file_name, file_name_size);
@@ -10394,7 +10414,7 @@ process_archive (char *file_name, FILE *file)
       archive_file_offset = ftell (file);
       archive_file_size = strtoul (arhdr.ar_size, NULL, 10);
 
-      process_object (namealc, file);
+      ret |= process_object (namealc, file);
 
       free (namealc);
 
@@ -10405,24 +10425,26 @@ process_archive (char *file_name, FILE *file)
                 SEEK_SET) != 0)
        {
          error (_("%s: failed to seek to next archive header\n"), file_name);
-         return 1;
+         ret = 1;
+         break;
        }
 
       got = fread (&arhdr, 1, sizeof arhdr, file);
       if (got != sizeof arhdr)
        {
          if (got == 0)
-           return 0;
+           break;
 
          error (_("%s: failed to read archive header\n"), file_name);
-         return 1;
+         ret = 1;
+         break;
        }
     }
 
   if (longnames != 0)
     free (longnames);
 
-  return 0;
+  return ret;
 }
 
 static int
This page took 0.034675 seconds and 4 git commands to generate.