I cloned the riscv-tools repository (master branch) and followed the build procedure. Everything went fine.
Then I tried compiling the hello world program for a RV32IM instruction set, doing this:
riscv64-unknown-elf-gcc -m32 -march=RV32IM -o hello hello.c -save-temps
I used options save-temps to keep the intermediate files. (hello.s, hello.i, hello.o)
Everything is OK so far, I can run the hello world program with:
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 do get the assembly code into hello.dump
riscv64-unknown-elf-objdump -D -S -l -F  hello.o > hello.o.dump
Now what I would be interested to see is the assembly code without pseudo instructions and with the non ABI-register names.
It appears to be possible to get that, when I do:
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 adding these options, it does not 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 it a command syntax error or is it just not supported yet by the disassembler?
I can reproduce this and get the same error message. However, riscv64-unknown-elf-objdump returns 0 and the output file does contain an assembler dump without pseudoinstructions and/or with numeric register names, as requested by the option. So it seems like this is working as expected, it just also outputs an irritating error message.
The riscv-tools repo has not been updated since Feb. I also tried this with a build of a more recent version of riscv-gnu-toolchain and here I don't get the error message. So I'd say this is a non-critical bug that already has been fixed in riscv-gnu-toolchain and thus it will be fixed in riscv-tools as soon as riscv-gnu-toolchain is updated there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With