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: Is it possible to make the whole image above 4G on a 64 bit machine?


On Wed, Aug 29, 2012 at 7:17 AM, John Reiser <jreiser@bitwagon.com> wrote:
>>>   If it's possible to make the whole image above 4G, how I can do that?
>>> If not, could you explain why? Thanks.
>
>> You must use PIE to place an executable above 4G.
>
> There are other requirements, too, independent of using -fPIE.  Do this:
>    grep R_X86_64 /usr/include/elf.h   |  grep sign
> to see several of the potential problems.
>
> Any use of the relocation type:
>    #define R_X86_64_PC32           2       /* PC relative 32 bit signed */
> must be within 2G of the destination.  In practice this means that
> you must tell the compiler to use a different memory model if you have
> more than 2GB of subroutines (.text) in a single module (executable or
> shared library.)  Because this case is rare, then your favorite compiler
> might not support it.
>

This is PC relative.  The image can be anywhere in 64-bit
address space.  Different models apply to the size of
image, not where it is loaded.


-- 
H.J.


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