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

does not generate correct code for Windows #47

Open
szdytom opened this issue Apr 1, 2022 · 1 comment
Open

does not generate correct code for Windows #47

szdytom opened this issue Apr 1, 2022 · 1 comment

Comments

@szdytom
Copy link

szdytom commented Apr 1, 2022

I tired to port the compiler to Windws but there are some errors:

Generated out.s does not compile correctly on Windows.

GAS(the AT&T asm) on Windows don't work identical, it have a little difference about psedo-ops. So I wrote a cg.c for NASM.

It passes the compiling stage, but it still faces a runtime error.
It seems because of something called shadow storage on Windows:

The x64 Application Binary Interface (ABI) uses a four-register fast-call calling convention by default. Space is allocated on the call stack as a shadow store for callees to save those registers.
https://docs.microsoft.com/en-us/cpp/build/x64-calling-convention?view=msvc-170

the x64 calling convention on Windows it very different (and hard to understand for me), do you have any idea on fixing this?

@ravenleeblack
Copy link

Is your nasm cg.c available @szdytom?

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