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]

Re: start address of a binary


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


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