On 11/5/24 14:27, H. Peter Anvin wrote:
I don't know if it is necessary, but you can do something like this to
make absolutely sure you don't end up with non-relative symbol references:
static inline __constfunc void * sym_addr(const void *sym)
{
void *addr;
asm("lea %c1(%%rip),%0" : "=r" (addr) : "i" (sym));
return addr;
}
Compiling with "-fpic -fvisibility=hidden -mcmodel=medium" can also be
used to suppress non-relative references. If you have external symbol
references they at least *should* be emitted as GOTPCRELX relocations
which the linker should relax to relative references; however, I would
think that you really don't want any of those :)
-hpa
_______________________________________________
kexec mailing list
kexec@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/kexec