From ccc03251e8ac39e57ae63c1c33cd5ab8829bd7bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Tup=C3=BD?= Date: Thu, 1 Feb 2024 13:18:18 +0100 Subject: [PATCH] Fixed minor ELF emitter bugs. --- source/compiler/test/main.s | 13 ++----------- .../target/outputs/elf.cpp | 4 ++-- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/source/compiler/test/main.s b/source/compiler/test/main.s index da4b9d20..34185203 100644 --- a/source/compiler/test/main.s +++ b/source/compiler/test/main.s @@ -12,18 +12,9 @@ // - implicit returns for non-void functions should be a thing i32 main() { - i32*** memory = cast(malloc(100)); + u64 a = 100; - memory[0] = cast(malloc(100)); - memory[1] = cast(malloc(100)); - - memory[0, 0] = cast(malloc(100)); - memory[1, 0] = cast(malloc(100)); - - memory[0, 0, 0] = 1; - memory[1, 0, 0] = 2; - - printf("%d %d\n", memory[0, 0, 0], memory[1, 0, 0]); + printf("value: %lld\n", a); ret 0; } diff --git a/source/intermediate_representation/target/outputs/elf.cpp b/source/intermediate_representation/target/outputs/elf.cpp index 03728582..8c3c2401 100644 --- a/source/intermediate_representation/target/outputs/elf.cpp +++ b/source/intermediate_representation/target/outputs/elf.cpp @@ -101,7 +101,7 @@ namespace sigma::ir { string_table.append_string_nt(".symtab"); // initialize the strtab - elf64_s_header strtab; + elf64_s_header strtab{}; strtab.name = static_cast(string_table.get_size()); string_table.append_string_nt(".strtab"); @@ -115,7 +115,7 @@ namespace sigma::ir { output_size += string_table.get_size(); // initialize the symtab - elf64_s_header symtab; + elf64_s_header symtab{}; symtab.name = symbol_table_name; symtab.type = SHT_SYMTAB;