during writing a post to the thread "LoadLibrary emulation" I asked myself this question:

On (good old ...) AMIGA it was possible to write 100% relative object-code, which must not be relocated after loading. On 680x0 CPU there was read access to the instruction point register and you had the chance to address all things relative to this register.
I wonder if this could be done also on Intel - if I dont use global data, do only relative jump commands and call all functions as ?

(on AMIGA resulting in:
- faster load process (no relocation needed)
- shorter + faster program, since smaller address modes
dont know if useful on Intel architecture)
Posted on 2002-03-01 08:21:56 by beaster
I wonder if this could be done also on Intel - if I dont use global data, do only relative jump commands and call all functions as ?

quite possible. as you can't access the instruction pointer directly, you'd have to do something like


call @label
@label:
pop eax
sub eax,offset @label
Posted on 2002-03-01 08:43:47 by Tola