Using dev-libs/elfutils-0.175 the kernel fails to compile kernels (an example compiling 4.20.0-rc3) and the error is shown below. Using dev-libs/elfutils-0.173 the kernel compiles OK. Reproducible: Always Steps to Reproduce: 1.Install dev-libs/elfutils-0.175 2.Compile the kernel 3. Actual Results: HOSTCC scripts/basic/fixdep CPP arch/x86/kernel/macros.s DESCEND objtool HOSTCC /home/alexandr/Projects/linux-kernel/linux/tools/objtool/fixdep.o HOSTLD /home/alexandr/Projects/linux-kernel/linux/tools/objtool/fixdep-in.o LINK /home/alexandr/Projects/linux-kernel/linux/tools/objtool/fixdep CC /home/alexandr/Projects/linux-kernel/linux/tools/objtool/exec-cmd.o CC /home/alexandr/Projects/linux-kernel/linux/tools/objtool/help.o CC /home/alexandr/Projects/linux-kernel/linux/tools/objtool/pager.o CC /home/alexandr/Projects/linux-kernel/linux/tools/objtool/parse-options.o CC /home/alexandr/Projects/linux-kernel/linux/tools/objtool/run-command.o CC /home/alexandr/Projects/linux-kernel/linux/tools/objtool/arch/x86/decode.o CC /home/alexandr/Projects/linux-kernel/linux/tools/objtool/builtin-check.o CC /home/alexandr/Projects/linux-kernel/linux/tools/objtool/builtin-orc.o LD /home/alexandr/Projects/linux-kernel/linux/tools/objtool/arch/x86/objtool-in.o CC /home/alexandr/Projects/linux-kernel/linux/tools/objtool/check.o CC /home/alexandr/Projects/linux-kernel/linux/tools/objtool/sigchain.o CC /home/alexandr/Projects/linux-kernel/linux/tools/objtool/subcmd-config.o LD /home/alexandr/Projects/linux-kernel/linux/tools/objtool/libsubcmd-in.o AR /home/alexandr/Projects/linux-kernel/linux/tools/objtool/libsubcmd.a HOSTCC arch/x86/tools/relocs_32.o CC /home/alexandr/Projects/linux-kernel/linux/tools/objtool/orc_gen.o CC /home/alexandr/Projects/linux-kernel/linux/tools/objtool/orc_dump.o HOSTCC arch/x86/tools/relocs_64.o CC /home/alexandr/Projects/linux-kernel/linux/tools/objtool/elf.o HOSTCC arch/x86/tools/relocs_common.o CC /home/alexandr/Projects/linux-kernel/linux/tools/objtool/special.o HOSTLD arch/x86/tools/relocs CC /home/alexandr/Projects/linux-kernel/linux/tools/objtool/objtool.o CC /home/alexandr/Projects/linux-kernel/linux/tools/objtool/libstring.o CC /home/alexandr/Projects/linux-kernel/linux/tools/objtool/str_error_r.o LD /home/alexandr/Projects/linux-kernel/linux/tools/objtool/objtool-in.o LINK /home/alexandr/Projects/linux-kernel/linux/tools/objtool/objtool HOSTCC scripts/genksyms/genksyms.o HOSTCC scripts/mod/mk_elfconfig HOSTCC scripts/selinux/genheaders/genheaders CC scripts/mod/empty.o CC scripts/mod/devicetable-offsets.s MKELF scripts/mod/elfconfig.h HOSTCC scripts/mod/modpost.o HOSTCC scripts/selinux/mdp/mdp YACC scripts/genksyms/parse.tab.c LEX scripts/genksyms/lex.lex.c YACC scripts/genksyms/parse.tab.h HOSTCC scripts/mod/file2alias.o HOSTCC scripts/genksyms/parse.tab.o HOSTCC scripts/genksyms/lex.lex.o CC kernel/bounds.s CC arch/x86/kernel/asm-offsets.s HOSTCC scripts/mod/sumversion.o GEN scripts/gdb/linux/constants.py HOSTCC scripts/bin2c HOSTLD scripts/mod/modpost HOSTCC scripts/kallsyms HOSTCC scripts/pnmtologo HOSTLD scripts/genksyms/genksyms HOSTCC scripts/conmakehash CALL scripts/checksyscalls.sh HOSTCC scripts/recordmcount HOSTCC scripts/sortextable HOSTCC scripts/asn1_compiler HOSTCC scripts/sign-file HOSTCC scripts/extract-cert CHK include/generated/compile.h CC init/main.o HOSTCC usr/gen_init_cpio CC init/do_mounts.o CC arch/x86/crypto/glue_helper.o GEN usr/initramfs_data.cpio AS usr/initramfs_data.o AR usr/built-in.a CC init/do_mounts_rd.o objdump: init/.tmp_do_mounts_rd.o: unable to initialize decompress status for section .debug_info objdump: init/.tmp_do_mounts_rd.o: unable to initialize decompress status for section .debug_info objdump: init/.tmp_do_mounts_rd.o: file format not recognized CC init/do_mounts_initrd.o AS arch/x86/crypto/aes-x86_64-asm_64.o CC arch/x86/crypto/aes_glue.o objdump: init/.tmp_main.o: unable to initialize decompress status for section .debug_info objdump: init/.tmp_main.o: unable to initialize decompress status for section .debug_info objdump: init/.tmp_main.o: file format not recognized CC init/do_mounts_md.o objdump: init/.tmp_do_mounts.o: unable to initialize decompress status for section .debug_info objdump: init/.tmp_do_mounts.o: unable to initialize decompress status for section .debug_info objdump: init/.tmp_do_mounts.o: file format not recognized CC init/initramfs.o AS arch/x86/crypto/des3_ede-asm_64.o objdump: init/.tmp_do_mounts_initrd.o: unable to initialize decompress status for section .debug_info objdump: init/.tmp_do_mounts_initrd.o: unable to initialize decompress status for section .debug_info objdump: init/.tmp_do_mounts_initrd.o: file format not recognized CC arch/x86/crypto/des3_ede_glue.o CC kernel/bpf/core.o objdump: init/.tmp_do_mounts_md.o: unable to initialize decompress status for section .debug_info objdump: init/.tmp_do_mounts_md.o: unable to initialize decompress status for section .debug_info objdump: init/.tmp_do_mounts_md.o: file format not recognized CC kernel/cgroup/cgroup.o objdump: init/.tmp_initramfs.o: unable to initialize decompress status for section .debug_info objdump: init/.tmp_initramfs.o: unable to initialize decompress status for section .debug_info objdump: init/.tmp_initramfs.o: file format not recognized CC init/calibrate.o objdump: init/.tmp_calibrate.o: unable to initialize decompress status for section .debug_info objdump: init/.tmp_calibrate.o: unable to initialize decompress status for section .debug_info objdump: init/.tmp_calibrate.o: file format not recognized CC init/init_task.o AS arch/x86/crypto/camellia-x86_64-asm_64.o CC arch/x86/crypto/camellia_glue.o CC init/version.o objdump: kernel/bpf/.tmp_core.o: unable to initialize decompress status for section .debug_info objdump: kernel/bpf/.tmp_core.o: unable to initialize decompress status for section .debug_info objdump: kernel/bpf/.tmp_core.o: file format not recognized CC kernel/bpf/syscall.o AS arch/x86/crypto/blowfish-x86_64-asm_64.o CC arch/x86/crypto/blowfish_glue.o AR init/built-in.a CC kernel/cgroup/rstat.o objdump: kernel/cgroup/.tmp_rstat.o: unable to initialize decompress status for section .debug_info objdump: kernel/cgroup/.tmp_rstat.o: unable to initialize decompress status for section .debug_info objdump: kernel/cgroup/.tmp_rstat.o: file format not recognized CC kernel/cgroup/namespace.o AS arch/x86/crypto/twofish-x86_64-asm_64.o CC arch/x86/crypto/twofish_glue.o objdump: kernel/cgroup/.tmp_namespace.o: unable to initialize decompress status for section .debug_info objdump: kernel/cgroup/.tmp_namespace.o: unable to initialize decompress status for section .debug_info objdump: kernel/cgroup/.tmp_namespace.o: file format not recognized CC kernel/cgroup/cgroup-v1.o AS arch/x86/crypto/twofish-x86_64-asm_64-3way.o CC arch/x86/crypto/twofish_glue_3way.o objdump: kernel/bpf/.tmp_syscall.o: unable to initialize decompress status for section .debug_info objdump: kernel/bpf/.tmp_syscall.o: unable to initialize decompress status for section .debug_info objdump: kernel/bpf/.tmp_syscall.o: file format not recognized CC kernel/bpf/verifier.o objdump: kernel/cgroup/.tmp_cgroup.o: unable to initialize decompress status for section .debug_info objdump: kernel/cgroup/.tmp_cgroup.o: unable to initialize decompress status for section .debug_info objdump: kernel/cgroup/.tmp_cgroup.o: file format not recognized CC kernel/cgroup/freezer.o AS arch/x86/crypto/serpent-sse2-x86_64-asm_64.o objdump: kernel/cgroup/.tmp_cgroup-v1.o: unable to initialize decompress status for section .debug_info objdump: kernel/cgroup/.tmp_cgroup-v1.o: unable to initialize decompress status for section .debug_info objdump: kernel/cgroup/.tmp_cgroup-v1.o: file format not recognized CC kernel/bpf/inode.o CC arch/x86/crypto/serpent_sse2_glue.o objdump: kernel/cgroup/.tmp_freezer.o: unable to initialize decompress status for section .debug_info objdump: kernel/cgroup/.tmp_freezer.o: unable to initialize decompress status for section .debug_info objdump: kernel/cgroup/.tmp_freezer.o: file format not recognized Expected Results: Compilation completes OK. This bug was initially added to Bug 671650 - dev-libs/elfutils-0.175 fails test run-strip-reloc.sh (CFLAGS=-Og) but moved to this bug by request.
Can you also add your kernel's '.config' file? and output of 'emerge --info elfutils' here? I'll try to reproduce locally. I'm surprised kernel build system uses elfutils at all.
Created attachment 556076 [details] Kernel .config
(In reply to Aaron Bauman from comment #2) > Created attachment 556076 [details] > Kernel .config confirmed here.
Meh, my kernel is 4.19.2 and 4.19.3.
(In reply to Aaron Bauman from comment #3) > (In reply to Aaron Bauman from comment #2) > > Created attachment 556076 [details] > > Kernel .config > > confirmed here. Thank you! Reproduced on sys-kernel/gentoo-sources-4.19.3. Something is wrong with libelf handling of debug sections. Masking 0.175 until we get more details.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=df2f45b688044dd60f18cca5c0e49b75d70095bf commit df2f45b688044dd60f18cca5c0e49b75d70095bf Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2018-11-23 18:53:32 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2018-11-23 19:08:52 +0000 package.mask: mask >=dev-libs/elfutils-0.175, bug #671760 New version breaks kernel compilation as objtool seemingly corrupts object files. Mask until more details are found out. Reported-by: Alexandre Ferreira Bug: https://bugs.gentoo.org/671760 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> profiles/package.mask | 5 +++++ 1 file changed, 5 insertions(+)
Minimal trigger that allows bisecting elftools (objtool binary is taken from kernel build): $ cat rapl.c.c void a(void) {} $ gcc -nostdinc -g -o rapl.o -c rapl.c.c $ ./objtool orc generate --module --no-fp --retpoline rapl.o $ ld -m elf_x86_64 -z max-page-size=0x200000 -r -o intel-rapl-perf.o rapl.o ld: rapl.o: unable to initialize decompress status for section .debug_info ... rapl.o: file not recognized: file format not recognized
Bisected down to something plausible: $ git bisect bad cf10453f8252df81225796d98548ba6eac113df3 is the first bad commit commit cf10453f8252df81225796d98548ba6eac113df3 Author: Mark Wielaard <mark@klomp.org> Date: Tue Nov 13 21:18:09 2018 +0100 libelf: Correctly setup alignment of SHF_COMPRESSED section data. We didn't set the alignment of SHF_COMPRESSED sections correctly. Those sections start with an Elf(32|64)_Chdr. Make sure sh_addralign is setup to be able to read such a struct directly. Likewise don't trust the alignment set on any SHF_COMPRESSED section, but always make the (raw) compressed data aligned correctly for the reading the Elf(32|64)_Chdr directly. Signed-off-by: Mark Wielaard <mark@klomp.org> :040000 040000 99b0262c62d71ac5aaa178519df9a4db917ab1bd df8299442f6fae9677d31699b88638a325eb9527 M libelf $ git bisect log # bad: [628b4a93c6863b9982d817db6acaacbc4e116453] tests: Call test_cleanup in backtrace-subr.sh check_unsupported. # good: [aa36de0335e3ce12898954985a208f6336731289] Prepare for 0.173 git bisect start 'master' 'elfutils-0.173' # good: [2876b3b648f665736ac9c879d34de5e3866ba8f9] Handle ADD/SUB relocations git bisect good 2876b3b648f665736ac9c879d34de5e3866ba8f9 # good: [f2d59180b90b56b32240f0ba106add050a1b7d09] strip: Extract code to update shdrstrndx into new common function. git bisect good f2d59180b90b56b32240f0ba106add050a1b7d09 # good: [d3e6266754b95244063aa1e40c531fdd57259332] strip: Also handle gnu compressed debug sections with --reloc-debug-sections git bisect good d3e6266754b95244063aa1e40c531fdd57259332 # good: [d3e6266754b95244063aa1e40c531fdd57259332] strip: Also handle gnu compressed debug sections with --reloc-debug-sections git bisect good d3e6266754b95244063aa1e40c531fdd57259332 # bad: [a01938d584b91e747167bb4b3f30ec300c4d6e43] libelf: Mark both fsize and msize with const attribute. git bisect bad a01938d584b91e747167bb4b3f30ec300c4d6e43 # bad: [a01938d584b91e747167bb4b3f30ec300c4d6e43] libelf: Mark both fsize and msize with const attribute. git bisect bad a01938d584b91e747167bb4b3f30ec300c4d6e43 # bad: [22ec8efc1dd87cdc7892523457eb55990b967224] elflint: Allow PT_GNU_EH_FRAME segment to match SHT_X86_64_UNWIND section. git bisect bad 22ec8efc1dd87cdc7892523457eb55990b967224 # bad: [cf10453f8252df81225796d98548ba6eac113df3] libelf: Correctly setup alignment of SHF_COMPRESSED section data. git bisect bad cf10453f8252df81225796d98548ba6eac113df3 # first bad commit: [cf10453f8252df81225796d98548ba6eac113df3] libelf: Correctly setup alignment of SHF_COMPRESSED section data.
Filed https://sourceware.org/PR23916 upstream. Let's see if it's really elfutils' bug or kernel's latent bug.
This ended up being an old binutils bug in writing alignment of compressed sections. The fix is queued for binutils-2.32. Unfortunately the fix change user-facing API of bfd_check_compression_header. We will likely not backport the fix to older branches.
I have also met this problem, This issue also occurs on *brand new* Gentoo install images(both minimal and live). >dev-libs/elfutils-0.173 would better to be masked to make successful kernel compilation. and elfutils on install images also downgraded to 0.173, latest version makes to suffer many new user to stuck on the step of kernel compile.
(In reply to Seong-ho Cho from comment #11) > I have also met this problem, > This issue also occurs on *brand new* Gentoo install images(both minimal and > live). > > >dev-libs/elfutils-0.173 would better to be masked to make successful kernel compilation. > and elfutils on install images also downgraded to 0.173, > latest version makes to suffer many new user to stuck on the step of kernel > compile. %s/also downgraded/also should be downgraded/ Sorry for mistypo.
(In reply to Seong-ho Cho from comment #11) > I have also met this problem, > This issue also occurs on *brand new* Gentoo install images(both minimal and > live). > > >dev-libs/elfutils-0.173 would better to be masked to make successful kernel compilation. > and elfutils on install images also downgraded to 0.173, > latest version makes to suffer many new user to stuck on the step of kernel > compile. According to #comment6 >=elfutils-0.175 is masked since 24 November. Normally kernel compilation should be done in stage3 chroot. stage3 is based on stable packages. >=elfutils-0.175 was never stable. I suggest you to file a separate bug against releng team to not unmask masked elfutils.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4f858b23a08ac5510e836ce434f854d7beea0fb9 commit 4f858b23a08ac5510e836ce434f854d7beea0fb9 Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2019-02-23 13:04:30 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2019-02-23 13:06:11 +0000 package.mask: unmask >=dev-libs/elfutils-0.175, bug #671760 binutils-2.32 is in ~arch. Newest elfutils should now be usable for ~arch as well. Closes: https://bugs.gentoo.org/671760 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> profiles/package.mask | 5 ----- 1 file changed, 5 deletions(-)
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7ef6ada6d119ed6afccc9d6fb2006bc3e2814b40 commit 7ef6ada6d119ed6afccc9d6fb2006bc3e2814b40 Author: Andreas K. Hüttel <dilfridge@gentoo.org> AuthorDate: 2019-04-06 15:23:54 +0000 Commit: Andreas K. Hüttel <dilfridge@gentoo.org> CommitDate: 2019-04-06 15:24:59 +0000 dev-libs/elfutils: Undo stabilization of 0.176 Stabilization was initiated without acknowledgment by toolchain The result of the stabilization is a configuration in stable that is unable to build the kernel, see bug 671760. Bug: https://bugs.gentoo.org/676794 Bug: https://bugs.gentoo.org/671760 Package-Manager: Portage-2.3.62, Repoman-2.3.12 Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org> dev-libs/elfutils/elfutils-0.176.ebuild | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
*** Bug 682680 has been marked as a duplicate of this bug. ***
I've hit this bug trying to compile linux 4.19.34. The only thing changed on the system since building 4.19.33 was the upgrade to gcc-8.3.0-r1 (from 8.3.0). Interestingly enough downgrading back to gcc-8.3.0 did not solve the issue (even with Linux 4.19.33), but I've rebuild binutils-2.32 in the meantime. I tried to: * rebuild binutils-2.32 * downgrade back to gcc-8.3.0 * downgrade from elfutils-0.176 to 175-r1 and 173-r1 What information can I send you to help solve this?
(In reply to Philipp Ammann from comment #17) > I've hit this bug trying to compile linux 4.19.34. The only thing changed on > the system since building 4.19.33 was the upgrade to gcc-8.3.0-r1 (from > 8.3.0). Interestingly enough downgrading back to gcc-8.3.0 did not solve the > issue (even with Linux 4.19.33), but I've rebuild binutils-2.32 in the > meantime. I tried to: > > * rebuild binutils-2.32 > * downgrade back to gcc-8.3.0 > * downgrade from elfutils-0.176 to 175-r1 and 173-r1 > > What information can I send you to help solve this? Make sure you run binutils-2.32 and >=elfutils-0.175 or binutils-2.31.1 and <elfutils-0.175.
(In reply to Philipp Ammann from comment #17) > I've hit this bug trying to compile linux 4.19.34. The only thing changed on > the system since building 4.19.33 was the upgrade to gcc-8.3.0-r1 (from > 8.3.0). Interestingly enough downgrading back to gcc-8.3.0 did not solve the > issue (even with Linux 4.19.33), but I've rebuild binutils-2.32 in the > meantime. I tried to: > > * rebuild binutils-2.32 > * downgrade back to gcc-8.3.0 > * downgrade from elfutils-0.176 to 175-r1 and 173-r1 > > What information can I send you to help solve this? In addition to what Sergei wrote, also make sure you used eselect to switch to the new binutils version, in case you have both 2.32 and a older version around. Don't ask me how I know that :P
This not only happens for kernel compile, in fact it seems it does not affect >5.1.x kernels, but faced this issue when trying to compile app-emulation/containerd (tested version 1.2.5).
(In reply to David Carlos Manuelda from comment #20) I have the bug with gentoo-sources-5.1.15. It appeared when elfutils-0.176 was stabilized. Reverting to 0.173-r2 allowed me to compile again the kernel.
(In reply to Jérôme Borme from comment #21) > (In reply to David Carlos Manuelda from comment #20) > I have the bug with gentoo-sources-5.1.15. It appeared when elfutils-0.176 > was stabilized. Reverting to 0.173-r2 allowed me to compile again the kernel. Make sure you have binutils-2.32 installed and active. That should work with new elfutils.
Created https://wiki.gentoo.org/wiki/Binutils_2.32_upgrade_notes/elfutils_0.175:_unable_to_initialize_decompress_status_for_section_.debug_info to explain the failure and an example way to get past it.
*** Bug 671692 has been marked as a duplicate of this bug. ***
*** Bug 678780 has been marked as a duplicate of this bug. ***
*** Bug 689056 has been marked as a duplicate of this bug. ***
*** Bug 671762 has been marked as a duplicate of this bug. ***
dev-libs/elfutils-0.176 and sys-devel/binutils-2.32-r1 are stable, old versions of elfutils have been removed, of binutils have been masked.