[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.
- [Bug ld/16821] New: x86_64 PE/COFF: ld truncates addresses of symbols from linker scripts to 32 bit, corinna at vinschen dot de, 2014/04/08
- [Bug ld/16821] x86_64 PE/COFF: ld truncates addresses of symbols from linker scripts to 32 bit, yselkowitz at cygwin dot com, 2014/04/08
- [Bug ld/16821] x86_64 PE/COFF: ld truncates addresses of symbols from linker scripts to 32 bit, nickc at redhat dot com, 2014/04/09
- [Bug ld/16821] x86_64 PE/COFF: ld truncates addresses of symbols from linker scripts to 32 bit, nickc at redhat dot com, 2014/04/09
- [Bug ld/16821] x86_64 PE/COFF: ld truncates addresses of symbols from linker scripts to 32 bit, corinna at vinschen dot de, 2014/04/09
- [Bug ld/16821] x86_64 PE/COFF: ld truncates addresses of symbols from linker scripts to 32 bit, nickc at redhat dot com, 2014/04/11
- [Bug ld/16821] x86_64 PE/COFF: ld truncates addresses of symbols from linker scripts to 32 bit,
corinna at vinschen dot de <=
- [Bug ld/16821] x86_64 PE/COFF: ld truncates addresses of symbols from linker scripts to 32 bit, cvs-commit at gcc dot gnu.org, 2014/04/11
- [Bug ld/16821] x86_64 PE/COFF: ld truncates addresses of symbols from linker scripts to 32 bit, ebotcazou at gcc dot gnu.org, 2014/04/12
- [Bug ld/16821] x86_64 PE/COFF: ld truncates addresses of symbols from linker scripts to 32 bit, asmwarrior at gmail dot com, 2014/04/14
- [Bug ld/16821] x86_64 PE/COFF: ld truncates addresses of symbols from linker scripts to 32 bit, cvs-commit at gcc dot gnu.org, 2014/04/22
- [Bug ld/16821] x86_64 PE/COFF: ld truncates addresses of symbols from linker scripts to 32 bit, nickc at redhat dot com, 2014/04/22
- [Bug ld/16821] x86_64 PE/COFF: ld truncates addresses of symbols from linker scripts to 32 bit, cvs-commit at gcc dot gnu.org, 2014/04/22
- [Bug ld/16821] x86_64 PE/COFF: ld truncates addresses of symbols from linker scripts to 32 bit, cvs-commit at gcc dot gnu.org, 2014/04/28