diff options
author | Alan Modra <amodra@gmail.com> | 2021-04-06 18:57:04 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2021-04-06 23:25:09 +0930 |
commit | a2e66773735d2d2de2ba652e44650288c88ad752 (patch) | |
tree | f2e8dfe1592fd03641ab6e14951cc89e3e38b79e /opcodes | |
parent | 4db29512ce5616e90a9cdbc4daa852589b7357c0 (diff) | |
download | binutils-a2e66773735d2d2de2ba652e44650288c88ad752.zip binutils-a2e66773735d2d2de2ba652e44650288c88ad752.tar.gz binutils-a2e66773735d2d2de2ba652e44650288c88ad752.tar.bz2 |
Return symbol from symbol_at_address_func
include/
* dis-asm.h (struct disassemble_info <symbol_at_address_func>):
Return asymbol*.
binutils/
* objdump.c (objdump_symbol_at_address): Return asymbol*.
opcodes/
* dis-buf.c (generic_symbol_at_address): Return symbol* NULL.
* s12z-dis.c (decode_possible_symbol): Use symbol returned from
symbol_at_address_func.
Diffstat (limited to 'opcodes')
-rw-r--r-- | opcodes/ChangeLog | 6 | ||||
-rw-r--r-- | opcodes/dis-buf.c | 6 | ||||
-rw-r--r-- | opcodes/s12z-dis.c | 25 |
3 files changed, 14 insertions, 23 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index f3572a6..7a380dc 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,9 @@ +2021-04-06 Alan Modra <amodra@gmail.com> + + * dis-buf.c (generic_symbol_at_address): Return symbol* NULL. + * s12z-dis.c (decode_possible_symbol): Use symbol returned from + symbol_at_address_func. + 2021-04-05 Alan Modra <amodra@gmail.com> * configure.ac: Don't check for limits.h, string.h, strings.h or diff --git a/opcodes/dis-buf.c b/opcodes/dis-buf.c index 2a93465..dfc1563 100644 --- a/opcodes/dis-buf.c +++ b/opcodes/dis-buf.c @@ -87,13 +87,13 @@ generic_print_address (bfd_vma addr, struct disassemble_info *info) (*info->fprintf_func) (info->stream, "0x%s", buf); } -/* Just return true. */ +/* Just return NULL. */ -int +asymbol * generic_symbol_at_address (bfd_vma addr ATTRIBUTE_UNUSED, struct disassemble_info *info ATTRIBUTE_UNUSED) { - return 1; + return NULL; } /* Just return TRUE. */ diff --git a/opcodes/s12z-dis.c b/opcodes/s12z-dis.c index 4616bc8..ec8f4f7 100644 --- a/opcodes/s12z-dis.c +++ b/opcodes/s12z-dis.c @@ -206,27 +206,12 @@ decode_possible_symbol (bfd_vma addr, bfd_vma base, struct disassemble_info *info, bool relative) { const char *fmt = relative ? "*%+" BFD_VMA_FMT "d" : "%" BFD_VMA_FMT "d"; - if (!info->symbol_at_address_func (addr + base, info)) - { - (*info->fprintf_func) (info->stream, fmt, addr); - } + asymbol *sym = info->symbol_at_address_func (addr + base, info); + + if (!sym) + (*info->fprintf_func) (info->stream, fmt, addr); else - { - asymbol *sym = NULL; - int j; - for (j = 0; j < info->symtab_size; ++j) - { - sym = info->symtab[j]; - if (bfd_asymbol_value (sym) == addr + base) - { - break; - } - } - if (j < info->symtab_size) - (*info->fprintf_func) (info->stream, "%s", bfd_asymbol_name (sym)); - else - (*info->fprintf_func) (info->stream, fmt, addr); - } + (*info->fprintf_func) (info->stream, "%s", bfd_asymbol_name (sym)); } |