* [PATCH] aarch64: Fix bogus type punning in parse_barrier() [PR26699]
@ 2020-10-06 13:59 Alex Coplan
2020-10-06 14:20 ` Nick Clifton
0 siblings, 1 reply; 2+ messages in thread
From: Alex Coplan @ 2020-10-06 13:59 UTC (permalink / raw)
To: binutils; +Cc: Richard Earnshaw
[-- Attachment #1: Type: text/plain, Size: 1048 bytes --]
Hello,
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.
Testing:
* Regression tested natively on aarch64_be-linux-gnu.
* Regression tested an x86_64 -> aarch64-none-elf cross.
OK for master and backport to binutils-2.35?
Thanks,
Alex
---
gas/ChangeLog:
2020-10-06 Alex Coplan <alex.coplan@arm.com>
* 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.
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1313 bytes --]
diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c
index 4bcfa053f75..fac571ea573 100644
--- a/gas/config/tc-aarch64.c
+++ b/gas/config/tc-aarch64.c
@@ -247,12 +247,6 @@ set_fatal_syntax_error (const char *error)
present. */
#define COND_ALWAYS 0x10
-typedef struct
-{
- const char *template;
- unsigned long value;
-} asm_barrier_opt;
-
typedef struct
{
const char *template;
@@ -3993,7 +3987,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 20d5c204094..c973584af59 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 9d86f66806a..6f494f885a6 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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] aarch64: Fix bogus type punning in parse_barrier() [PR26699]
2020-10-06 13:59 [PATCH] aarch64: Fix bogus type punning in parse_barrier() [PR26699] Alex Coplan
@ 2020-10-06 14:20 ` Nick Clifton
0 siblings, 0 replies; 2+ messages in thread
From: Nick Clifton @ 2020-10-06 14:20 UTC (permalink / raw)
To: Alex Coplan, binutils; +Cc: Richard Earnshaw
Hi Alex,
> OK for master and backport to binutils-2.35?
Approved - please apply - both locations.
Cheers
Nick
> gas/ChangeLog:
> 2020-10-06 Alex Coplan <alex.coplan@arm.com>
>
> * 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.
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-10-06 14:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-06 13:59 [PATCH] aarch64: Fix bogus type punning in parse_barrier() [PR26699] Alex Coplan
2020-10-06 14:20 ` Nick Clifton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).