[BFD] bfd_perform_relocation usage
Stefan Beyer
beyer@cs.man.ac.uk
Wed Mar 19 17:57:00 GMT 2003
Hello all!
I checked the relevant archives and docs for this, but I cannot find
anything:
How exactly am I to use bfd_perform_relocation? I am having problems in
figuring out what the arguments mean and what has to be done before
calling it.
I am trying to load an object file (.o) dynamically.
(what DLD used to do for a.out, but for ELF)
I have done this by hand for Intel, but need to port it to ARM and thought
I should figure out BFD to make things easier.
At the moment I open a bfd for reading, read the section contents to some
piece of memory, load the symbol table and load the relocation tables for
each section, then loop through them calling bfd_perform_relocation:
bfd_perform_relocation (abfd, rels[i], sec_contents, sec, NULL, &error);
abfd is the bfd, rels[i] the relocation entry, sec_contents is a
pointer to the contents of the section, read in by
bfd_get_section_contents, I don't think I need an output bfd (so NULL) and
error is just a char *.
It falls over with a segmentation fault somewhere in bfd_perform_relocation
on the first call.
Could someone please confirm, if I understand the way bfd is meant to be
used, in particular the arguments I give it and the order I do things in?
Alternatively a pointer to some example code using bfd_perform_relocation
would be helpful.
Thanks in advance.
Stefan Beyer
--
beyer@cs.man.ac.uk
http://www.cs.man.ac.uk/~beyers8
More information about the Binutils
mailing list