flat assembler
Message board for the users of flat assembler.

Index > Main > ?Forcing FASM to use only relative addressing?

Author
Thread Post new topic Reply to topic
hyperzap



Joined: 22 Apr 2011
Posts: 4
hyperzap 15 May 2012, 12:40
Hi all,

I am writing small binary stub functions (which need to be runnable from any position in memory) which reference only themselves and the stack(offsets from EBP). I was wondering if there is a way to force FASM to output code that uses purely relative addresses for all jmp (and similar) operations? Is this the default behaviour?

Thanks,

Hyperzap
Post 15 May 2012, 12:40
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20357
Location: In your JS exploiting you and your system
revolution 15 May 2012, 13:09
Immediate near jumps and calls are always relative. This is part of the x86 design.
Post 15 May 2012, 13:09
View user's profile Send private message Visit poster's website Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 16 May 2012, 09:50
I think one can craft a FASM macro which catches the longer jumps and calls and emits an warning/error. Then there is no need to force FASM to do anything. It just tells you the places where to look for too long jumps and you can rearrange your code.
Post 16 May 2012, 09:50
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger 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.