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

Ian Lance Taylor ian@wasabisystems.com
Mon Jan 19 16:06:00 GMT 2004


Shekhar Divekar <shekhar@cradle.com> writes:

> 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.

Why not just put both the ARCH_REV* and ISA* in bfd_mach?  Why not
just define bfd_mach to be what you need?

In any case, you can access the ELF header by doing #include
"elf-bfd.h" and then using elf_elfheader (abfd).  It breaks the
layering, though.

Ian



More information about the Binutils mailing list