[Rpm-maint] [PATCH] find-debuginfo.sh: Only add minisymtab for executables or shared libraries.

Mark Wielaard mark at klomp.org
Sun Apr 16 16:16:02 UTC 2017


It only makes sense to add a minisymtab for executables and shared
libraries. Other executable ELF files (like kernel modules) don't need it.
Since those don't have a dynsym section trying to add it will fail and
produce confusing errors from nm.

Signed-off-by: Mark Wielaard <mark at klomp.org>
---
 scripts/find-debuginfo.sh | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/scripts/find-debuginfo.sh b/scripts/find-debuginfo.sh
index 6f38e19..39bb0b7 100755
--- a/scripts/find-debuginfo.sh
+++ b/scripts/find-debuginfo.sh
@@ -358,7 +358,16 @@ do_file()
   fi
 
   # strip -g implies we have full symtab, don't add mini symtab in that case.
-  $strip_g || ($include_minidebug && add_minidebug "${debugfn}" "$f")
+  # It only makes sense to add a minisymtab for executables and shared
+  # libraries. Other executable ELF files (like kernel modules) don't need it.
+  if [ "$include_minidebug" = "true" -a "$strip_g" = "false" ]; then
+    skip_mini=true
+    case "$(file -bi "$f")" in
+      application/x-sharedlib*) skip_mini=false ;;
+      application/x-executable*) skip_mini=false ;;
+    esac
+    $skip_mini || add_minidebug "${debugfn}" "$f"
+  fi
 
   echo "./${f#$RPM_BUILD_ROOT}" >> "$ELFBINSFILE"
 
-- 
2.9.3



More information about the Rpm-maint mailing list