Jay K <jay.krell@xxxxxxxxxxx> writes: > Ian, I don't have to use -fPIC and go through GOT/PLT, in case my code will end up in a .so? > Well, it looks like you can do that -- omit -fPIC -- but then you get TEXTREL, not good. > > > You know, x86 already has the ip-relative 0xE8 opcode. > I'd like to just use that, directly to the function, have the linker generate a stub if it ends up imported (using GOT/PLT). > But still whatever more complicated stuff is needed to reference data without TEXTREL. That approach does not permit symbol interpositioning, which is a key goal of ELF. If you don't want to permit symbol interpositioning, you can avoid the PLT if you with -fPIC, but link with -Bsymbolic. That will still wind up using the GOT for global/static variables, but I don't see how you can avoid that in position independent code. There is no PC relative load instruction for 32-bit x86. As far as I can see you must either use a GOT or get a TEXTREL tag. Ian