A patch to only warn undefined symbol in DSO to be built

H . J . Lu hjl@valinux.com
Wed Feb 7 00:15:00 GMT 2001


On Wed, Feb 07, 2001 at 07:03:58PM +1100, Alan Modra wrote:
> On Tue, 6 Feb 2001, H . J . Lu wrote:
> 
> > Here is a patch.
> 
> I have a competing one that I was busy checking when your email arrived. 
> :-)
> 
> Index: elflink.h
> ===================================================================
> RCS file: /cvs/src/src/bfd/elflink.h,v
> retrieving revision 1.78
> diff -u -p -r1.78 elflink.h
> --- elflink.h	2001/01/23 11:45:53	1.78
> +++ elflink.h	2001/02/07 07:58:30
> @@ -5092,9 +5092,10 @@ elf_link_output_extsym (h, data)
>       warnings for them.  */
>    if (! finfo->info->relocateable
>        && ! finfo->info->allow_shlib_undefined
> -      && ! (finfo->info->shared
> -	    && !finfo->info->no_undefined)
>        && h->root.type == bfd_link_hash_undefined
> +      && (! finfo->info->shared
> +	  || ! finfo->info->no_undefined
> +	  || (h->root.u.undef.abfd->flags & DYNAMIC) == 0)
>        && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0
>        && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0)
>      {
> 
> It does the same thing in a slightly different way, but also checks for

Are you sure it works? I added

finfo->output_bfd == h->root.u.undef.abfd

to check if the undefined symbol is in the DSO to be built.

> bfd_link_hash_undefined before accessing h_.root.u.undef
> 

That is not bad.

-- 
H.J. Lu (hjl@valinux.com)


More information about the Binutils mailing list