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 COMMITTED: Correct 64-bit big-endian swap unaligned write


Craig Silverstein noticed that I made a dumb mistake in the 64-bit
big-endian unaligned write code.  I committed this patch to fix it.
I never noticed it since gold only works for little-endian targets at
the moment.

Ian


2008-04-03  Ian Lance Taylor  <iant@google.com>

	* elfcpp_swap.h (Swap_unaligned<64, true>::writeval): Correct
	byte order.


Index: elfcpp_swap.h
===================================================================
RCS file: /cvs/src/src/elfcpp/elfcpp_swap.h,v
retrieving revision 1.4
diff -u -p -r1.4 elfcpp_swap.h
--- elfcpp_swap.h	1 Oct 2007 21:25:23 -0000	1.4
+++ elfcpp_swap.h	3 Apr 2008 23:32:25 -0000
@@ -367,14 +367,14 @@ struct Swap_unaligned<64, true>
   static inline void
   writeval(unsigned char* wv, Valtype v)
   {
-    wv[7] = v >> 56;
-    wv[6] = v >> 48;
-    wv[5] = v >> 40;
-    wv[4] = v >> 32;
-    wv[3] = v >> 24;
-    wv[2] = v >> 16;
-    wv[1] = v >> 8;
-    wv[0] = v;
+    wv[0] = v >> 56;
+    wv[1] = v >> 48;
+    wv[2] = v >> 40;
+    wv[3] = v >> 32;
+    wv[4] = v >> 24;
+    wv[5] = v >> 16;
+    wv[6] = v >> 8;
+    wv[7] = v;
   }
 };
 

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