Skip to content

Commit 6612f4a

Browse files
hash image only when we have debug info building
1 parent e65bc12 commit 6612f4a

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

src/linker/lnk.c

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4087,20 +4087,24 @@ lnk_run(int argc, char **argv)
40874087
ProfEnd();
40884088
}
40894089

4090-
switch (config->guid_type) {
4091-
case LNK_DebugInfoGuid_Null: break;
4092-
case Lnk_DebugInfoGuid_ImageBlake3: {
4093-
ProfBegin("Hash Image With Blake3");
4094-
LNK_Symbol *guid_symbol = lnk_symbol_table_searchf(symtab, LNK_SymbolScopeFlag_Internal, LNK_CV_HEADER_GUID_SYMBOL_NAME);
4095-
U64 guid_foff = lnk_file_off_from_symbol(sect_id_map, guid_symbol);
4090+
LNK_Symbol *guid_symbol = lnk_symbol_table_searchf(symtab, LNK_SymbolScopeFlag_Internal, LNK_CV_HEADER_GUID_SYMBOL_NAME);
4091+
if (guid_symbol) {
4092+
Assert(build_debug_info);
40964093

4097-
U128 hash = lnk_blake3_hash_parallel(tp, 128, image_data);
4094+
switch (config->guid_type) {
4095+
case LNK_DebugInfoGuid_Null: break;
4096+
case Lnk_DebugInfoGuid_ImageBlake3: {
4097+
ProfBegin("Hash Image With Blake3");
40984098

4099-
OS_Guid *guid_ptr = (OS_Guid *)(image_data.str + guid_foff);
4100-
MemoryCopy(guid_ptr, hash.u64, sizeof(hash.u64));
4099+
U128 hash = lnk_blake3_hash_parallel(tp, 128, image_data);
41014100

4102-
ProfEnd();
4103-
} break;
4101+
U64 guid_foff = lnk_file_off_from_symbol(sect_id_map, guid_symbol);
4102+
OS_Guid *guid_ptr = (OS_Guid *)(image_data.str + guid_foff);
4103+
MemoryCopy(guid_ptr, hash.u64, sizeof(hash.u64));
4104+
4105+
ProfEnd();
4106+
} break;
4107+
}
41044108
}
41054109

41064110
LNK_WriteThreadContext *ctx = push_array(scratch.arena, LNK_WriteThreadContext, 1);

0 commit comments

Comments
 (0)