[hjl@valinux.com: Re: An ELF/PPC patch for ld/testsuite]

Geoff Keating geoffk@cygnus.com
Thu Oct 19 12:43:00 GMT 2000


> Date: Thu, 19 Oct 2000 09:35:28 -0700
> From: "H . J . Lu" <hjl@valinux.com>

> > How hard is it to fix elf32-ppc properly?
> > 
> 
> According to Geoffrey, they are not supposed to work under
> ELF/PPC.

To be precise, given the sequence of operations the testsuite makes,
the dynamic linker should always produce an error.

The basic restriction on powerpc is that in non-PIC code, no branch
can span more than 2^26 bytes.  The testcases manage to hit this in
various ways:

- by creating a non-PIC shared object with a load offset which causes
  it to be loaded at 0x10000, and having that shared object branch to
  the application which is loaded at 0x10000000.  ld.so assumes that
  if you try to control your application's memory map, you know what
  you are doing.
- by creating a non-PIC shared object without a load offset, which
  causes it to be loaded just under the application at
  0x0FFFsomething, and having it branch to an undefined weak symbol
  which means location 0.  non-PIC code using undefined weak symbols
  is not supported on powerpc because it can't work.

The other restriction is a generic ELF one, which is that non-PIC
applications cannot reliably reference undefined weak symbols.  The
symbols will sometimes appear to be zero and sometimes not.

-- 
- Geoffrey Keating <geoffk@cygnus.com>


More information about the Binutils mailing list