This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc 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: evolution vs prelink on debian ppc sid


On Thu, Sep 26, 2002 at 03:55:57PM -0700, Roland McGrath wrote:
> > We have extended the ELF spec for prelink.
> 
> Indeed.  However, our dladdr presumes invariants that are not specified but
> just happen to be true with our own tools--but oops, not even all of our
> own tools.  
> 
> > Why not add one more thing, a DT_DYNSYM_SZ entry with the required
> > information?
> 
> That is obviously the best thing.
> 
> > Let not do anything which costs unnecessaily at runtime.  I can probably
> > even get this in the official gABI.
> 
> We have to do something with objects that don't have the new tag, i.e. all
> objects that exist now.  We can just continue to presume unspecified
> invariants about their layout, and change the one case we know of (prelink)
> that violates the invariant to always produce the new tag.  The safest
> choice is the one that costs a little at run-time.  But a) it's not a huge
> cost, and b) does anyone really care that `dladdr' be a high-performance
> interface?  If you do really care, then the cost can be minimized by
> caching the result as I suggested, or even just folding that scan into the
> existing load-time scans over all the dynamic tags.

Yeah. I think it should be ld, not prelink, which would add DT_SYMTAB_SZ
(shall we ask Caldera to allocate 34 for it or use 0x6ffffdf4?) and the code
should do:
if (match->l_info[DT_SYMTAB_SZ])
  symtabend = (char *) symtab + match->l_info[DT_SYMTAB_SZ]->d_un.d_val;
else
  {
    static const int tags [] =
      { DT_STRTAB, DT_JMPREL, DT_RELA, DT_REL, DT_HASH,
        DT_INIT, DT_INIT_ARRAY, DT_FINI_ARRAY,
        DT_PREINIT_ARRAY, ADDRIDX (DT_GNU_CONFLICT),
        ADDRIDX (DT_GNU_LIBLIST), VERSYMIDX (DT_VERSYM),
        VERSYMIDX (DT_VERDEF), VERSYMIDX (DT_VERNEED) };
    int tag;

    for (symtabend = (const ElfW(Sym) *) -1, tag = 0;
         tag < sizeof (tags) / sizeof (tags[0]); tag++)
      {
        if (D_PTR (match, l_info[tags[tag]]) >= symtab
            && D_PTR (match, l_info[tags[tag]]) < symtabend)
          symtabend
            = (const ElfW(Sym) *) D_PTR (match, l_info[tags[tag]]);
      }
    if (symtabend == (const ElfW(Sym) *) -1)
      symtabend = symtab;
  }
to cope with binaries/libs which don't have this dynamic tag.

	Jakub


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