|
Mark Wielaard |
284dc3 |
From 85395ae424cf79bc05abe94472bdc11ea9239753 Mon Sep 17 00:00:00 2001
|
|
Mark Wielaard |
284dc3 |
From: Mark Wielaard <mark@klomp.org>
|
|
Mark Wielaard |
284dc3 |
Date: Mon, 17 Jul 2017 12:58:26 +0200
|
|
Mark Wielaard |
284dc3 |
Subject: [PATCH] find-debuginfo.sh: Add --keep-section and --remove-section
|
|
Mark Wielaard |
284dc3 |
for eu-strip.
|
|
Mark Wielaard |
284dc3 |
|
|
Mark Wielaard |
284dc3 |
Use --keep-section SECTION or --remove-section SECTION to explicitly
|
|
Mark Wielaard |
284dc3 |
keep a (non-allocated) section in the main executable or explicitly
|
|
Mark Wielaard |
284dc3 |
remove it into the .debug file. SECTION is an extended wildcard pattern.
|
|
Mark Wielaard |
284dc3 |
Both options can be given more than once.
|
|
Mark Wielaard |
284dc3 |
|
|
Mark Wielaard |
284dc3 |
https://bugzilla.redhat.com/show_bug.cgi?id=1465997
|
|
Mark Wielaard |
284dc3 |
|
|
Mark Wielaard |
284dc3 |
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
|
Mark Wielaard |
284dc3 |
(cherry picked from commit b388bfe936dd6d68d2f4efd1b4393bf8f8c13fe8)
|
|
Mark Wielaard |
284dc3 |
---
|
|
Mark Wielaard |
284dc3 |
scripts/find-debuginfo.sh | 21 +++++++++++++++++++--
|
|
Mark Wielaard |
284dc3 |
1 file changed, 19 insertions(+), 2 deletions(-)
|
|
Mark Wielaard |
284dc3 |
|
|
Mark Wielaard |
284dc3 |
diff --git a/scripts/find-debuginfo.sh b/scripts/find-debuginfo.sh
|
|
Mark Wielaard |
284dc3 |
index 185d25f96..5ec52d3bc 100644
|
|
Mark Wielaard |
284dc3 |
--- a/scripts/find-debuginfo.sh
|
|
Mark Wielaard |
284dc3 |
+++ b/scripts/find-debuginfo.sh
|
|
Mark Wielaard |
284dc3 |
@@ -3,6 +3,7 @@
|
|
Mark Wielaard |
284dc3 |
#for inclusion in an rpm spec file.
|
|
Mark Wielaard |
284dc3 |
#
|
|
Mark Wielaard |
284dc3 |
# Usage: find-debuginfo.sh [--strict-build-id] [-g] [-r] [-m] [-i] [-n]
|
|
Mark Wielaard |
284dc3 |
+# [--keep-section SECTION] [--remove-section SECTION]
|
|
Mark Wielaard |
284dc3 |
# [-j N]
|
|
Mark Wielaard |
284dc3 |
# [-o debugfiles.list]
|
|
Mark Wielaard |
284dc3 |
# [-S debugsourcefiles.list]
|
|
Mark Wielaard |
284dc3 |
@@ -15,9 +16,14 @@
|
|
Mark Wielaard |
284dc3 |
# [builddir]
|
|
Mark Wielaard |
284dc3 |
#
|
|
Mark Wielaard |
284dc3 |
# The -g flag says to use strip -g instead of full strip on DSOs or EXEs.
|
|
Mark Wielaard |
284dc3 |
+# The -r flag says to use eu-strip --reloc-debug-sections.
|
|
Mark Wielaard |
284dc3 |
+# Use --keep-section SECTION or --remove-section SECTION to explicitly
|
|
Mark Wielaard |
284dc3 |
+# keep a (non-allocated) section in the main executable or explicitly
|
|
Mark Wielaard |
284dc3 |
+# remove it into the .debug file. SECTION is an extended wildcard pattern.
|
|
Mark Wielaard |
284dc3 |
+# Both options can be given more than once.
|
|
Mark Wielaard |
284dc3 |
+#
|
|
Mark Wielaard |
284dc3 |
# The --strict-build-id flag says to exit with failure status if
|
|
Mark Wielaard |
284dc3 |
# any ELF binary processed fails to contain a build-id note.
|
|
Mark Wielaard |
284dc3 |
-# The -r flag says to use eu-strip --reloc-debug-sections.
|
|
Mark Wielaard |
284dc3 |
# The -m flag says to include a .gnu_debugdata section in the main binary.
|
|
Mark Wielaard |
284dc3 |
# The -i flag says to include a .gdb_index section in the .debug file.
|
|
Mark Wielaard |
284dc3 |
# The -n flag says to not recompute the build-id.
|
|
Mark Wielaard |
284dc3 |
@@ -65,6 +71,9 @@ strip_g=false
|
|
Mark Wielaard |
284dc3 |
# with -r arg, pass --reloc-debug-sections to eu-strip.
|
|
Mark Wielaard |
284dc3 |
strip_r=false
|
|
Mark Wielaard |
284dc3 |
|
|
Mark Wielaard |
284dc3 |
+# keep or remove arguments to eu-strip.
|
|
Mark Wielaard |
284dc3 |
+keep_remove_args=
|
|
Mark Wielaard |
284dc3 |
+
|
|
Mark Wielaard |
284dc3 |
# with -m arg, add minimal debuginfo to binary.
|
|
Mark Wielaard |
284dc3 |
include_minidebug=false
|
|
Mark Wielaard |
284dc3 |
|
|
Mark Wielaard |
284dc3 |
@@ -158,6 +167,14 @@ while [ $# -gt 0 ]; do
|
|
Mark Wielaard |
284dc3 |
-r)
|
|
Mark Wielaard |
284dc3 |
strip_r=true
|
|
Mark Wielaard |
284dc3 |
;;
|
|
Mark Wielaard |
284dc3 |
+ --keep-section)
|
|
Mark Wielaard |
284dc3 |
+ keep_remove_args="${keep_remove_args} --keep-section $2"
|
|
Mark Wielaard |
284dc3 |
+ shift
|
|
Mark Wielaard |
284dc3 |
+ ;;
|
|
Mark Wielaard |
284dc3 |
+ --remove-section)
|
|
Mark Wielaard |
284dc3 |
+ keep_remove_args="${keep_remove_args} --remove-section $2"
|
|
Mark Wielaard |
284dc3 |
+ shift
|
|
Mark Wielaard |
284dc3 |
+ ;;
|
|
Mark Wielaard |
284dc3 |
-j)
|
|
Mark Wielaard |
284dc3 |
n_jobs=$2
|
|
Mark Wielaard |
284dc3 |
shift
|
|
Mark Wielaard |
284dc3 |
@@ -215,7 +232,7 @@ strip_to_debug()
|
|
Mark Wielaard |
284dc3 |
application/x-sharedlib*) g=-g ;;
|
|
Mark Wielaard |
284dc3 |
application/x-executable*) g=-g ;;
|
|
Mark Wielaard |
284dc3 |
esac
|
|
Mark Wielaard |
284dc3 |
- eu-strip --remove-comment $r $g -f "$1" "$2" || exit
|
|
Mark Wielaard |
284dc3 |
+ eu-strip --remove-comment $r $g ${keep_remove_args} -f "$1" "$2" || exit
|
|
Mark Wielaard |
284dc3 |
chmod 444 "$1" || exit
|
|
Mark Wielaard |
284dc3 |
}
|
|
Mark Wielaard |
284dc3 |
|