This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: start address of a binary
- To: Sébastien Côté <scote1 at Matrox dot COM>
- Subject: Re: start address of a binary
- From: Ian Lance Taylor <ian at zembu dot com>
- Date: 07 Mar 2001 09:24:46 -0800
- Cc: binutils at sources dot redhat dot com
- References: <3AA65F38.877708FC@matrox.com>
Sébastien Côté <scote1@Matrox.COM> writes:
> I'd like to know why the text start address of an elf binary is so
> different for each architecture. For example, it's 0x10000000 for
> linux, 0x01800000 for elf32ppc and 0x40000 for elf32lppc.
>
> Does this really changes anything (as long as the address is in
> user-space)? I'm trying to run Linux on PowerPC in little-endian,
> should I use 0x10000000 or something else? I experimented a bit and it
> SEEMS to work with any address, but then why all those diffrent
> addresses?...
In general, almost any address will work.
For efficiency reasons, you normally want the text segment to start on
a page boundary (the definition of a page is processor dependent).
For better handling of NULL in C programs, you normally do not want
the text segment to start at 0. To protect the text segments against
writes and to permit sharing, you normally want the data segment to
start on a different page from the end of the text segment. On some
processors, the kernel can run more efficiently if it allocates a
portion of the address space for itself; this address space is then
unavailable for user programs.
I can't think of any good reason for elf32ppc and elf32lppc to have
different start addresses. It may be that they once were the same,
and then one was switched for ABI conformance but the other was not.
Ian