fixup symbol tree offsets in module stream

This commit is contained in:
Nikita Smith
2026-04-06 12:04:32 -07:00
parent acce76aa4c
commit 46243548f3
+17 -16
View File
@@ -2129,29 +2129,30 @@ THREAD_POOL_TASK_FUNC(lnk_write_pdb_modules)
U64 pos = 0; U64 pos = 0;
lnk_write_debug_s_to_pdb_module(mod, debug_s, &buf, &pos); lnk_write_debug_s_to_pdb_module(mod, debug_s, &buf, &pos);
// patch symbol offsets // sub range symbol data pages and patch symbol tree offsets
//cv_patch_symbol_tree_offsets_new(dummy, sizeof(CV_Signature), PDB_SYMBOL_ALIGN); String8List mod_symbols = str8_list_substr(temp.arena, mod_pages, r1u64(sizeof(CV_Signature), sizeof(CV_Signature) + mod->sym_data_size));
cv_patch_symbol_tree_offsets_new(mod_symbols, sizeof(CV_Signature), PDB_SYMBOL_ALIGN);
temp_end(temp); temp_end(temp);
} }
barrier_wait(tp->barrier); barrier_wait(tp->barrier);
#if 0 for EachIndex(i, obj_indices.count) {
// parse checksum data U64 obj_idx = obj_indices.v[i];
String8List checksum_data = cv_sub_section_from_debug_s(debug_s, CV_C13SubSectionKind_FileChksms); CV_DebugS debug_s = task->cv->debug_s_arr[obj_idx];
CV_ChecksumList checksum_list = cv_c13_parse_checksum_data_list(scratch.arena, checksum_data); String8 string_table = cv_string_table_from_debug_s(debug_s);
String8List file_chksms_raw = cv_sub_section_from_debug_s(debug_s, CV_C13SubSectionKind_FileChksms);
CV_ChecksumList file_chksms = cv_c13_parse_checksum_data_list(scratch.arena, file_chksms_raw);
String8List src_file_names = cv_c13_collect_source_file_names(arena, file_chksms, string_table);
// get strings sub-section // collect source files module refs
String8 string_data = cv_string_table_from_debug_s(debug_s); str8_list_concat_in_place(&task->mod_arr[obj_idx]->source_file_list, &src_file_names);
// collect source file names from checksum headers // patch path offsets in file checksum headers (in obj the offsets point to a string table in .debug$S,
String8List source_file_names_list = cv_c13_collect_source_file_names(arena, checksum_list, string_data); // and because linker merges string tables the old offsets need to be fixed up)
PDB_DbiModule *mod = task->mod_arr[obj_idx]; cv_c13_patch_string_offsets_in_checksum_list(file_chksms, string_table, task->pdb->info->strtab.size, task->string_ht);
str8_list_concat_in_place(&mod->source_file_list, &source_file_names_list); }
barrier_wait(tp->barrier);
// relocate checksum data
cv_c13_patch_string_offsets_in_checksum_list(checksum_list, string_data, task->pdb->info->strtab.size, task->string_ht);
#endif
scratch_end(scratch); scratch_end(scratch);
} }