* gdbint.texinfo: Bring the HTML `top' menu into sync with the
[binutils-gdb.git] / binutils / readelf.c
index 9fea0771e2cb717e0c652d213dca72ccc82ad816..3c29c8dff101785b8b00632c79a278ed7348759a 100644 (file)
@@ -2,7 +2,7 @@
    Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
 
    Originally developed by Eric Youngdale <eric@andante.jic.com>
-   Modifications by Nick Clifton <nickc@cygnus.com>
+   Modifications by Nick Clifton <nickc@redhat.com>
 
    This file is part of GNU Binutils.
 
@@ -119,6 +119,7 @@ int                     do_debug_pubnames;
 int                     do_debug_aranges;
 int                     do_debug_frames;
 int                     do_debug_frames_interp;
+int                    do_debug_macinfo;
 int                     do_arch;
 int                     do_notes;
 int                    is_32bit_elf;
@@ -183,8 +184,11 @@ static void               dynamic_segment_mips_val    PARAMS ((Elf_Internal_Dyn
 static void               dynamic_segment_parisc_val  PARAMS ((Elf_Internal_Dyn *));
 static int                process_dynamic_segment     PARAMS ((FILE *));
 static int                process_symbol_table        PARAMS ((FILE *));
+static int                process_syminfo             PARAMS ((FILE *));
 static int                process_section_contents    PARAMS ((FILE *));
-static void               process_file                PARAMS ((char *));
+static void               process_mips_fpe_exception  PARAMS ((int));
+static int                process_mips_specific       PARAMS ((FILE *));
+static int                process_file                PARAMS ((char *));
 static int                process_relocs              PARAMS ((FILE *));
 static int                process_version_sections    PARAMS ((FILE *));
 static char *             get_ver_flags               PARAMS ((unsigned int));
@@ -206,10 +210,13 @@ static int                  dump_section                PARAMS ((Elf32_Internal_Shdr *,
 static int               display_debug_section       PARAMS ((Elf32_Internal_Shdr *, FILE *));
 static int                display_debug_info          PARAMS ((Elf32_Internal_Shdr *, unsigned char *, FILE *));
 static int                display_debug_not_supported PARAMS ((Elf32_Internal_Shdr *, unsigned char *, FILE *));
+static int                prescan_debug_info          PARAMS ((Elf32_Internal_Shdr *, unsigned char *, FILE *));
 static int                display_debug_lines         PARAMS ((Elf32_Internal_Shdr *, unsigned char *, FILE *));
+static int                display_debug_pubnames      PARAMS ((Elf32_Internal_Shdr *, unsigned char *, FILE *));
 static int                display_debug_abbrev        PARAMS ((Elf32_Internal_Shdr *, unsigned char *, FILE *));
 static int                display_debug_aranges       PARAMS ((Elf32_Internal_Shdr *, unsigned char *, FILE *));
 static int                display_debug_frames        PARAMS ((Elf32_Internal_Shdr *, unsigned char *, FILE *));
+static int                display_debug_macinfo       PARAMS ((Elf32_Internal_Shdr *, unsigned char *, FILE *));
 static unsigned char *    process_abbrev_section      PARAMS ((unsigned char *, unsigned char *));
 static unsigned long      read_leb128                 PARAMS ((unsigned char *, int *, int));
 static int                process_extended_line_op    PARAMS ((unsigned char *, int, int));
@@ -233,6 +240,7 @@ static int            process_note                   PARAMS ((Elf32_Internal_Note *));
 static int               process_corefile_note_segment  PARAMS ((FILE *, bfd_vma, bfd_vma));
 static int               process_corefile_note_segments PARAMS ((FILE *));
 static int               process_corefile_contents      PARAMS ((FILE *));
+static int               process_arch_specific          PARAMS ((FILE *));
 
 typedef int Elf32_Word;
 
@@ -802,12 +810,24 @@ dump_relocations (file, rel_offset, rel_size, symtab, nsyms, strtab, is_rela)
        return 0;
     }
 
-  if (is_rela)
-    printf
-      (_("  Offset    Info  Type            Symbol's Value  Symbol's Name          Addend\n"));
+  if (is_32bit_elf)
+    {
+      if (is_rela)
+       printf
+         (_(" Offset     Info    Type            Symbol's Value  Symbol's Name          Addend\n"));
+      else
+       printf
+         (_(" Offset     Info    Type            Symbol's Value  Symbol's Name\n"));
+    }
   else
-    printf
-      (_("  Offset    Info  Type            Symbol's Value  Symbol's Name\n"));
+    {
+      if (is_rela)
+       printf
+         (_("    Offset             Info            Type               Symbol's Value   Symbol's Name           Addend\n"));
+      else
+       printf
+         (_("    Offset             Info            Type               Symbol's Value   Symbol's Name\n"));
+    }
 
   for (i = 0; i < rel_size; i++)
     {
@@ -847,11 +867,26 @@ dump_relocations (file, rel_offset, rel_size, symtab, nsyms, strtab, is_rela)
 #endif
        }
 
+      if (is_32bit_elf)
+       {
 #ifdef _bfd_int64_low
-      printf ("  %8.8lx  %5.5lx ", _bfd_int64_low (offset), _bfd_int64_low (info));
+         printf ("%8.8lx  %8.8lx ", _bfd_int64_low (offset), _bfd_int64_low (info));
 #else
-      printf ("  %8.8lx  %5.5lx ", offset, info);
+         printf ("%8.8lx  %8.8lx ", offset, info);
 #endif
+       }
+      else
+       {
+#ifdef _bfd_int64_low
+         printf ("%8.8lx%8.8lx  %8.8lx%8.8lx ",
+                 _bfd_int64_high (offset),
+                 _bfd_int64_low (offset),
+                 _bfd_int64_high (info),
+                 _bfd_int64_low (info));
+#else
+         printf ("%16.16lx  %16.16lx ", offset, info);
+#endif
+       }
 
       switch (elf_header.e_machine)
        {
@@ -920,6 +955,7 @@ dump_relocations (file, rel_offset, rel_size, symtab, nsyms, strtab, is_rela)
          break;
 
        case EM_PPC:
+       case EM_PPC64:
          rtype = elf_ppc_reloc_type (type);
          break;
 
@@ -1566,9 +1602,15 @@ get_machine_flags (e_flags, e_machine)
          if (e_flags & EF_MIPS_CPIC)
            strcat (buf, ", cpic");
 
+         if (e_flags & EF_MIPS_UCODE)
+           strcat (buf, ", ugen_reserved");
+
          if (e_flags & EF_MIPS_ABI2)
            strcat (buf, ", abi2");
 
+         if (e_flags & EF_MIPS_32BITMODE)
+           strcat (buf, ", 32bitmode");
+
          if ((e_flags & EF_MIPS_ARCH) == E_MIPS_ARCH_1)
            strcat (buf, ", mips1");
 
@@ -2019,7 +2061,7 @@ usage ()
   fprintf (stdout, _("  -D or --use-dynamic       Use the dynamic section info when displaying symbols\n"));
   fprintf (stdout, _("  -x <number> or --hex-dump=<number>\n"));
   fprintf (stdout, _("                            Dump the contents of section <number>\n"));
-  fprintf (stdout, _("  -w[liaprf] or --debug-dump[=line,=info,=abbrev,=pubnames,=ranges,=frames]\n"));
+  fprintf (stdout, _("  -w[liaprmf] or --debug-dump[=line,=info,=abbrev,=pubnames,=ranges,=macro,=frames]\n"));
   fprintf (stdout, _("                            Display the contents of DWARF2 debug sections\n"));
 #ifdef SUPPORT_DISASSEMBLY
   fprintf (stdout, _("  -i <number> or --instruction-dump=<number>\n"));
@@ -2189,6 +2231,11 @@ parse_args (argc, argv)
                  do_debug_frames = 1;
                  break;
 
+               case 'm':
+               case 'M':
+                 do_debug_macinfo = 1;
+                 break;
+
                default:
                  warn (_("Unrecognised debug option '%s'\n"), optarg);
                  break;
@@ -2935,7 +2982,7 @@ process_section_headers (file)
        }
       else if ((do_debugging || do_debug_info || do_debug_abbrevs
                || do_debug_lines || do_debug_pubnames || do_debug_aranges
-               || do_debug_frames)
+               || do_debug_frames || do_debug_macinfo)
               && strncmp (name, ".debug_", 7) == 0)
        {
          name += 7;
@@ -2947,6 +2994,7 @@ process_section_headers (file)
              || (do_debug_pubnames && (strcmp (name, "pubnames") == 0))
              || (do_debug_aranges  && (strcmp (name, "aranges") == 0))
              || (do_debug_frames   && (strcmp (name, "frame") == 0))
+             || (do_debug_macinfo  && (strcmp (name, "macinfo") == 0))
              )
            request_dump (i, DEBUG_DUMP);
        }
@@ -5885,58 +5933,67 @@ get_TAG_name (tag)
 {
   switch (tag)
     {
-    case DW_TAG_padding: return "DW_TAG_padding";
-    case DW_TAG_array_type: return "DW_TAG_array_type";
-    case DW_TAG_class_type: return "DW_TAG_class_type";
-    case DW_TAG_entry_point: return "DW_TAG_entry_point";
-    case DW_TAG_enumeration_type: return "DW_TAG_enumeration_type";
-    case DW_TAG_formal_parameter: return "DW_TAG_formal_parameter";
-    case DW_TAG_imported_declaration: return "DW_TAG_imported_declaration";
-    case DW_TAG_label: return "DW_TAG_label";
-    case DW_TAG_lexical_block: return "DW_TAG_lexical_block";
-    case DW_TAG_member: return "DW_TAG_member";
-    case DW_TAG_pointer_type: return "DW_TAG_pointer_type";
-    case DW_TAG_reference_type: return "DW_TAG_reference_type";
-    case DW_TAG_compile_unit: return "DW_TAG_compile_unit";
-    case DW_TAG_string_type: return "DW_TAG_string_type";
-    case DW_TAG_structure_type: return "DW_TAG_structure_type";
-    case DW_TAG_subroutine_type: return "DW_TAG_subroutine_type";
-    case DW_TAG_typedef: return "DW_TAG_typedef";
-    case DW_TAG_union_type: return "DW_TAG_union_type";
+    case DW_TAG_padding:                return "DW_TAG_padding";
+    case DW_TAG_array_type:             return "DW_TAG_array_type";
+    case DW_TAG_class_type:             return "DW_TAG_class_type";
+    case DW_TAG_entry_point:            return "DW_TAG_entry_point";
+    case DW_TAG_enumeration_type:       return "DW_TAG_enumeration_type";
+    case DW_TAG_formal_parameter:       return "DW_TAG_formal_parameter";
+    case DW_TAG_imported_declaration:   return "DW_TAG_imported_declaration";
+    case DW_TAG_label:                  return "DW_TAG_label";
+    case DW_TAG_lexical_block:          return "DW_TAG_lexical_block";
+    case DW_TAG_member:                 return "DW_TAG_member";
+    case DW_TAG_pointer_type:           return "DW_TAG_pointer_type";
+    case DW_TAG_reference_type:         return "DW_TAG_reference_type";
+    case DW_TAG_compile_unit:           return "DW_TAG_compile_unit";
+    case DW_TAG_string_type:            return "DW_TAG_string_type";
+    case DW_TAG_structure_type:         return "DW_TAG_structure_type";
+    case DW_TAG_subroutine_type:        return "DW_TAG_subroutine_type";
+    case DW_TAG_typedef:                return "DW_TAG_typedef";
+    case DW_TAG_union_type:             return "DW_TAG_union_type";
     case DW_TAG_unspecified_parameters: return "DW_TAG_unspecified_parameters";
-    case DW_TAG_variant: return "DW_TAG_variant";
-    case DW_TAG_common_block: return "DW_TAG_common_block";
-    case DW_TAG_common_inclusion: return "DW_TAG_common_inclusion";
-    case DW_TAG_inheritance: return "DW_TAG_inheritance";
-    case DW_TAG_inlined_subroutine: return "DW_TAG_inlined_subroutine";
-    case DW_TAG_module: return "DW_TAG_module";
-    case DW_TAG_ptr_to_member_type: return "DW_TAG_ptr_to_member_type";
-    case DW_TAG_set_type: return "DW_TAG_set_type";
-    case DW_TAG_subrange_type: return "DW_TAG_subrange_type";
-    case DW_TAG_with_stmt: return "DW_TAG_with_stmt";
-    case DW_TAG_access_declaration: return "DW_TAG_access_declaration";
-    case DW_TAG_base_type: return "DW_TAG_base_type";
-    case DW_TAG_catch_block: return "DW_TAG_catch_block";
-    case DW_TAG_const_type: return "DW_TAG_const_type";
-    case DW_TAG_constant: return "DW_TAG_constant";
-    case DW_TAG_enumerator: return "DW_TAG_enumerator";
-    case DW_TAG_file_type: return "DW_TAG_file_type";
-    case DW_TAG_friend: return "DW_TAG_friend";
-    case DW_TAG_namelist: return "DW_TAG_namelist";
-    case DW_TAG_namelist_item: return "DW_TAG_namelist_item";
-    case DW_TAG_packed_type: return "DW_TAG_packed_type";
-    case DW_TAG_subprogram: return "DW_TAG_subprogram";
-    case DW_TAG_template_type_param: return "DW_TAG_template_type_param";
-    case DW_TAG_template_value_param: return "DW_TAG_template_value_param";
-    case DW_TAG_thrown_type: return "DW_TAG_thrown_type";
-    case DW_TAG_try_block: return "DW_TAG_try_block";
-    case DW_TAG_variant_part: return "DW_TAG_variant_part";
-    case DW_TAG_variable: return "DW_TAG_variable";
-    case DW_TAG_volatile_type: return "DW_TAG_volatile_type";
-    case DW_TAG_MIPS_loop: return "DW_TAG_MIPS_loop";
-    case DW_TAG_format_label: return "DW_TAG_format_label";
-    case DW_TAG_function_template: return "DW_TAG_function_template";
-    case DW_TAG_class_template: return "DW_TAG_class_template";
+    case DW_TAG_variant:                return "DW_TAG_variant";
+    case DW_TAG_common_block:           return "DW_TAG_common_block";
+    case DW_TAG_common_inclusion:       return "DW_TAG_common_inclusion";
+    case DW_TAG_inheritance:            return "DW_TAG_inheritance";
+    case DW_TAG_inlined_subroutine:     return "DW_TAG_inlined_subroutine";
+    case DW_TAG_module:                 return "DW_TAG_module";
+    case DW_TAG_ptr_to_member_type:     return "DW_TAG_ptr_to_member_type";
+    case DW_TAG_set_type:               return "DW_TAG_set_type";
+    case DW_TAG_subrange_type:          return "DW_TAG_subrange_type";
+    case DW_TAG_with_stmt:              return "DW_TAG_with_stmt";
+    case DW_TAG_access_declaration:     return "DW_TAG_access_declaration";
+    case DW_TAG_base_type:              return "DW_TAG_base_type";
+    case DW_TAG_catch_block:            return "DW_TAG_catch_block";
+    case DW_TAG_const_type:             return "DW_TAG_const_type";
+    case DW_TAG_constant:               return "DW_TAG_constant";
+    case DW_TAG_enumerator:             return "DW_TAG_enumerator";
+    case DW_TAG_file_type:              return "DW_TAG_file_type";
+    case DW_TAG_friend:                 return "DW_TAG_friend";
+    case DW_TAG_namelist:               return "DW_TAG_namelist";
+    case DW_TAG_namelist_item:          return "DW_TAG_namelist_item";
+    case DW_TAG_packed_type:            return "DW_TAG_packed_type";
+    case DW_TAG_subprogram:             return "DW_TAG_subprogram";
+    case DW_TAG_template_type_param:    return "DW_TAG_template_type_param";
+    case DW_TAG_template_value_param:   return "DW_TAG_template_value_param";
+    case DW_TAG_thrown_type:            return "DW_TAG_thrown_type";
+    case DW_TAG_try_block:              return "DW_TAG_try_block";
+    case DW_TAG_variant_part:           return "DW_TAG_variant_part";
+    case DW_TAG_variable:               return "DW_TAG_variable";
+    case DW_TAG_volatile_type:          return "DW_TAG_volatile_type";
+    case DW_TAG_MIPS_loop:              return "DW_TAG_MIPS_loop";
+    case DW_TAG_format_label:           return "DW_TAG_format_label";
+    case DW_TAG_function_template:      return "DW_TAG_function_template";
+    case DW_TAG_class_template:         return "DW_TAG_class_template";
+      /* DWARF 2.1 values.  */
+    case DW_TAG_dwarf_procedure:        return "DW_TAG_dwarf_procedure";
+    case DW_TAG_restrict_type:          return "DW_TAG_restrict_type";
+    case DW_TAG_interface_type:         return "DW_TAG_interface_type";
+    case DW_TAG_namespace:              return "DW_TAG_namespace";
+    case DW_TAG_imported_module:        return "DW_TAG_imported_module";
+    case DW_TAG_unspecified_type:       return "DW_TAG_unspecified_type";
+    case DW_TAG_partial_unit:           return "DW_TAG_partial_unit";
+    case DW_TAG_imported_unit:          return "DW_TAG_imported_unit";
     default:
       {
        static char buffer [100];
@@ -5953,85 +6010,100 @@ get_AT_name (attribute)
 {
   switch (attribute)
     {
-    case DW_AT_sibling: return "DW_AT_sibling";
-    case DW_AT_location: return "DW_AT_location";
-    case DW_AT_name: return "DW_AT_name";
-    case DW_AT_ordering: return "DW_AT_ordering";
-    case DW_AT_subscr_data: return "DW_AT_subscr_data";
-    case DW_AT_byte_size: return "DW_AT_byte_size";
-    case DW_AT_bit_offset: return "DW_AT_bit_offset";
-    case DW_AT_bit_size: return "DW_AT_bit_size";
-    case DW_AT_element_list: return "DW_AT_element_list";
-    case DW_AT_stmt_list: return "DW_AT_stmt_list";
-    case DW_AT_low_pc: return "DW_AT_low_pc";
-    case DW_AT_high_pc: return "DW_AT_high_pc";
-    case DW_AT_language: return "DW_AT_language";
-    case DW_AT_member: return "DW_AT_member";
-    case DW_AT_discr: return "DW_AT_discr";
-    case DW_AT_discr_value: return "DW_AT_discr_value";
-    case DW_AT_visibility: return "DW_AT_visibility";
-    case DW_AT_import: return "DW_AT_import";
-    case DW_AT_string_length: return "DW_AT_string_length";
-    case DW_AT_common_reference: return "DW_AT_common_reference";
-    case DW_AT_comp_dir: return "DW_AT_comp_dir";
-    case DW_AT_const_value: return "DW_AT_const_value";
-    case DW_AT_containing_type: return "DW_AT_containing_type";
-    case DW_AT_default_value: return "DW_AT_default_value";
-    case DW_AT_inline: return "DW_AT_inline";
-    case DW_AT_is_optional: return "DW_AT_is_optional";
-    case DW_AT_lower_bound: return "DW_AT_lower_bound";
-    case DW_AT_producer: return "DW_AT_producer";
-    case DW_AT_prototyped: return "DW_AT_prototyped";
-    case DW_AT_return_addr: return "DW_AT_return_addr";
-    case DW_AT_start_scope: return "DW_AT_start_scope";
-    case DW_AT_stride_size: return "DW_AT_stride_size";
-    case DW_AT_upper_bound: return "DW_AT_upper_bound";
-    case DW_AT_abstract_origin: return "DW_AT_abstract_origin";
-    case DW_AT_accessibility: return "DW_AT_accessibility";
-    case DW_AT_address_class: return "DW_AT_address_class";
-    case DW_AT_artificial: return "DW_AT_artificial";
-    case DW_AT_base_types: return "DW_AT_base_types";
-    case DW_AT_calling_convention: return "DW_AT_calling_convention";
-    case DW_AT_count: return "DW_AT_count";
+    case DW_AT_sibling:              return "DW_AT_sibling";
+    case DW_AT_location:             return "DW_AT_location";
+    case DW_AT_name:                 return "DW_AT_name";
+    case DW_AT_ordering:             return "DW_AT_ordering";
+    case DW_AT_subscr_data:          return "DW_AT_subscr_data";
+    case DW_AT_byte_size:            return "DW_AT_byte_size";
+    case DW_AT_bit_offset:           return "DW_AT_bit_offset";
+    case DW_AT_bit_size:             return "DW_AT_bit_size";
+    case DW_AT_element_list:         return "DW_AT_element_list";
+    case DW_AT_stmt_list:            return "DW_AT_stmt_list";
+    case DW_AT_low_pc:               return "DW_AT_low_pc";
+    case DW_AT_high_pc:              return "DW_AT_high_pc";
+    case DW_AT_language:             return "DW_AT_language";
+    case DW_AT_member:               return "DW_AT_member";
+    case DW_AT_discr:                return "DW_AT_discr";
+    case DW_AT_discr_value:          return "DW_AT_discr_value";
+    case DW_AT_visibility:           return "DW_AT_visibility";
+    case DW_AT_import:               return "DW_AT_import";
+    case DW_AT_string_length:        return "DW_AT_string_length";
+    case DW_AT_common_reference:     return "DW_AT_common_reference";
+    case DW_AT_comp_dir:             return "DW_AT_comp_dir";
+    case DW_AT_const_value:          return "DW_AT_const_value";
+    case DW_AT_containing_type:      return "DW_AT_containing_type";
+    case DW_AT_default_value:        return "DW_AT_default_value";
+    case DW_AT_inline:               return "DW_AT_inline";
+    case DW_AT_is_optional:          return "DW_AT_is_optional";
+    case DW_AT_lower_bound:          return "DW_AT_lower_bound";
+    case DW_AT_producer:             return "DW_AT_producer";
+    case DW_AT_prototyped:           return "DW_AT_prototyped";
+    case DW_AT_return_addr:          return "DW_AT_return_addr";
+    case DW_AT_start_scope:          return "DW_AT_start_scope";
+    case DW_AT_stride_size:          return "DW_AT_stride_size";
+    case DW_AT_upper_bound:          return "DW_AT_upper_bound";
+    case DW_AT_abstract_origin:      return "DW_AT_abstract_origin";
+    case DW_AT_accessibility:        return "DW_AT_accessibility";
+    case DW_AT_address_class:        return "DW_AT_address_class";
+    case DW_AT_artificial:           return "DW_AT_artificial";
+    case DW_AT_base_types:           return "DW_AT_base_types";
+    case DW_AT_calling_convention:   return "DW_AT_calling_convention";
+    case DW_AT_count:                return "DW_AT_count";
     case DW_AT_data_member_location: return "DW_AT_data_member_location";
-    case DW_AT_decl_column: return "DW_AT_decl_column";
-    case DW_AT_decl_file: return "DW_AT_decl_file";
-    case DW_AT_decl_line: return "DW_AT_decl_line";
-    case DW_AT_declaration: return "DW_AT_declaration";
-    case DW_AT_discr_list: return "DW_AT_discr_list";
-    case DW_AT_encoding: return "DW_AT_encoding";
-    case DW_AT_external: return "DW_AT_external";
-    case DW_AT_frame_base: return "DW_AT_frame_base";
-    case DW_AT_friend: return "DW_AT_friend";
-    case DW_AT_identifier_case: return "DW_AT_identifier_case";
-    case DW_AT_macro_info: return "DW_AT_macro_info";
-    case DW_AT_namelist_items: return "DW_AT_namelist_items";
-    case DW_AT_priority: return "DW_AT_priority";
-    case DW_AT_segment: return "DW_AT_segment";
-    case DW_AT_specification: return "DW_AT_specification";
-    case DW_AT_static_link: return "DW_AT_static_link";
-    case DW_AT_type: return "DW_AT_type";
-    case DW_AT_use_location: return "DW_AT_use_location";
-    case DW_AT_variable_parameter: return "DW_AT_variable_parameter";
-    case DW_AT_virtuality: return "DW_AT_virtuality";
+    case DW_AT_decl_column:          return "DW_AT_decl_column";
+    case DW_AT_decl_file:            return "DW_AT_decl_file";
+    case DW_AT_decl_line:            return "DW_AT_decl_line";
+    case DW_AT_declaration:          return "DW_AT_declaration";
+    case DW_AT_discr_list:           return "DW_AT_discr_list";
+    case DW_AT_encoding:             return "DW_AT_encoding";
+    case DW_AT_external:             return "DW_AT_external";
+    case DW_AT_frame_base:           return "DW_AT_frame_base";
+    case DW_AT_friend:               return "DW_AT_friend";
+    case DW_AT_identifier_case:      return "DW_AT_identifier_case";
+    case DW_AT_macro_info:           return "DW_AT_macro_info";
+    case DW_AT_namelist_items:       return "DW_AT_namelist_items";
+    case DW_AT_priority:             return "DW_AT_priority";
+    case DW_AT_segment:              return "DW_AT_segment";
+    case DW_AT_specification:        return "DW_AT_specification";
+    case DW_AT_static_link:          return "DW_AT_static_link";
+    case DW_AT_type:                 return "DW_AT_type";
+    case DW_AT_use_location:         return "DW_AT_use_location";
+    case DW_AT_variable_parameter:   return "DW_AT_variable_parameter";
+    case DW_AT_virtuality:           return "DW_AT_virtuality";
     case DW_AT_vtable_elem_location: return "DW_AT_vtable_elem_location";
-    case DW_AT_MIPS_fde: return "DW_AT_MIPS_fde";
-    case DW_AT_MIPS_loop_begin: return "DW_AT_MIPS_loop_begin";
+      /* DWARF 2.1 values.  */
+    case DW_AT_allocated:            return "DW_AT_allocated";
+    case DW_AT_associated:           return "DW_AT_associated";
+    case DW_AT_data_location:        return "DW_AT_data_location";
+    case DW_AT_stride:               return "DW_AT_stride";
+    case DW_AT_entry_pc:             return "DW_AT_entry_pc";
+    case DW_AT_use_UTF8:             return "DW_AT_use_UTF8";
+    case DW_AT_extension:            return "DW_AT_extension";
+    case DW_AT_ranges:               return "DW_AT_ranges";
+    case DW_AT_trampoline:           return "DW_AT_trampoline";
+    case DW_AT_call_column:          return "DW_AT_call_column";
+    case DW_AT_call_file:            return "DW_AT_call_file";
+    case DW_AT_call_line:            return "DW_AT_call_line";
+      /* SGI/MIPS extensions.  */
+    case DW_AT_MIPS_fde:             return "DW_AT_MIPS_fde";
+    case DW_AT_MIPS_loop_begin:      return "DW_AT_MIPS_loop_begin";
     case DW_AT_MIPS_tail_loop_begin: return "DW_AT_MIPS_tail_loop_begin";
-    case DW_AT_MIPS_epilog_begin: return "DW_AT_MIPS_epilog_begin";
+    case DW_AT_MIPS_epilog_begin:    return "DW_AT_MIPS_epilog_begin";
     case DW_AT_MIPS_loop_unroll_factor: return "DW_AT_MIPS_loop_unroll_factor";
     case DW_AT_MIPS_software_pipeline_depth: return "DW_AT_MIPS_software_pipeline_depth";
-    case DW_AT_MIPS_linkage_name: return "DW_AT_MIPS_linkage_name";
-    case DW_AT_MIPS_stride: return "DW_AT_MIPS_stride";
-    case DW_AT_MIPS_abstract_name: return "DW_AT_MIPS_abstract_name";
-    case DW_AT_MIPS_clone_origin: return "DW_AT_MIPS_clone_origin";
-    case DW_AT_MIPS_has_inlines: return "DW_AT_MIPS_has_inlines";
-    case DW_AT_sf_names: return "DW_AT_sf_names";
-    case DW_AT_src_info: return "DW_AT_src_info";
-    case DW_AT_mac_info: return "DW_AT_mac_info";
-    case DW_AT_src_coords: return "DW_AT_src_coords";
-    case DW_AT_body_begin: return "DW_AT_body_begin";
-    case DW_AT_body_end: return "DW_AT_body_end";
+    case DW_AT_MIPS_linkage_name:    return "DW_AT_MIPS_linkage_name";
+    case DW_AT_MIPS_stride:          return "DW_AT_MIPS_stride";
+    case DW_AT_MIPS_abstract_name:   return "DW_AT_MIPS_abstract_name";
+    case DW_AT_MIPS_clone_origin:    return "DW_AT_MIPS_clone_origin";
+    case DW_AT_MIPS_has_inlines:     return "DW_AT_MIPS_has_inlines";
+      /* GNU extensions.  */
+    case DW_AT_sf_names:             return "DW_AT_sf_names";
+    case DW_AT_src_info:             return "DW_AT_src_info";
+    case DW_AT_mac_info:             return "DW_AT_mac_info";
+    case DW_AT_src_coords:           return "DW_AT_src_coords";
+    case DW_AT_body_begin:           return "DW_AT_body_begin";
+    case DW_AT_body_end:             return "DW_AT_body_end";
     default:
       {
        static char buffer [100];
@@ -6048,27 +6120,27 @@ get_FORM_name (form)
 {
   switch (form)
     {
-    case DW_FORM_addr: return "DW_FORM_addr";
-    case DW_FORM_block2: return "DW_FORM_block2";
-    case DW_FORM_block4: return "DW_FORM_block4";
-    case DW_FORM_data2: return "DW_FORM_data2";
-    case DW_FORM_data4: return "DW_FORM_data4";
-    case DW_FORM_data8: return "DW_FORM_data8";
-    case DW_FORM_string: return "DW_FORM_string";
-    case DW_FORM_block: return "DW_FORM_block";
-    case DW_FORM_block1: return "DW_FORM_block1";
-    case DW_FORM_data1: return "DW_FORM_data1";
-    case DW_FORM_flag: return "DW_FORM_flag";
-    case DW_FORM_sdata: return "DW_FORM_sdata";
-    case DW_FORM_strp: return "DW_FORM_strp";
-    case DW_FORM_udata: return "DW_FORM_udata";
-    case DW_FORM_ref_addr: return "DW_FORM_ref_addr";
-    case DW_FORM_ref1: return "DW_FORM_ref1";
-    case DW_FORM_ref2: return "DW_FORM_ref2";
-    case DW_FORM_ref4: return "DW_FORM_ref4";
-    case DW_FORM_ref8: return "DW_FORM_ref8";
+    case DW_FORM_addr:      return "DW_FORM_addr";
+    case DW_FORM_block2:    return "DW_FORM_block2";
+    case DW_FORM_block4:    return "DW_FORM_block4";
+    case DW_FORM_data2:     return "DW_FORM_data2";
+    case DW_FORM_data4:     return "DW_FORM_data4";
+    case DW_FORM_data8:     return "DW_FORM_data8";
+    case DW_FORM_string:    return "DW_FORM_string";
+    case DW_FORM_block:     return "DW_FORM_block";
+    case DW_FORM_block1:    return "DW_FORM_block1";
+    case DW_FORM_data1:     return "DW_FORM_data1";
+    case DW_FORM_flag:      return "DW_FORM_flag";
+    case DW_FORM_sdata:     return "DW_FORM_sdata";
+    case DW_FORM_strp:      return "DW_FORM_strp";
+    case DW_FORM_udata:     return "DW_FORM_udata";
+    case DW_FORM_ref_addr:  return "DW_FORM_ref_addr";
+    case DW_FORM_ref1:      return "DW_FORM_ref1";
+    case DW_FORM_ref2:      return "DW_FORM_ref2";
+    case DW_FORM_ref4:      return "DW_FORM_ref4";
+    case DW_FORM_ref8:      return "DW_FORM_ref8";
     case DW_FORM_ref_udata: return "DW_FORM_ref_udata";
-    case DW_FORM_indirect: return "DW_FORM_indirect";
+    case DW_FORM_indirect:  return "DW_FORM_indirect";
     default:
       {
        static char buffer [100];
@@ -6240,6 +6312,80 @@ process_abbrev_section (start, end)
 }
 
 
+static int
+display_debug_macinfo (section, start, file)
+     Elf32_Internal_Shdr * section;
+     unsigned char *       start;
+     FILE *                file ATTRIBUTE_UNUSED;
+{
+  unsigned char * end = start + section->sh_size;
+  unsigned char * curr = start;
+  unsigned int bytes_read;
+  enum dwarf_macinfo_record_type op;
+
+  printf (_("Contents of the %s section:\n\n"), SECTION_NAME (section));
+
+  while (curr < end)
+    {
+      unsigned int lineno;
+      const char * string;
+
+      op = * curr;
+      curr ++;
+
+      switch (op)
+       {
+       case DW_MACINFO_start_file:
+         {
+           unsigned int filenum;
+
+           lineno = read_leb128 (curr, & bytes_read, 0);
+           curr += bytes_read;
+           filenum = read_leb128 (curr, & bytes_read, 0);
+           curr += bytes_read;
+
+           printf (_(" DW_MACINFO_start_file - lineno: %d filenum: %d\n"), lineno, filenum);
+         }
+         break;
+
+       case DW_MACINFO_end_file:
+         printf (_(" DW_MACINFO_end_file\n"));
+         break;
+
+       case DW_MACINFO_define:
+         lineno = read_leb128 (curr, & bytes_read, 0);
+         curr += bytes_read;
+         string = curr;
+         curr += strlen (string) + 1;
+         printf (_(" DW_MACINFO_define - lineno : %d macro : %s\n"), lineno, string);
+         break;
+
+       case DW_MACINFO_undef:
+         lineno = read_leb128 (curr, & bytes_read, 0);
+         curr += bytes_read;
+         string = curr;
+         curr += strlen (string) + 1;
+         printf (_(" DW_MACINFO_undef - lineno : %d macro : %s\n"), lineno, string);
+         break;
+
+       case DW_MACINFO_vendor_ext:
+         {
+           unsigned int constant;
+
+           constant = read_leb128 (curr, & bytes_read, 0);
+           curr += bytes_read;
+           string = curr;
+           curr += strlen (string) + 1;
+           printf (_(" DW_MACINFO_vendor_ext - constant : %d string : %s\n"), constant, string);
+         }
+         break;
+       }
+    }
+
+  return 1;
+}
+  
+
 static int
 display_debug_abbrev (section, start, file)
      Elf32_Internal_Shdr * section;
@@ -6591,6 +6737,22 @@ decode_location_expression (data, pointer_size, length)
          printf ("DW_OP_nop");
          break;
 
+         /* DWARF 2.1 extensions.  */
+       case DW_OP_push_object_address:
+         printf ("DW_OP_push_object_address");
+         break;
+       case DW_OP_call2:
+         printf ("DW_OP_call2: <%lx>", (long) byte_get (data, 2));
+         data += 2;
+         break;
+       case DW_OP_call4:
+         printf ("DW_OP_call4: <%lx>", (long) byte_get (data, 4));
+         data += 4;
+         break;
+       case DW_OP_calli:
+         printf ("DW_OP_calli");
+         break;
+
        default:
          if (op >= DW_OP_lo_user
              && op <= DW_OP_hi_user)
@@ -6600,6 +6762,9 @@ decode_location_expression (data, pointer_size, length)
          /* No way to tell where the next op is, so just bail.  */
          return;
        }
+
+      /* Separate the ops.  */
+      printf ("; ");
     }
 }
 
@@ -6761,6 +6926,11 @@ read_and_display_attr (attribute, form, data, cu_offset, pointer_size)
        case DW_LANG_Ada83:          printf ("(Ada)"); break;
        case DW_LANG_Cobol74:        printf ("(Cobol 74)"); break;
        case DW_LANG_Cobol85:        printf ("(Cobol 85)"); break;
+         /* DWARF 2.1 values.  */
+       case DW_LANG_C99:            printf ("(ANSI C99)"); break;
+       case DW_LANG_Ada95:          printf ("(ADA 95)"); break;
+       case DW_LANG_Fortran95:       printf ("(Fortran 95)"); break;
+         /* MIPS extension.  */
        case DW_LANG_Mips_Assembler: printf ("(MIPS assembler)"); break;
        default:                     printf ("(Unknown: %lx)", uvalue); break;
        }
@@ -6778,6 +6948,8 @@ read_and_display_attr (attribute, form, data, cu_offset, pointer_size)
        case DW_ATE_signed_char:     printf ("(signed char)"); break;
        case DW_ATE_unsigned:        printf ("(unsigned)"); break;
        case DW_ATE_unsigned_char:   printf ("(unsigned char)"); break;
+         /* DWARF 2.1 value.  */
+       case DW_ATE_imaginary_float: printf ("(imaginary float)"); break;
        default:
          if (uvalue >= DW_ATE_lo_user
              && uvalue <= DW_ATE_hi_user)
@@ -6844,10 +7016,25 @@ read_and_display_attr (attribute, form, data, cu_offset, pointer_size)
        }
       break;
 
+    case DW_AT_ordering:
+      switch (uvalue)
+       {
+       case -1: printf ("(undefined)"); break;
+       case 0:  printf ("(row major)"); break;
+       case 1:  printf ("(column major)"); break;
+       }
+      break;
+
     case DW_AT_frame_base:
     case DW_AT_location:
     case DW_AT_data_member_location:
     case DW_AT_vtable_elem_location:
+    case DW_AT_allocated:
+    case DW_AT_associated:
+    case DW_AT_data_location:
+    case DW_AT_stride:
+    case DW_AT_upper_bound:
+    case DW_AT_lower_bound:
       if (block_start)
        {
          printf ("(");
@@ -6879,6 +7066,7 @@ display_debug_info (section, start, file)
     {
       DWARF2_External_CompUnit * external;
       DWARF2_Internal_CompUnit   compunit;
+      Elf32_Internal_Shdr *      relsec;
       unsigned char *            tags;
       int                        i;
       int                       level;
@@ -6891,6 +7079,68 @@ display_debug_info (section, start, file)
       compunit.cu_abbrev_offset = BYTE_GET (external->cu_abbrev_offset);
       compunit.cu_pointer_size  = BYTE_GET (external->cu_pointer_size);
 
+      /* Check for RELA relocations in the abbrev_offset address, and
+         apply them.  */
+      for (relsec = section_headers;
+          relsec < section_headers + elf_header.e_shnum;
+          ++relsec)
+       {
+         unsigned long nrelas, nsyms;
+         Elf_Internal_Rela *rela, *rp;
+         Elf32_Internal_Shdr *symsec;
+         Elf_Internal_Sym *symtab;
+         Elf_Internal_Sym *sym;
+
+         if (relsec->sh_type != SHT_RELA
+             || section_headers + relsec->sh_info != section)
+           continue;
+
+         if (!slurp_rela_relocs (file, relsec->sh_offset, relsec->sh_size,
+                                 & rela, & nrelas))
+           return 0;
+
+         symsec = section_headers + relsec->sh_link;
+         nsyms = symsec->sh_size / symsec->sh_entsize;
+         symtab = GET_ELF_SYMBOLS (file, symsec->sh_offset, nsyms);
+
+         for (rp = rela; rp < rela + nrelas; ++rp)
+           {
+             if (rp->r_offset
+                 != (bfd_vma) ((unsigned char *) &external->cu_abbrev_offset
+                               - section_begin))
+               continue;
+             
+             if (is_32bit_elf)
+               {
+                 sym = symtab + ELF32_R_SYM (rp->r_info);
+
+                 if (ELF32_ST_TYPE (sym->st_info) != STT_SECTION)
+                   {
+                     warn (_("Skipping unexpected symbol type %u"),
+                           ELF32_ST_TYPE (sym->st_info));
+                     continue;
+                   }
+               }
+             else
+               {
+                 sym = symtab + ELF64_R_SYM (rp->r_info);
+
+                 if (ELF64_ST_TYPE (sym->st_info) != STT_SECTION)
+                   {
+                     warn (_("Skipping unexpected symbol type %u"),
+                           ELF64_ST_TYPE (sym->st_info));
+                     continue;
+                   }
+               }
+
+             compunit.cu_abbrev_offset += rp->r_addend;
+             break;
+           }
+
+         free (rela);
+         break;
+       }
+
       tags = start + sizeof (* external);
       cu_offset = start - section_begin;
       start += compunit.cu_length + sizeof (external->cu_length);
@@ -6973,8 +7223,9 @@ display_debug_info (section, start, file)
              return 0;
            }
 
-         printf (_(" <%d><%x>: Abbrev Number: %lu (%s)\n"),
-                 level, tags - section_begin - bytes_read,
+         printf (_(" <%d><%lx>: Abbrev Number: %lu (%s)\n"),
+                 level,
+                 (unsigned long) (tags - section_begin - bytes_read),
                  abbrev_number,
                  get_TAG_name (entry->tag));
 
@@ -7091,6 +7342,10 @@ Frame_Chunk;
    in the frame info.  */
 #define DW_CFA_unreferenced (-1)
 
+static void frame_need_space PARAMS ((Frame_Chunk *, int));
+static void frame_display_row PARAMS ((Frame_Chunk *, int *, int *));
+static int size_of_encoded_value PARAMS ((int));
+
 static void
 frame_need_space (fc, reg)
      Frame_Chunk * fc;
@@ -7389,10 +7644,10 @@ display_debug_frames (section, start, file)
              start += augmentation_data_len;
            }
 
-         printf ("\n%08lx %08lx %08lx FDE cie=%08x pc=%08lx..%08lx\n",
+         printf ("\n%08lx %08lx %08lx FDE cie=%08lx pc=%08lx..%08lx\n",
                  (unsigned long)(saved_start - section_start), length, cie_id,
-                 cie->chunk_start - section_start, fc->pc_begin,
-                 fc->pc_begin + fc->pc_range);
+                 (unsigned long)(cie->chunk_start - section_start),
+                 fc->pc_begin, fc->pc_begin + fc->pc_range);
          if (! do_debug_frames_interp && augmentation_data_len)
            {
              unsigned long i;
@@ -7781,7 +8036,7 @@ debug_displays[] =
   { ".debug_pubnames",    display_debug_pubnames, NULL },
   { ".debug_frame",       display_debug_frames, NULL },
   { ".eh_frame",          display_debug_frames, NULL },
-  { ".debug_macinfo",     display_debug_not_supported, NULL },
+  { ".debug_macinfo",     display_debug_macinfo, NULL },
   { ".debug_str",         display_debug_not_supported, NULL },
   { ".debug_static_func", display_debug_not_supported, NULL },
   { ".debug_static_vars", display_debug_not_supported, NULL },
@@ -8291,7 +8546,8 @@ process_mips_specific (file)
          free (econf64);
        }
 
-      printf (_("\nSection '.conflict' contains %d entries:\n"), conflictsno);
+      printf (_("\nSection '.conflict' contains %ld entries:\n"),
+             (long) conflictsno);
       puts (_("  Num:    Index       Value  Name"));
 
       for (cnt = 0; cnt < conflictsno; ++cnt)
@@ -8587,7 +8843,7 @@ get_file_header (file)
   return 1;
 }
 
-static void
+static int
 process_file (file_name)
      char * file_name;
 {
@@ -8598,21 +8854,21 @@ process_file (file_name)
   if (stat (file_name, & statbuf) < 0)
     {
       error (_("Cannot stat input file %s.\n"), file_name);
-      return;
+      return 1;
     }
 
   file = fopen (file_name, "rb");
   if (file == NULL)
     {
       error (_("Input file %s not found.\n"), file_name);
-      return;
+      return 1;
     }
 
   if (! get_file_header (file))
     {
       error (_("%s: Failed to read file header\n"), file_name);
       fclose (file);
-      return;
+      return 1;
     }
 
   /* Initialise per file variables.  */
@@ -8629,7 +8885,7 @@ process_file (file_name)
   if (! process_file_header ())
     {
       fclose (file);
-      return;
+      return 1;
     }
 
   process_section_headers (file);
@@ -8687,6 +8943,8 @@ process_file (file_name)
       free (dynamic_syminfo);
       dynamic_syminfo = NULL;
     }
+
+  return 0;
 }
 
 #ifdef SUPPORT_DISASSEMBLY
@@ -8713,6 +8971,8 @@ main (argc, argv)
      int     argc;
      char ** argv;
 {
+  int err;
+
 #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
   setlocale (LC_MESSAGES, "");
 #endif
@@ -8724,11 +8984,12 @@ main (argc, argv)
   if (optind < (argc - 1))
     show_name = 1;
 
+  err = 0;
   while (optind < argc)
-    process_file (argv [optind ++]);
+    err |= process_file (argv [optind ++]);
 
   if (dump_sects != NULL)
     free (dump_sects);
 
-  return 0;
+  return err;
 }