Skip to content

Commit

Permalink
Fixed minor ELF emitter bugs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Goubermouche committed Feb 1, 2024
1 parent cf1561f commit ccc0325
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
13 changes: 2 additions & 11 deletions source/compiler/test/main.s
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,9 @@
// - implicit returns for non-void functions should be a thing

i32 main() {
i32*** memory = cast<i32***>(malloc(100));
u64 a = 100;

memory[0] = cast<i32**>(malloc(100));
memory[1] = cast<i32**>(malloc(100));

memory[0, 0] = cast<i32*>(malloc(100));
memory[1, 0] = cast<i32*>(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;
}

Expand Down
4 changes: 2 additions & 2 deletions source/intermediate_representation/target/outputs/elf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<u32>(string_table.get_size());
string_table.append_string_nt(".strtab");
Expand All @@ -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;
Expand Down

0 comments on commit ccc0325

Please sign in to comment.