coff section definition for big obj

This commit is contained in:
Nikita Smith
2024-11-07 11:54:24 -08:00
parent 7bb88f480e
commit 27cd7a21a3
2 changed files with 14 additions and 10 deletions
+10 -8
View File
@@ -97,15 +97,17 @@ coff_header_info_from_data(String8 data)
COFF_HeaderInfo info = {0}; COFF_HeaderInfo info = {0};
if (coff_is_big_obj(data)) { if (coff_is_big_obj(data)) {
COFF_HeaderBigObj *big_header = (COFF_HeaderBigObj*)data.str; COFF_HeaderBigObj *big_header = (COFF_HeaderBigObj*)data.str;
info.machine = big_header->machine; info.type = COFF_DataType_BIG_OBJ;
info.section_array_off = sizeof(COFF_HeaderBigObj); info.machine = big_header->machine;
info.section_count_no_null = big_header->section_count; info.section_array_off = sizeof(COFF_HeaderBigObj);
info.string_table_off = big_header->pointer_to_symbol_table + sizeof(COFF_Symbol32) * big_header->number_of_symbols; info.section_count_no_null = big_header->section_count;
info.symbol_size = sizeof(COFF_Symbol32); info.string_table_off = big_header->pointer_to_symbol_table + sizeof(COFF_Symbol32) * big_header->number_of_symbols;
info.symbol_off = big_header->pointer_to_symbol_table; info.symbol_size = sizeof(COFF_Symbol32);
info.symbol_count = big_header->number_of_symbols; info.symbol_off = big_header->pointer_to_symbol_table;
info.symbol_count = big_header->number_of_symbols;
} else if (coff_is_obj(data)) { } else if (coff_is_obj(data)) {
COFF_Header *header = (COFF_Header*)data.str; COFF_Header *header = (COFF_Header*)data.str;
info.type = COFF_DataType_OBJ;
info.machine = header->machine; info.machine = header->machine;
info.section_array_off = sizeof(COFF_Header); info.section_array_off = sizeof(COFF_Header);
info.section_count_no_null = header->section_count; info.section_count_no_null = header->section_count;
+4 -2
View File
@@ -522,9 +522,10 @@ typedef struct COFF_SymbolSecDef
U16 number_of_relocations; U16 number_of_relocations;
U16 number_of_ln; U16 number_of_ln;
U32 check_sum; U32 check_sum;
U16 number; // one-based section index U16 number_lo; // one-based section index
U8 selection; U8 selection;
U8 unused[3]; U8 unused;
U16 number_hi;
} COFF_SymbolSecDef; } COFF_SymbolSecDef;
// specifies how section data should be modified when placed in the image file. // specifies how section data should be modified when placed in the image file.
@@ -682,6 +683,7 @@ typedef U32 COFF_DataType;
typedef struct COFF_HeaderInfo typedef struct COFF_HeaderInfo
{ {
COFF_MachineType machine; COFF_MachineType machine;
COFF_DataType type;
U64 section_array_off; U64 section_array_off;
U64 section_count_no_null; U64 section_count_no_null;
U64 string_table_off; U64 string_table_off;