In bug #784923 we found out that portage complains about pre-stripped files on glibc due to binutils-2.36 not emitting unused ".symtab". Executable exeample: $ cat > crtn.S .section .init,"ax",@progbits addq $8, %rsp ret .section .fini,"ax",@progbits addq $8, %rsp ret $ x86_64-pc-linux-gnu-gcc -O2 crtn.S -c -o crtn-2.36.o # -B/usr/x86_64-pc-linux-gnu/binutils-bin/2.35.2/ $ x86_64-pc-linux-gnu-gcc -O2 crtn.S -c -o crtn-2.35.o -B/usr/x86_64-pc-linux-gnu/binutils-bin/2.35.2/ $ scanelf -yqRBF '#k%F' -k '!.symtab' crtn-2.35.o crtn-2.36.o crtn-2.36.o Note: 2.36 file does not contain '.symtab' that portage expects as a proxy of unstripped binary: https://gitweb.gentoo.org/proj/portage.git/tree/bin/estrip#n329
bug #795810 is another example where ELF file without program headers is slagged as "stripped". `readelf` complains on these files as: "There are no program headers in this file."
Ideally `scanelf` should provide a mechanism for us to finter on files with program headers only. I don't think it has that as a one-liner. I wonder if '#e' is expected to Just work. It does not today: $ scanelf -yqRBF '#e#k%F' -k '!.symtab' crtn-2.36.o crtn-2.36.o
(In reply to Sergei Trofimovich from comment #2) > Ideally `scanelf` should provide a mechanism for us to finter on files with > program headers only. I don't think it has that as a one-liner. > > I wonder if '#e' is expected to Just work. It does not today: > > $ scanelf -yqRBF '#e#k%F' -k '!.symtab' crtn-2.36.o > crtn-2.36.o Ah, it does not work as is because '#e#k' works as "any of", not "all of".
Also, absence of program headers is expected: It's not a final executable. We'll need a different, heuristic. Maybe, presence of non-empty executable PROGBITS sections: [ 1] .text PROGBITS 0000000000000000 00000040 0000000000000007 0000000000000000 AX 0 0 1
Later code in estrip uses 'file' to check type of file: https://gitweb.gentoo.org/proj/portage.git/tree/bin/estrip?id=36dbd3e4336fa199a35b4f74c1679511707138f5#n492 f=$(file "${x}") || exit 0 ... if [[ ${f} == *"current ar archive"* ]] ; then process_ar "${x}" elif [[ ${f} == *"SB executable"* || ${f} == *"SB pie executable"* || ${f} == *"SB shared object"* ]] ; then process_elf "${x}" "${inode_link}" ${PORTAGE_STRIP_FLAGS} elif [[ ${f} == *"SB relocatable"* ]] ; then process_elf "${x}" "${inode_link}" ${SAFE_STRIP_FLAGS} fi So maybe earlier code in estrip (https://gitweb.gentoo.org/proj/portage.git/tree/bin/estrip?id=36dbd3e4336fa199a35b4f74c1679511707138f5#n406) should ignore *"SB relocatable"* files (i.e. *.o files)?
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ff1f410ec18385497f00dd86f2a64d60b1ed4b1a commit ff1f410ec18385497f00dd86f2a64d60b1ed4b1a Author: Sam James <sam@gentoo.org> AuthorDate: 2025-05-10 01:52:52 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2025-05-10 01:53:27 +0000 toolchain.eclass: set QA_PRESTRIPPED for now for Go As slyfox analysed on the bug, Portage shouldn't be warning on these files as they're not executables. We should look at fixing Portage but set QA_PRESTRIPPED for now to avoid noise and potentially missing other actual warnings. Bug: https://bugs.gentoo.org/793770 Closes: https://bugs.gentoo.org/795810 Closes: https://bugs.gentoo.org/955240 Signed-off-by: Sam James <sam@gentoo.org> eclass/toolchain.eclass | 2 ++ 1 file changed, 2 insertions(+)