From 4288405d5ec2c68c7e9d8d68a090c6c9ff3825d1 Mon Sep 17 00:00:00 2001 From: Jim Wilson Date: Thu, 30 May 2019 15:23:10 -0700 Subject: RISC-V: Fix lui argument parsing. This fixes a bug reported on the riscv.org sw-dev mailing list. This rejects "lui x1,symbol", as a symbol should only be accepted here when used inside %hi(). Without the fix, this gets assembled as "lui x1,0" with no relocation which is clearly wrong. gas/ * config/tc-riscv.c (riscv_ip) <'u'>: Move O_constant check inside if statement. Delete O_symbol and O_constant check after if statement. * testsuite/gas/riscv/auipc-parsing.s: Test lui with missing %hi. * testsuite/gas/riscv/auipc-parsing.l: Update. --- gas/testsuite/gas/riscv/auipc-parsing.l | 2 ++ gas/testsuite/gas/riscv/auipc-parsing.s | 3 +++ 2 files changed, 5 insertions(+) (limited to 'gas/testsuite') diff --git a/gas/testsuite/gas/riscv/auipc-parsing.l b/gas/testsuite/gas/riscv/auipc-parsing.l index df41e0e..54eedcb 100644 --- a/gas/testsuite/gas/riscv/auipc-parsing.l +++ b/gas/testsuite/gas/riscv/auipc-parsing.l @@ -1,3 +1,5 @@ .*: Assembler messages: .*: Error: illegal operands `auipc x8,x9' .*: Error: illegal operands `lui x10,x11' +.*: Error: illegal operands `auipc x12,symbol' +.*: Error: illegal operands `lui x13,symbol' diff --git a/gas/testsuite/gas/riscv/auipc-parsing.s b/gas/testsuite/gas/riscv/auipc-parsing.s index f580869..7af4df9 100644 --- a/gas/testsuite/gas/riscv/auipc-parsing.s +++ b/gas/testsuite/gas/riscv/auipc-parsing.s @@ -1,3 +1,6 @@ # Don't accept a register for 'u' operands. auipc x8,x9 lui x10,x11 +# Don't accept a symbol without %hi() for 'u' operands. + auipc x12,symbol + lui x13,symbol -- cgit v1.1