add /RAD_REMOVE_SECTION switch and special case debug sections

This commit is contained in:
Nikita Smith
2025-06-25 10:53:23 -07:00
committed by Ryan Fleury
parent 9c59cfd4e7
commit 89e2ea15ad
7 changed files with 116 additions and 69 deletions
+14 -10
View File
@@ -420,6 +420,20 @@ lnk_coff_section_header_from_section_number(LNK_Obj *obj, U64 section_number)
return section_header;
}
internal B32
lnk_is_coff_section_debug(LNK_Obj *obj, U64 sect_idx)
{
String8 string_table = str8_substr(obj->data, obj->header.string_table_range);
COFF_SectionHeader *section_header = lnk_coff_section_header_from_section_number(obj, sect_idx+1);
String8 full_name = coff_name_from_section_header(string_table, section_header);
String8 name, postfix;
coff_parse_section_name(full_name, &name, &postfix);
B32 is_debug = str8_match(name, str8_lit(".debug"), 0);
return is_debug;
}
internal COFF_ParsedSymbol
lnk_parsed_symbol_from_coff_symbol_idx(LNK_Obj *obj, U64 symbol_idx)
{
@@ -436,16 +450,6 @@ lnk_parsed_symbol_from_coff_symbol_idx(LNK_Obj *obj, U64 symbol_idx)
return result;
}
internal COFF_SectionHeader *
lnk_section_header_from_section_number(LNK_Obj *obj, U64 section_number)
{
COFF_SectionHeader *section_table = (COFF_SectionHeader *)str8_substr(obj->data, obj->header.section_table_range).str;
if (section_number > 0 && section_number <= obj->header.section_count_no_null) {
return &section_table[section_number-1];
}
return 0;
}
internal
THREAD_POOL_TASK_FUNC(lnk_collect_obj_chunks_task)
{