]> git.baikalelectronics.ru Git - kernel.git/commit
x86/boot/compressed: Remove .eh_frame section from bzImage
authorArvind Sankar <nivedita@alum.mit.edu>
Thu, 9 Jan 2020 15:02:18 +0000 (10:02 -0500)
committerBorislav Petkov <bp@suse.de>
Mon, 24 Feb 2020 11:30:28 +0000 (12:30 +0100)
commit5c5ef25ffefb84c9ca56391b1785c049605832ff
tree3b251df239719d616380ac7748c11ec381aea5fa
parente69727f34bf4c0dd4888bdb6489a0764070300e2
x86/boot/compressed: Remove .eh_frame section from bzImage

Discarding unnecessary sections with "*(*)" (see thread at Link: below)
works fine with the bfd linker but fails with 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

lld tries to also discard essential sections like .shstrtab, .symtab and
.strtab, which results in the link failing since .shstrtab is required
by the ELF specification: the e_shstrndx field in the ELF header is the
index of .shstrtab, and each section in the section table is required to
have an sh_name that points into the .shstrtab.

.symtab and .strtab are also necessary to generate the zoffset.h file
for the bzImage header.

Since the only sizeable section that can be discarded is .eh_frame,
restrict the discard to only .eh_frame to be safe.

 [ bp: Flesh out commit message and replace offending commit with this one. ]

Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
Signed-off-by: Borislav Petkov <bp@suse.de>
Tested-by: Nathan Chancellor <natechancellor@gmail.com>
Link: https://lkml.kernel.org/r/20200109150218.16544-2-nivedita@alum.mit.edu
arch/x86/boot/compressed/vmlinux.lds.S