This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[mips patch RFA] get disasm ABI from section, not symbols.
- From: cgd at broadcom dot com
- To: binutils at sources dot redhat dot com
- Date: 30 Jun 2003 15:09:18 -0700
- Subject: [mips patch RFA] get disasm ABI from section, not symbols.
The patch below causes the disassembler to get the ABI from the
disassembly data's section's owner, rather from the symbols associated
with the disassembly data.
Doing the latter, you can get into a weird situation like:
op reg, reg
foo:
op reg, reg
and, if 'foo' is the first symbol in the file, the result of
disassembling those two instructions may be different (the former will
not have the ABI set properly, the latter will).
This seems to DTRT at least for the case discussed in the thread including:
http://sources.redhat.com/ml/binutils/2003-06/msg00865.html
and it doesn't break binutils/ld/gas make/"make check" (for the big
list of architectures for which i typically run that 8-).
Thinking that use of 'section->owner' is icky, i looked around, and
tehre are other similar uses. So I don't feel so bad. 8-)
chris
--
2003-06-30 Chris Demetriou <cgd@broadcom.com>
* mips-dis.c (set_default_mips_dis_options): Get BFD from
the disassembler_info's section, rather than from the
disassembler_info's symbols pointer.
Index: mips-dis.c
===================================================================
RCS file: /cvs/src/src/opcodes/mips-dis.c,v
retrieving revision 1.43
diff -u -p -r1.43 mips-dis.c
--- mips-dis.c 8 Apr 2003 07:14:47 -0000 1.43
+++ mips-dis.c 30 Jun 2003 22:03:16 -0000
@@ -495,11 +495,11 @@ set_default_mips_dis_options (info)
mips_hwr_names = mips_hwr_names_numeric;
/* If an ELF "newabi" binary, use the n32/(n)64 GPR names. */
- if (info->flavour == bfd_target_elf_flavour && info->symbols != NULL)
+ if (info->flavour == bfd_target_elf_flavour && info->section != NULL)
{
Elf_Internal_Ehdr *header;
- header = elf_elfheader (bfd_asymbol_bfd (*(info->symbols)));
+ header = elf_elfheader (info->section->owner);
if (is_newabi (header))
mips_gpr_names = mips_gpr_names_newabi;
}