Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Bald-Badger opened this issue Dec 7, 2021 · 1 comment

Comments

@Bald-Badger
Copy link

Bald-Badger commented Dec 7, 2021

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

@TheThirdOne
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants