Position Independent Code in fasm

Programming, for all ages and all languages.
Post Reply
trolly
Member
Member
Posts: 52
Joined: Tue Mar 25, 2008 12:26 pm

Position Independent Code in fasm

Post by trolly »

hi,

i wrote some macro to make positiion independant code for x86 in fasm.

in the files there is pic version of : MOV, OR, AND, ADD,SUB, INC,DEC
could you help me to optimize it, beceause they are very barbaric.
Attachments
pic.asm
PIC macro for fasm
(1.62 KiB) Downloaded 106 times
JohnnyTheDon
Member
Member
Posts: 524
Joined: Sun Nov 09, 2008 2:55 am
Location: Pennsylvania, USA

Re: Position Independent Code in fasm

Post by JohnnyTheDon »

In x86_64 you can use RIP relative addressing, which basically does what you did without extra instructions. I think there is a comparable method for 32-bit code, but I'm not sure what it is.
Post Reply