This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: Properly sign extend offset


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]