aboutsummaryrefslogtreecommitdiff
path: root/binutils/objdump.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2022-01-30 09:17:56 -0800
committerH.J. Lu <hjl.tools@gmail.com>2022-01-31 10:16:49 -0800
commite1dbfc17c5305eef8f021c1baa703151bffc1490 (patch)
treeecca0df32edcb737c8c323fc4f1a0f2f8893ed6c /binutils/objdump.c
parent492325c4b78933e41608c53963d29b1f16affd47 (diff)
downloadgdb-e1dbfc17c5305eef8f021c1baa703151bffc1490.zip
gdb-e1dbfc17c5305eef8f021c1baa703151bffc1490.tar.gz
gdb-e1dbfc17c5305eef8f021c1baa703151bffc1490.tar.bz2
Load debug section only when dumping debug sections
Don't load debug sections if we aren't dumping any debug sections. PR binutils/28843 * objdump.c (dump_any_debugging): New. (load_debug_section): Return false if dump_any_debugging isn't set. (main): Set dump_any_debugging when dumping any debug sections. * readelf (dump_any_debugging): New. (parse_args): Set dump_any_debugging when dumping any debug sections. (load_debug_section): Return false if dump_any_debugging isn't set.
Diffstat (limited to 'binutils/objdump.c')
-rw-r--r--binutils/objdump.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/binutils/objdump.c b/binutils/objdump.c
index 08a0fe5..24e9186 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -131,6 +131,7 @@ static bool color_output = false; /* --visualize-jumps=color. */
static bool extended_color_output = false; /* --visualize-jumps=extended-color. */
static int process_links = false; /* --process-links. */
+static int dump_any_debugging;
static int demangle_flags = DMGL_ANSI | DMGL_PARAMS;
/* A structure to record the sections mentioned in -j switches. */
@@ -3851,6 +3852,9 @@ load_debug_section (enum dwarf_section_display_enum debug, void *file)
asection *sec;
const char *name;
+ if (!dump_any_debugging)
+ return false;
+
/* If it is already loaded, do nothing. */
if (section->start != NULL)
{
@@ -5688,6 +5692,10 @@ main (int argc, char **argv)
if (!seenflag)
usage (stderr, 2);
+ dump_any_debugging = (dump_debugging
+ || dump_dwarf_section_info
+ || process_links);
+
if (formats_info)
exit_status = display_info ();
else