How can I access ELF Header from FOO-dis.c

Shekhar Divekar
Mon Jan 19 15:49:00 GMT 2004

To explain my requirement more.

The target is a SoC supporting multiple ISAs. MACHs map to
ISAs x ArchRevision. So bfd_get_mach() can give me only the default
MACH for an ArchRevision. In CGEN_COMPUTE_MACH I depend on SECTION
name [which is diff for each ISA] and ArchRevision to select the MACH.

The ARCH + MACH scheme is insufficient to represent all variations
hence I have to e_flags to store ArchRevision info.

So pictorially we have

       TARGET_ARCH		[bfd_arch]
	/   \
       /       \
      /         \
   ARCH_REV1     ARCH_REV2___
   |   |   |      |     |   |
ISA1 ISA2 ISA3  ISA1 ISA2 ISA3	[bfd_mach]

I have all the needed info in e_flags but I can't pass it to
disassembler without breaking the current bfd/cgen scheme.

Can someone suggest a good solution.


Ian Lance Taylor wrote:
> Shekhar Divekar <> writes:
>>I am working on a port of binutils 2.14.90 to our target.
>>I want use CGEN_COMPUTE_MACH macro in print_insn
>>to decipher the mach for which I am disassembling.
>>Also we store the arch and mach info in e_flgas of
>>ELF header.
>>How can I access ELF header information from
>>FOO-dis.c ?
> Normally a disassembler would get this information using
> bfd_get_arch() and bfd_get_mach().  Other parts of BFD would arrange
> to have the right information stored there.
> Ian

More information about the Binutils mailing list