Fix rsp not being escaped properly in the Win32 GAS ASM generator
This commit is contained in:
parent
4d5fd36390
commit
09af190aa9
|
@ -702,13 +702,13 @@ static int AsCall(struct SymbolTableEntry* Entry, int Args) {
|
|||
printf("\t\t\tFunction returns into %s\n", Registers[OutRegister]);
|
||||
|
||||
// Allocate shadow space
|
||||
fprintf(OutputFile, "\taddq\t$-32, %rsp\n");
|
||||
fprintf(OutputFile, "\taddq\t$-32, %%rsp\n");
|
||||
fprintf(OutputFile, "\tcall\t%s\n", Entry->Name);
|
||||
// Deallocate arguments and stack space.
|
||||
if (Args > 4)
|
||||
fprintf(OutputFile, "\taddq\t$%d, %%rsp\n", (8 * (Args - 4)) + 32);
|
||||
else
|
||||
fprintf(OutputFile, "\taddq\t$32, %rsp\n");
|
||||
fprintf(OutputFile, "\taddq\t$32, %%rsp\n");
|
||||
|
||||
fprintf(OutputFile, "\tmovq\t%%rax, %s\n", Registers[OutRegister]);
|
||||
|
||||
|
|
1
tests/print.em
Normal file
1
tests/print.em
Normal file
|
@ -0,0 +1 @@
|
|||
int :: printf(char* fmt);
|
|
@ -1,4 +1,4 @@
|
|||
import "print.em"
|
||||
import "tests/print.em"
|
||||
|
||||
int :: main () {
|
||||
printf("%s\r\n", "hi there");
|
||||
|
|
Loading…
Reference in New Issue
Block a user