diff options
author | Vladislav Khmelevsky <och95@yandex.ru> | 2023-01-22 22:07:36 +0400 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2023-01-23 12:51:10 +1030 |
commit | 7e538762c2c1f2e5c4be31b9ec7d99cc4fbabf7f (patch) | |
tree | 170fa321de38af8b762d336b4e0c35d4861f77a6 /binutils/objdump.c | |
parent | eb8f8bbb117dd83c7a3a92f540f02724f7e2920e (diff) | |
download | binutils-7e538762c2c1f2e5c4be31b9ec7d99cc4fbabf7f.zip binutils-7e538762c2c1f2e5c4be31b9ec7d99cc4fbabf7f.tar.gz binutils-7e538762c2c1f2e5c4be31b9ec7d99cc4fbabf7f.tar.bz2 |
Fix objdump --reloc for specific symbol
If objdump is used with both --disassemble=symbol and --reloc options
skip relocations that have addresses before the symbol, so that they
are not displayed.
Diffstat (limited to 'binutils/objdump.c')
-rw-r--r-- | binutils/objdump.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/binutils/objdump.c b/binutils/objdump.c index ee2f577..9e76684 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -3910,6 +3910,13 @@ disassemble_section (bfd *abfd, asection *section, void *inf) { do_print = true; + /* Skip over the relocs belonging to addresses below the + symbol address. */ + const bfd_vma sym_offset = bfd_asymbol_value (sym) - section->vma; + while (rel_pp < rel_ppend && + (*rel_pp)->address - rel_offset < sym_offset) + ++rel_pp; + if (sym->flags & BSF_FUNCTION) { if (bfd_get_flavour (abfd) == bfd_target_elf_flavour |