binutils is broken

H . J . Lu hjl@lucon.org
Tue Oct 2 23:55:00 GMT 2001


On Wed, Oct 03, 2001 at 04:04:04PM +0930, Alan Modra wrote:
> On Tue, Oct 02, 2001 at 04:43:56PM -0700, H . J . Lu wrote:
> >  
> > @@ -1132,6 +1103,7 @@ elf_i386_adjust_dynamic_symbol (info, h)
> >  		  || h->weakdef->root.type == bfd_link_hash_defweak);
> >        h->root.u.def.section = h->weakdef->root.u.def.section;
> >        h->root.u.def.value = h->weakdef->root.u.def.value;
> > +      return true;
> >      }
> >  
> >    /* This is a reference to a symbol defined by a dynamic object which
> 
> The above is the change that actually breaks things (note you had the
> diff reversed, so the problem is caused by continuing on and generating
> copy relocs for the weakdef).  Doing so defines the symbol in the dynbss
> section, and the comment at line 3695 of elflink.h comes into play
> because we have a definition for tzname, daylight etc. in the
> application.
> 
> The real bug is around line 3618 of elflink.h, where flags are copied
> to a weakdef.  I think copy_indirect_symbol needs to be called here
> instead so that the x86 dyn_relocs field gets copied to the weakdef.
> That would make my incorrect fudge in ..adjust_dynamic_symbol not needed.
> 
> I'm testing this patch at the moment, and will commit it if all is
> well.
> 
> 	* elflink.h (elf_fix_symbol_flags): Copy flags to weakdef using
> 	elf_backend_copy_indirect_symbol so that backend has a chance to
> 	copy other necessary fields.
> 	* elf.c (_bfd_elf_link_hash_copy_indirect): Bail out after
> 	copying flags if this is a weakdef.
> 	* elf32-i386 (elf_i386_adjust_dynamic_symbol): Don't do copy
> 	reloc processing for weakdefs.
> 

I don't think it works. It won't even link timezone/tst-timezone.c in
glibc for me. You can just do

# gcc tst-timezone.c
# a.out

It should compile/run cleanly.


H.J.



More information about the Binutils mailing list