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

Misaligned address in linker idea #4

Open
dicarlo236 opened this issue Oct 19, 2018 · 1 comment
Open

Misaligned address in linker idea #4

dicarlo236 opened this issue Oct 19, 2018 · 1 comment

Comments

@dicarlo236
Copy link
Contributor

I noticed the same thing you did - the game's linker seems to write out misaligned addresses sometimes!
(

final_addr &= ~3;
) and I think I know what's happening.

I believe this misalignment actually intended: all the misaligned addresses I've seen so far have 2 in the bottom 3 bits. In GOAL, a pair is different from other objects. Instead of having a type pointer in front of the object, a pair is stored as the pointer to the pair + 2. There's a similar trick done on some integers.

If you check load-boundary-h.go, load-boundary.go, and load-boundary-data.go, it looks like there's a lot of data stored in a linked list/tree made of pairs. Linking the part that has this data structure causes lots of misaligned addresses when linking.

@rmitton
Copy link
Owner

rmitton commented Oct 19, 2018

Hmm, certainly a possibility! A bit odd nonetheless.
Nice find!

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

No branches or pull requests

2 participants