Page 1 of 1

linking relocatable elf files

Posted: Wed Dec 12, 2007 4:07 pm
by FlashBurn
1st thing is it possible that I can say to ld, put only those symbols into the symbol table I made global?

The 2nd question is, is it possible to say ld, to put the relocation entry for every function call into the elf file? And I mean every function call not only the calls which are out of an object file. I need this for changing the functions at runtime. (so i needn´t to use indirect calls)

Posted: Sat Dec 22, 2007 1:00 pm
by frank
Maybe these options may help a bit
--export-dynamic
When creating a dynamically linked executable, add all symbols to the dynamic symbol table. The dynamic symbol table is the set of symbols which are visible from dynamic objects at run time. If you do not use this option, the dynamic symbol table will normally contain only those symbols which are referenced by some dynamic object mentioned in the link. If you use dlopen to load a dynamic object which needs to refer back to the symbols defined by the program, rather than some other dynamic object, then you will probably need to use this option when linking the program itself.
-x
--discard-all
Delete all local symbols.

-X
--discard-locals
Delete all temporary local symbols. For most targets, this is all local symbols whose names begin with `L'.
Also take a look at the LD manual