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 segfault by using lea instruction #1

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

phaubertin
Copy link
Owner

@phaubertin phaubertin commented Oct 8, 2023

The JIT requires the code generated by the code generator to be position independent. Currently, this is not the case when we attempt to move the address of a local function or a label into a register. We change that here by using the lea instruction instead of the mov instruction. This allows us to use the RIP-relative form of the lea instruction.

This fixes an issue where, when certain errors such as a bound check failure happen, the program segfaults instead of printing the expected error message and exiting cleanly.

@phaubertin phaubertin marked this pull request as draft October 8, 2023 19:49
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.

1 participant