flat assembler
Message board for the users of flat assembler.

Index > Windows > fasmg examples - no relocs for pe64

Author
Thread Post new topic Reply to topic
zhak



Joined: 12 Apr 2005
Posts: 501
Location: Belarus
zhak 17 May 2017, 17:24
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?

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?
Post 17 May 2017, 17:24
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 17 May 2017, 18:27
zhak wrote:
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.

zhak wrote:
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.
Post 17 May 2017, 18:27
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.