===================================================================
RCS file: /cvs/src/src/gas/config/tc-sh.c,v
retrieving revision 1.132
@@ -156,6 +156,11 @@
#define ENCODE_RELAX(what,length) (((what) << 4) + (length))
#define GET_WHAT(x) ((x>>4))
+/* Truncate and sign-extend at 32 bits, so that building on a 64-bit host
+ gives identical results to a 32-bit host. */
+#define TRUNC(X) ((long) (X) & 0xffffffff)
+#define SEXT(X) ((TRUNC (X) ^ 0x80000000) - 0x80000000)
+
/* These are the three types of relaxable instruction. */
/* These are the types of relaxable instructions; except for END which is
a marker. */
@@ -4183,7 +4188,7 @@
val = ((val >> shift)
| ((long) -1 & ~ ((long) -1 >> shift)));
}
- if (max != 0 && (val < min || val > max))
+ if (max != 0 && (SEXT(val) < min || SEXT(val) > max))
as_bad_where (fixP->fx_file, fixP->fx_line, _("offset out of range"));
else if (max != 0)
/* Stop the generic code from trying to overlow check the value as well.