* [PATCH] objdump: Fix relocations objdumping for specific symbol
@ 2023-01-22 18:07 Vladislav Khmelevsky
2023-01-23 2:40 ` Alan Modra
0 siblings, 1 reply; 2+ messages in thread
From: Vladislav Khmelevsky @ 2023-01-22 18:07 UTC (permalink / raw)
To: binutils; +Cc: Vladislav Khmelevsky
If objdump is used with both --disassemble=symbol and --reloc options
skip relocations that are belonging to the addresses below the symbol address.
---
binutils/objdump.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/binutils/objdump.c b/binutils/objdump.c
index 61a18746fde..155461fc3cd 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -3909,6 +3909,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
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] objdump: Fix relocations objdumping for specific symbol
2023-01-22 18:07 [PATCH] objdump: Fix relocations objdumping for specific symbol Vladislav Khmelevsky
@ 2023-01-23 2:40 ` Alan Modra
0 siblings, 0 replies; 2+ messages in thread
From: Alan Modra @ 2023-01-23 2:40 UTC (permalink / raw)
To: Vladislav Khmelevsky; +Cc: binutils
On Sun, Jan 22, 2023 at 10:07:36PM +0400, Vladislav Khmelevsky wrote:
> If objdump is used with both --disassemble=symbol and --reloc options
> skip relocations that are belonging to the addresses below the symbol address.
Thanks, pushed.
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-01-23 2:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-22 18:07 [PATCH] objdump: Fix relocations objdumping for specific symbol Vladislav Khmelevsky
2023-01-23 2:40 ` Alan Modra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).