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

fix init, fix macOS globals, add macOS args, add args + parse_int example #11

Merged
merged 1 commit into from
Aug 12, 2024

Conversation

soxfox42
Copy link
Contributor

Just a bunch of changes that came up while adding Callisto to my tak repo.

  • rsp was being saved to rsi inside of __init instead of outside. This caused two issues. Linux libc argv handling was broken because rsi was overwritten before __x86_64_program_init, and Linux no-libc argv handling was broken because rsi was off by 8 bytes because of the __init return address.

    Because __x86_64_program_init is inlined anyway, I just removed the saved stack pointer and accounted for the offset manually. The alternative would be to save the stack pointer before call __init, but a different register would need to be used to avoid the first issue.

  • Marked macOS core as supporting Args feature (implemented in std PR).

  • Fixed globals failing to assemble on macOS due to use of absolute addressing.

    Most of this is accomplished with default rel, which tells NASM to use RIP-relative addressing wherever possible, but I also had to manually fix CompileAddr to generate lea + mov instead of just mov. This works fine on Linux too.

  • Added add_args example. This is basically the program I used while testing Args on macOS and the parse_int function, and I figured it was a nice example to have.

@MESYETI MESYETI merged commit 4de92f8 into callisto-lang:main Aug 12, 2024
3 checks passed
@soxfox42 soxfox42 deleted the tak_fixes branch August 12, 2024 09:06
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

Successfully merging this pull request may close these issues.

2 participants