2017-12-05 11:46:24 +01:00
|
|
|
--- ./scripts/find-debuginfo.sh.orig 2017-10-05 10:04:57.586602035 +0000
|
|
|
|
+++ ./scripts/find-debuginfo.sh 2017-12-01 14:45:15.439290101 +0000
|
|
|
|
@@ -326,12 +326,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 \) \
|
|
|
|
- -print |
|
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' |
|
2017-12-05 11:46:24 +01:00
|
|
|
+find "$RPM_BUILD_ROOT" ! -path "${debugdir}/*.debug" -type f \( -perm /111 -or -name "*.so*" -or -name "*.ko" \) ! -name "*.a" -print0 | 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
|
|
|
|
@@ -364,6 +370,8 @@ do_file()
|
|
|
|
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"} \
|
|
|
|
@@ -387,17 +395,30 @@ do_file()
|
|
|
|
# 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
|
|
|
|
@@ -507,7 +528,7 @@ if $run_dwz \
|
2017-07-26 14:48:33 +02:00
|
|
|
rmdir "${RPM_BUILD_ROOT}/usr/lib/debug/.dwz" 2>/dev/null
|
|
|
|
if [ -f "${RPM_BUILD_ROOT}/usr/lib/debug/.dwz/${dwz_multifile_name}" ]; then
|
|
|
|
id="`readelf -Wn "${RPM_BUILD_ROOT}/usr/lib/debug/.dwz/${dwz_multifile_name}" \
|
|
|
|
- 2>/dev/null | sed -n 's/^ Build ID: \([0-9a-f]\+\)/\1/p'`"
|
|
|
|
+ 2>/dev/null | sed -n 's/^.* Build ID: \([0-9a-f]\+\)/\1/p'`"
|
|
|
|
fi
|
2017-12-05 11:46:24 +01:00
|
|
|
|
|
|
|
# dwz invalidates .gnu_debuglink CRC32 in the main files.
|
|
|
|
@@ -551,12 +572,14 @@ if [ -s "$SOURCEFILE" ]; then
|
|
|
|
# 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
|
|
|
|
2008-09-12 20:37:28 +02:00
|
|
|
if [ -d "${RPM_BUILD_ROOT}/usr/lib" -o -d "${RPM_BUILD_ROOT}/usr/src" ]; then
|
|
|
|
((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"
|