When I'm compiling win32.exe from examples, I get .reloc section filled.
When I do the same for pe64 file, reloc section is created, but is zero length
What am I missing about pe64 relocations? How do they work?
Since in long mode the default addressing is RIP-relative, usually no relocations are needed as the code is already position-independent. Only when you use an instruction that contains absolute address in its encoding (like "mov rax,var" instead of "lea rax,[var]") a relocation is going to be necessary.
Also, PE macros redefine both dd and dq data types for relocation. In case of PE64, do both dd and dq should be processed for relocation or only dq?
They have different relocation types that apply. For dword it is IMAGE_REL_BASED_HIGHLOW while for qword it is IMAGE_REL_BASED_DIR64.