Igor Gnatenko 082d5d
From f22cb2890026544499ee4f1a309a44c71e0b8152 Mon Sep 17 00:00:00 2001
Igor Gnatenko 082d5d
From: Mark Wielaard <mark@klomp.org>
Igor Gnatenko 082d5d
Date: Mon, 26 Jun 2017 17:38:30 +0200
Igor Gnatenko 082d5d
Subject: [PATCH 41/49] find-debuginfo.sh: Don't create dwz multi file if there
Igor Gnatenko 082d5d
 is only one .debug.
Mark Wielaard 150179
Igor Gnatenko 082d5d
dwz -m multi only works when there are multiple .debug input files.
Igor Gnatenko 082d5d
With just one .debug file it doesn't really make sense to extract
Igor Gnatenko 082d5d
the shared debug info into a separate file and dwz will complain:
Igor Gnatenko 082d5d
Igor Gnatenko 082d5d
  dwz: Too few files for multifile optimization.
Igor Gnatenko 082d5d
Igor Gnatenko 082d5d
So only add -m multi if there is more than one .debug file.
Igor Gnatenko 082d5d
Igor Gnatenko 082d5d
Signed-off-by: Mark Wielaard <mark@klomp.org>
Igor Gnatenko 082d5d
(cherry picked from commit 0f162dc41f2051eab237bd223356d88e94a07580)
Igor Gnatenko 082d5d
---
Igor Gnatenko 082d5d
 scripts/find-debuginfo.sh | 10 ++++++----
Igor Gnatenko 082d5d
 1 file changed, 6 insertions(+), 4 deletions(-)
Mark Wielaard 150179
Mark Wielaard 150179
diff --git a/scripts/find-debuginfo.sh b/scripts/find-debuginfo.sh
Igor Gnatenko 082d5d
index eb62a158a..3bfc15a79 100644
Mark Wielaard 150179
--- a/scripts/find-debuginfo.sh
Mark Wielaard 150179
+++ b/scripts/find-debuginfo.sh
Igor Gnatenko 082d5d
@@ -442,8 +442,8 @@ fi
Mark Wielaard 150179
 # Invoke the DWARF Compressor utility.
Mark Wielaard 150179
 if $run_dwz \
Mark Wielaard 150179
    && [ -d "${RPM_BUILD_ROOT}/usr/lib/debug" ]; then
Mark Wielaard 150179
-  dwz_files="`cd "${RPM_BUILD_ROOT}/usr/lib/debug"; find -type f -name \*.debug`"
Mark Wielaard 150179
-  if [ -n "${dwz_files}" ]; then
Mark Wielaard 150179
+  readarray dwz_files < <(cd "${RPM_BUILD_ROOT}/usr/lib/debug"; find -type f -name \*.debug)
Mark Wielaard 150179
+  if [ ${#dwz_files[@]} -gt 0 ]; then
Mark Wielaard 150179
     dwz_multifile_name="${RPM_PACKAGE_NAME}-${RPM_PACKAGE_VERSION}-${RPM_PACKAGE_RELEASE}.${RPM_ARCH}"
Mark Wielaard 150179
     dwz_multifile_suffix=
Mark Wielaard 150179
     dwz_multifile_idx=0
Igor Gnatenko 082d5d
@@ -452,14 +452,16 @@ if $run_dwz \
Mark Wielaard 150179
       dwz_multifile_suffix=".${dwz_multifile_idx}"
Mark Wielaard 150179
     done
Mark Wielaard 150179
     dwz_multfile_name="${dwz_multifile_name}${dwz_multifile_suffix}"
Mark Wielaard 150179
-    dwz_opts="-h -q -r -m .dwz/${dwz_multifile_name}"
Mark Wielaard 150179
+    dwz_opts="-h -q -r"
Mark Wielaard 150179
+    [ ${#dwz_files[@]} -gt 1 ] \
Mark Wielaard 150179
+      && dwz_opts="${dwz_opts} -m .dwz/${dwz_multifile_name}"
Mark Wielaard 150179
     mkdir -p "${RPM_BUILD_ROOT}/usr/lib/debug/.dwz"
Mark Wielaard 150179
     [ -n "${dwz_low_mem_die_limit}" ] \
Mark Wielaard 150179
       && dwz_opts="${dwz_opts} -l ${dwz_low_mem_die_limit}"
Mark Wielaard 150179
     [ -n "${dwz_max_die_limit}" ] \
Mark Wielaard 150179
       && dwz_opts="${dwz_opts} -L ${dwz_max_die_limit}"
Mark Wielaard 150179
     if type dwz >/dev/null 2>&1; then
Mark Wielaard 150179
-      ( cd "${RPM_BUILD_ROOT}/usr/lib/debug" && dwz $dwz_opts $dwz_files )
Mark Wielaard 150179
+      ( cd "${RPM_BUILD_ROOT}/usr/lib/debug" && dwz $dwz_opts ${dwz_files[@]} )
Mark Wielaard 150179
     else
Mark Wielaard 150179
       echo >&2 "*** ERROR: DWARF compression requested, but no dwz installed"
Mark Wielaard 150179
       exit 2
Igor Gnatenko 082d5d
-- 
Igor Gnatenko 082d5d
2.13.2
Igor Gnatenko 082d5d