summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippo Valsorda <filippo@cloudflare.com>2016-05-21 00:54:40 +0100
committerFilippo Valsorda <filippo@cloudflare.com>2016-05-30 04:44:24 +0200
commitd6fe0339eeea6cf2d89c521f19a793e8e9d21cf4 (patch)
tree57c990a875bb714b5deec79b34280338f0e5585c
parent59de5df53512b466eb78488611abcfe8a41b015e (diff)
Fix ub in binutils causing failure to build for arm with clang
https://sourceware.org/bugzilla/show_bug.cgi?id=19222 Fixed by applying binutils@d840c08.
-rw-r--r--patches/binutils-2.25.1/0007-tcarm.diff21
1 files changed, 21 insertions, 0 deletions
diff --git a/patches/binutils-2.25.1/0007-tcarm.diff b/patches/binutils-2.25.1/0007-tcarm.diff
new file mode 100644
index 0000000..e1af9c9
--- /dev/null
+++ b/patches/binutils-2.25.1/0007-tcarm.diff
@@ -0,0 +1,21 @@
+From d840c081f8082e8b9e63fead5306643975a97bb3 Mon Sep 17 00:00:00 2001
+From: Richard Earnshaw <Richard.Earnshaw@arm.com>
+Date: Thu, 20 Nov 2014 17:02:47 +0000
+Subject: [PATCH] * config/tc-arm.c (rotate_left): Avoid undefined behaviour
+ when N = 0.
+
+---
+
+diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
+index 5077f87..9100fb2 100644
+--- a/gas/config/tc-arm.c
++++ b/gas/config/tc-arm.c
+@@ -7251,7 +7251,7 @@ parse_operands (char *str, const unsigned int *pattern, bfd_boolean thumb)
+
+ /* Functions for operand encoding. ARM, then Thumb. */
+
+-#define rotate_left(v, n) (v << n | v >> (32 - n))
++#define rotate_left(v, n) (v << (n & 31) | v >> ((32 - n) & 31))
+
+ /* If VAL can be encoded in the immediate field of an ARM instruction,
+ return the encoded form. Otherwise, return FAIL. */