Tested with gas built from riscv-gnu-toolchain (commit 411d1345507e5313c3575720f128be9e6c0ed941, riscv-binutils commit 82dcb8613e1b1fb2989deffde1d3c9729695ff9c):
$ cat test.s
auipc x1, x0, %asdasda(foo)
$ riscv32-unknown-elf-as test.s
test.s: Assembler messages:
test.s:1: Internal error (Segmentation fault).
Please report this bug.
The problem is the extra register, not the unknown relocation function. I get the same error with just
auipc x0, x1
The problem seems to be limited to auipc and lui, which aren't properly checking their arguments. The second arg can be a constant or a %*hi operator, but can't be a register. There is no check to fail when it is a register though.
The master branch has been updated by Jim Wilson <firstname.lastname@example.org>:
Author: Jim Wilson <email@example.com>
Date: Mon Dec 10 16:40:46 2018 -0800
RISC-V: Don't segfault for two regs in auipc or lui.
* config/tc-riscv.c (my_getSmallExpression): Expand comment for
register support. Set expr_end if parse a register.
(riscv_ip) <'u'>: Break if imm_expr is not a symbol or constant.
* testsuite/gas/riscv/auipc-parsing.d: New.
* testsuite/gas/riscv/auipc-parsing.l: New.
* testsuite/gas/riscv/auipc-parsing.s: New.
Fixed on mainline.