From 610c45e3e13cf00b60f1c1462a961bd878c744f4 Mon Sep 17 00:00:00 2001 From: Curle Date: Mon, 14 Sep 2020 02:08:14 +0100 Subject: [PATCH] Adjust ASM generation to account for c11 pointer arithmetic standards --- src/Assembler.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Assembler.c b/src/Assembler.c index 5ee92c3..bd7adf8 100644 --- a/src/Assembler.c +++ b/src/Assembler.c @@ -449,8 +449,16 @@ void AsNewSymb(int ID) { TypeSize = PrimitiveSize(Symbols[ID].Type); - fprintf(OutputFile, "\t.comm\t%s, %d, %d\n", Symbols[ID].Name, TypeSize, TypeSize); + fprintf(OutputFile, "\t.data\n" + "\t.globl\t%s\n", + Symbols[ID].Name); + switch(TypeSize) { + case 1: fprintf(OutputFile, "%s:\t.byte\t0\n", Symbols[ID].Name); + case 4: fprintf(OutputFile, "%s:\t.long\t0\n", Symbols[ID].Name); + case 8: fprintf(OutputFile, "%s:\t.quad\t0\n", Symbols[ID].Name); + default: DieDecimal("Unknown type in AsNewSymbol", TypeSize); + } } int AsCall(int Register, int FuncID) {