lkml.org 
[lkml]   [2020]   [Jun]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v3 7/7] x86/boot: Check that there are no runtime relocations
On Tue, Jun 30, 2020 at 03:00:43PM -0700, Fangrui Song wrote:
> * Ard Biesheuvel
> > On Tue, 30 Jun 2020 at 01:34, Fangrui Song <maskray@google.com> wrote:
>
> If the executable is purely static, it does not need to have PLT. All
> calls to a PLT can be redirected to the function itself. Some range
> extension thunks (other terms: stub groups, veneers, etc) may still be
> needed if the distance is too large.
>
> There are cases where a GOT cannot be avoided, e.g.
>
> extern char foo[] __attribute__((weak, visibility("hidden")));
> char *fun() { return foo; }
>
> If foo is a SHN_ABS, `movq foo@GOTPCREL(%rip), %rax` can't be optimized
> by GOTPCRELX (https://sourceware.org/bugzilla/show_bug.cgi?id=25749 binutils>=2.35 will be good)
> Many other architectures don't even have a GOT optimization.

Urk -- the example given in that bug report isn't even weak. Are you
guys proposing to pessimize every access to a global symbol, regardless
of visibility, by going through the GOT on the off chance that somebody
might define one of them as SHN_ABS? Can we at least gate it behind
something like __attribute__((might_be_shn_abs))?

>
> >I don't think it's really relevant for the kernel build -- all we get is
> >ld -static --no-dynamic-linker, all -static does is prevent searching
> >shared libraries, and we already pass --no-dynamic-linker if it's
> >supported.
> >
> >[0] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81498

\
 
 \ /
  Last update: 2020-07-01 01:28    [W:0.126 / U:8.336 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site