COFF x86_64 relocation types

433 Views Asked by At

I am working on linker development for an open source project. The target architecture is AMD_X86_X64. In AMD_X86_X64 specification The relocation types' calculations for ELF are declared for example, R_X86_64_64 the calculation is S + A. How to do these calculations in COFF I can't find them online ?

1

There are 1 best solutions below

2
vitsoft On BEST ANSWER

COFF relocation types are enumerated at COFF Relocations for x64.

IMAGE_REL_AMD64_ABSOLUTE corresponds with R_X86_X64_COPY (no relocation),
IMAGE_REL_AMD64_ADDR64 corresponds with R_X86_X64_64 (S+A),
IMAGE_REL_AMD64_ADDR32 corresponds with R_X86_X64_32 (S+A),
IMAGE_REL_AMD64_REL32 corresponds with R_X86_X64_PC32 (S+A-P).