This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PATCH COMMITTED: Correct 64-bit big-endian swap unaligned write
- From: Ian Lance Taylor <iant at google dot com>
- To: binutils at sourceware dot org
- Date: Thu, 03 Apr 2008 16:35:59 -0700
- Subject: 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;
}
};