How to determine if a global symbol is defined in .so and hence needs to be output to the binary as undefined

Ian Lance Taylor iant@google.com
Thu Sep 6 17:05:00 GMT 2007


Mayank Kumar <mayank@microsoft.com> writes:

> While creating a binary usinf ld, I want to determine if a symbol is
> completely defined in another .so and hence needs to be output to a
> binary as undefined.  What is the best way to achieve this or how is
> this handled in elf format.

In ELF this is handled in elf_link_output_extsym, in the case for
bfd_link_hash_defined where input_sec->output_section == NULL.

But COFF/PE uses completely different code.  You can't just blindly
copy the ELF code.  You have to understand how the COFF/PE code is
supposed to work.  The approximately equivalent COFF code is
_bfd_coff_write_global_sym.

Ian



More information about the Binutils mailing list