Skip to content

Commit e78d334

Browse files
nivedita76ardbiesheuvel
authored andcommitted
x86/boot: Mark global variables as static
Mike Lothian reports that after commit 964124a ("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: 964124a ("efi/x86: Remove extra headroom for setup block") Reported-by: Mike Lothian <[email protected]> Tested-by: Mike Lothian <[email protected]> Signed-off-by: Arvind Sankar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ard Biesheuvel <[email protected]>
1 parent 3d8c11e commit e78d334

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

arch/x86/boot/tools/build.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@ u8 buf[SETUP_SECT_MAX*512];
5959
#define PECOFF_COMPAT_RESERVE 0x0
6060
#endif
6161

62-
unsigned long efi32_stub_entry;
63-
unsigned long efi64_stub_entry;
64-
unsigned long efi_pe_entry;
65-
unsigned long efi32_pe_entry;
66-
unsigned long kernel_info;
67-
unsigned long startup_64;
68-
unsigned long _ehead;
69-
unsigned long _end;
62+
static unsigned long efi32_stub_entry;
63+
static unsigned long efi64_stub_entry;
64+
static unsigned long efi_pe_entry;
65+
static unsigned long efi32_pe_entry;
66+
static unsigned long kernel_info;
67+
static unsigned long startup_64;
68+
static unsigned long _ehead;
69+
static unsigned long _end;
7070

7171
/*----------------------------------------------------------------------*/
7272

0 commit comments

Comments
 (0)