[RFC PATCH 6/7] x86/kexec: Debugging support: Dump registers on exception
H. Peter Anvin
hpa at zytor.com
Tue Nov 5 14:57:28 PST 2024
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
More information about the kexec
mailing list