32 bit host build failure from peXXigen.c

Nicholas Clifton nickc@redhat.com
Thu Apr 24 15:10:00 GMT 2014


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


-------------- next part --------------
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);


More information about the Binutils mailing list