[tip:,x86/boot] x86/boot/compressed: Remove unnecessary sections from bzImage
diff mbox series

Message ID 158213131544.13786.16073593038276169304.tip-bot2@tip-bot2
State In Next
Commit e11831d0ada3efc7f9268f35c80257f7e1b1dd0c
Headers show
Series
  • [tip:,x86/boot] x86/boot/compressed: Remove unnecessary sections from bzImage
Related show

Commit Message

tip-bot2 for Maciej W. Rozycki Feb. 19, 2020, 4:55 p.m. UTC
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@alum.mit.edu>
AuthorDate:    Thu, 09 Jan 2020 10:02:18 -05:00
Committer:     Borislav Petkov <bp@suse.de>
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@alum.mit.edu>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Kees Cook <keescook@chromium.org>
Link: https://lkml.kernel.org/r/20200109150218.16544-2-nivedita@alum.mit.edu
---
 arch/x86/boot/compressed/vmlinux.lds.S | 5 +++++
 1 file changed, 5 insertions(+)

Patch
diff mbox series

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/ : {
+		*(*)
+	}
 }