Igor Gnatenko 082d5d
From 349489c3219e31efd552d87e255b06a864d1c034 Mon Sep 17 00:00:00 2001
Igor Gnatenko 082d5d
From: Mark Wielaard <mark@klomp.org>
Igor Gnatenko 082d5d
Date: Sun, 16 Apr 2017 18:16:02 +0200
Igor Gnatenko 082d5d
Subject: [PATCH 28/49] find-debuginfo.sh: Only add minisymtab for executables
Igor Gnatenko 082d5d
 or shared libraries.
Mark Wielaard e589ca
Igor Gnatenko 082d5d
It only makes sense to add a minisymtab for executables and shared
Igor Gnatenko 082d5d
libraries. Other executable ELF files (like kernel modules) don't need it.
Igor Gnatenko 082d5d
Since those don't have a dynsym section trying to add it will fail and
Igor Gnatenko 082d5d
produce confusing errors from nm.
Igor Gnatenko 082d5d
Igor Gnatenko 082d5d
Signed-off-by: Mark Wielaard <mark@klomp.org>
Igor Gnatenko 082d5d
(cherry picked from commit 3790a6872749a9601be6044be7d8fb0951131376)
Igor Gnatenko 082d5d
---
Igor Gnatenko 082d5d
 scripts/find-debuginfo.sh | 11 ++++++++++-
Igor Gnatenko 082d5d
 1 file changed, 10 insertions(+), 1 deletion(-)
Mark Wielaard e589ca
Mark Wielaard e589ca
diff --git a/scripts/find-debuginfo.sh b/scripts/find-debuginfo.sh
Igor Gnatenko 082d5d
index 1420ef6cd..f1ffcd7d8 100644
Mark Wielaard e589ca
--- a/scripts/find-debuginfo.sh
Mark Wielaard e589ca
+++ b/scripts/find-debuginfo.sh
Igor Gnatenko 082d5d
@@ -347,7 +347,16 @@ while read nlinks inum f; do
Mark Wielaard e589ca
   fi
Mark Wielaard e589ca
 
Mark Wielaard e589ca
   # strip -g implies we have full symtab, don't add mini symtab in that case.
Mark Wielaard e589ca
-  $strip_g || ($include_minidebug && add_minidebug "${debugfn}" "$f")
Mark Wielaard e589ca
+  # It only makes sense to add a minisymtab for executables and shared
Mark Wielaard e589ca
+  # libraries. Other executable ELF files (like kernel modules) don't need it.
Mark Wielaard e589ca
+  if [ "$include_minidebug" = "true" -a "$strip_g" = "false" ]; then
Mark Wielaard e589ca
+    skip_mini=true
Mark Wielaard e589ca
+    case "$(file -bi "$f")" in
Mark Wielaard e589ca
+      application/x-sharedlib*) skip_mini=false ;;
Mark Wielaard e589ca
+      application/x-executable*) skip_mini=false ;;
Mark Wielaard e589ca
+    esac
Mark Wielaard e589ca
+    $skip_mini || add_minidebug "${debugfn}" "$f"
Mark Wielaard e589ca
+  fi
Mark Wielaard e589ca
 
Mark Wielaard e589ca
   echo "./${f#$RPM_BUILD_ROOT}" >> "$ELFBINSFILE"
Mark Wielaard e589ca
 
Igor Gnatenko 082d5d
-- 
Igor Gnatenko 082d5d
2.13.2
Igor Gnatenko 082d5d