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

Re: elf64lppc: ld script template


On Thu, May 14, 2015 at 04:05:04PM -0500, Peter Bergner wrote:
> On Thu, 2015-05-14 at 17:20 -0300, Breno Leitao wrote:
> > Hi there,
> > 
> > I am working to try to enable Erlang HIPE for ppc64le ABI, and they use a specific
> > loader script file during the build, as:
> > 
> > # ld -m elf64ppc -T hipe/elf64ppc.x  ....
> > 
> > The elf64ppc.x file could be found at [1], and I willing to create a elf64lppc.x
> > file to specific the new ABi.
> > 

Unfortunately the git repository history doesn't go back far enough to
see why elf64ppc.x was added, but whatever the problem was, this
wasn't the correct solution.

> > That said, I am wondering if there is a template I can look at, or some file to
> > guide me on creating this new file.
> 
> That looks like a hacked (or just old?) default linker script.  If you
> want a base to start with, grab the default linker script used on a LE
> system.  You can get that via:
> 
>   linux$ ld --verbose > elf64lppc.x

Copying a default linker script and adding it to some package means
you have a package that is almost guaranteed not to build, or to fail
at runtime when using some future toolchain.  So don't do that.

This elf64ppc.x script looks to be a standard script from 2.15, with
the executable base address changed from 0x10000000 to 0x01800000.
Except they got that wrong, with the value assigned to
__executable_start missing a zero..

So rip out that script, and pass -Ttext-segment=0x1800000 to ld
instead, assuming you're willing to use a binutils-2.20 feature.
Even better, rip out the script, *don't* pass -Ttext-segment, and see
what breaks.

-- 
Alan Modra
Australia Development Lab, IBM


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