TheThirdOne/rars

Adding support for "<tag>:" type label & offset dumped from elf file

Bald-Badger opened this issue · 1 comments

Hello,
I've been trying to load GCC generated linked assembly into RARS
For example, there's this line in the decompiled linked binary as:

<register_fini>:
	li	a5,0
	beqz	a5,<register_fini+0x14>

and if I try to compile this by RARS, it will throw out an error:

_Error in ~\sim\instr.s line 7 column 1: <register_fini>:
Invalid language element: <register_fini>

if I manually remove the ''<>" bracket everywhere in the code, there are still problems:
for example: when compiling the same code with brackets removed:

register_fini:
	li	a5,0
	beqz	a5,register_fini+0x14

this error raises:
Error in ~\sim\instr.s line 3 column 2: "beqz": Too many or incorrectly formatted operands. Expected: beqz t1,label

would it be possible that in the future we can add support for "<label>" kind of label and <label+0x123> kind of offset?

seems that no one have posted this so far... so I might just post it here

I think that if you compile to assembly using a command like gcc -S code.c -o output.s you will get generally better results than using a disassembled binary. Notably your first block of code would not work with other assemblers either; I do not plan on adding this.

label+offset is a common enough pattern that it would be nice to support, but it would not be easy to get working. It would definitely something that I would add as part of a rewrite of the assembler.

Related issues: #100, #102