On Mon, Jun 29, 2020 at 09:06:07AM -0700, Kees Cook wrote:
> On Mon, Jun 29, 2020 at 10:09:27AM -0400, Arvind Sankar wrote:
> > The BFD linker generates runtime relocations for z_input_len and
> > z_output_len, even though they are absolute symbols.
> > 
> > This is fixed for binutils-2.35 [1]. Work around this for earlier
> > versions by defining two variables input_len and output_len in addition
> > to the symbols, and use them via position-independent references.
> > 
> > This eliminates the last two runtime relocations in the head code and
> > allows us to drop the -z noreloc-overflow flag to the linker.
> > 
> > [1] https://sourceware.org/bugzilla/show_bug.cgi?id=25754
> > 
> > Signed-off-by: Arvind Sankar <nived...@alum.mit.edu>
> > Reviewed-by: Ard Biesheuvel <a...@kernel.org>
> > Reviewed-by: Fangrui Song <mask...@google.com>
> > ---
> >  arch/x86/boot/compressed/Makefile  |  8 --------
> >  arch/x86/boot/compressed/head_32.S | 17 ++++++++---------
> >  arch/x86/boot/compressed/head_64.S |  4 ++--
> >  arch/x86/boot/compressed/mkpiggy.c |  6 ++++++
> >  4 files changed, 16 insertions(+), 19 deletions(-)
> 
> I continue to really enjoy the smaller code. Anything that makes
> mkpiggy.c smaller is a win. :)
> 
> Reviewed-by: Kees Cook <keesc...@chromium.org>
> 
> -- 
> Kees Cook

It doesn't actually reduce the size? mkpiggy.c _could_ I think be
replaced with some carefully written shell code, but this doesn't do
anything like that.

Reply via email to