In the BFD backend, determine whether a relocation is for a symbol coming from a shared-library
Alan Modra
amodra@gmail.com
Wed Apr 15 02:59:10 GMT 2020
On Fri, Apr 10, 2020 at 10:01:38AM -0400, William Tambe via Binutils wrote:
> In the BFD backend,
Which BFD backend?
> is there a way to determine whether a relocation
> is for a symbol coming from a shared-library, as oppose to the symbol
> coming from an object-file ?
Yes, but the details depend on which parts of BFD you are trying to
use. And if linking, at which stage of linking. If this is a
question about the linker, and if all object files and libraries have
been loaded, and the symbol is defined or weak defined, then
bfd_link_hash_entry.u.def.section will specify the section where the
symbol is defined. From section->owner you can figure out whether the
section is from a shared library, a relocatable object file, or is a
special section such as the absolute section. If your symbols are
using elf_link_hash_entry then there are some flags that you might be
able to use instead.
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list