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: [RFC] Providing init_fini_syms earlier?


On Mon, Jul 11, 2005 at 10:25:21AM -0400, Carlos O'Donell wrote:
> On Thu, Jul 07, 2005 at 09:32:35PM -0700, H. J. Lu wrote:
> > On Thu, Jul 07, 2005 at 10:58:57PM -0400, Carlos O'Donell wrote:
> > > > 2. __init_array_start/__init_array_end are provided by linker for
> > > > static exexcutables since DT_INIT_ARRAY isn't available.
> > > 
> > > Linking a dynamic executable adds libc_nonshared.a, which has undefined
> > > references to __init_array_start and associated symbols.
> > > 
> > > It looks to me that the linker provides these symbols in all links,
> > > wether static or dynamic executables.
> > > 
> > > In the later case, because the linker provides the symbol so late, it's
> > > impossible to know if I should or shouldn't allocate space. Space is
> > > allocated, and after the section sizes have been fixed, the linker
> > > provides the symbols. At this point we know we don't need them, and we
> > > don't emit a relocation. However, we can no longer resize the section.
> > > 
> > 
> > I have
> > 
> > bash-3.00$ readelf -s /usr/lib/libc_nonshared.a| grep _array_
> >      5: 00000000     0 NOTYPE  GLOBAL HIDDEN  UND __preinit_array_start
> >      6: 00000000     0 NOTYPE  GLOBAL HIDDEN  UND __preinit_array_end
> >      7: 00000000     0 NOTYPE  GLOBAL HIDDEN  UND __init_array_start
> >      8: 00000000     0 NOTYPE  GLOBAL HIDDEN  UND __init_array_end
> >      9: 00000000     0 NOTYPE  GLOBAL HIDDEN  UND __fini_array_start
> >     10: 00000000     0 NOTYPE  GLOBAL HIDDEN  UND __fini_array_end
> > 
> > What do you have?
> 
> carlos@firin:~$ readelf -s /usr/lib/libc_nonshared.a| grep _array_
>      9: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND __init_array_end
>     10: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND __init_array_start
>     13: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND __fini_array_end
>     14: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND __fini_array_start
> 
> This depends largely on the version of libc installed (2.3.2 debian).
> The newer versions have "attribute_hidden" while 2.3.2 does not.

That was a glibc bug. I posted a patch for the linker bug.


H.J.


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