@B display correct symbols for .data/.bss refs.
If a reloc is present it is used to lookup the correct symbol.
This commit is contained in:
parent
d1a6d29461
commit
771f273346
|
@ -9167,7 +9167,7 @@ do
|
|||
DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
|
||||
BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
|
||||
;;
|
||||
arm*-* | xscale-* | strongarm-* | d10v-*)
|
||||
arm*-* | xscale-* | strongarm-* | d10v-* | m68*-*-amiga*)
|
||||
OBJDUMP_DEFS="-DDISASSEMBLER_NEEDS_RELOCS"
|
||||
;;
|
||||
i[3-6]86-*-pe* | i[3-6]86-*-cygwin* | i[3-6]86-*-mingw32** | i[3-6]86-*-netbsdpe*)
|
||||
|
|
|
@ -245,7 +245,7 @@ changequote([,])dnl
|
|||
DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
|
||||
BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
|
||||
;;
|
||||
arm*-* | xscale-* | strongarm-* | d10v-*)
|
||||
arm*-* | xscale-* | strongarm-* | d10v-* | m68*-*-amiga*)
|
||||
OBJDUMP_DEFS="-DDISASSEMBLER_NEEDS_RELOCS"
|
||||
;;
|
||||
changequote(,)dnl
|
||||
|
|
|
@ -1314,16 +1314,36 @@ disassemble_bytes (info, disassemble_fn, insns, data,
|
|||
info->bytes_per_line = 0;
|
||||
info->bytes_per_chunk = 0;
|
||||
|
||||
#ifdef DISASSEMBLER_NEEDS_RELOCS
|
||||
/* SBF: workaround for the issue below:
|
||||
* move relppp until current insn is reached
|
||||
* and put the relp pointer into the info structure.
|
||||
* Now the implementation may judge by itself if the flag is correct.
|
||||
* The pointer is also used to display the correct symbol name.
|
||||
* For now only used in m68k-ds.c
|
||||
* */
|
||||
while ((*relppp) < relppend
|
||||
&& (**relppp)->address < (bfd_vma)addr_offset)
|
||||
++(*relppp);
|
||||
|
||||
if (*relppp < relppend)
|
||||
info->relp = **relppp;
|
||||
else
|
||||
#endif
|
||||
info->relp = 0;
|
||||
|
||||
#ifdef DISASSEMBLER_NEEDS_RELOCS
|
||||
/* FIXME: This is wrong. It tests the number of octets
|
||||
in the last instruction, not the current one. */
|
||||
in the last instruction, not the current one.
|
||||
SBF: read above. */
|
||||
|
||||
if (*relppp < relppend
|
||||
&& (**relppp)->address >= addr_offset
|
||||
&& (**relppp)->address <= addr_offset + octets / opb)
|
||||
info->flags = INSN_HAS_RELOC;
|
||||
info->flags = INSN_HAS_RELOC;
|
||||
else
|
||||
#endif
|
||||
info->flags = 0;
|
||||
info->flags = 0;
|
||||
|
||||
octets = (*disassemble_fn) (section->vma + addr_offset, info);
|
||||
info->fprintf_func = (fprintf_ftype) fprintf;
|
||||
|
|
|
@ -98,6 +98,10 @@ typedef struct disassemble_info {
|
|||
The bottom 16 bits are for the internal use of the disassembler. */
|
||||
unsigned long flags;
|
||||
#define INSN_HAS_RELOC 0x80000000
|
||||
|
||||
/* Used if DISASSEMBLER_NEEDS_RELOCS is defined. */
|
||||
arelent *relp;
|
||||
|
||||
PTR private_data;
|
||||
|
||||
/* Function used to get bytes to disassemble. MEMADDR is the
|
||||
|
@ -281,6 +285,9 @@ extern void perror_memory PARAMS ((int, bfd_vma, struct disassemble_info *));
|
|||
extern void generic_print_address
|
||||
PARAMS ((bfd_vma, struct disassemble_info *));
|
||||
|
||||
extern asection * generic_get_section_for_reloc
|
||||
PARAMS((bfd_vma, struct disassemble_info *));
|
||||
|
||||
/* Always true. */
|
||||
extern int generic_symbol_at_address
|
||||
PARAMS ((bfd_vma, struct disassemble_info *));
|
||||
|
|
|
@ -823,13 +823,29 @@ print_insn_arg (d, buffer, p0, addr, info)
|
|||
switch (val & 7)
|
||||
{
|
||||
case 0:
|
||||
val = NEXTWORD (p);
|
||||
(*info->print_address_func) (val, info);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
uval = NEXTULONG (p);
|
||||
(*info->print_address_func) (uval, info);
|
||||
uval = (val & 7) ? NEXTULONG(p) : (unsigned int) NEXTWORD(p);
|
||||
|
||||
if (info->relp)
|
||||
{
|
||||
if (info->relp->address <= addr + (p - p0)
|
||||
&& info->relp->sym_ptr_ptr && *info->relp->sym_ptr_ptr)
|
||||
{
|
||||
/* Swap section with the correct one. */
|
||||
struct objdump_disasm_info *aux =
|
||||
(struct objdump_disasm_info *) info->application_data;
|
||||
asection * text = aux->sec;
|
||||
aux->sec = bfd_get_section (*info->relp->sym_ptr_ptr);
|
||||
(*info->print_address_func) (uval, info);
|
||||
|
||||
/* restore section to .text */
|
||||
aux->sec = text;
|
||||
}
|
||||
else
|
||||
(*info->fprintf_func) (info->stream, "%d", uval);
|
||||
}
|
||||
else
|
||||
(*info->print_address_func) (uval, info);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
|
Loading…
Reference in New Issue