mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-06 05:48:40 +00:00
remove unused layout flag in section struct
This commit is contained in:
committed by
Ryan Fleury
parent
47ef37ed8e
commit
e971db7fdd
+47
-54
@@ -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,69 +3417,68 @@ 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 = §_n->data;
|
LNK_Section *sect = §_n->data;
|
||||||
if (sect->has_layout) {
|
|
||||||
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");
|
|
||||||
|
|
||||||
for (LNK_SectionContribChunk *sc_chunk = sect->contribs.first; sc_chunk != 0; sc_chunk = sc_chunk->next) {
|
str8_list_pushf(arena, &map, "%S\n", sect->name);
|
||||||
for (U64 sc_idx = 0; sc_idx < sc_chunk->count; sc_idx += 1) {
|
str8_list_pushf(arena, &map, "%-8s %-8s %-8s %-8s %-16s %-8s %s\n", "FileOff", "VirtOff", "VirtSize", "FileSize", "Blake3", "SC", "Source");
|
||||||
Temp temp = temp_begin(scratch.arena);
|
|
||||||
LNK_SectionContrib *sc = sc_chunk->v[sc_idx];
|
|
||||||
|
|
||||||
U64 file_off = image_section_table[sc->u.sect_idx]->foff + sc->u.off;
|
for (LNK_SectionContribChunk *sc_chunk = sect->contribs.first; sc_chunk != 0; sc_chunk = sc_chunk->next) {
|
||||||
U64 virt_off = image_section_table[sc->u.sect_idx]->voff + sc->u.off;
|
for (U64 sc_idx = 0; sc_idx < sc_chunk->count; sc_idx += 1) {
|
||||||
U64 virt_size = sc->u.size;
|
Temp temp = temp_begin(scratch.arena);
|
||||||
U64 file_size = sc->u.size;
|
LNK_SectionContrib *sc = sc_chunk->v[sc_idx];
|
||||||
String8 sc_data = str8_substr(image_data, rng_1u64(file_off, file_off + virt_size));
|
|
||||||
|
|
||||||
U128 sc_hash = {0};
|
U64 file_off = image_section_table[sc->u.sect_idx]->foff + sc->u.off;
|
||||||
if (~sect->flags & COFF_SectionFlag_CntUninitializedData) {
|
U64 virt_off = image_section_table[sc->u.sect_idx]->voff + sc->u.off;
|
||||||
blake3_hasher hasher; blake3_hasher_init(&hasher);
|
U64 virt_size = sc->u.size;
|
||||||
blake3_hasher_update(&hasher, sc_data.str, sc_data.size);
|
U64 file_size = sc->u.size;
|
||||||
blake3_hasher_finalize(&hasher, (U8 *)&sc_hash, sizeof(sc_hash));
|
String8 sc_data = str8_substr(image_data, rng_1u64(file_off, file_off + virt_size));
|
||||||
}
|
|
||||||
|
|
||||||
String8 file_off_str = push_str8f(temp.arena, "%08x", file_off);
|
U128 sc_hash = {0};
|
||||||
String8 virt_off_str = push_str8f(temp.arena, "%08x", virt_off);
|
if (~sect->flags & COFF_SectionFlag_CntUninitializedData) {
|
||||||
String8 virt_size_str = push_str8f(temp.arena, "%08x", virt_size);
|
blake3_hasher hasher; blake3_hasher_init(&hasher);
|
||||||
String8 file_size_str = push_str8f(temp.arena, "%08x", file_size);
|
blake3_hasher_update(&hasher, sc_data.str, sc_data.size);
|
||||||
String8 sc_hash_str = push_str8f(temp.arena, "%08x%08x", sc_hash.u64[0], sc_hash.u64[1]);
|
blake3_hasher_finalize(&hasher, (U8 *)&sc_hash, sizeof(sc_hash));
|
||||||
String8 sc_idx_str = push_str8f(temp.arena, "%llx", sc_idx);
|
}
|
||||||
String8 source_str;
|
|
||||||
{
|
String8 file_off_str = push_str8f(temp.arena, "%08x", file_off);
|
||||||
String8List source_list = {0};
|
String8 virt_off_str = push_str8f(temp.arena, "%08x", virt_off);
|
||||||
|
String8 virt_size_str = push_str8f(temp.arena, "%08x", virt_size);
|
||||||
|
String8 file_size_str = push_str8f(temp.arena, "%08x", file_size);
|
||||||
|
String8 sc_hash_str = push_str8f(temp.arena, "%08x%08x", sc_hash.u64[0], sc_hash.u64[1]);
|
||||||
|
String8 sc_idx_str = push_str8f(temp.arena, "%llx", sc_idx);
|
||||||
|
String8 source_str;
|
||||||
|
{
|
||||||
|
String8List source_list = {0};
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// location
|
// location
|
||||||
if (chunk->obj) {
|
if (chunk->obj) {
|
||||||
if (chunk->obj->lib_path.size) {
|
if (chunk->obj->lib_path.size) {
|
||||||
String8 lib_name = chunk->obj->lib_path;
|
String8 lib_name = chunk->obj->lib_path;
|
||||||
lib_name = str8_skip_last_slash(lib_name);
|
lib_name = str8_skip_last_slash(lib_name);
|
||||||
lib_name = str8_chop_last_dot(lib_name);
|
lib_name = str8_chop_last_dot(lib_name);
|
||||||
|
|
||||||
String8 obj_name = chunk->obj->path;
|
String8 obj_name = chunk->obj->path;
|
||||||
obj_name = str8_skip_last_slash(obj_name);
|
obj_name = str8_skip_last_slash(obj_name);
|
||||||
|
|
||||||
str8_list_pushf(temp.arena, &source_list, "%S:%S", lib_name, obj_name);
|
str8_list_pushf(temp.arena, &source_list, "%S:%S", lib_name, obj_name);
|
||||||
} else {
|
} else {
|
||||||
str8_list_push(temp.arena, &source_list, chunk->obj->path);
|
str8_list_push(temp.arena, &source_list, chunk->obj->path);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
str8_list_pushf(temp.arena, &source_list, "<no_loc>");
|
str8_list_pushf(temp.arena, &source_list, "<no_loc>");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// string join
|
// string join
|
||||||
source_str = str8_list_join(temp.arena, &source_list, &(StringJoin){.sep=str8_lit(" ")});
|
source_str = str8_list_join(temp.arena, &source_list, &(StringJoin){.sep=str8_lit(" ")});
|
||||||
}
|
|
||||||
|
|
||||||
str8_list_pushf(arena, &map, "%-8S %-8S %-8S %-8S %-16S %-8S %S\n", file_off_str, virt_off_str, virt_size_str, file_size_str, sc_hash, sc_idx_str, source_str);
|
|
||||||
|
|
||||||
temp_end(temp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
str8_list_pushf(arena, &map, "%-8S %-8S %-8S %-8S %-16S %-8S %S\n", file_off_str, virt_off_str, virt_size_str, file_size_str, sc_hash, sc_idx_str, source_str);
|
||||||
|
|
||||||
|
temp_end(temp);
|
||||||
}
|
}
|
||||||
str8_list_pushf(arena, &map, "\n");
|
|
||||||
}
|
}
|
||||||
|
str8_list_pushf(arena, &map, "\n");
|
||||||
}
|
}
|
||||||
ProfEnd();
|
ProfEnd();
|
||||||
|
|
||||||
|
|||||||
@@ -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 = §ab->list;
|
LNK_SectionList *sect_list = §ab->list;
|
||||||
SLLQueuePush(sect_list->first, sect_list->last, sect_node);
|
SLLQueuePush(sect_list->first, sect_list->last, sect_node);
|
||||||
@@ -396,11 +395,9 @@ 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] = §_node->data;
|
||||||
result.v[result.count] = §_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;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user