Windows object file COFF relocations explanation

477 views Asked by At

I'm trying to create an x86-64 Windows COFF object file, but I don't entirely understand the different types of relocations described at https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#x64-processors. Specifically, I'm not sure what do IMAGE_REL_AMD64_REL32 (including _* variants), IMAGE_REL_AMD64_SREL32, IMAGE_REL_AMD64_PAIR and IMAGE_REL_AMD64_SSPAN32 do. There is some documentation for them, but it isn't descriptive enough, and I couldn't find any external resources referencing these. To be more precise, I'm not aware what does 'span-dependent value' mean, and also what exactly REL32 ones are relative to. I'd greatly appreciate any information on this.

EDIT: Okay, after some thought I understood that REL32 ones are for RIP-relative addressing, and the variants are for when the address is relative to a position offset from the start of an instruction, and the symbols points to its start. I still wonder what SREL32, PAIR and SSPAN32 are for...

0

There are 0 answers