[v2] RISC-V/objdump: Do not re-seacrh for mapping symbols when didn't find any.
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_binutils_build--master-arm |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 |
success
|
Test passed
|
linaro-tcwg-bot/tcwg_binutils_check--master-arm |
success
|
Test passed
|
Commit Message
From: Dmitry Bushev <dmitry.bushev@syntacore.com>
In object files without any mapping symbols it's better to not
search up to start of a section upon each instruction entry. Instead,
cache symbol number from which search was started and if no symbol found,
next time do not search past that symbol.
Signed-off-by: Dmitry Bushev <dmitry.bushev@syntacore.com>
---
opcodes/riscv-dis.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
Comments
Hi,
I have applied your notes on the first revision.
With best regards,
Dmitry
@@ -68,6 +68,7 @@ struct riscv_private_data
/* Used for mapping symbols. */
static int last_map_symbol = -1;
+static int no_map_symbols_before = 0;
static bfd_vma last_stop_offset = 0;
static bfd_vma last_map_symbol_boundary = 0;
static enum riscv_seg_mstate last_map_state = MAP_NONE;
@@ -1136,7 +1137,10 @@ riscv_search_mapping_symbol (bfd_vma memaddr,
/* Reset the last_map_symbol if we start to dump a new section. */
if (memaddr <= 0)
- last_map_symbol = -1;
+ {
+ last_map_symbol = -1;
+ no_map_symbols_before = 0;
+ }
/* If the last stop offset is different from the current one, then
don't use the last_map_symbol to search. We usually reset the
@@ -1173,7 +1177,7 @@ riscv_search_mapping_symbol (bfd_vma memaddr,
{
n = from_last_map_symbol ? last_map_symbol : info->symtab_pos;
- for (; n >= 0; n--)
+ for (; n >= no_map_symbols_before; n--)
{
bfd_vma addr = bfd_asymbol_value (info->symtab[n]);
/* We have searched all possible symbols in the range. */
@@ -1220,6 +1224,11 @@ riscv_search_mapping_symbol (bfd_vma memaddr,
if (!found_next)
last_map_symbol_boundary = info->section->vma + info->section->size;
}
+ else
+ /* Remember that we already scanned all symbols before symtab_pos and
+ * didn't find any. Next time, do not scan those symbols again. */
+ no_map_symbols_before = info->symtab_pos;
+
/* Save the information for next use. */
last_map_symbol = symbol;