RISC-V: attributes and assembly / disassembly
Jan Beulich
jbeulich@suse.com
Mon Sep 12 16:13:58 GMT 2022
Hello,
for use in other work I've been playing with this piece of assembly code
.option push
.option arch, +c
aliasC:
sll x1, x1, 3
c.slli x1, 3
sra x8, x8, 3
c.srai x8, 3
srl x8, x8, 3
c.srli x8, 3
.option pop
ending up quite surprised that the resulting object doesn't disassemble
(at least not without giving the disassembler extra options). It then
occurred to me to drop the push/pop of the options, and voila - things
worked. Aiui riscv_write_out_attrs() populates Tag_RISCV_arch with the
state of things at the end of assembly. Which raises (at least) two
questions:
1) Shouldn't the assembler accumulate all extensions which were ever
enabled in the course of processing the source, and use that set to
populate Tag_RISCV_arch? Even if that's too simplistic, I don't think
the state of things at the end of assembly can be taken as
representative for the entire object.
2) The assembler properly sets the RVC bit in the ELF flags in the
case described. Shouldn't the disassembler use that information
alongside the attributes section?
Thanks for any insight,
Jan
More information about the Binutils
mailing list