stripper: Strip all unneeded relocation information

Message ID 20191224104651.11097-1-michael.tremer@ipfire.org
State Accepted
Commit 25d50589747eb20e48057f0a2efdac74b0f2cbb1
Headers
Series stripper: Strip all unneeded relocation information |

Commit Message

Michael Tremer Dec. 24, 2019, 10:46 a.m. UTC
  Libraries were treated differently and therfore it could
happen that they were not stripped from any unnecessary
relocation information at all.

This patch changes that and strips everything from
libraries that we do not need.

The ISO was 3MB smaller.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
---
 src/stripper | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
  

Patch

diff --git a/src/stripper b/src/stripper
index f121d3591..ac5f58ca5 100755
--- a/src/stripper
+++ b/src/stripper
@@ -17,7 +17,7 @@  done
 
 function _strip() {
 	local file=${1}
-	local cmd="${STRIP-strip}"
+	local strip="${STRIP-strip}"
 
 	local exclude l
 	for exclude in ${excludes}; do
@@ -27,17 +27,19 @@  function _strip() {
 		fi
 	done
 
+	local cmd=( "${strip}" )
+
 	case "$(file -bi ${file})" in
-		application/x-sharedlib*|application/x-archive*)
-			cmd="${cmd} --strip-debug --remove-section=.comment --remove-section=.note"
+		application/x-archive*)
+			cmd+=( "--strip-debug" "--remove-section=.comment" "--remove-section=.note" )
 			;;
 		*)
-			cmd="${cmd} --strip-unneeded"
+			cmd+=( "--strip-all" )
 			;;
 	esac
 
 	echo "Stripping ${file}..."
-	${cmd} ${file}
+	${cmd[*]} ${file}
 }
 
 for dir in ${dirs}; do