remove unused layout flag in section struct

This commit is contained in:
Nikita Smith
2025-06-25 10:53:24 -07:00
committed by Ryan Fleury
parent 47ef37ed8e
commit e971db7fdd
3 changed files with 50 additions and 61 deletions
+1 -8
View File
@@ -1999,9 +1999,6 @@ lnk_build_win32_header(Arena *arena, LNK_SymbolTable *symtab, LNK_Config *config
U64 sizeof_image = 0; U64 sizeof_image = 0;
for (U64 sect_idx = 0; sect_idx < sects.count; sect_idx += 1) { for (U64 sect_idx = 0; sect_idx < sects.count; sect_idx += 1) {
LNK_Section *sect = sects.v[sect_idx]; LNK_Section *sect = sects.v[sect_idx];
if ( ! sect->has_layout) {
continue;
}
if (code_base == 0 && sect->flags & COFF_SectionFlag_CntCode) { if (code_base == 0 && sect->flags & COFF_SectionFlag_CntCode) {
code_base = sect->voff; code_base = sect->voff;
} }
@@ -2091,9 +2088,6 @@ lnk_build_win32_header(Arena *arena, LNK_SymbolTable *symtab, LNK_Config *config
{ {
for (U64 sect_idx = 0; sect_idx < sects.count; sect_idx += 1) { for (U64 sect_idx = 0; sect_idx < sects.count; sect_idx += 1) {
LNK_Section *sect = sects.v[sect_idx]; LNK_Section *sect = sects.v[sect_idx];
if (!sect->has_layout) {
continue;
}
COFF_SectionHeader *coff_section = &coff_section_table[sect_idx]; COFF_SectionHeader *coff_section = &coff_section_table[sect_idx];
@@ -3423,7 +3417,7 @@ lnk_build_rad_chunk_map(Arena *arena, String8 image_data, U64 thread_count, LNK_
str8_list_pushf(arena, &map, "# SECTIONS\n"); str8_list_pushf(arena, &map, "# SECTIONS\n");
for (LNK_SectionNode *sect_n = sectab->list.first; sect_n != 0; sect_n = sect_n->next) { for (LNK_SectionNode *sect_n = sectab->list.first; sect_n != 0; sect_n = sect_n->next) {
LNK_Section *sect = &sect_n->data; LNK_Section *sect = &sect_n->data;
if (sect->has_layout) {
str8_list_pushf(arena, &map, "%S\n", sect->name); str8_list_pushf(arena, &map, "%S\n", sect->name);
str8_list_pushf(arena, &map, "%-8s %-8s %-8s %-8s %-16s %-8s %s\n", "FileOff", "VirtOff", "VirtSize", "FileSize", "Blake3", "SC", "Source"); str8_list_pushf(arena, &map, "%-8s %-8s %-8s %-8s %-16s %-8s %s\n", "FileOff", "VirtOff", "VirtSize", "FileSize", "Blake3", "SC", "Source");
@@ -3486,7 +3480,6 @@ lnk_build_rad_chunk_map(Arena *arena, String8 image_data, U64 thread_count, LNK_
} }
str8_list_pushf(arena, &map, "\n"); str8_list_pushf(arena, &map, "\n");
} }
}
ProfEnd(); ProfEnd();
-3
View File
@@ -184,7 +184,6 @@ lnk_section_table_push(LNK_SectionTable *sectab, String8 name, COFF_SectionFlags
sect->id = sectab->id_max++; sect->id = sectab->id_max++;
sect->name = push_str8_copy(sectab->arena, name); sect->name = push_str8_copy(sectab->arena, name);
sect->flags = flags; sect->flags = flags;
sect->has_layout = 1;
LNK_SectionList *sect_list = &sectab->list; LNK_SectionList *sect_list = &sectab->list;
SLLQueuePush(sect_list->first, sect_list->last, sect_node); SLLQueuePush(sect_list->first, sect_list->last, sect_node);
@@ -396,12 +395,10 @@ lnk_section_table_get_output_sections(Arena *arena, LNK_SectionTable *sectab)
result.v = push_array(arena, LNK_Section *, sectab->list.count); result.v = push_array(arena, LNK_Section *, sectab->list.count);
for (LNK_SectionNode *sect_node = sectab->list.first; sect_node != 0; sect_node = sect_node->next) { for (LNK_SectionNode *sect_node = sectab->list.first; sect_node != 0; sect_node = sect_node->next) {
if (sect_node->data.has_layout) {
Assert(result.count < sectab->list.count); Assert(result.count < sectab->list.count);
result.v[result.count] = &sect_node->data; result.v[result.count] = &sect_node->data;
result.count += 1; result.count += 1;
} }
}
U64 unused_entry_count = sectab->list.count - result.count; U64 unused_entry_count = sectab->list.count - result.count;
arena_pop(arena, unused_entry_count * sizeof(result.v[0])); arena_pop(arena, unused_entry_count * sizeof(result.v[0]));
-1
View File
@@ -64,7 +64,6 @@ typedef struct LNK_Section
U64 id; U64 id;
String8 name; String8 name;
COFF_SectionFlags flags; COFF_SectionFlags flags;
B32 has_layout;
B32 is_merged; B32 is_merged;
U64 merge_id; U64 merge_id;
LNK_SectionContribChunkList contribs; LNK_SectionContribChunkList contribs;