This is the mail archive of the binutils@sourceware.cygnus.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]

Re: GNU linker and Function stubs on mips.


Hi Ian,
    I am glad to say that the problem has now been solved. After hours of debugging
I really hit myself for the thing that was causing all the problem :-(. The problem
was in _bfd_mips_elf_adjust_dynamic_symbol().
You will be quite surprised to see the change required. Here is the cvs diff..

*************** _bfd_mips_elf_adjust_dynamic_symbol (inf
*** 7612,7618 ****

    /* For a function, create a stub, if needed. */
    if (h->type == STT_FUNC
!       || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
      {
        if (! elf_hash_table (info)->dynamic_sections_created)
        return true;
--- 7708,7714 ----

    /* For a function, create a stub, if needed. */
    if (h->type == STT_FUNC
!       && (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
      {
        if (! elf_hash_table (info)->dynamic_sections_created)
        return true;

As we know, we need to create a function stub only for a function that require a PLT
and not otherwise.

The function stubs were being generated irrespective of whether the function
requires a PLT or not, because the test conditions  for this were being  *ORed*.
Ideally the test conditions should be *ANDed*. That is what I did.

First I compiled the simple hello and compared the dump against the dump of a hello
from the native linker.
They just match !!

Immediately I compiled bash and it just works fine !!. All undefined symbols that
are referenced by non-call relocs do not have the stubs (Finally !!). I did a couple
of other tests too and had no problems.

I feel that this change is required for all mips targets. Because again on MIPS
function stubs are needed *if* and *only* if the function requires a PLT abd *not*
otherwise.

Ian, what do you think ? If this change is O.K for you, can you please check in the
change ??.

Thanks a lot !!

With best regards.

Koundinya







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