coping with PT_PHDR not being in loaded segment

Franz Sirl Franz.Sirl-kernel@lauterbach.com
Mon May 10 13:59:00 GMT 1999


Am Mon, 10 May 1999 schrieb Ulrich Drepper:
>Franz Sirl <Franz.Sirl-kernel@lauterbach.com> writes:
>
>> Has anyone successfully verified on any platform that the fix works? I 
>> still get the FAIL "FAIL: shared (non PIC, load offset)" in the 
>> ld-testsuite of gas-990418 on powerpc-linux-gnu. But now the testcase 
>> segfaults instead of printing "BUG in dynamic linker".
>
>Please run the debugger.  You can use the dynamic loader just like a
>program.

I wish it was that easy on PPC. gdb is nearly useless in debugging ld.so on
PPC. Nevertheless, with some hairy debugging I was able to narrow it down to
the following code in do-lookup.h, around line 76:

      /* Search the appropriate hash bucket in this object's symbol table
         for a definition for the same symbol name.  */
      for (symidx = map->l_buckets[hash % map->l_nbuckets];
           symidx != STN_UNDEF;
           symidx = map->l_chain[symidx])
        {
          sym = &symtab[symidx];

It seems to segfault because map->l_nbuckets is zero and so the modulo operation
produces an invalid (undefined) index for the map->l_buckets[] array.

Franz.



More information about the Libc-hacker mailing list