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

Question: labels support and relative address #20

Open
czastack opened this issue Jul 14, 2023 · 2 comments
Open

Question: labels support and relative address #20

czastack opened this issue Jul 14, 2023 · 2 comments

Comments

@czastack
Copy link

Does this project have plans to support labels and rel address like nasm?

@dderjoel
Copy link
Collaborator

We do want to support labels at some point and we have talked about how we'd want to implement it, but currently nobody is dedicated to work on this project. We're more than happy to help and merge any PR, if you happen to be able to spare some time on this.

The high level idea was to create a map of "label"-"address" while the first pass of assembling.

  • Add a node to that map, whenever a label is parsed.
  • if an instruction with label is parsed, check this map and calculate the relative offset, if the label is already in the map, if not, assemble with 0x0 as the offset and create an entry in a back patch list.
  • at the end, traverse the back patch list, and and back patch all the necessary instructions.

@czastack
Copy link
Author

@dderjoel Thank you for reply. I can have a try on this idea in free time.

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