Bug#977596: please error on static archive without any code sections
Package: lintian
Please show an error on static archives without any code sections. This happens
when a package ships a lib<foo>.a which is built with -flto=auto, but without
-ffat-lto-objects. dh_strip already takes care of stripping the lto sections,
but maybe is leaving the .a file unusable.
see
https://github.com/rpm-software-management/rpmlint/blob/master/rpmlint/checks/BinariesCheck.py
(_check_no_text_in_archive function) for an implementation.
or a shell implementation:
readelf -W --section-headers lib<foo>.a \
| sed -n '/^ *\[[ 0-9]*\]/s/ *\[[ 0-9]*\] *//p' \
| awk 'BEGIN {rv=1} /^NULL/ {next} $1 ~
/^.(text|data|(preinit|init|fini)_array$)/ {if ($5 !~ /^0+$/) rv=0} END { exit rv}'
You can test this with e.g. xxhash, building with
export DEB_CFLAGS_MAINT_APPEND = -flto=auto
and
export DEB_CFLAGS_MAINT_APPEND = -flto=auto -ffat-lto-objects
Reply to: