bfd function to read ELF file image from memory
Ian Lance Taylor
ian@airs.com
Mon May 19 20:30:00 GMT 2003
Roland McGrath <roland@redhat.com> writes:
> > > Still, I would just to have one calling interface that handles
> > > 32-bit and 64-bit ELF. To implement that front-end function I need
> > > a compile-time check I can use in elfcode.h that tells me whether
> > > 32-bit and/or 64-bit targets are being built. What works?
> >
> > You can check "#if ARCH_SIZE == 64" or "#if ARCH_SIZE == 32".
>
> I must be misunderstanding you, or else that can't be right. I asked about
> how front-end source code can know whether it needs to call just the 32-bit
> function from the 32-bit compile of elfcode.h, just the 64-bit function
> from the 64-bit compile of elfcode.h, or switch between the two at runtime
> based on bfd_get_arch_size.
I doubt there are any publically visible functions with name changes
from 32-bit to 64-bit. But there are certainly functions like
bfd_get_gp_size() which look at the BFD to decide where to get the
backend specific information. You could do something like that,
assuming you put the appropriate hook in the elf_backend_data struct,
which is less intrusive than putting it in the bfd_target struct.
Ian
More information about the Gdb-patches
mailing list