From 89f4e7a8dbed4272f85f10568a542697aa3b38f8 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Mon, 13 Aug 2018 01:22:14 +0100 Subject: `-no-crt` flag for windows amd64 --- src/ir_print.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/ir_print.cpp') diff --git a/src/ir_print.cpp b/src/ir_print.cpp index ac1c20d90..46d351c8f 100644 --- a/src/ir_print.cpp +++ b/src/ir_print.cpp @@ -1737,6 +1737,15 @@ void print_llvm_ir(irGen *ir) { } } + if (ir->print_chkstk) { + // TODO(bill): Clean up this code + ir_write_str_lit(f, "\n\n"); + ir_write_str_lit(f, "define void @__chkstk() #0 {\n"); + ir_write_str_lit(f, "\tcall void asm sideeffect \"push %rcx \\09\\0Apush %rax \\09\\0Acmp $$0x1000,%rax \\09\\0Alea 24(%rsp),%rcx \\09\\0Ajb 1f \\09\\0A2: \\09\\0Asub $$0x1000,%rcx \\09\\0Aorl $$0,(%rcx) \\09\\0Asub $$0x1000,%rax \\09\\0Acmp $$0x1000,%rax \\09\\0Aja 2b \\09\\0A1: \\09\\0Asub %rax,%rcx \\09\\0Aorl $$0,(%rcx) \\09\\0Apop %rax \\09\\0Apop %rcx \\09\\0Aret \\09\\0A\", \"~{dirflag},~{fpsr},~{flags}\"()\n"); + ir_write_str_lit(f, "\tret void\n"); + ir_write_str_lit(f, "}\n\n"); + } + // NOTE(bill): Print procedures with bodies next for_array(member_index, m->members.entries) { auto *entry = &m->members.entries[member_index]; -- cgit v1.2.3