From patchwork Tue Dec 24 10:46:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tremer X-Patchwork-Id: 2659 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 47htFf1K5zz3xXr for ; Tue, 24 Dec 2019 10:47:02 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail02.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 47htFd01c4z2KR; Tue, 24 Dec 2019 10:47:00 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 47htFc6Hs1z2yHh; Tue, 24 Dec 2019 10:47:00 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 47htFb5jGKz2xcM for ; Tue, 24 Dec 2019 10:46:59 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPSA id 47htFb2Pksz2KR; Tue, 24 Dec 2019 10:46:59 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=201909ed25519; t=1577184419; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=8uOQbZRY09n5odhRpqO95EZJPwgBiwW57P78q/xq4hk=; b=ZmEB9qUlZNhD4CEGL+qdBP/ZRIYHawD9LW+er34PfCl0Te6W23ChIwCu1ZaRd0j77mYNUm 5HK7slEK/PJIqRBQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=201909rsa; t=1577184419; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=8uOQbZRY09n5odhRpqO95EZJPwgBiwW57P78q/xq4hk=; b=Gxeq73mc7JeWvybU1FTeSAxQ5ftqnMUH2q/POeuDdUP2UicFTVTK5LQOAVQwM4g/YEBNoM /cJslvqmrwbpuiE5jHo2uHgwirsOwQGx8mUrYWk9Gce8e+XbK6FXoTDMtDaSOypHzgRdZ2 Org13TjDA6X4GCwyi+hS+Fg3x/a4qwLhuVEYceBFOYns8nyorJI4Q4dnBXGjjCrAf3lrfm nmXZT3kXJyn67Y1E/4PcqorxXVWhN0WD6CnITqOL+GVsnTQO8Ti2Xw7oPlI6rJ6o7eybcw FQOLYbo+OzVDj+IoTMjFcXMWhEfC8wqXBDHgnGbkwFZMSRnYL411Gyq9kiSE0Q== From: Michael Tremer To: development@lists.ipfire.org Subject: [PATCH] stripper: Strip all unneeded relocation information Date: Tue, 24 Dec 2019 10:46:51 +0000 Message-Id: <20191224104651.11097-1-michael.tremer@ipfire.org> MIME-Version: 1.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Tremer Errors-To: development-bounces@lists.ipfire.org Sender: "Development" 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 --- src/stripper | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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