This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: BFD (mips-elf): Reading relocation entries in user program
- From: Ian Lance Taylor <iant at google dot com>
- To: "Marshall B. Rogers" <mbr at 64 dot vg>
- Cc: binutils at sourceware dot org
- Date: Sun, 12 Jul 2009 22:44:05 -0700
- Subject: Re: BFD (mips-elf): Reading relocation entries in user program
- References: <f9669fd00907121701g4bb9e4dax7abc511e55a38f15@mail.gmail.com>
"Marshall B. Rogers" <mbr@64.vg> writes:
> I've been sifting through documentation on the BFD library in hopes of
> finding an interface for reading the relocations of a section/file
> (since I noticed various relocation types are defined in "bfd.h").
> This doesn't seem to be possible, though - I'm guessing due to BFD's
> goal of abstraction.
>
> Still, I love BFD's programming interface, and I prefer it over
> libelf, which is quite clunky. Is there a simple - albeit possibly
> hacky - way to get at the relocation entries in an ELF file through
> BFD? Hopefully I won't have to end up using some strange combination
> of BFD and libelf...
bfd_get_reloc_upper_bound and bfd_canonicalize_reloc. See
binutils/objdump.c for an example of usage.
BFD's documentation is truly horrible. But, then, libelf's is not all
that great either.
Ian