This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PATCH: Properly sign extend offset
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: binutils at sources dot redhat dot com
- Date: Tue, 15 Sep 2009 10:46:52 -0700
- Subject: PATCH: Properly sign extend offset
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
We need to sign extend offset only for 32bit address mode. We shouldn't
check use_rela_relocations since w64 doesn't set it.
H.J.
---
2009-09-15 H.J. Lu <hongjiu.lu@intel.com>
* config/tc-i386.c (offset_in_range): Sign extend offset only
for 32bit address mode.
Index: config/tc-i386.c
===================================================================
--- config/tc-i386.c (revision 6828)
+++ config/tc-i386.c (working copy)
@@ -1762,8 +1762,11 @@ offset_in_range (offsetT val, int size)
default: abort ();
}
- /* If BFD64, sign extend val. */
- if (!use_rela_relocations)
+#ifdef BFD64
+ /* If BFD64, sign extend val for 32bit address mode. */
+ if (flag_code != CODE_64BIT
+ || i.prefix[ADDR_PREFIX])
+#endif
if ((val & ~(((addressT) 2 << 31) - 1)) == 0)
val = (val ^ ((addressT) 1 << 31)) - ((addressT) 1 << 31);