Page 1 of 1

Position Independent Code in fasm

Posted: Fri Jan 02, 2009 1:29 am
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.

Re: Position Independent Code in fasm

Posted: Fri Jan 02, 2009 4:04 pm
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.