summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Brown2012-03-04 22:09:40 +0100
committerMichael Brown2012-03-04 22:34:46 +0100
commite187de72398a995658d22b583c278532c3f99aa7 (patch)
tree429ec154aec92ecb1ed5e8fa4f6d6f90af53140c /src
parent[crypto] Replace SHA-1 implementation (diff)
downloadipxe-e187de72398a995658d22b583c278532c3f99aa7.tar.gz
ipxe-e187de72398a995658d22b583c278532c3f99aa7.tar.xz
ipxe-e187de72398a995658d22b583c278532c3f99aa7.zip
[i386] Fix building on older versions of gcc
Fix a strict-aliasing error on certain versions of gcc. Reported-by: Marko Myllynen <myllynen@redhat.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src')
-rw-r--r--src/arch/i386/include/bits/byteswap.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/arch/i386/include/bits/byteswap.h b/src/arch/i386/include/bits/byteswap.h
index 381e695fb..d40771354 100644
--- a/src/arch/i386/include/bits/byteswap.h
+++ b/src/arch/i386/include/bits/byteswap.h
@@ -52,7 +52,10 @@ __bswap_variable_64 ( uint64_t x ) {
static inline __attribute__ (( always_inline )) void
__bswap_64s ( uint64_t *x ) {
- uint32_t __attribute__ (( may_alias )) *dwords = ( ( void * ) x );
+ struct {
+ uint32_t low;
+ uint32_t high;
+ } __attribute__ (( may_alias )) *dwords = ( ( void * ) x );
uint32_t discard;
__asm__ ( "movl %0,%2\n\t"
@@ -60,8 +63,9 @@ __bswap_64s ( uint64_t *x ) {
"xchgl %2,%1\n\t"
"bswapl %2\n\t"
"movl %2,%0\n\t"
- : "=g" ( dwords[0] ), "=g" ( dwords[1] ), "=r" ( discard )
- : "0" ( dwords[0] ), "1" ( dwords[1] ) );
+ : "=g" ( dwords->low ), "=g" ( dwords->high ),
+ "=r" ( discard )
+ : "0" ( dwords->low ), "1" ( dwords->high ) );
}
#endif /* _BITS_BYTESWAP_H */