linux-efi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ardb@kernel.org>
To: Mike Lothian <mike@fireburn.co.uk>
Cc: Arvind Sankar <nivedita@alum.mit.edu>,
	linux-efi <linux-efi@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	X86 ML <x86@kernel.org>
Subject: Re: [PATCH] x86/boot: Mark global variables as static
Date: Tue, 12 May 2020 13:05:21 +0200	[thread overview]
Message-ID: <CAMj1kXGbUg3g-s5qoHgrYoBnoJLR9Oc7YrCO1xMHx-+Ys6=Tfg@mail.gmail.com> (raw)
In-Reply-To: <CAHbf0-HLKiq_+erhHfV9XqMhfchN2975nAsuya4-oXEOUNdhiw@mail.gmail.com>

On Tue, 12 May 2020 at 01:12, Mike Lothian <mike@fireburn.co.uk> wrote:
>
> Feel free to add my tested by
>
>
> On Mon, 11 May 2020 at 23:58, Arvind Sankar <nivedita@alum.mit.edu> wrote:
> >
> > Mike Lothian reports that after commit
> >   964124a97b97 ("efi/x86: Remove extra headroom for setup block")
> > gcc 10.1.0 fails with
> >
> >   HOSTCC  arch/x86/boot/tools/build
> >   /usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/../../../../x86_64-pc-linux-gnu/bin/ld:
> >   error: linker defined: multiple definition of '_end'
> >   /usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/../../../../x86_64-pc-linux-gnu/bin/ld:
> >   /tmp/ccEkW0jM.o: previous definition here
> >   collect2: error: ld returned 1 exit status
> >   make[1]: *** [scripts/Makefile.host:103: arch/x86/boot/tools/build] Error 1
> >   make: *** [arch/x86/Makefile:303: bzImage] Error 2
> >
> > The issue is with the _end variable that was added, to hold the end of
> > the compressed kernel from zoffsets.h (ZO__end). The name clashes with
> > the linker-defined _end symbol that indicates the end of the build
> > program itself.
> >
> > Even when there is no compile-time error, this causes build to use
> > memory past the end of its .bss section.
> >
> > To solve this, mark _end as static, and for symmetry, mark the rest of
> > the variables that keep track of symbols from the compressed kernel as
> > static as well.
> >
> > Fixes: 964124a97b97 ("efi/x86: Remove extra headroom for setup block")
> > Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>

Thanks, I'll queue this as a fix.


> > ---
> >  arch/x86/boot/tools/build.c | 16 ++++++++--------
> >  1 file changed, 8 insertions(+), 8 deletions(-)
> >
> > diff --git a/arch/x86/boot/tools/build.c b/arch/x86/boot/tools/build.c
> > index 8f8c8e386cea..c8b8c1a8d1fc 100644
> > --- a/arch/x86/boot/tools/build.c
> > +++ b/arch/x86/boot/tools/build.c
> > @@ -59,14 +59,14 @@ u8 buf[SETUP_SECT_MAX*512];
> >  #define PECOFF_COMPAT_RESERVE 0x0
> >  #endif
> >
> > -unsigned long efi32_stub_entry;
> > -unsigned long efi64_stub_entry;
> > -unsigned long efi_pe_entry;
> > -unsigned long efi32_pe_entry;
> > -unsigned long kernel_info;
> > -unsigned long startup_64;
> > -unsigned long _ehead;
> > -unsigned long _end;
> > +static unsigned long efi32_stub_entry;
> > +static unsigned long efi64_stub_entry;
> > +static unsigned long efi_pe_entry;
> > +static unsigned long efi32_pe_entry;
> > +static unsigned long kernel_info;
> > +static unsigned long startup_64;
> > +static unsigned long _ehead;
> > +static unsigned long _end;
> >
> >  /*----------------------------------------------------------------------*/
> >
> > --
> > 2.26.2
> >

  reply	other threads:[~2020-05-12 11:05 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-01 23:05 [PATCH 0/5] Minimize the need to move the kernel in the EFI stub Arvind Sankar
2020-03-01 23:05 ` [PATCH 1/5] x86/boot/compressed/32: Save the output address instead of recalculating it Arvind Sankar
2020-03-03 19:10   ` Ard Biesheuvel
2020-03-01 23:05 ` [PATCH 2/5] efi/x86: Decompress at start of PE image load address Arvind Sankar
2020-03-03  6:28   ` Mika Penttilä
2020-03-03 13:45     ` Arvind Sankar
2020-03-03 19:08   ` Ard Biesheuvel
2020-03-01 23:05 ` [PATCH 3/5] efi/x86: Add kernel preferred address to PE header Arvind Sankar
2020-03-03 19:11   ` Ard Biesheuvel
2020-03-01 23:05 ` [PATCH 4/5] efi/x86: Remove extra headroom for setup block Arvind Sankar
2020-03-02  4:21   ` Mika Penttilä
2020-03-03  4:14     ` Arvind Sankar
2020-03-01 23:05 ` [PATCH 5/5] efi/x86: Don't relocate the kernel unless necessary Arvind Sankar
2020-03-03 19:15   ` Ard Biesheuvel
2020-03-03 22:12 ` [PATCH v2 0/5] Minimize the need to move the kernel in the EFI stub Arvind Sankar
2020-03-03 22:12   ` [PATCH v2 1/5] x86/boot/compressed/32: Save the output address instead of recalculating it Arvind Sankar
2020-03-03 22:12   ` [PATCH v2 2/5] efi/x86: Decompress at start of PE image load address Arvind Sankar
2020-03-03 22:12   ` [PATCH v2 3/5] efi/x86: Add kernel preferred address to PE header Arvind Sankar
2020-03-03 22:12   ` [PATCH v2 4/5] efi/x86: Remove extra headroom for setup block Arvind Sankar
2020-05-11 17:01     ` Mike Lothian
2020-05-11 18:36       ` Arvind Sankar
2020-05-11 21:13         ` Ard Biesheuvel
2020-05-11 22:53           ` Arvind Sankar
2020-05-11 22:58             ` [PATCH] x86/boot: Mark global variables as static Arvind Sankar
2020-05-11 23:12               ` Mike Lothian
2020-05-12 11:05                 ` Ard Biesheuvel [this message]
2020-03-03 22:12   ` [PATCH v2 5/5] efi/x86: Don't relocate the kernel unless necessary Arvind Sankar
2020-03-03 23:08     ` Ard Biesheuvel
2020-03-03 23:34       ` Arvind Sankar
2020-03-04  7:30         ` Ard Biesheuvel
2020-03-03 22:26   ` [PATCH v2 0/5] Minimize the need to move the kernel in the EFI stub Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMj1kXGbUg3g-s5qoHgrYoBnoJLR9Oc7YrCO1xMHx-+Ys6=Tfg@mail.gmail.com' \
    --to=ardb@kernel.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mike@fireburn.co.uk \
    --cc=nivedita@alum.mit.edu \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).