reloc helper

This commit is contained in:
Nikita Smith
2025-09-23 06:23:31 -07:00
committed by Ryan Fleury
parent 0a930be613
commit 3c0c531c53
2 changed files with 17 additions and 0 deletions
+15
View File
@@ -103,6 +103,21 @@ coff_read_symbol_name(String8 string_table, COFF_SymbolName *name)
return name_str;
}
internal U64
coff_is_addr_reloc(COFF_MachineType machine, U32 type)
{
U64 is_addr = 0;
switch (machine) {
case COFF_MachineType_Unknown: is_addr = 0; break;
case COFF_MachineType_X64: {
if (type == COFF_Reloc_X64_Addr32) is_addr = 4;
else if (type == COFF_Reloc_X64_Addr64) is_addr = 8;
} break;
default: NotImplemented; break;
}
return is_addr;
}
internal U64
coff_apply_size_from_reloc_x64(COFF_Reloc_X64 x)
{
+2
View File
@@ -601,6 +601,8 @@ internal String8 coff_read_symbol_name(String8 string_table, COFF_SymbolName *na
////////////////////////////////
// Reloc
internal U64 coff_is_addr_reloc(COFF_MachineType machine, U32 type);
internal U64 coff_apply_size_from_reloc_x64(COFF_Reloc_X64 x);
internal U64 coff_apply_size_from_reloc_x86(COFF_Reloc_X86 x);