This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
RFC: Target specific initialisation of disassemble_info
- From: Nick Clifton <nickc at redhat dot com>
- To: binutils at sources dot redhat dot com
- Date: Thu, 13 Nov 2003 14:41:45 +0000
- Subject: RFC: Target specific initialisation of disassemble_info
Hi Guys,
I am planning to apply the patch below to add the ability for
targets to override the default values supplied to the
disassemble_info structure. Does anyone have any comments or
concerns about the patch ?
I have created the patch in order to work around a problem for the
ARM ELF port. I recently added support to GAS to generate special
mapping symbols as required by the ARM-ELF specification.
Unfortunately with that patch applied the ARM disassembler will now
select a mapping symbol in preference to a function name symbol if
they both have the same address. I want to add a new field to the
disasemble_info structure in order to be able to skip over these
mapping symbols, but in order to do that I need a target specific
way to initialise that field. Hence this patch.
Cheers
Nick
include/ChangeLog
2003-11-13 Nick Clifton <nickc@redhat.com>
* dis-asm.h: Add prototype for disassemble_init_for_target().
opcodes/ChangeLog
2003-11-13 Nick Clifton <nickc@redhat.com>
* disassemble.c (disassemble_init_for_target): New function.
Allow target specific initialisation of disassemble_info
structure.
binutils/ChangeLog
2003-11-13 Nick Clifton <nickc@redhat.com>
* objdump.c (disassemble_data): Call
disassemble_init_for_target after having initialised the
disasm_info.arch field.
Index: include/dis-asm.h
===================================================================
RCS file: /cvs/src/src/include/dis-asm.h,v
retrieving revision 1.45
diff -c -3 -p -r1.45 dis-asm.h
*** include/dis-asm.h 3 Sep 2003 23:43:17 -0000 1.45
--- include/dis-asm.h 13 Nov 2003 12:54:07 -0000
*************** extern void print_arm_disassembler_optio
*** 251,262 ****
--- 257,272 ----
/* Fetch the disassembler for a given BFD, if that support is available. */
extern disassembler_ftype disassembler (bfd *);
+ /* Amend the disassemble_info structure as necessary for the target architecture.
+ Should only be called after initialising the info->arch field. */
+ extern void disassemble_init_for_target (struct disassemble_info * info);
+
/* Document any target specific options available from the disassembler. */
extern void disassembler_usage (FILE *);
Index: opcodes/disassemble.c
===================================================================
RCS file: /cvs/src/src/opcodes/disassemble.c,v
retrieving revision 1.44
diff -c -3 -p -r1.44 disassemble.c
*** opcodes/disassemble.c 10 Oct 2003 22:13:49 -0000 1.44
--- opcodes/disassemble.c 13 Nov 2003 12:54:15 -0000
*************** disassembler_usage (stream)
*** 397,399 ****
--- 397,417 ----
return;
}
+
+ void
+ disassemble_init_for_target (struct disassemble_info * info)
+ {
+ if (info == NULL)
+ return;
+
+ switch (info->arch)
+ {
+ default:
+ break;
+ }
+ }
Index: binutils/objdump.c
===================================================================
RCS file: /cvs/src/src/binutils/objdump.c,v
retrieving revision 1.82
diff -c -3 -p -r1.82 objdump.c
*** binutils/objdump.c 11 Nov 2003 01:57:04 -0000 1.82
--- binutils/objdump.c 13 Nov 2003 12:53:36 -0000
*************** disassemble_data (bfd *abfd)
*** 1844,1849 ****
--- 1845,1853 ----
/* ??? Aborting here seems too drastic. We could default to big or little
instead. */
disasm_info.endian = BFD_ENDIAN_UNKNOWN;
+
+ /* Allow the target to customize the info structure. */
+ disassemble_init_for_target (& disasm_info);
/* Pre-load the dynamic relocs if we are going
to be dumping them along with the disassembly. */