RISCV parse parameters numeric and non-liased

I cloned the riscv-tools repository (master branch) and followed the build procedure. Everything went well.

Then I tried to compile the hello world program for the RV32IM instruction set by doing the following:

riscv64-unknown-elf-gcc -m32 -march=RV32IM -o hello hello.c -save-temps

      

I used the save-temps options to store intermediate files. (hello.s, hello.i, hello.o)

So far so good, I can run the world hello program:

spike pk hello
Hello world!

      

Now I wanted to take a look at the assembly code for this program. I did the following and I got the assembly code in hello.dump

riscv64-unknown-elf-objdump -D -S -l -F  hello.o > hello.o.dump

      

Now what I would be interested to see is assembly code without pseudo instructions and non ABI register names.

It looks like this is possible when I do this:

riscv64-unknown-elf-objdump --target-help

      

I get this:

The following RISC-V-specific disassembler options are supported for use
with the -M switch (multiple options should be separated by commas):

numeric       Print numeric reigster names, rather than ABI names.

no-aliases    Disassemble only into canonical instructions, rather
              than into pseudoinstructions.

      

However, when I try to add these parameters, it doesn't work.

riscv64-unknown-elf-objdump -D -S -l -F  -Mno-aliases hello.o > hello.o.dump
Unrecognized disassembler option: no-aliases

riscv64-unknown-elf-objdump -D -S -l -F  -Mnumeric hello.o > hello.o.dump
Unrecognized disassembler option: numeric

riscv64-unknown-elf-objdump -D -S -l -F  -Mnumeric,no-aliases hello.o > hello.o.dump
Unrecognized disassembler option: numeric
Unrecognized disassembler option: no-aliases

      

Is this a command syntax error or is it not yet supported by the disassembler?

+3


source to share


2 answers


I can reproduce this and get the same error message. However, it riscv64-unknown-elf-objdump

returns 0, and the output file contains an assembler dump without pseudo-instructions and / or with numeric register names as required by the option. So it looks like it works as expected, it also prints an annoying error message.



riscv-tools

repo hasn't been updated since February. I also tried it with a newer build riscv-gnu-toolchain

and I don't get an error here. Therefore, I would say that this is a non-fatal bug that has already been fixed in riscv-gnu-toolchain

, and therefore it will be fixed in riscv-tools

as soon as it is updated there riscv-gnu-toolchain

.

+4


source


You are correct, I am getting an error, but when I look at the assembler dump, the numeric register names and non-pseudo instructions are visible in the file.



Thanks for pointing out that this is just a misleading error message printed ...

0


source







All Articles