2019-10-02 15:28:11 +02:00
|
|
|
--- ./scripts/find-debuginfo.sh.orig 2019-09-09 07:56:53.377788842 +0000
|
|
|
|
+++ ./scripts/find-debuginfo.sh 2019-10-02 11:11:56.878979662 +0000
|
|
|
|
@@ -348,12 +348,18 @@ trap 'rm -rf "$temp"' EXIT
|
2008-09-16 01:28:45 +02:00
|
|
|
|
2017-12-05 11:46:24 +01:00
|
|
|
# Build a list of unstripped ELF files and their hardlinks
|
|
|
|
touch "$temp/primary"
|
2008-09-12 20:37:28 +02:00
|
|
|
-find "$RPM_BUILD_ROOT" ! -path "${debugdir}/*.debug" -type f \
|
|
|
|
- \( -perm -0100 -or -perm -0010 -or -perm -0001 \) \
|
2019-10-02 15:28:11 +02:00
|
|
|
- -print | LC_ALL=C sort |
|
2017-01-19 16:41:55 +01:00
|
|
|
-file -N -f - | sed -n -e 's/^\(.*\):[ ]*.*ELF.*, not stripped.*/\1/p' |
|
2008-09-16 01:28:45 +02:00
|
|
|
-xargs --no-run-if-empty stat -c '%h %D_%i %n' |
|
2019-10-02 15:28:11 +02:00
|
|
|
+find "$RPM_BUILD_ROOT" ! -path "${debugdir}/*.debug" -type f \( -perm /111 -or -name "*.so*" -or -name "*.ko" \) ! -name "*.a" -print0 | LC_ALL=C sort -z |
|
2008-09-16 01:28:45 +02:00
|
|
|
+xargs --no-run-if-empty -0 stat -c '%h %D_%i %n' |
|
2008-09-12 20:37:28 +02:00
|
|
|
while read nlinks inum f; do
|
|
|
|
+ case $(objdump -h $f 2>/dev/null | egrep -o '(debug[\.a-z_]*|gnu.version)') in
|
|
|
|
+ *debuglink*) continue ;;
|
|
|
|
+ *debug*) ;;
|
|
|
|
+ *gnu.version*)
|
2017-01-19 16:41:55 +01:00
|
|
|
+ echo "WARNING: "`echo $f | sed -e "s,^$RPM_BUILD_ROOT/*,/,"`" is already stripped!"
|
|
|
|
+ continue
|
|
|
|
+ ;;
|
2008-09-12 20:37:28 +02:00
|
|
|
+ *) continue ;;
|
|
|
|
+ esac
|
2017-12-05 11:46:24 +01:00
|
|
|
if [ $nlinks -gt 1 ]; then
|
|
|
|
var=seen_$inum
|
|
|
|
if test -n "${!var}"; then
|
2019-10-02 15:28:11 +02:00
|
|
|
@@ -386,6 +392,8 @@ do_file()
|
2017-12-05 11:46:24 +01:00
|
|
|
if [ "$no_recompute_build_id" = "true" ]; then
|
|
|
|
no_recompute="-n"
|
2008-09-12 20:37:28 +02:00
|
|
|
fi
|
|
|
|
+ mode=$(stat -c %a "$f")
|
|
|
|
+ chmod +w "$f"
|
2017-12-05 11:46:24 +01:00
|
|
|
id=$(${lib_rpm_dir}/debugedit -b "$debug_base_name" -d "$debug_dest_name" \
|
|
|
|
$no_recompute -i \
|
|
|
|
${build_id_seed:+--build-id-seed="$build_id_seed"} \
|
2019-10-02 15:28:11 +02:00
|
|
|
@@ -413,17 +421,30 @@ do_file()
|
2017-12-05 11:46:24 +01:00
|
|
|
# just has its file names collected and adjusted.
|
|
|
|
case "$dn" in
|
|
|
|
/usr/lib/debug/*)
|
|
|
|
+ chmod $mode "$f"
|
|
|
|
return ;;
|
2008-09-12 20:37:28 +02:00
|
|
|
esac
|
2006-12-19 00:17:44 +01:00
|
|
|
|
2008-09-12 20:37:28 +02:00
|
|
|
mkdir -p "${debugdn}"
|
|
|
|
- if test -w "$f"; then
|
|
|
|
- strip_to_debug "${debugfn}" "$f"
|
|
|
|
- else
|
|
|
|
- chmod u+w "$f"
|
|
|
|
- strip_to_debug "${debugfn}" "$f"
|
|
|
|
- chmod u-w "$f"
|
|
|
|
- fi
|
2017-12-05 11:46:24 +01:00
|
|
|
+ objcopy --only-keep-debug "$f" "$debugfn" || :
|
2008-09-12 20:37:28 +02:00
|
|
|
+ (
|
|
|
|
+ shopt -s extglob
|
|
|
|
+ strip_option="--strip-all"
|
|
|
|
+ case "$f" in
|
|
|
|
+ *.ko)
|
|
|
|
+ strip_option="--strip-debug" ;;
|
|
|
|
+ *$STRIP_KEEP_SYMTAB*)
|
|
|
|
+ if test -n "$STRIP_KEEP_SYMTAB"; then
|
|
|
|
+ strip_option="--strip-debug"
|
|
|
|
+ fi
|
|
|
|
+ ;;
|
|
|
|
+ esac
|
|
|
|
+ if test "$NO_DEBUGINFO_STRIP_DEBUG" = true ; then
|
|
|
|
+ strip_option=
|
|
|
|
+ fi
|
2017-12-05 11:46:24 +01:00
|
|
|
+ objcopy --add-gnu-debuglink="$debugfn" -R .comment -R .GCC.command.line $strip_option "$f"
|
|
|
|
+ chmod $mode "$f"
|
2008-09-12 20:37:28 +02:00
|
|
|
+ ) || :
|
2006-12-19 00:17:44 +01:00
|
|
|
|
2017-01-19 16:41:55 +01:00
|
|
|
# strip -g implies we have full symtab, don't add mini symtab in that case.
|
2017-12-05 11:46:24 +01:00
|
|
|
# It only makes sense to add a minisymtab for executables and shared
|
2019-10-02 15:28:11 +02:00
|
|
|
@@ -581,12 +602,14 @@ if [ -s "$SOURCEFILE" ]; then
|
2017-12-05 11:46:24 +01:00
|
|
|
# and non-standard modes may be inherented from original directories, fixup
|
|
|
|
find "${RPM_BUILD_ROOT}${debug_dest_name}" -type d -print0 |
|
|
|
|
xargs --no-run-if-empty -0 chmod 0755
|
|
|
|
+ find "${RPM_BUILD_ROOT}${debug_dest_name}" -type f -print0 |
|
2008-09-12 20:37:28 +02:00
|
|
|
+ xargs --no-run-if-empty -0 chmod a+r
|
|
|
|
fi
|
2007-04-23 23:21:13 +02:00
|
|
|
|
2019-10-02 15:28:11 +02:00
|
|
|
if [ -d "${RPM_BUILD_ROOT}/usr/lib" ] || [ -d "${RPM_BUILD_ROOT}/usr/src" ]; then
|
2008-09-12 20:37:28 +02:00
|
|
|
((nout > 0)) ||
|
|
|
|
test ! -d "${RPM_BUILD_ROOT}/usr/lib" ||
|
|
|
|
- (cd "${RPM_BUILD_ROOT}/usr/lib"; find debug -type d) |
|
|
|
|
+ (cd "${RPM_BUILD_ROOT}/usr/lib"; test ! -d debug || find debug -type d) |
|
|
|
|
sed 's,^,%dir /usr/lib/,' >> "$LISTFILE"
|
2008-04-09 18:18:03 +02:00
|
|
|
|
2008-09-12 20:37:28 +02:00
|
|
|
(cd "${RPM_BUILD_ROOT}/usr"
|