rename import table regular -> static

This commit is contained in:
Nikita Smith
2024-10-19 14:52:38 -07:00
parent 800a2349e5
commit d5c2e50e9a
3 changed files with 15 additions and 15 deletions
+7 -7
View File
@@ -3257,7 +3257,7 @@ l.count += 1; \
// state
LNK_SymbolTable *symtab = lnk_symbol_table_alloc_ex(config->symbol_table_cap_defined, config->symbol_table_cap_internal, config->symbol_table_cap_weak, config->symbol_table_cap_lib);
LNK_SectionTable *st = lnk_init_section_table(symtab, config->section_virt_off, config->sect_align, config->file_align);
LNK_ImportTable *imptab_regular = 0;
LNK_ImportTable *imptab_static = 0;
LNK_ImportTable *imptab_delayed = 0;
LNK_ExportTable *exptab = lnk_export_table_alloc();
HashTable *disallow_lib_ht = hash_table_init(scratch.arena, 0x100);
@@ -3560,17 +3560,17 @@ l.count += 1; \
func = lnk_import_table_push_func_delayed(imptab_delayed, symtab, dll, import_header);
}
} else {
if (!imptab_regular) {
if (!imptab_static) {
Assert(config->machine != COFF_MachineType_UNKNOWN);
imptab_regular = lnk_import_table_alloc_regular(st, symtab, config->machine);
imptab_static = lnk_import_table_alloc_static(st, symtab, config->machine);
}
LNK_ImportDLL *dll = lnk_import_table_search_dll(imptab_regular, import_header->dll_name);
LNK_ImportDLL *dll = lnk_import_table_search_dll(imptab_static, import_header->dll_name);
if (!dll) {
dll = lnk_import_table_push_dll_regular(imptab_regular, symtab, import_header->dll_name, import_header->machine);
dll = lnk_import_table_push_dll_static(imptab_static, symtab, import_header->dll_name, import_header->machine);
}
LNK_ImportFunc *func = lnk_import_table_search_func(dll, import_header->func_name);
if (!func) {
func = lnk_import_table_push_func_regular(imptab_regular, symtab, dll, import_header);
func = lnk_import_table_push_func_static(imptab_static, symtab, dll, import_header);
}
}
}
@@ -4394,7 +4394,7 @@ l.count += 1; \
//lnk_section_table_release(&st);
//lnk_symbol_table_release(&symtab);
//lnk_export_table_release(&export_table);
//lnk_import_table_release(&imptab_regular);
//lnk_import_table_release(&imptab_static);
//lnk_import_table_release(&imptab_delayed);
//tp_arena_release(&tp_arena);
+5 -5
View File
@@ -2,7 +2,7 @@
// Licensed under the MIT license (https://opensource.org/license/mit/)
internal LNK_ImportTable *
lnk_import_table_alloc_regular(LNK_SectionTable *st, LNK_SymbolTable *symtab, COFF_MachineType machine)
lnk_import_table_alloc_static(LNK_SectionTable *st, LNK_SymbolTable *symtab, COFF_MachineType machine)
{
ProfBeginFunction();
@@ -178,7 +178,7 @@ lnk_import_table_search_func(LNK_ImportDLL *dll, String8 name)
}
internal LNK_ImportDLL *
lnk_import_table_push_dll_regular(LNK_ImportTable *imptab, LNK_SymbolTable *symtab, String8 dll_name, COFF_MachineType machine)
lnk_import_table_push_dll_static(LNK_ImportTable *imptab, LNK_SymbolTable *symtab, String8 dll_name, COFF_MachineType machine)
{
ProfBeginFunction();
@@ -401,7 +401,7 @@ lnk_import_table_push_dll_delayed(LNK_ImportTable *imptab, LNK_SymbolTable *symt
}
internal LNK_ImportFunc *
lnk_import_table_push_func_regular(LNK_ImportTable *imptab, LNK_SymbolTable *symtab, LNK_ImportDLL *dll, COFF_ImportHeader *header)
lnk_import_table_push_func_static(LNK_ImportTable *imptab, LNK_SymbolTable *symtab, LNK_ImportDLL *dll, COFF_ImportHeader *header)
{
ProfBeginFunction();
@@ -438,7 +438,7 @@ lnk_import_table_push_func_regular(LNK_ImportTable *imptab, LNK_SymbolTable *sym
LNK_Chunk *int_chunk = lnk_section_push_chunk_data(data_sect, int_table_chunk, int_data, str8_zero());
// create symbol for lookup chunk
String8 int_symbol_name = push_str8f(symtab->arena, "regular.%S.%S.name", dll->name, header->func_name);
String8 int_symbol_name = push_str8f(symtab->arena, "static.%S.%S.name", dll->name, header->func_name);
LNK_Symbol *int_symbol = lnk_make_defined_symbol_chunk(symtab->arena, int_symbol_name, LNK_DefinedSymbolVisibility_Internal, 0, int_chunk, 0, 0, 0);
lnk_symbol_table_push(symtab, int_symbol);
@@ -464,7 +464,7 @@ lnk_import_table_push_func_regular(LNK_ImportTable *imptab, LNK_SymbolTable *sym
} break;
}
String8 ilt_symbol_name = push_str8f(symtab->arena, "regular.%S.%S.ilt", dll->name, header->func_name);
String8 ilt_symbol_name = push_str8f(symtab->arena, "static.%S.%S.ilt", dll->name, header->func_name);
String8 iat_symbol_name = push_str8f(symtab->arena, "__imp_%S", header->func_name);
LNK_Symbol *ilt_symbol = lnk_make_defined_symbol_chunk(symtab->arena, ilt_symbol_name, LNK_DefinedSymbolVisibility_Internal, 0, ilt_chunk, 0, 0, 0);
LNK_Symbol *iat_symbol = lnk_make_defined_symbol_chunk(symtab->arena, iat_symbol_name, LNK_DefinedSymbolVisibility_Extern, 0, iat_chunk, 0, 0, 0);
+3 -3
View File
@@ -59,12 +59,12 @@ typedef struct LNK_ImportTable
HashTable *dll_ht;
} LNK_ImportTable;
internal LNK_ImportTable * lnk_import_table_alloc_regular(LNK_SectionTable *st, LNK_SymbolTable *symtab, COFF_MachineType machine);
internal LNK_ImportTable * lnk_import_table_alloc_static(LNK_SectionTable *st, LNK_SymbolTable *symtab, COFF_MachineType machine);
internal LNK_ImportTable * lnk_import_table_alloc_delayed(LNK_SectionTable *st, LNK_SymbolTable *symtab, COFF_MachineType machine, B32 is_unloadable, B32 is_bindable);
internal void lnk_import_table_release(LNK_ImportTable **imptab);
internal LNK_ImportDLL * lnk_import_table_push_dll_regular(LNK_ImportTable *imptab, LNK_SymbolTable *symtab, String8 dll_name, COFF_MachineType machine);
internal LNK_ImportDLL * lnk_import_table_push_dll_static(LNK_ImportTable *imptab, LNK_SymbolTable *symtab, String8 dll_name, COFF_MachineType machine);
internal LNK_ImportDLL * lnk_import_table_push_dll_delayed(LNK_ImportTable *imptab, LNK_SymbolTable *symtab, String8 dll_name, COFF_MachineType machine);
internal LNK_ImportFunc * lnk_import_table_push_func_regular(LNK_ImportTable *imptab, LNK_SymbolTable *symtab, LNK_ImportDLL *dll, COFF_ImportHeader *header);
internal LNK_ImportFunc * lnk_import_table_push_func_static(LNK_ImportTable *imptab, LNK_SymbolTable *symtab, LNK_ImportDLL *dll, COFF_ImportHeader *header);
internal LNK_ImportFunc * lnk_import_table_push_func_delayed(LNK_ImportTable *imptab, LNK_SymbolTable *symtab, LNK_ImportDLL *dll, COFF_ImportHeader *header);
internal LNK_ImportDLL * lnk_import_table_search_dll(LNK_ImportTable *imptab, String8 name);
internal LNK_ImportFunc * lnk_import_table_search_func(LNK_ImportDLL *dll, String8 name);