Fix previous delta to allow for compilation on 32-bit systems

This commit is contained in:
Nick Clifton 2022-12-16 15:44:55 +00:00
parent 832a980e17
commit c7ce51d8c8
5 changed files with 60 additions and 3 deletions

View file

@ -1,5 +1,9 @@
-*- text -*-
* Objdump has a new command line option --show-all-symbols which will make it
display all symbols that match a given address when disassembling. (Normally
only the first symbol that matches an address is shown).
* Add --enable-colored-disassembly configure time option to enable colored
disassembly output by default, if the output device is a terminal. Note,
this configure option is disabled by default.

View file

@ -2274,6 +2274,7 @@ objdump [@option{-a}|@option{--archive-headers}]
[@option{--prefix-addresses}]
[@option{--[no-]show-raw-insn}]
[@option{--adjust-vma=}@var{offset}]
[@option{--show-all-symbols}]
[@option{--dwarf-depth=@var{n}}]
[@option{--dwarf-start=@var{n}}]
[@option{--ctf-parent=}@var{section}]
@ -2784,6 +2785,10 @@ non-empty sections are displayed.
Display source code intermixed with disassembly, if possible. Implies
@option{-d}.
@item --show-all-symbols
When disassembling, show all the symbols that match a given address,
not just the first one.
@item --source-comment[=@var{txt}]
@cindex source disassembly
@cindex disassembly, with source

View file

@ -7741,7 +7741,7 @@ display_debug_addr (struct dwarf_section *section,
if (end < entry)
{
warn (_("Corrupt %s section header: length field (%lx) is too small\n"),
section->name, length);
section->name, (long) length);
return 0;
}
SAFE_BYTE_GET_AND_INC (version, curr_header, 2, entry);
@ -7761,8 +7761,8 @@ display_debug_addr (struct dwarf_section *section,
{
warn (_("Corrupt %s section: address base of entry %u (%lx) is less than entry %u (%lx)\n"),
section->name,
i, debug_addr_info [i]->addr_base,
i + 1, debug_addr_info [i + 1]->addr_base);
i, (long) debug_addr_info [i]->addr_base,
i + 1, (long) debug_addr_info [i + 1]->addr_base);
return 0;
}
}

View file

@ -137,6 +137,7 @@ static bool visualize_jumps = false; /* --visualize-jumps. */
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 show_all_symbols; /* --show-all-symbols. */
static enum color_selection
{
@ -399,6 +400,8 @@ usage (FILE *stream, int status)
fprintf (stream, _("\
--adjust-vma=OFFSET Add OFFSET to all displayed section addresses\n"));
fprintf (stream, _("\
--show-all-symbols When disassembling, display all symbols at a given address\n"));
fprintf (stream, _("\
--special-syms Include special symbols in symbol dumps\n"));
fprintf (stream, _("\
--inlines Print all inlines for source line (with -l)\n"));
@ -537,6 +540,7 @@ static struct option long_options[]=
{"section", required_argument, NULL, 'j'},
{"section-headers", no_argument, NULL, 'h'},
{"sframe", optional_argument, NULL, OPTION_SFRAME},
{"show-all-symbols", no_argument, &show_all_symbols, 1},
{"show-raw-insn", no_argument, &show_raw_insn, 1},
{"source", no_argument, NULL, 'S'},
{"source-comment", optional_argument, NULL, OPTION_SOURCE_COMMENT},
@ -3942,6 +3946,24 @@ disassemble_section (bfd *abfd, asection *section, void *inf)
objdump_print_addr_with_sym (abfd, section, sym, addr,
pinfo, false);
pinfo->fprintf_func (pinfo->stream, ":\n");
if (sym != NULL && show_all_symbols)
{
for (++place; place < sorted_symcount; place++)
{
sym = sorted_syms[place];
if (bfd_asymbol_value (sym) != addr)
break;
if (! pinfo->symbol_is_valid (sym, pinfo))
continue;
if (strcmp (bfd_section_name (sym->section), bfd_section_name (section)) != 0)
break;
objdump_print_addr_with_sym (abfd, section, sym, addr, pinfo, false);
pinfo->fprintf_func (pinfo->stream, ":\n");
}
}
}
if (sym != NULL && bfd_asymbol_value (sym) > addr)

View file

@ -375,6 +375,32 @@ if { [is_elf_format] } then {
}
}
proc test_objdump_d_show_all_symbols { testfile dumpfile } {
global OBJDUMP
global OBJDUMPFLAGS
set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -d --show-all-symbols $testfile"]
set want "${dumpfile}.*:.*00+0 <text_symbol>"
if ![regexp $want $got] then {
fail "objdump -d --show-all-symbols $testfile: Missing 'text_symbol'"
return
}
set want "${dumpfile}.*:.*00+0 <static_text_symbol>"
if ![regexp $want $got] then {
fail "objdump -d --show-all-symbols $testfile: Missing 'static_text_symbol'"
return
}
pass "objdump -d --show-all-symbols $testfile"
}
# The AIX and ECOFF assemblers default to makeing symbols local, not global.
# So they do not show up in this test.
setup_xfail "*-*-*aix*"
setup_xfail "*-*-*ecoff"
test_objdump_d_show_all_symbols $testfile $testfile
# Test objdump -s