[linux-elitists] BFD and libiberty

Greg KH greg@kroah.com
Sun Nov 9 22:55:12 PST 2003

On Sun, Nov 09, 2003 at 07:13:59PM -0800, Jason Spence wrote:
> Something else that's kind of bugging me is that libbfd requires you
> to call bfd_check_format() on the target object and play guessing
> games for each possible type before it'll fill out the rest of the bfd
> structure so the other API calls don't crash when you pass them the
> bfd.  As far as I can tell, that's the only way to get the rest of the
> bfd filled out.  Is it just me, or is this actually as clunky as I
> think it is?

It's not just you, I ran into the same problem last time I did any BFD
coding.  I just hard-coded the target to i686-pc-linux-gnu with a call
to bfd_set_default_target("i686-pc-linux-gnu") which solved my problems.

But I knew I was only playing around with elf format files, you might
not be able to get away with this.

There is the libelf library if you want another choice in dealing with
object files.  But I found that libbfd was easier to use in the end,
which really amazed me.

greg k-h

More information about the linux-elitists mailing list