[tip: x86/boot] x86/boot/compressed: Remove unnecessary sections from bzImage

From: tip-bot2 for Arvind Sankar
Date: Wed Feb 19 2020 - 11:55:28 EST


The following commit has been merged into the x86/boot branch of tip:

Commit-ID: e11831d0ada3efc7f9268f35c80257f7e1b1dd0c
Gitweb: https://git.kernel.org/tip/e11831d0ada3efc7f9268f35c80257f7e1b1dd0c
Author: Arvind Sankar <nivedita@xxxxxxxxxxxx>
AuthorDate: Thu, 09 Jan 2020 10:02:18 -05:00
Committer: Borislav Petkov <bp@xxxxxxx>
CommitterDate: Wed, 19 Feb 2020 17:35:30 +01:00

x86/boot/compressed: Remove unnecessary sections from bzImage

Discarding the sections that are unused in the compressed kernel saves
about 10 KiB on 32-bit and 6 KiB on 64-bit, mostly from .eh_frame.

Signed-off-by: Arvind Sankar <nivedita@xxxxxxxxxxxx>
Signed-off-by: Borislav Petkov <bp@xxxxxxx>
Acked-by: Kees Cook <keescook@xxxxxxxxxxxx>
Link: https://lkml.kernel.org/r/20200109150218.16544-2-nivedita@xxxxxxxxxxxx
---
arch/x86/boot/compressed/vmlinux.lds.S | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/arch/x86/boot/compressed/vmlinux.lds.S b/arch/x86/boot/compressed/vmlinux.lds.S
index 508cfa6..12a2060 100644
--- a/arch/x86/boot/compressed/vmlinux.lds.S
+++ b/arch/x86/boot/compressed/vmlinux.lds.S
@@ -73,4 +73,9 @@ SECTIONS
#endif
. = ALIGN(PAGE_SIZE); /* keep ZO size page aligned */
_end = .;
+
+ /* Discard all remaining sections */
+ /DISCARD/ : {
+ *(*)
+ }
}