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

M. Giannakidis mgiann@beta-cae.gr
Sat Jun 12 10:36:00 GMT 2004


Ian Lance Taylor wrote:

>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
>
>  
>
Thanks.

I tried your suggestion, and came across the following

I was able to change the initial address of the program to a number of 
my choice. But I
wasn't able to move this address high enough. I got relocation errors 
when the
initial assignment to '.', generated addresses above 0x80000000 (2Gb)

The errors produced be the linker were: 
In function start:
... relocation truncated to fit: R_X86_64_32S __libc_csu_fini
... relocation truncated to fit: R_X86_64_32S __libc_csu_init
... relocation truncated to fit: R_X86_64_32S main
In function frame_dummy:
... relocation truncated to fit: R_X86_64_PC32 _Jv_RegisterClasses
... relocation truncated to fit: R_X86_64_32S .ctros


All of the above  were on a Linux Suse 9 x86_64 machine with 2.4.21 
kernel, binutils-2.14.90.05-43 and libc 2.3.2

However, when doing the same on a i686 RedHat Linux machine with 2.4.20 
kernel, binutils-2.13.90.02-2 and libc 2.3.2, I was able to assign 
initial addresses in the linker script way above 0x80000000.

In both cases the linker scripts I used were generated by ld, using the 
--verbose option and changing only the initial assignment to '.'

What is it I'm missing in the 64bit environment?
Is there a system design limitation that doesn't allow linking with 
address above a certain limit?

Mike



More information about the Binutils mailing list