aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Coplan <alex.coplan@arm.com>2020-10-06 15:56:44 +0100
committerAndreas K. Hüttel <dilfridge@gentoo.org>2020-10-21 00:57:03 +0300
commitd4626319f471ced17d61d26a5ea22da2197e3e4e (patch)
tree15d665814b8143311635019012161f324ab46066
parentaarch64: Add support for Neoverse V1 CPU (diff)
downloadbinutils-gdb-d4626319f471ced17d61d26a5ea22da2197e3e4e.tar.gz
binutils-gdb-d4626319f471ced17d61d26a5ea22da2197e3e4e.tar.bz2
binutils-gdb-d4626319f471ced17d61d26a5ea22da2197e3e4e.zip
aarch64: Fix bogus type punning in parse_barrier() [PR26699]
This patch fixes a bogus use of type punning in parse_barrier() which was causing an assembly failure on big endian LP64 hosts when attempting to assemble "isb sy" for AArch64. The type of the entries in aarch64_barrier_opt_hsh is aarch64_name_value_pair. We were incorrectly casting this to the locally-defined asm_barrier_opt which has a wider type (on LP64) for the second member. This happened to work on little-endian hosts but fails on LP64 big endian. The fix is to use the correct type in parse_barrier(). This makes the locally-defined asm_barrier_opt redundant, so remove it. gas/ChangeLog: PR 26699 * config/tc-aarch64.c (asm_barrier_opt): Delete. (parse_barrier): Fix bogus type punning. * testsuite/gas/aarch64/system.d: Update disassembly. * testsuite/gas/aarch64/system.s: Add isb sy test. (cherry picked from commit 05cfb0d8cc9b7f8676f5ae55a93642f091d5405f) (cherry picked from commit def9db5cb2a3e87ceada962a3269367b08dc4846)
-rw-r--r--gas/ChangeLog8
-rw-r--r--gas/config/tc-aarch64.c8
-rw-r--r--gas/testsuite/gas/aarch64/system.d1
-rw-r--r--gas/testsuite/gas/aarch64/system.s1
4 files changed, 11 insertions, 7 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 113023909d..e9f57478fc 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,11 @@
+2020-10-06 Alex Coplan <alex.coplan@arm.com>
+
+ PR 26699
+ * config/tc-aarch64.c (asm_barrier_opt): Delete.
+ (parse_barrier): Fix bogus type punning.
+ * testsuite/gas/aarch64/system.d: Update disassembly.
+ * testsuite/gas/aarch64/system.s: Add isb sy test.
+
2020-10-02 Alex Coplan <alex.coplan@arm.com>
* config/tc-aarch64.c (aarch64_cpus): Add Neoverse V1.
diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c
index 91692305c8..a21fbe6cf5 100644
--- a/gas/config/tc-aarch64.c
+++ b/gas/config/tc-aarch64.c
@@ -250,12 +250,6 @@ set_fatal_syntax_error (const char *error)
typedef struct
{
const char *template;
- unsigned long value;
-} asm_barrier_opt;
-
-typedef struct
-{
- const char *template;
uint32_t value;
} asm_nzcv;
@@ -3994,7 +3988,7 @@ static int
parse_barrier (char **str)
{
char *p, *q;
- const asm_barrier_opt *o;
+ const struct aarch64_name_value_pair *o;
p = q = *str;
while (ISALPHA (*q))
diff --git a/gas/testsuite/gas/aarch64/system.d b/gas/testsuite/gas/aarch64/system.d
index 20d5c20409..c973584af5 100644
--- a/gas/testsuite/gas/aarch64/system.d
+++ b/gas/testsuite/gas/aarch64/system.d
@@ -190,6 +190,7 @@ Disassembly of section \.text:
.*: d5033edf isb #0xe
.*: d5033fdf isb
.*: d5033fdf isb
+.*: d5033fdf isb
.*: d503309f ssbb
.*: d503349f pssbb
.*: d8000000 prfm pldl1keep, 0 <LABEL1>
diff --git a/gas/testsuite/gas/aarch64/system.s b/gas/testsuite/gas/aarch64/system.s
index 9d86f66806..6f494f885a 100644
--- a/gas/testsuite/gas/aarch64/system.s
+++ b/gas/testsuite/gas/aarch64/system.s
@@ -44,6 +44,7 @@
all_barriers op=isb, from=0, to=15
isb
+ isb sy
ssbb
pssbb