PATCH: undefined symbols in shared libraries
Alan Modra
amodra@bigpond.net.au
Fri Mar 12 02:59:00 GMT 2004
On Thu, Mar 11, 2004 at 01:18:08PM -0800, H. J. Lu wrote:
> - ((info->shared && info->unresolved_syms_in_shared_libs == RM_GENERATE_ERROR) \
> - || (!info->shared && info->unresolved_syms_in_objects == RM_GENERATE_ERROR) \
> + (info->unresolved_syms_in_objects == RM_GENERATE_ERROR \
> || ELF_ST_VISIBILITY (h->other)) \
Ick, this macro needs trimming down to 80 columns.
I don't think this is correct, nor was the test correct before. It
seems wrong to me that we're testing info->shared here (and also
!info->executable a little earlier), as that just confuses the meaning
of info->unresolved_syms_in_shared_libs and
info->unresolved_syms_in_objects. This is all completely untested,
but I think we should be using
else if (h->root.type == bfd_link_hash_undefweak)
;
else if (((h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0
|| info->unresolved_syms_in_objects == RM_IGNORE)
&& ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0
|| (info->unresolved_syms_in_shared_libs == RM_IGNORE))
&& ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
;
else
{
bfd_boolean err;
err = (((h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) != 0
&& info->unresolved_syms_in_objects == RM_GENERATE_ERROR)
|| ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0
&& (info->unresolved_syms_in_shared_libs
== RM_GENERATE_ERROR))
|| ELF_ST_VISIBILITY (h->other) != STV_DEFAULT);
if (! info->callbacks->undefined_symbol (info, h->root.root.string,
input_bfd, input_section,
rel->r_offset, err))
return FALSE;
warned = TRUE;
}
You might then need to tweak lexsup.c to set unresolved_syms_in_*
differently. Note the comments in bfdlink.h disagree with the way ld
currently sets these flags.
--
Alan Modra
IBM OzLabs - Linux Technology Centre
More information about the Binutils
mailing list