[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3a91abd7-5edd-4f4e-bb15-fb9c91f64cc9@zytor.com>
Date: Tue, 5 Nov 2024 14:57:28 -0800
From: "H. Peter Anvin" <hpa@...or.com>
To: "Woodhouse, David" <dwmw@...zon.co.uk>,
"peterz@...radead.org" <peterz@...radead.org>,
"kexec@...ts.infradead.org" <kexec@...ts.infradead.org>,
"jpoimboe@...nel.org" <jpoimboe@...nel.org>
Cc: "horms@...nel.org" <horms@...nel.org>, "x86@...nel.org" <x86@...nel.org>,
"bp@...en8.de" <bp@...en8.de>, "mingo@...hat.com" <mingo@...hat.com>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"kai.huang@...el.com" <kai.huang@...el.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"kirill.shutemov@...ux.intel.com" <kirill.shutemov@...ux.intel.com>,
"nik.borisov@...e.com" <nik.borisov@...e.com>,
"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>
Subject: Re: [RFC PATCH 6/7] x86/kexec: Debugging support: Dump registers on
exception
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
Powered by blists - more mailing lists