diff --git a/src/coff/coff_parse.h b/src/coff/coff_parse.h index 425e2ce5..7278791f 100644 --- a/src/coff/coff_parse.h +++ b/src/coff/coff_parse.h @@ -50,7 +50,7 @@ typedef struct COFF_Symbol32Array typedef struct COFF_ParsedSymbol { String8 name; - U32 value; + U64 value; U32 section_number; COFF_SymbolType type; COFF_SymStorageClass storage_class; diff --git a/src/linker/lnk.c b/src/linker/lnk.c index 3d610e47..fb435399 100644 --- a/src/linker/lnk.c +++ b/src/linker/lnk.c @@ -1146,16 +1146,16 @@ THREAD_POOL_TASK_FUNC(lnk_obj_reloc_patcher) NotImplemented; } - symbol_secnum = 0; - symbol_secoff = 0; // There aren't enough bits in COFF symbol to store full image base address, // so we special case __ImageBase. A better solution would be to add // a 64-bit symbol format to COFF. if (str8_match(symbol.name, str8_lit("__ImageBase"), 0)) { - symbol_voff = 0; - } else { - symbol_voff = (S64)symbol.value - (S64)task->image_base; + symbol.value = task->image_base; } + + symbol_secnum = 0; + symbol_secoff = 0; + symbol_voff = (S64)symbol.value - (S64)task->image_base; } else if (interp == COFF_SymbolValueInterp_Weak) { // unresolved weak } else if (interp == COFF_SymbolValueInterp_Undefined) {