mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-13 07:32:23 -07:00
promote section definition number to 32-bit when linking big obj
This commit is contained in:
+3
-2
@@ -760,9 +760,10 @@ lnk_make_res_obj(TP_Context *tp,
|
||||
coff_sect_symbol.aux_symbol_count = 1;
|
||||
coff_sect_symbol.storage_class = COFF_SymStorageClass_STATIC;
|
||||
|
||||
Assert(sect->isect <= max_U16);
|
||||
COFF_SymbolSecDef secdef = {0};
|
||||
secdef.length = safe_cast_u32(sect_size);
|
||||
secdef.number = sect->isect;
|
||||
secdef.number_lo = sect->isect;
|
||||
secdef.number_of_relocations = safe_cast_u32(reloc_count);
|
||||
|
||||
coff_symbol16_list_push(scratch.arena, &coff_symbol_list, coff_sect_symbol);
|
||||
@@ -3279,7 +3280,7 @@ l.count += 1; \
|
||||
B32 build_win32_header = 1;
|
||||
B32 patch_relocs = 1;
|
||||
B32 sort_exception_info = 1;
|
||||
B32 build_imp_lib = 1; //config->build_imp_lib;
|
||||
B32 build_imp_lib = config->build_imp_lib;
|
||||
LNK_ObjList obj_list = {0};
|
||||
LNK_LibList lib_index[LNK_InputSource_Count] = {0};
|
||||
String8 image_data = str8_zero();
|
||||
|
||||
@@ -481,7 +481,7 @@ lnk_op_list_from_chunk(Arena *arena, LNK_Chunk *root, U64 total_chunk_count, U8
|
||||
frame->chunk_array = *chunk->u.arr;
|
||||
frame->ichunk = 0;
|
||||
SLLStackPush(stack, frame);
|
||||
} goto yeild;
|
||||
} goto _continue;
|
||||
|
||||
case LNK_Chunk_List: {
|
||||
// balance ops at :end_chunk_series
|
||||
@@ -507,7 +507,7 @@ lnk_op_list_from_chunk(Arena *arena, LNK_Chunk *root, U64 total_chunk_count, U8
|
||||
frame->chunk_array = chunk_array;
|
||||
frame->ichunk = 0;
|
||||
SLLStackPush(stack, frame);
|
||||
} goto yeild;
|
||||
} goto _continue;
|
||||
|
||||
case LNK_Chunk_Null: { /* ignore */ } break;
|
||||
}
|
||||
@@ -530,7 +530,7 @@ lnk_op_list_from_chunk(Arena *arena, LNK_Chunk *root, U64 total_chunk_count, U8
|
||||
// move to next frame
|
||||
SLLStackPop(stack);
|
||||
|
||||
yeild:;
|
||||
_continue:;
|
||||
}
|
||||
|
||||
scratch_end(scratch);
|
||||
|
||||
+14
-2
@@ -417,7 +417,8 @@ THREAD_POOL_TASK_FUNC(lnk_obj_initer)
|
||||
lnk_chunk_set_debugf(arena, master_common_block, "%S: master common block", path);
|
||||
|
||||
// convert from coff
|
||||
LNK_SymbolArray symbol_arr = lnk_symbol_array_from_coff(arena, input->data, obj, cached_path, coff_info.string_table_off, coff_info.section_count_no_null, coff_sect_arr, coff_symbols, chunk_arr, master_common_block);
|
||||
B32 is_big_obj = coff_info.type == COFF_DataType_BIG_OBJ;
|
||||
LNK_SymbolArray symbol_arr = lnk_symbol_array_from_coff(arena, input->data, obj, cached_path, is_big_obj, coff_info.string_table_off, coff_info.section_count_no_null, coff_sect_arr, coff_symbols, chunk_arr, master_common_block);
|
||||
LNK_SymbolList symbol_list = lnk_symbol_list_from_array(arena, symbol_arr);
|
||||
LNK_RelocList *reloc_list_arr = lnk_reloc_list_array_from_coff(arena, coff_info.machine, input->data, coff_info.section_count_no_null, coff_sect_arr, chunk_arr, symbol_arr);
|
||||
|
||||
@@ -715,6 +716,7 @@ lnk_symbol_array_from_coff(Arena *arena,
|
||||
String8 coff_data,
|
||||
LNK_Obj *obj,
|
||||
String8 obj_path,
|
||||
B32 is_big_obj,
|
||||
U64 string_table_off,
|
||||
U64 sect_count,
|
||||
COFF_SectionHeader *coff_sect_arr,
|
||||
@@ -774,7 +776,17 @@ lnk_symbol_array_from_coff(Arena *arena,
|
||||
check_sum = secdef->check_sum;
|
||||
|
||||
if (secdef->selection == COFF_ComdatSelectType_ASSOCIATIVE) {
|
||||
LNK_Chunk *head_chunk = &chunk_arr[secdef->number - 1];
|
||||
U32 secdef_number = secdef->number_lo;
|
||||
if (is_big_obj) {
|
||||
secdef_number |= (U32)secdef->number_hi << 16;
|
||||
}
|
||||
|
||||
if (secdef_number == 0 || secdef_number > sect_count) {
|
||||
lnk_error(LNK_Error_IllData, "%S: symbol %u has out of bounds section definition number %u", name, symbol_idx, secdef_number);
|
||||
break;
|
||||
}
|
||||
|
||||
LNK_Chunk *head_chunk = &chunk_arr[secdef_number - 1];
|
||||
LNK_Chunk *associate_chunk = &chunk_arr[coff_symbol->section_number - 1];
|
||||
lnk_chunk_associate(arena, head_chunk, associate_chunk);
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ internal LNK_ChunkList * lnk_collect_obj_chunks(TP_Context *tp, TP_Arena *arena
|
||||
internal LNK_ObjNodeArray lnk_obj_list_push_parallel(TP_Context *tp, TP_Arena *tp_arena, LNK_ObjList *obj_list, LNK_SectionTable *st, U64 input_count, LNK_InputObj **inputs);
|
||||
|
||||
internal LNK_Chunk * lnk_sect_chunk_array_from_coff(Arena *arena, U64 obj_id, String8 obj_path, String8 coff_data, U64 sect_count, COFF_SectionHeader *coff_sect_arr, String8 *sect_name_arr, String8 *sect_postfix_arr);
|
||||
internal LNK_SymbolArray lnk_symbol_array_from_coff(Arena *arena, String8 coff_data, LNK_Obj *obj, String8 obj_path, U64 string_table_off, U64 sect_count, COFF_SectionHeader *coff_sect_arr, COFF_Symbol32Array coff_symbols, LNK_Chunk *chunk_arr, LNK_Chunk *master_common_block);
|
||||
internal LNK_SymbolArray lnk_symbol_array_from_coff(Arena *arena, String8 coff_data, LNK_Obj *obj, String8 obj_path, B32 is_big_obj, U64 string_table_off, U64 sect_count, COFF_SectionHeader *coff_sect_arr, COFF_Symbol32Array coff_symbols, LNK_Chunk *chunk_arr, LNK_Chunk *master_common_block);
|
||||
internal LNK_RelocList lnk_reloc_list_from_coff_reloc_array(Arena *arena, COFF_MachineType machine, LNK_Chunk *chunk, LNK_SymbolArray symbol_array, COFF_Reloc *reloc_v, U64 reloc_count);
|
||||
internal LNK_RelocList * lnk_reloc_list_array_from_coff(Arena *arena, COFF_MachineType machine, String8 coff_data, U64 sect_count, COFF_SectionHeader *coff_sect_arr, LNK_Chunk *sect_chunk_arr, LNK_SymbolArray symbol_array);
|
||||
internal LNK_DirectiveInfo lnk_init_directives(Arena *arena, String8 obj_path, U64 chunk_count, String8 *sect_name_arr, LNK_Chunk *chunk_arr);
|
||||
|
||||
Reference in New Issue
Block a user