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]

HPPA ELF DT_PLTGOT handling


The HPPA ELF specification I have says:

        "The DT_PLTGOT dynamic table entry is used to specify the global
	  pointer (gp) value for the load module. The d_ptr field contains a 
	  link-time virtual address that must be relocated by the dynamic-
	  loader. The relocated value is used as the gp value for all functions in
	  the module"

 Currently the code does:

            case DT_PLTGOT:
              /* Use PLTGOT to set the GOT register.  */
              dyn.d_un.d_ptr = elf_gp (output_bfd);
              break;

where elf_gp is set by elf32_hppa_set_gp with code that implements:

      /* Choose to point our LTP at, in this order, one of .plt, .got,
         or .data, if these sections exist.  In the case of choosing
         .plt try to make the LTP ideal for addressing anywhere in the
         .plt or .got with a 14 bit signed offset.  Typically, the end
         of the .plt is the start of the .got, so choose .plt + 0x2000
         if either the .plt or .got is larger than 0x2000.  If both
         the .plt and .got are smaller than 0x2000, choose the end of
         the .plt section.  */

I don't believe that this optimisation is of any use as the stubs created by 
the linker don't make use of it (afaict).

A much more convenient (from the POV of the dynamic linker) is to always set 
DT_PLTGOT to a pointer to the GOT. glibc goes searching for the GOT which it 
would no longer need to do. Is this worth considering?

Nick


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