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: corinna at vinschen dot de
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:34:15 +0000

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

Corinna Vinschen <corinna at vinschen dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ktietz at redhat dot com

--- Comment #5 from Corinna Vinschen <corinna at vinschen dot de> ---
(In reply to Nick Clifton from comment #4)
> 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*

Yeah, that sounds bad.  Also, you have to be quite careful with the section
layout because the Windows loader is pretty dumb and needs a rather standarized
layout, otherwise it refuses to load the executable.  There isn't much wiggle
room :(

I'm CCing ktietz, maybe he has some idea how to fix the __image_base__ value.


Corinna

-- 
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]