aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorClément Chigot <clement.chigot@atos.net>2021-06-11 11:00:56 +0200
committerAlan Modra <amodra@gmail.com>2021-07-14 21:40:05 +0930
commit51d29b8cacd75865a9ffc46cffffe1e47c33ccff (patch)
tree8800eb84ab44902fb543d25dfa7ad60f29503b6b /binutils
parentbe36c6e3374821fe5699556bbfa2280e3a4696df (diff)
downloadgdb-51d29b8cacd75865a9ffc46cffffe1e47c33ccff.zip
gdb-51d29b8cacd75865a9ffc46cffffe1e47c33ccff.tar.gz
gdb-51d29b8cacd75865a9ffc46cffffe1e47c33ccff.tar.bz2
objdump: add DWARF support for AIX
DWARF sections have special names on AIX which need be handled by objdump in order to correctly print them. This patch also adds the correlation in bfd for future uses. bfd/ * libxcoff.h (struct xcoff_dwsect_name): Add DWARF name. * coff-rs6000.c (xcoff_dwsect_names): Update. * coffcode.h (sec_to_styp_flags): Likewise. (coff_new_section_hook): Likewise. binutils/ * dwarf.h (struct dwarf_section): Add XCOFF name. * dwarf.c (struct dwarf_section_display): Update. * objdump.c (load_debug_section): Add XCOFF name handler. (dump_dwarf_section): Likewise. gas/ * config/tc-ppc.c (ppc_change_debug_section): Update to match new name's field.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog7
-rw-r--r--binutils/dwarf.c90
-rw-r--r--binutils/dwarf.h4
-rw-r--r--binutils/objdump.c14
4 files changed, 66 insertions, 49 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 2afe3ce..b775f0a 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,10 @@
+2021-07-14 Clément Chigot <clement.chigot@atos.net>
+
+ * dwarf.h (struct dwarf_section): Add XCOFF name.
+ * dwarf.c (struct dwarf_section_display): Update.
+ * objdump.c (load_debug_section): Add XCOFF name handler.
+ (dump_dwarf_section): Likewise.
+
2021-07-12 Nick Clifton <nickc@redhat.com>
* po/fr.po: Updated French translation.
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index fbd5d6a..bd030f3 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -11678,53 +11678,53 @@ dwarf_select_sections_all (void)
struct dwarf_section_display debug_displays[] =
{
- { { ".debug_abbrev", ".zdebug_abbrev", NO_ABBREVS }, display_debug_abbrev, &do_debug_abbrevs, false },
- { { ".debug_aranges", ".zdebug_aranges", NO_ABBREVS }, display_debug_aranges, &do_debug_aranges, true },
- { { ".debug_frame", ".zdebug_frame", NO_ABBREVS }, display_debug_frames, &do_debug_frames, true },
- { { ".debug_info", ".zdebug_info", ABBREV (abbrev)}, display_debug_info, &do_debug_info, true },
- { { ".debug_line", ".zdebug_line", NO_ABBREVS }, display_debug_lines, &do_debug_lines, true },
- { { ".debug_pubnames", ".zdebug_pubnames", NO_ABBREVS }, display_debug_pubnames, &do_debug_pubnames, false },
- { { ".debug_gnu_pubnames", ".zdebug_gnu_pubnames", NO_ABBREVS }, display_debug_gnu_pubnames, &do_debug_pubnames, false },
- { { ".eh_frame", "", NO_ABBREVS }, display_debug_frames, &do_debug_frames, true },
- { { ".debug_macinfo", ".zdebug_macinfo", NO_ABBREVS }, display_debug_macinfo, &do_debug_macinfo, false },
- { { ".debug_macro", ".zdebug_macro", NO_ABBREVS }, display_debug_macro, &do_debug_macinfo, true },
- { { ".debug_str", ".zdebug_str", NO_ABBREVS }, display_debug_str, &do_debug_str, false },
- { { ".debug_line_str", ".zdebug_line_str", NO_ABBREVS }, display_debug_str, &do_debug_str, false },
- { { ".debug_loc", ".zdebug_loc", NO_ABBREVS }, display_debug_loc, &do_debug_loc, true },
- { { ".debug_loclists", ".zdebug_loclists", NO_ABBREVS }, display_debug_loc, &do_debug_loc, true },
- { { ".debug_pubtypes", ".zdebug_pubtypes", NO_ABBREVS }, display_debug_pubnames, &do_debug_pubtypes, false },
- { { ".debug_gnu_pubtypes", ".zdebug_gnu_pubtypes", NO_ABBREVS }, display_debug_gnu_pubnames, &do_debug_pubtypes, false },
- { { ".debug_ranges", ".zdebug_ranges", NO_ABBREVS }, display_debug_ranges, &do_debug_ranges, true },
- { { ".debug_rnglists", ".zdebug_rnglists", NO_ABBREVS }, display_debug_ranges, &do_debug_ranges, true },
- { { ".debug_static_func", ".zdebug_static_func", NO_ABBREVS }, display_debug_not_supported, NULL, false },
- { { ".debug_static_vars", ".zdebug_static_vars", NO_ABBREVS }, display_debug_not_supported, NULL, false },
- { { ".debug_types", ".zdebug_types", ABBREV (abbrev) }, display_debug_types, &do_debug_info, true },
- { { ".debug_weaknames", ".zdebug_weaknames", NO_ABBREVS }, display_debug_not_supported, NULL, false },
- { { ".gdb_index", "", NO_ABBREVS }, display_gdb_index, &do_gdb_index, false },
- { { ".debug_names", "", NO_ABBREVS }, display_debug_names, &do_gdb_index, false },
- { { ".trace_info", "", ABBREV (trace_abbrev) }, display_trace_info, &do_trace_info, true },
- { { ".trace_abbrev", "", NO_ABBREVS }, display_debug_abbrev, &do_trace_abbrevs, false },
- { { ".trace_aranges", "", NO_ABBREVS }, display_debug_aranges, &do_trace_aranges, false },
- { { ".debug_info.dwo", ".zdebug_info.dwo", ABBREV (abbrev_dwo) }, display_debug_info, &do_debug_info, true },
- { { ".debug_abbrev.dwo", ".zdebug_abbrev.dwo", NO_ABBREVS }, display_debug_abbrev, &do_debug_abbrevs, false },
- { { ".debug_types.dwo", ".zdebug_types.dwo", ABBREV (abbrev_dwo) }, display_debug_types, &do_debug_info, true },
- { { ".debug_line.dwo", ".zdebug_line.dwo", NO_ABBREVS }, display_debug_lines, &do_debug_lines, true },
- { { ".debug_loc.dwo", ".zdebug_loc.dwo", NO_ABBREVS }, display_debug_loc, &do_debug_loc, true },
- { { ".debug_macro.dwo", ".zdebug_macro.dwo", NO_ABBREVS }, display_debug_macro, &do_debug_macinfo, true },
- { { ".debug_macinfo.dwo", ".zdebug_macinfo.dwo", NO_ABBREVS }, display_debug_macinfo, &do_debug_macinfo, false },
- { { ".debug_str.dwo", ".zdebug_str.dwo", NO_ABBREVS }, display_debug_str, &do_debug_str, true },
- { { ".debug_str_offsets", ".zdebug_str_offsets", NO_ABBREVS }, display_debug_str_offsets, &do_debug_str_offsets, true },
- { { ".debug_str_offsets.dwo", ".zdebug_str_offsets.dwo", NO_ABBREVS }, display_debug_str_offsets, &do_debug_str_offsets, true },
- { { ".debug_addr", ".zdebug_addr", NO_ABBREVS }, display_debug_addr, &do_debug_addr, true },
- { { ".debug_cu_index", "", NO_ABBREVS }, display_cu_index, &do_debug_cu_index, false },
- { { ".debug_tu_index", "", NO_ABBREVS }, display_cu_index, &do_debug_cu_index, false },
- { { ".gnu_debuglink", "", NO_ABBREVS }, display_debug_links, &do_debug_links, false },
- { { ".gnu_debugaltlink", "", NO_ABBREVS }, display_debug_links, &do_debug_links, false },
- { { ".debug_sup", "", NO_ABBREVS }, display_debug_sup, &do_debug_links, false },
+ { { ".debug_abbrev", ".zdebug_abbrev", ".dwabrev", NO_ABBREVS }, display_debug_abbrev, &do_debug_abbrevs, false },
+ { { ".debug_aranges", ".zdebug_aranges", ".dwarnge", NO_ABBREVS }, display_debug_aranges, &do_debug_aranges, true },
+ { { ".debug_frame", ".zdebug_frame", ".dwframe", NO_ABBREVS }, display_debug_frames, &do_debug_frames, true },
+ { { ".debug_info", ".zdebug_info", ".dwinfo", ABBREV (abbrev)}, display_debug_info, &do_debug_info, true },
+ { { ".debug_line", ".zdebug_line", ".dwline", NO_ABBREVS }, display_debug_lines, &do_debug_lines, true },
+ { { ".debug_pubnames", ".zdebug_pubnames", ".dwpbnms", NO_ABBREVS }, display_debug_pubnames, &do_debug_pubnames, false },
+ { { ".debug_gnu_pubnames", ".zdebug_gnu_pubnames", "", NO_ABBREVS }, display_debug_gnu_pubnames, &do_debug_pubnames, false },
+ { { ".eh_frame", "", "", NO_ABBREVS }, display_debug_frames, &do_debug_frames, true },
+ { { ".debug_macinfo", ".zdebug_macinfo", "", NO_ABBREVS }, display_debug_macinfo, &do_debug_macinfo, false },
+ { { ".debug_macro", ".zdebug_macro", ".dwmac", NO_ABBREVS }, display_debug_macro, &do_debug_macinfo, true },
+ { { ".debug_str", ".zdebug_str", ".dwstr", NO_ABBREVS }, display_debug_str, &do_debug_str, false },
+ { { ".debug_line_str", ".zdebug_line_str", "", NO_ABBREVS }, display_debug_str, &do_debug_str, false },
+ { { ".debug_loc", ".zdebug_loc", ".dwloc", NO_ABBREVS }, display_debug_loc, &do_debug_loc, true },
+ { { ".debug_loclists", ".zdebug_loclists", "", NO_ABBREVS }, display_debug_loc, &do_debug_loc, true },
+ { { ".debug_pubtypes", ".zdebug_pubtypes", ".dwpbtyp", NO_ABBREVS }, display_debug_pubnames, &do_debug_pubtypes, false },
+ { { ".debug_gnu_pubtypes", ".zdebug_gnu_pubtypes", "", NO_ABBREVS }, display_debug_gnu_pubnames, &do_debug_pubtypes, false },
+ { { ".debug_ranges", ".zdebug_ranges", ".dwrnges", NO_ABBREVS }, display_debug_ranges, &do_debug_ranges, true },
+ { { ".debug_rnglists", ".zdebug_rnglists", "", NO_ABBREVS }, display_debug_ranges, &do_debug_ranges, true },
+ { { ".debug_static_func", ".zdebug_static_func", "", NO_ABBREVS }, display_debug_not_supported, NULL, false },
+ { { ".debug_static_vars", ".zdebug_static_vars", "", NO_ABBREVS }, display_debug_not_supported, NULL, false },
+ { { ".debug_types", ".zdebug_types", "", ABBREV (abbrev) }, display_debug_types, &do_debug_info, true },
+ { { ".debug_weaknames", ".zdebug_weaknames", "", NO_ABBREVS }, display_debug_not_supported, NULL, false },
+ { { ".gdb_index", "", "", NO_ABBREVS }, display_gdb_index, &do_gdb_index, false },
+ { { ".debug_names", "", "", NO_ABBREVS }, display_debug_names, &do_gdb_index, false },
+ { { ".trace_info", "", "", ABBREV (trace_abbrev) }, display_trace_info, &do_trace_info, true },
+ { { ".trace_abbrev", "", "", NO_ABBREVS }, display_debug_abbrev, &do_trace_abbrevs, false },
+ { { ".trace_aranges", "", "", NO_ABBREVS }, display_debug_aranges, &do_trace_aranges, false },
+ { { ".debug_info.dwo", ".zdebug_info.dwo", "", ABBREV (abbrev_dwo) }, display_debug_info, &do_debug_info, true },
+ { { ".debug_abbrev.dwo", ".zdebug_abbrev.dwo", "", NO_ABBREVS }, display_debug_abbrev, &do_debug_abbrevs, false },
+ { { ".debug_types.dwo", ".zdebug_types.dwo", "", ABBREV (abbrev_dwo) }, display_debug_types, &do_debug_info, true },
+ { { ".debug_line.dwo", ".zdebug_line.dwo", "", NO_ABBREVS }, display_debug_lines, &do_debug_lines, true },
+ { { ".debug_loc.dwo", ".zdebug_loc.dwo", "", NO_ABBREVS }, display_debug_loc, &do_debug_loc, true },
+ { { ".debug_macro.dwo", ".zdebug_macro.dwo", "", NO_ABBREVS }, display_debug_macro, &do_debug_macinfo, true },
+ { { ".debug_macinfo.dwo", ".zdebug_macinfo.dwo", "", NO_ABBREVS }, display_debug_macinfo, &do_debug_macinfo, false },
+ { { ".debug_str.dwo", ".zdebug_str.dwo", "", NO_ABBREVS }, display_debug_str, &do_debug_str, true },
+ { { ".debug_str_offsets", ".zdebug_str_offsets", "", NO_ABBREVS }, display_debug_str_offsets, &do_debug_str_offsets, true },
+ { { ".debug_str_offsets.dwo", ".zdebug_str_offsets.dwo", "", NO_ABBREVS }, display_debug_str_offsets, &do_debug_str_offsets, true },
+ { { ".debug_addr", ".zdebug_addr", "", NO_ABBREVS }, display_debug_addr, &do_debug_addr, true },
+ { { ".debug_cu_index", "", "", NO_ABBREVS }, display_cu_index, &do_debug_cu_index, false },
+ { { ".debug_tu_index", "", "", NO_ABBREVS }, display_cu_index, &do_debug_cu_index, false },
+ { { ".gnu_debuglink", "", "", NO_ABBREVS }, display_debug_links, &do_debug_links, false },
+ { { ".gnu_debugaltlink", "", "", NO_ABBREVS }, display_debug_links, &do_debug_links, false },
+ { { ".debug_sup", "", "", NO_ABBREVS }, display_debug_sup, &do_debug_links, false },
/* Separate debug info files can containt their own .debug_str section,
and this might be in *addition* to a .debug_str section already present
- in the main file. Hence we need to have two entries for .debug_str. */
- { { ".debug_str", ".zdebug_str", NO_ABBREVS }, display_debug_str, &do_debug_str, false },
+ in the main file. Hence we need to have two entries for .debug_str. */
+ { { ".debug_str", ".zdebug_str", "", NO_ABBREVS }, display_debug_str, &do_debug_str, false },
};
/* A static assertion. */
diff --git a/binutils/dwarf.h b/binutils/dwarf.h
index 887b720..dd4f4c8 100644
--- a/binutils/dwarf.h
+++ b/binutils/dwarf.h
@@ -128,11 +128,13 @@ enum dwarf_section_display_enum
struct dwarf_section
{
/* A debug section has a different name when it's stored compressed
- or not. COMPRESSED_NAME and UNCOMPRESSED_NAME are the two
+ or not. XCOFF DWARF section also have a special name.
+ COMPRESSED_NAME, UNCOMPRESSED_NAME and XCOFF_NAME are the three
possibilities. NAME is set to whichever one is used for this
input file, as determined by load_debug_section(). */
const char * uncompressed_name;
const char * compressed_name;
+ const char * xcoff_name;
const char * name;
/* If non-NULL then FILENAME is the name of the separate debug info
file containing the section. */
diff --git a/binutils/objdump.c b/binutils/objdump.c
index a7b8303..f78b70a 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -3718,7 +3718,6 @@ load_debug_section (enum dwarf_section_display_enum debug, void *file)
if (streq (section->filename, bfd_get_filename (abfd)))
return true;
}
-
/* Locate the debug section. */
sec = bfd_get_section_by_name (abfd, section->uncompressed_name);
if (sec != NULL)
@@ -3728,6 +3727,12 @@ load_debug_section (enum dwarf_section_display_enum debug, void *file)
sec = bfd_get_section_by_name (abfd, section->compressed_name);
if (sec != NULL)
section->name = section->compressed_name;
+ else
+ {
+ sec = bfd_get_section_by_name (abfd, section->xcoff_name);
+ if (sec != NULL)
+ section->name = section->xcoff_name;
+ }
}
if (sec == NULL)
return false;
@@ -3811,7 +3816,8 @@ dump_dwarf_section (bfd *abfd, asection *section,
for (i = 0; i < max; i++)
if ((strcmp (debug_displays [i].section.uncompressed_name, match) == 0
- || strcmp (debug_displays [i].section.compressed_name, match) == 0)
+ || strcmp (debug_displays [i].section.compressed_name, match) == 0
+ || strcmp (debug_displays [i].section.xcoff_name, match) == 0)
&& debug_displays [i].enabled != NULL
&& *debug_displays [i].enabled)
{
@@ -3819,8 +3825,10 @@ dump_dwarf_section (bfd *abfd, asection *section,
if (strcmp (sec->uncompressed_name, match) == 0)
sec->name = sec->uncompressed_name;
- else
+ else if (strcmp (sec->compressed_name, match) == 0)
sec->name = sec->compressed_name;
+ else
+ sec->name = sec->xcoff_name;
if (load_specific_debug_section ((enum dwarf_section_display_enum) i,
section, abfd))
{