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]

Re: How can I link a program with a starting address of 0x100000000 for its text?


"M. Giannakidis" <mgiann@beta-cae.gr> writes:

> By compiling an application on a SunOS 5.8 platform, I came accross an
> intresting feature: ( description taken from sun.com documentation)
> 
> "By default 64-bit SPARC programs are linked with a starting address
> of 0x100000000. The whole program is above 4 gigabytes, including its
> text, data, heap, stack, and shared object dependencies. This helps
> ensure that 64-bit programs are correct by making it so the program
> will fault in the least significant 4 gigabytes of its address space
> if it truncates any of its pointers. While 64-bit programs are linked
> above 4 gigabytes, it is still possible to link them below 4 gigabytes
> by using a mapfile and the *-M* option to the compiler or link-editor
> (see /usr/lib/ld/sparcv9/map.below4G). "
> 
> 
> You can realize that this is vary helpful when porting an apllication
> to 64bit.
> 
> Is there a way to achieve the same behavior on an x86_64 Linux AMD
> platform for an ELF application that uses shared libraries?

Find the default linker script, which may be in your file system, or
can be dumped using ld --verbose.  Put that in a file.  Change the
initial assignment to '.' to be the address of your dreams.  Invoke
the linker with -T FILENAME.

Ian


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