Skip to content
New issue

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

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

Already on GitHub? # to your account

-definelabel is sign-extended from 32-bit to 64-bit #158

Closed
Prof9 opened this issue Oct 23, 2019 · 0 comments · Fixed by #159
Closed

-definelabel is sign-extended from 32-bit to 64-bit #158

Prof9 opened this issue Oct 23, 2019 · 0 comments · Fixed by #159

Comments

@Prof9
Copy link
Contributor

Prof9 commented Oct 23, 2019

Given the following test.asm:

.definelabel	testlabel2,0xFFFFFFFF
.gba
.create "test.bin",0
.org 0xFFFFFFFF
testlabel3:
.close

Assembled with:

armips -definelabel testlabel 0xFFFFFFFF -sym test.sym test.asm

Produces a test.sym with:

00000000 0
FFFFFFFFFFFFFFFF testlabel
FFFFFFFF testlabel2
FFFFFFFF testlabel3
�

As you can see, the 0xFFFFFFFF that was passed in with -definelabel was sign-extended from 32-bit to 64-bit. Whereas the ones defined with .definelabel and : were not.

We can also see this when we change all the label values to 0x1122334455667788, which will result in the following symfile:

00000000 0
FFFFFFFF55667788 testlabel
1122334455667788 testlabel2
1122334455667788 testlabel3
�

Though this somehow produces 0xFFFFFFFF55667788 and not just 0x55667788. It seems like any value at least 0x80000000 is just sign-extended anyway.

This is kind of annoying, since having such a 64-bit label in your symfile when you didn't intend to will cause No$gba to throw a Symbolic Info File Corrupt error and refuse to run the ROM.

Ideally all three of these methods would behave the same way.

A workaround is to use -equ testlabel 0xFFFFFFFF instead.

sp1187 added a commit that referenced this issue Oct 24, 2019
Fix -definelabel sign extend (fixes #158)
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant