* 32 bit host build failure from peXXigen.c
@ 2014-04-16 17:34 Doug Evans
2014-04-17 0:14 ` asmwarrior
2014-04-22 15:58 ` Nicholas Clifton
0 siblings, 2 replies; 8+ messages in thread
From: Doug Evans @ 2014-04-16 17:34 UTC (permalink / raw)
To: nick clifton, Binutils
Hi.
Commit 32ae0d80cd430150ad9536aa160f34f504e129bc has this:
PR ld/16821
* peXXigen.c (abs_finder): New function.
(_bfd_XXi_swap_sym_out): For absolute symbols with values larger
than 1^32 try to convert them into section relative values
instead.
and I'm getting build failures.
peigen.c: In function 'abs_finder':
peigen.c:215:3: error: left shift count >= width of type [-Werror]
return (sec->vma <= abs_val) && ((sec->vma + (1L << 32)) > abs_val);
^
peigen.c: In function '_bfd_pei_swap_sym_out':
peigen.c:239:7: error: left shift count >= width of type [-Werror]
&& in->n_value > ((1L << 32) - 1)
^
peigen.c:239:22: error: comparison between signed and unsigned integer
expressions [-Werror=sign-compare]
&& in->n_value > ((1L << 32) - 1)
Nick, can you fix?
Thanks!
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: 32 bit host build failure from peXXigen.c
2014-04-16 17:34 32 bit host build failure from peXXigen.c Doug Evans
@ 2014-04-17 0:14 ` asmwarrior
2014-04-22 15:58 ` Nicholas Clifton
1 sibling, 0 replies; 8+ messages in thread
From: asmwarrior @ 2014-04-17 0:14 UTC (permalink / raw)
To: Doug Evans, nick clifton, Binutils
On 2014-4-17 1:34, Doug Evans wrote:
> Hi.
>
> Commit 32ae0d80cd430150ad9536aa160f34f504e129bc has this:
>
> PR ld/16821
> * peXXigen.c (abs_finder): New function.
> (_bfd_XXi_swap_sym_out): For absolute symbols with values larger
> than 1^32 try to convert them into section relative values
> instead.
>
> and I'm getting build failures.
>
> peigen.c: In function 'abs_finder':
> peigen.c:215:3: error: left shift count >= width of type [-Werror]
> return (sec->vma <= abs_val) && ((sec->vma + (1L << 32)) > abs_val);
> ^
> peigen.c: In function '_bfd_pei_swap_sym_out':
> peigen.c:239:7: error: left shift count >= width of type [-Werror]
> && in->n_value > ((1L << 32) - 1)
> ^
> peigen.c:239:22: error: comparison between signed and unsigned integer
> expressions [-Werror=sign-compare]
> && in->n_value > ((1L << 32) - 1)
>
>
> Nick, can you fix?
> Thanks!
>
FYI:
Some discussion about this build failures were here:
https://sourceware.org/bugzilla/show_bug.cgi?id=16821
Yuanhui Zhang
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: 32 bit host build failure from peXXigen.c
2014-04-16 17:34 32 bit host build failure from peXXigen.c Doug Evans
2014-04-17 0:14 ` asmwarrior
@ 2014-04-22 15:58 ` Nicholas Clifton
2014-04-23 20:18 ` Edjunior Barbosa Machado
1 sibling, 1 reply; 8+ messages in thread
From: Nicholas Clifton @ 2014-04-22 15:58 UTC (permalink / raw)
To: Doug Evans, Binutils
Hi Doug,
> and I'm getting build failures.
>
> peigen.c: In function 'abs_finder':
> peigen.c:215:3: error: left shift count >= width of type [-Werror]
> return (sec->vma <= abs_val) && ((sec->vma + (1L << 32)) > abs_val);
> ^
> peigen.c: In function '_bfd_pei_swap_sym_out':
> peigen.c:239:7: error: left shift count >= width of type [-Werror]
> && in->n_value > ((1L << 32) - 1)
> ^
> peigen.c:239:22: error: comparison between signed and unsigned integer
> expressions [-Werror=sign-compare]
> && in->n_value > ((1L << 32) - 1)
>
>
> Nick, can you fix?
Should be fixed now.
Cheers
Nick
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: 32 bit host build failure from peXXigen.c
2014-04-22 15:58 ` Nicholas Clifton
@ 2014-04-23 20:18 ` Edjunior Barbosa Machado
2014-04-24 15:10 ` Nicholas Clifton
0 siblings, 1 reply; 8+ messages in thread
From: Edjunior Barbosa Machado @ 2014-04-23 20:18 UTC (permalink / raw)
To: Nicholas Clifton, Doug Evans, Binutils
On 04/22/2014 12:58 PM, Nicholas Clifton wrote:
> Hi Doug,
>
>> and I'm getting build failures.
>>
>> peigen.c: In function 'abs_finder':
>> peigen.c:215:3: error: left shift count >= width of type [-Werror]
>> return (sec->vma <= abs_val) && ((sec->vma + (1L << 32)) > abs_val);
>> ^
>> peigen.c: In function '_bfd_pei_swap_sym_out':
>> peigen.c:239:7: error: left shift count >= width of type [-Werror]
>> && in->n_value > ((1L << 32) - 1)
>> ^
>> peigen.c:239:22: error: comparison between signed and unsigned integer
>> expressions [-Werror=sign-compare]
>> && in->n_value > ((1L << 32) - 1)
>>
>>
>> Nick, can you fix?
>
> Should be fixed now.
>
Hi Nick,
now I'm facing this build issue with peigen.c on x86:
...
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../bfd -DTRAD_CORE -I. -I../../bfd -I../../bfd/../include -DHAVE_bfd_elf32_i386_vec -DHAVE_i386linux_vec -DHAVE_i386pei_vec -DHAVE_bfd_elf32_little_generic_vec -DHAVE_bfd_elf32_big_generic_vec -DBINDIR=\"/usr/local/bin\" -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -MT peigen.lo -MD -MP -MF .deps/peigen.Tpo -c peigen.c -o peigen.o
peigen.c: In function â_bfd_pei_swap_sym_outâ:
peigen.c:240:7: error: comparison is always false due to limited range of data type [-Werror=type-limits]
cc1: all warnings being treated as errors
make[4]: *** [peigen.lo] Error 1
This problem was introduced on commit d5f59c10fc37e325d3fbad4ae7970c7cf0857b46.
Thanks,
--
Edjunior
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: 32 bit host build failure from peXXigen.c
2014-04-23 20:18 ` Edjunior Barbosa Machado
@ 2014-04-24 15:10 ` Nicholas Clifton
2014-04-24 16:23 ` Edjunior Barbosa Machado
0 siblings, 1 reply; 8+ messages in thread
From: Nicholas Clifton @ 2014-04-24 15:10 UTC (permalink / raw)
To: Edjunior Barbosa Machado, Doug Evans, Binutils
[-- Attachment #1: Type: text/plain, Size: 523 bytes --]
Hi Edjunior,
> now I'm facing this build issue with peigen.c on x86:
> peigen.c: In function â_bfd_pei_swap_sym_outâ:
> peigen.c:240:7: error: comparison is always false due to limited range of data type [-Werror=type-limits]
Darn. Which version of gcc are you using ?
I have just tried using gcc 4.8.2 on a 32-bit Fedora 20 installation and
this error did not happen. (I did find and fix another 32-bit issue).
Could you try out the attached patch and let me know if it works for you ?
Cheers
Nick
[-- Attachment #2: fred --]
[-- Type: text/plain, Size: 1534 bytes --]
diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c
index d462753..977e389 100644
--- a/bfd/peXXigen.c
+++ b/bfd/peXXigen.c
@@ -235,22 +235,22 @@ _bfd_XXi_swap_sym_out (bfd * abfd, void * inp, void * extp)
problem by finding a section whose base address is sufficient to
reduce the absolute value to < 1^32, and then transforming the
symbol into a section relative symbol. This of course is a hack. */
- if (sizeof (in->n_value) > 4
- && in->n_value > ((1ULL << 32) - 1)
- && in->n_scnum == -1)
- {
- asection * sec;
+ if (sizeof (in->n_value) > 4)
+ if (in->n_value > ((1ULL << 32) - 1)
+ && in->n_scnum == -1)
+ {
+ asection * sec;
- sec = bfd_sections_find_if (abfd, abs_finder, & in->n_value);
- if (sec)
- {
- in->n_value -= sec->vma;
- in->n_scnum = sec->target_index;
- }
- /* else: FIXME: The value is outside the range of any section. This
- happens for __image_base__ and __ImageBase__ and maybe some other
- symbols as well. We should find a way to handle these values. */
- }
+ sec = bfd_sections_find_if (abfd, abs_finder, & in->n_value);
+ if (sec)
+ {
+ in->n_value -= sec->vma;
+ in->n_scnum = sec->target_index;
+ }
+ /* else: FIXME: The value is outside the range of any section. This
+ happens for __image_base__ and __ImageBase__ and maybe some other
+ symbols as well. We should find a way to handle these values. */
+ }
H_PUT_32 (abfd, in->n_value, ext->e_value);
H_PUT_16 (abfd, in->n_scnum, ext->e_scnum);
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: 32 bit host build failure from peXXigen.c
2014-04-24 15:10 ` Nicholas Clifton
@ 2014-04-24 16:23 ` Edjunior Barbosa Machado
2014-04-25 13:07 ` Nicholas Clifton
0 siblings, 1 reply; 8+ messages in thread
From: Edjunior Barbosa Machado @ 2014-04-24 16:23 UTC (permalink / raw)
To: Nicholas Clifton, Doug Evans, Binutils
Hi Nick,
On 04/24/2014 12:09 PM, Nicholas Clifton wrote:
> Darn. Which version of gcc are you using ?
>
> I have just tried using gcc 4.8.2 on a 32-bit Fedora 20 installation and
> this error did not happen. (I did find and fix another 32-bit issue).
>
> Could you try out the attached patch and let me know if it works for you ?
>
Thank you for the patch, but unfortunately it still fails on my build
here, with the same error message (comparison is always false due to
limited range of data type [-Werror=type-limits]).
I'm using gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5).
Thanks,
--
Edjunior
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: 32 bit host build failure from peXXigen.c
2014-04-24 16:23 ` Edjunior Barbosa Machado
@ 2014-04-25 13:07 ` Nicholas Clifton
2014-04-25 15:17 ` Edjunior Barbosa Machado
0 siblings, 1 reply; 8+ messages in thread
From: Nicholas Clifton @ 2014-04-25 13:07 UTC (permalink / raw)
To: Edjunior Barbosa Machado; +Cc: Doug Evans, Binutils
[-- Attachment #1: Type: text/plain, Size: 392 bytes --]
Hi Edjunior,
> Thank you for the patch, but unfortunately it still fails on my build
Ho hum. OK - I have another patch for you to try...
> I'm using gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5).
Ah - unfortunately I do not have access to a system with this version of
gcc.
Please try the attached patch and let me know if I have gotten it right
this time. :-)
Cheers
Nick
[-- Attachment #2: peXXigen.patch --]
[-- Type: text/x-patch, Size: 973 bytes --]
diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c
index d462753..dc45daf 100644
--- a/bfd/peXXigen.c
+++ b/bfd/peXXigen.c
@@ -236,7 +236,15 @@ _bfd_XXi_swap_sym_out (bfd * abfd, void * inp, void * extp)
reduce the absolute value to < 1^32, and then transforming the
symbol into a section relative symbol. This of course is a hack. */
if (sizeof (in->n_value) > 4
+ /* GCC 4.6.x erroneously complains about the next test always being
+ false when compiled on a 32-bit host. (The sizeof test above
+ should have made the warning unnecessary). Hence we have to
+ predicate the test. It should not matter if the test is omitted
+ since the worst that can happen is that some absolute symbols
+ are needlessly converted to equivalent section relative symbols. */
+#if defined BFD64 || ! defined __GNUC__ || __GNUC__ > 4 || __GNUC_MINOR__ > 6
&& in->n_value > ((1ULL << 32) - 1)
+#endif
&& in->n_scnum == -1)
{
asection * sec;
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: 32 bit host build failure from peXXigen.c
2014-04-25 13:07 ` Nicholas Clifton
@ 2014-04-25 15:17 ` Edjunior Barbosa Machado
0 siblings, 0 replies; 8+ messages in thread
From: Edjunior Barbosa Machado @ 2014-04-25 15:17 UTC (permalink / raw)
To: Nicholas Clifton; +Cc: Doug Evans, Binutils
On 04/25/2014 10:06 AM, Nicholas Clifton wrote:
> Ah - unfortunately I do not have access to a system with this version of
> gcc.
>
>
> Please try the attached patch and let me know if I have gotten it right
> this time. :-)
Hi Nick,
your latest patch fixed the build problem here, thanks a lot for your help!
--
Edjunior
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-04-25 15:17 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-16 17:34 32 bit host build failure from peXXigen.c Doug Evans
2014-04-17 0:14 ` asmwarrior
2014-04-22 15:58 ` Nicholas Clifton
2014-04-23 20:18 ` Edjunior Barbosa Machado
2014-04-24 15:10 ` Nicholas Clifton
2014-04-24 16:23 ` Edjunior Barbosa Machado
2014-04-25 13:07 ` Nicholas Clifton
2014-04-25 15:17 ` Edjunior Barbosa Machado
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).