This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: undefined symbols in shared libraries


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]