This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Build failure after fix for pr17512 cause linking failure when cross linking libgfortran on arm-none-linux-gnueabihf
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Pierre Muller <pierre dot muller at ics-cnrs dot unistra dot fr>
- Cc: Nicholas Clifton <nickc at redhat dot com>, Jiong Wang <jiong dot wang at arm dot com>, Binutils <binutils at sourceware dot org>
- Date: Fri, 7 Nov 2014 13:43:09 -0800
- Subject: Re: Build failure after fix for pr17512 cause linking failure when cross linking libgfortran on arm-none-linux-gnueabihf
- Authentication-results: sourceware.org; auth=none
- References: <5458AAB8 dot 7050302 at arm dot com> <5458BDBC dot 8080007 at redhat dot com> <5458DB83 dot 9010903 at arm dot com> <5458F573 dot 5030409 at redhat dot com> <5458F5FF dot 8060907 at arm dot com> <5458F87E dot 5050601 at redhat dot com> <545b39bd dot 45a4440a dot 0c80 dot 0cb5SMTPIN_ADDED_BROKEN at mx dot google dot com>
On Thu, Nov 6, 2014 at 1:04 AM, Pierre Muller
<pierre.muller@ics-cnrs.unistra.fr> wrote:
> Hi Nick,
>
> I think that this commit is what triggered this new failure:
> Cross compilation using cygwin-32 to generate a 64-bit mingw64 GDB binary:
>
> make[2]: Entering directory '/home/Pierre/git/build/mult-mingw64/bfd'
> /bin/sh ./libtool --tag=CC --mode=compile x86_64-w64-mingw32-gcc
> -DHAVE_CONFIG_H -I. -I../../../binutils-gdb/bfd -I.
> -I../../../binutils-gdb/bfd -I../../../binutils-gdb/bfd/../include
> -DHAVE_all_vecs -I./../intl -DBINDIR='"/usr/local/bin"' -W -Wall
> -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wno-format -Werror
> -gdwarf-4 -O0 -D__USE_MINGW_ACCESS -MT pex64igen.lo -MD -MP -MF
> .deps/pex64igen.Tpo -c -o pex64igen.lo pex64igen.c
> libtool: compile: x86_64-w64-mingw32-gcc -DHAVE_CONFIG_H -I.
> -I../../../binutils-gdb/bfd -I. -I../../../binutils-gdb/bfd
> -I../../../binutils-gdb/bfd/../include -DHAVE_all_vecs -I./../intl
> -DBINDIR=\"/usr/local/bin\" -W -Wall -Wstrict-prototypes
> -Wmissing-prototypes -Wshadow -Wno-format -Werror -gdwarf-4 -O0
> -D__USE_MINGW_ACCESS -MT pex64igen.lo -MD -MP -MF .deps/pex64igen.Tpo -c
> pex64igen.c -o pex64igen.o
> pex64igen.c: In function 'pe_print_idata':
> pex64igen.c:1470:34: error: comparison between signed and unsigned integer
> expressions [-Werror=sign-compare]
> else if (member - adj + 2 >= datasize)
> ^
> cc1: all warnings being treated as errors
> Makefile:1605: recipe for target 'pex64igen.lo' failed
> make[2]: *** [pex64igen.lo] Error 1
>
>
> Compiler is x86_64-w64-mingw32-gcc
> x86_64-w64-mingw32-gcc --version returns:
> x86_64-w64-mingw32-gcc (GCC) 4.8.3
>
> Should there be some explicit typecasts to avoid this warning
> or is a better fix possible?
>
>
> Pierre Muller
>
>> -----Message d'origine-----
>> De : binutils-owner@sourceware.org [mailto:binutils-
>> owner@sourceware.org] De la part de Nicholas Clifton
>> Envoyà : mardi 4 novembre 2014 17:02
>> Ã : Jiong Wang
>> Cc : binutils@sourceware.org
>> Objet : Re: pr17512 cause linking failure when cross linking
>> libgfortran on arm-none-linux-gnueabihf
>>
>> Hi Jiong,
>>
>> > I verified the patch fixed the issue on my local environment.
>>
>> Great. There were no regressions in my local tests, so I have checked
>> the patch into the master branch.
>>
>> Cheers
>> Nick
I checked in this to fix it.
--
H.J.
---
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 8fb37c6..dfa8c19 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,10 @@
2014-11-07 H.J. Lu <hongjiu.lu@intel.com>
+ * peXXigen.c (pe_print_idata): Cast to unsigned long in range
+ checks.
+
+2014-11-07 H.J. Lu <hongjiu.lu@intel.com>
+
PR ld/17482
* elf64-x86-64.c (elf_x86_64_relocate_section): Update comments
for IE->LE transition.
diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c
index 25f7273..2b63e2a 100644
--- a/bfd/peXXigen.c
+++ b/bfd/peXXigen.c
@@ -1467,7 +1467,7 @@ pe_print_idata (bfd * abfd, void * vfile)
member_high, member,
WithoutHighBit (member_high), member);
/* PR binutils/17512: Handle corrupt PE data. */
- else if (member - adj + 2 >= datasize)
+ else if (member - adj + 2 >= (unsigned long) datasize)
fprintf (file, _("\t<corrupt: 0x%04lx>"), member);
else
{
@@ -1502,7 +1502,7 @@ pe_print_idata (bfd * abfd, void * vfile)
fprintf (file, "\t%04lx\t %4lu <none>",
member, WithoutHighBit (member));
/* PR binutils/17512: Handle corrupt PE data. */
- else if (member - adj + 2 >= datasize)
+ else if (member - adj + 2 >= (unsigned long) datasize)
fprintf (file, _("\t<corrupt: 0x%04lx>"), member);
else
{