diff --git a/src/compiler/Compiler.c b/src/compiler/Compiler.c index 7a1ee32..1b7e649 100644 --- a/src/compiler/Compiler.c +++ b/src/compiler/Compiler.c @@ -148,10 +148,6 @@ static bool compileBinary(Compiler* cmp){ for(u32 i = 0; i < cmp->binary.section_list.len; i++){ CompiledSection* sec = &cmp->binary.section_list.data[i]; total_size += sec->bytes.len; - if(str_equals(sec->name, main_sec_name)) - continue; - prev_sec->next = sec; - sec->offset = prev_sec->offset + prev_sec->bytes.len; ConstDataProps cd = ConstDataProps_construct(sec->name, sec->bytes.len, sec->offset); if(!HashMap_ConstDataProps_tryPush(&cmp->binary.const_data_map, cd.name, cd)){ @@ -165,6 +161,10 @@ static bool compileBinary(Compiler* cmp){ } } + if(str_equals(sec->name, main_sec_name)) + continue; + prev_sec->next = sec; + sec->offset = prev_sec->offset + prev_sec->bytes.len; prev_sec = sec; }