problems adding/copying a symbol
George Hicken
gh299@ecs.soton.ac.uk
Sun Dec 2 19:06:00 GMT 2001
I am attempting to copy an object file using the bfd, and modify some
symbols on the way.
However, when I run the program, the bfd comes up with this error (or
similar):
[bfd]: symbol function_name required. Symbol not found
message: No symbols
The code below is the bit that is causing the problem. I supsect that there
is something I
am not doing in the correct order, or at all.
// the symbols that I don't attempt to copy are fine.
if ((oldSym->flags & BSF_FUNCTION) == 0) {
symList[symCount++] = oldSym;
continue;
}
// the one I try to copy don't work correctly.
asymbol *symCopy = bfd_make_empty_symbol(obfd);
symCopy->name = oldSym->name;
// have tried commenting this out.. didn't help.
bfd_copy_private_symbol_data(ibfd, oldSym, obfd, symCopy);
symCopy->section = bfd_get_section_by_name(obfd, oldSym->section->name);
symCopy->flags = oldSym->flags;
symCopy->value = oldSym->value;
// add syms to the list.
symList[symCount++] = symCopy;
I have sat down with a debugger and worked through most of the bfd that
seems to touch on this
and the best I can figure out to date is that for some reason the
sym_cache_entry for the symbol
does not reflect the actual symbol. It is missing the data in udata struct,
giving it a symtab
index of 0.
However I have no idea how to fix this, and I have been unable to find
anything in the documentation.
tia
--
George Hicken
ICQ#:462051
More information about the Binutils
mailing list