From ee75ada087572d2483c4226329e56b7ea21710ea Mon Sep 17 00:00:00 2001 From: Nikita Smith Date: Wed, 17 Sep 2025 16:43:39 -0700 Subject: [PATCH] mark function override meta-data sections with link info flag so they do not get a section definition --- src/linker/lnk_obj.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/linker/lnk_obj.c b/src/linker/lnk_obj.c index aa3362d7..7a8e1a88 100644 --- a/src/linker/lnk_obj.c +++ b/src/linker/lnk_obj.c @@ -261,15 +261,24 @@ THREAD_POOL_TASK_FUNC(lnk_obj_initer) } // - // mark debug info sections + // mark sections // { for EachIndex(sect_idx, header.section_count_no_null) { COFF_SectionHeader *sect_header = &coff_section_table[sect_idx]; - String8 sect_name = str8_cstring_capped(sect_header->name, sect_header->name + sizeof(sect_header->name)); + String8 sect_name = coff_name_from_section_header(raw_coff_string_table, sect_header); + + // debug info if (str8_starts_with(sect_name, str8_lit(".debug$"))) { sect_header->flags |= LNK_SECTION_FLAG_DEBUG; } + + // function overrides + if (str8_ends_with(sect_name, str8_lit("$fo$"), 0) || + str8_ends_with(sect_name, str8_lit("$fo_rvas$"), 0) || + str8_ends_with(sect_name, str8_lit("$fo_bdd$"), 0)) { + sect_header->flags |= COFF_SectionFlag_LnkInfo; + } } }