Pseudo-instructions from objdump

360 views
Skip to first unread message

Paulo Matos

unread,
Oct 24, 2017, 3:22:59 AM10/24/17
to RISC-V SW Dev
Hello,

I was quite surprised to see li in the objdump -d output. It looks like:
00000003 <foo>:
3: ff010113 addi sp,sp,-16
7: 00300793 li a5,3
b: 00f12623 sw a5,12(sp)
f: 00c12783 lw a5,12(sp)
13: 01010113 addi sp,sp,16
17: 00a78533 add a0,a5,a0
1b: 00008067 ret

Although I do understand this might be for readability, I would also
like to have an option to see the raw instructions. In this case,
instead of li a5, 3 I would like to see addi x15, x0, 3. Is this possible?

I understand the assembler to be generated by the compiler to use
pseudo-instructions, after all it makes the compiler life easier and the
assembler reader as well, but I am not so happy to see pseudo
instructions to come out of the objdump. What was the rationale behind
this decision?

Kind regards,

--
Paulo Matos

Tommy Murphy

unread,
Oct 24, 2017, 4:01:15 AM10/24/17
to RISC-V SW Dev

objdump --disassembler-options=no-aliases

Hope this helps.

Paulo Matos

unread,
Oct 24, 2017, 4:05:21 AM10/24/17
to sw-...@groups.riscv.org
Thanks. Was not aware of that option. Unfortunately it still uses ABI
register names and -M reg-names-raw (mentioned in the page you
referenced), does not work.

These options seem to be arch specific so it might be that it's not
_yet_ implemented for RISCV?

--
Paulo Matos

Tommy Murphy

unread,
Oct 24, 2017, 4:18:34 AM10/24/17
to RISC-V SW Dev
> These options seem to be arch specific so it might be that it's not 
> _yet_ implemented for RISCV? 

That's what it looks like alright but I don't know for sure unfortunately.
Certainly I can't see any way right now to force the use of raw reg names in the output.

Paulo Matos

unread,
Oct 24, 2017, 7:44:22 AM10/24/17
to sw-...@groups.riscv.org
I was told privately '-M numeric' works and it does. :)

--
Paulo Matos

Tommy Murphy

unread,
Oct 24, 2017, 7:51:25 AM10/24/17
to RISC-V SW Dev
So it does - thanks.
Pity it's not documented though (as far as I can see)...
So I presume you're using --disassembler-options=no-aliases,numeric to get a "raw" disasm listing (i.e. no pseudo/alias instructions and canonical rather than ABI register names)?

Bastian Koppelmann

unread,
Oct 24, 2017, 9:11:07 AM10/24/17
to Tommy Murphy, RISC-V SW Dev
On 10/24/2017 01:51 PM, Tommy Murphy wrote:
> So it does - thanks.
> Pity it's not documented though (as far as I can see)...
> So I presume you're using --disassembler-options=no-aliases,numeric to get
> a "raw" disasm listing (i.e. no pseudo/alias instructions and canonical
> rather than ABI register names)?

You can do 'riscv64-objdump --help' and it says it right at the bottom :)

Cheers,
Bastian

Tommy Murphy

unread,
Oct 24, 2017, 10:10:31 AM10/24/17
to RISC-V SW Dev, tommy_...@hotmail.com, kbas...@mail.uni-paderborn.de
Thanks - didn't think of that.
I tend to run the tools from Eclipse and refer to online docs so that was not an obvious place to look for me.

Paulo Matos

unread,
Oct 25, 2017, 2:15:31 AM10/25/17
to sw-...@groups.riscv.org


On 24/10/17 13:51, Tommy Murphy wrote:
> So it does - thanks.
> Pity it's not documented though (as far as I can see)...
> So I presume you're using --disassembler-options=no-aliases,numeric to
> get a "raw" disasm listing (i.e. no pseudo/alias instructions and
> canonical rather than ABI register names)?
>

That's correct!

--
Paulo Matos

Tommy Murphy

unread,
Oct 25, 2017, 5:10:59 AM10/25/17
to RISC-V SW Dev
OK - thanks for the confirmation.
Reply all
Reply to author
Forward
0 new messages