diff options
author | Sami Tolvanen <samitolvanen@google.com> | 2019-04-15 12:49:56 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2019-04-16 02:20:55 -0400 |
commit | 6a03469a1edc94da52b65478f1e00837add869a3 (patch) | |
tree | b2e8099427b1c107b8eb446eb237415c4ef1bb43 | |
parent | 2f5fb19341883bb6e37da351bc3700489d8506a7 (diff) |
x86/build/lto: Fix truncated .bss with -fdata-sections
With CONFIG_LD_DEAD_CODE_DATA_ELIMINATION=y, we compile the kernel with
-fdata-sections, which also splits the .bss section.
The new section, with a new .bss.* name, which pattern gets missed by the
main x86 linker script which only expects the '.bss' name. This results
in the discarding of the second part and a too small, truncated .bss
section and an unhappy, non-working kernel.
Use the common BSS_MAIN macro in the linker script to properly capture
and merge all the generated BSS sections.
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Kees Cook <keescook@chromium.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20190415164956.124067-1-samitolvanen@google.com
[ Extended the changelog. ]
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | arch/x86/kernel/vmlinux.lds.S | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S index bad8c51fee6e..a5127b2c195f 100644 --- a/arch/x86/kernel/vmlinux.lds.S +++ b/arch/x86/kernel/vmlinux.lds.S | |||
@@ -362,7 +362,7 @@ SECTIONS | |||
362 | .bss : AT(ADDR(.bss) - LOAD_OFFSET) { | 362 | .bss : AT(ADDR(.bss) - LOAD_OFFSET) { |
363 | __bss_start = .; | 363 | __bss_start = .; |
364 | *(.bss..page_aligned) | 364 | *(.bss..page_aligned) |
365 | *(.bss) | 365 | *(BSS_MAIN) |
366 | BSS_DECRYPTED | 366 | BSS_DECRYPTED |
367 | . = ALIGN(PAGE_SIZE); | 367 | . = ALIGN(PAGE_SIZE); |
368 | __bss_stop = .; | 368 | __bss_stop = .; |