lkml.org 
[lkml]   [2020]   [Feb]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/2] x86/boot/compressed: Remove unnecessary sections from bzImage
On Thu, Jan 09, 2020 at 10:02:18AM -0500, Arvind Sankar wrote:
> 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>
> ---
> 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 508cfa6828c5..12a20603d92e 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/ : {
> + *(*)
> + }
> }
> --
> 2.24.1
>

This patch breaks linking with ld.lld:

$ make -j$(nproc) -s CC=clang LD=ld.lld O=out.x86_64 distclean defconfig bzImage
ld.lld: error: discarding .shstrtab section is not allowed
...

I am not exactly sure how to keep that section around (or if it is
ABSOLUTELY necessary like ld.lld seems to claim) otherwise I would send
a patch.

It would be nice not to break this tool since it is faster than ld.bfd.

Cheers,
Nathan

\
 
 \ /
  Last update: 2020-02-22 06:09    [W:0.188 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site