[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: |
Wed, 09 Apr 2014 15:24:30 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=16821
Nick Clifton <nickc at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
--- Comment #2 from Nick Clifton <nickc at redhat dot com> ---
Hi Corinna,
DJ has found the cause of the problem: the PE and PE32+ file formats store
the value of symbols in a 32-bit field. For section relative symbols this
amount is usually enough, as section addresses can be 64-bit. But for absolute
symbols any value needing more than 32-bits is silently truncated by the
linker.
I have uploaded a patch which is a partial fix for the problem. It detects
out-of-range absolute values and tries to convert them into section relative
values. This works for most cases, but it fails for the __image_base__ and
__ImageBase__ symbols, and possibly some others that I have not yet
encountered. The problem is that these symbols have a value which is less than
the lowest addressed section, but higher than 1^32. (Note the value of
ImageBase in the PE header is not affected by this problem. It is only the
*symbols* __image_base__ and __ImageBase__ that are affected).
One thing that patch does not do at the moment is issue an error message when
it knows that the truncation is taking place and it has not found a way around
it. I omitted the warning because I know that it will be triggered for every
x86_64 cygwin binary that gets built, and most, if not all of them, do not care
about the value of __image_base__.
Any suggestions as to how to handle __image_base__ will be greatfully
received.
Cheers
Nick
--
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 <=
- [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, 2014/04/11
- [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