flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Windows > fasmg examples - no relocs for pe64

Author
Thread Post new topic Reply to topic
zhak



Joined: 12 Apr 2005
Posts: 473
Location: Belarus
fasmg examples - no relocs for pe64
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
Assembly Artist


Joined: 16 Jun 2003
Posts: 6356
Location: Kraków, Poland
Re: fasmg examples - no relocs for pe64

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


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.