process-lto: enhance __gnu_lto_slim diagnostics
Turn __gnu_lto_slim diagnostics into a concise phrase printed for each faulty archive file followed by a single lengthy multi-line descriptive text. Suggested-by: Vitaly Chikunov <vt@altlinux.org> Link: https://lore.altlinux.org/devel/20210827221847.arp4wv7ngnkdliwm@altlinux.org/T/#u
This commit is contained in:
parent
457de4ae02
commit
fcc291f3a6
@ -21,6 +21,7 @@ ValidateBuildRoot
|
||||
|
||||
cd "$RPM_BUILD_ROOT"
|
||||
mkdir -p .tmp
|
||||
rc=0
|
||||
|
||||
# They skip /usr/lib/debug from the search, but why. There aren't
|
||||
# such objects nor meaning to skip stripping them.
|
||||
@ -36,4 +37,22 @@ while read -r f; do
|
||||
[ -n "$f" ] && printf "%s\0" "$f"
|
||||
done | \
|
||||
eu-elfclassify --not-program --not-library --not-linux-kernel-module --stdin0 --print0 | \
|
||||
xargs -0 -r -P$(nproc) -n$(nproc) @RPMCONFIGDIR@/process-lto
|
||||
xargs -0 -r -P$(nproc) -n$(nproc) @RPMCONFIGDIR@/process-lto || rc=$?
|
||||
|
||||
if [ -e .tmp/lto-suggest ]; then
|
||||
single='this file contains'
|
||||
plural='these files contain'
|
||||
[ "$(wc -c < .tmp/lto-suggest)" = 1 ] &&
|
||||
phrase="$single" ||
|
||||
phrase="$plural"
|
||||
sed "s/^/${0##*/}: /" >&2 <<EOF
|
||||
Most likely $phrase GIMPLE bytecode that should NOT be packaged
|
||||
since its format can change between GCC versions.
|
||||
Use -ffat-lto-objects option to package machine code in static libraries, e.g.
|
||||
%{?optflags_lto:%global optflags_lto %optflags_lto -ffat-lto-objects}
|
||||
Alternatively, you might want to stop packaging static libraries
|
||||
or disable link-time optimization for this package.
|
||||
EOF
|
||||
fi
|
||||
|
||||
exit $rc
|
||||
|
@ -23,16 +23,15 @@ strip -p -R '.gnu.lto_*' -R '.gnu.debuglto_*' -N '__gnu_lto_v1' -- "$@" ||
|
||||
Fatal 'strip failed'
|
||||
|
||||
# Verify that we still have exportable symbols.
|
||||
suggest="Perhaps, you need to %global optflags_lto %optflags_lto -ffat-lto-objects"
|
||||
for f
|
||||
do
|
||||
for f; do
|
||||
# Output in one line per symbol format.
|
||||
nm -g -A -P "$f" > .tmp/lto-nm.$$ 2>/dev/null
|
||||
if grep -F -q -w ': __gnu_lto_slim' .tmp/lto-nm.$$; then
|
||||
echo >> .tmp/lto-suggest
|
||||
if grep -F -q -v -w ': __gnu_lto_slim' .tmp/lto-nm.$$; then
|
||||
Fatal "$f: contains __gnu_lto_slim. $suggest"
|
||||
Fatal "$f: contains __gnu_lto_slim."
|
||||
else
|
||||
Fatal "$f: contains __gnu_lto_slim only. $suggest"
|
||||
Fatal "$f: contains __gnu_lto_slim only."
|
||||
fi
|
||||
elif [ ! -s .tmp/lto-nm.$$ ]; then
|
||||
# This is only informational call of file.
|
||||
|
Loading…
Reference in New Issue
Block a user