summaryrefslogtreecommitdiff
path: root/binutils/patches/libiberty-md5.diff
blob: e0d912ae984bd9e1b75e5d10e569dd60c5f5acfc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# DP: Fix alias warning building libiberty/md5.c

--- a/include/md5.h
+++ a/include/md5.h
@@ -86,7 +86,11 @@
 
   md5_uint32 total[2];
   md5_uint32 buflen;
-  char buffer[128] ATTRIBUTE_ALIGNED_ALIGNOF(md5_uint32);
+  union
+  {
+    char buffer[128];
+    md5_uint32 buffer32[32];
+  };
 };
 
 /*
--- a/libiberty/md5.c
+++ b/libiberty/md5.c
@@ -114,9 +114,9 @@
   memcpy (&ctx->buffer[bytes], fillbuf, pad);
 
   /* Put the 64-bit file length in *bits* at the end of the buffer.  */
-  *(md5_uint32 *) &ctx->buffer[bytes + pad] = SWAP (ctx->total[0] << 3);
-  *(md5_uint32 *) &ctx->buffer[bytes + pad + 4] = SWAP ((ctx->total[1] << 3) |
-							(ctx->total[0] >> 29));
+  ctx->buffer32[(bytes + pad) / 4] = SWAP (ctx->total[0] << 3);
+  ctx->buffer32[(bytes + pad + 4) / 4] = SWAP ((ctx->total[1] << 3) |
+					       (ctx->total[0] >> 29));
 
   /* Process last bytes.  */
   md5_process_block (ctx->buffer, bytes + pad + 8, ctx);