bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/16821] x86_64 PE/COFF: ld truncates addresses of symbols from li


From: nickc at redhat dot com
Subject: [Bug ld/16821] x86_64 PE/COFF: ld truncates addresses of symbols from linker scripts to 32 bit
Date: Fri, 11 Apr 2014 13:13:20 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=16821

--- Comment #4 from Nick Clifton <nickc at redhat dot com> ---
Hi Corinna,

> Well, I'm wondering if ld couldn't utilize the fact that executables
> are never bigger than 2 Gigs.  I'm not entirely sure, but afaik the
> relocation information is signed.  Couldn't __image_base__ be defined
> with a negative offset relative to the first section?

Well, at the moment, __image_base__ is not a relocated value.  It is an
absolute symbol.  I suppose that it might be possible to use a base relocation
to adjust the value at run-time although that seems like a horrible hack too.

I did try another version of my original patch which created a new section at
ImageBase.  That way all absolute values could be converted to section-relative
values based upon this section.  Unfortunately that does not work because
section addresses are stored in the PE header as offsets from ImageBase, but an
offset of 0 is special.  It means that the section address is exacly 0, not
ImageBase+0.  You cannot put this new section before ImageBase as the section
addresses are all stored as positive offsets from ImageBase.  Plus if you put
the new section above ImageBase then you have no way of converting symbols
whose value is exacly ImageBase.  (eg __image_base__).

*sigh*

Cheers
  Nick

-- 
You are receiving this mail because:
You are on the CC list for the bug.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]