From patchwork Tue Feb 22 12:51:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tremer X-Patchwork-Id: 5263 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 "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4K2zbW0GNHz3xgf for ; Tue, 22 Feb 2022 12:52:39 +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) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4K2zZv33jKz5bV; Tue, 22 Feb 2022 12:52:07 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4K2zZt6RxCz32MR; Tue, 22 Feb 2022 12:52:06 +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 "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4K2zZj21hWz32Mf for ; Tue, 22 Feb 2022 12:51:57 +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) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4K2zZh6kKtz5WD; Tue, 22 Feb 2022 12:51:56 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1645534316; 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: in-reply-to:in-reply-to:references:references; bh=o+1Gdl9dtxKNcZ1CenWoMCjytQbHw3905PTqNo7iVCQ=; b=yhSUVnotXP25DrMWJv9t6E0gFZhi9tsH3grGHKUuZGvNP/1JS2bpmVuu2BvNcX9HmogQtU Yb2+ofcZkO3iH6AA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1645534316; 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: in-reply-to:in-reply-to:references:references; bh=o+1Gdl9dtxKNcZ1CenWoMCjytQbHw3905PTqNo7iVCQ=; b=k6dhkS7bYcCWR+qfAAiLEdlYIY4FEMI9/t+oLvtmtJLizKsaiGpYjwabeYQ/XkQiQDLBS6 Z0//Mle2xh0UzQ/Up2vV/75+PJRU8liUlQvkSm77H7IGyoJGCq2UMHmFCmzkwvQDni+FZh bj0J6XCcgwB1WwrFZIEcGubZADejEPCfyWTEasl+aWuUuNHsDofg+pMAFgGLQ6EYTcvUDr YgttvlwgH6+9eTdASHQzVoeYquxV32kAVpnvjWF8f5vnVyuUoo+T4tsJsDy1YLXZ8UTDVw JtnledxNb9oguhbU3vEGSuCesZo2SMlAcyslY5i4qU7i62FBm8tBh5QZZeGCQw== From: Michael Tremer To: development@lists.ipfire.org Subject: [PATCH 39/50] strip: Make this work when cross-compiling Date: Tue, 22 Feb 2022 12:51:24 +0000 Message-Id: <20220222125135.1211290-40-michael.tremer@ipfire.org> In-Reply-To: <20220222125135.1211290-1-michael.tremer@ipfire.org> References: <20220222125135.1211290-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" The host might not have the correct tools to strip a foreign architecture, therefore we need to use the cross tools. The crosstools might be built in an architecture that they cannot strip themselves and since they are not being part of the packaged toolchain, we will just skip them. Signed-off-by: Michael Tremer --- lfs/strip | 5 ++++- src/stripper | 13 ++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/lfs/strip b/lfs/strip index 466dfd9d5..c577c954b 100644 --- a/lfs/strip +++ b/lfs/strip @@ -48,7 +48,10 @@ md5 : $(TARGET) : ifeq "$(TOOLCHAIN)" "1" # Strip everything in the toolchain - $(DIR_SRC)/src/stripper $(TOOLS_DIR) + $(DIR_SRC)/src/stripper $(TOOLS_DIR) \ + --strip="$(TOOLS_DIR)/$(CROSSTARGET)/bin/strip" \ + --ignore-errors \ + --exclude=$(TOOLS_DIR)/$(CROSSTARGET) else # Don't strip VDR binaries, because they use a weird plugin system # which does not work when unneeded symbols get stripped from diff --git a/src/stripper b/src/stripper index fa624815b..498a8a30e 100755 --- a/src/stripper +++ b/src/stripper @@ -2,12 +2,20 @@ paths=() excludes=() +strip="strip" +break_on_error="1" while [ $# -gt 0 ]; do case "${1}" in + --strip=*) + strip="${1#*=}" + ;; --exclude=*) excludes+=( "!" "-path" "${1#*=}/*" ) ;; + --ignore-errors) + break_on_error="0" + ;; *) paths+=( "${1}" ) ;; @@ -49,11 +57,10 @@ function _strip() { --absolute-names --dump "${file}" 2>/dev/null)" echo "Stripping ${file}..." - if ! strip "${args[@]}" "${file}"; then - return 1 + if ! "${strip}" "${args[@]}" "${file}"; then + return ${break_on_error} fi - # Restore capabilities if [ -n "${capabilities}" ]; then setfattr --no-dereference --restore=<(echo "${capabilities}")