From patchwork Mon Mar 12 02:40:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Pitre X-Patchwork-Id: 10275003 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DF1D560233 for ; Mon, 12 Mar 2018 02:41:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CECD428BC7 for ; Mon, 12 Mar 2018 02:41:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C357828BCF; Mon, 12 Mar 2018 02:41:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3A26928BC7 for ; Mon, 12 Mar 2018 02:41:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:Message-ID: In-Reply-To:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=OmT2CzClL2rvjp5YG/NKk5BudoLSki5rQSFFWJj71d8=; b=UVnfJBClJJEPaH Xlx+5TQD67Wo+SxjIoNPDd3822EB7Lc3q78KLRntVc51EafS1LMEoKWyx2g53x2AKWIgrYyzbzZZH 90ZXXt7fsjWwfEZO/zRHdVM9UtpH+2CdvBmGndxSdvn6ydMWr4BsODZ3tr9pTUBa7Xwua2yAmjlZ9 s9TMiE4FivHZq6/cFEdjU7Rbl6kqAjBNboWKkUT4w2fJ253IYFvnT3Zx29SwrJ0bqAVAdsBAWfpbD RoRIxMSesVAf7gloX1+ymUUsJZ5dCL8fhuEDtPixBVbniTCXgSZeU2yh9QN/2Vx8pQWatF5q/DRdb w4OtduY82T0AwebBgDew==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1evDOh-0004IP-IS; Mon, 12 Mar 2018 02:41:11 +0000 Received: from mail-qt0-x244.google.com ([2607:f8b0:400d:c0d::244]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1evDOd-0004Ex-7M for linux-arm-kernel@lists.infradead.org; Mon, 12 Mar 2018 02:41:09 +0000 Received: by mail-qt0-x244.google.com with SMTP id g60so17259673qtd.11 for ; Sun, 11 Mar 2018 19:40:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=Shz+GrM86ojm0C6PefVAfx9CK1SG6+l89RfQHPjKnaM=; b=jZb5dTWUx8L3MjhUCQu8PObT49BwSncpBugrFUmUpzpDbTnW1PkGhgmHwPgI0mSXqk qWqa40jCZT++y5nFlPn/0dS5YfHiBl/9Lnpwz7G4aDSmjT7Chn8EIBrh21XE6EcMaPTo HrPiZ5UhVMOgEo6Vocest6ERSWznqSjkeSWmQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=Shz+GrM86ojm0C6PefVAfx9CK1SG6+l89RfQHPjKnaM=; b=sFRY4YXBPAJjgxdQUmMJ44x7TwubewGOKoZ3osmf15bt3qv/GT9G1oCE6Awop0ncjp JGqMTVmyiBxD6JZt3tRkEKfh8qcHJLxK8y6cEH8W+xoQij/aKfLd+LuNvud9T4Yas/DP VwtVAmj4yb0TogpWoOX2ln2J0s5o65cOkQgsiHb01WGdzSKdoHlBjDVM1ztSjdMiv6uJ EF/c3khKwxO6yWh2LgC224be5V5oLF+s8ca8cKQRcgUWGK+eB+C8fSW3Q+LtdUyURqDt ngPwKNGu08mEH1ygGlBrobQT3z2EkoskxW7YbFQPvd3Mbkh90e6br/xvsFma8JIhgO+G FleQ== X-Gm-Message-State: AElRT7GMlLBOWPwGg5F+sdgUgTWFQ/4nB/3uYSNwdWDIN1nZ9b+Lebm7 7lqVyG2OiAGHSgEGn5DudQ+ugA== X-Google-Smtp-Source: AG47ELtYnf+UK+hj6Ap/BVsKjm6kLjoFmV+/SsAZqTGbqnFYa4JH3pFEB2mO0rXOW8xgl+/ZZDoUkQ== X-Received: by 10.237.63.26 with SMTP id p26mr703234qtf.104.1520822455263; Sun, 11 Mar 2018 19:40:55 -0700 (PDT) Received: from xanadu.home (modemcable228.104-82-70.mc.videotron.ca. [70.82.104.228]) by smtp.gmail.com with ESMTPSA id c13sm4348593qth.97.2018.03.11.19.40.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 11 Mar 2018 19:40:54 -0700 (PDT) Date: Sun, 11 Mar 2018 22:40:53 -0400 (EDT) From: Nicolas Pitre To: Arnd Bergmann Subject: Re: [PATCH 1/7] ARM: disallow combining XIP and LTO In-Reply-To: <20180220215954.4092811-2-arnd@arndb.de> Message-ID: References: <20180220215954.4092811-1-arnd@arndb.de> <20180220215954.4092811-2-arnd@arndb.de> User-Agent: Alpine 2.21 (LFD 202 2017-01-01) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180311_194107_431904_B4127CAC X-CRM114-Status: GOOD ( 14.37 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andi Kleen , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP On Tue, 20 Feb 2018, Arnd Bergmann wrote: > This fails during deflate_xip_data.sh > > /home/arnd/cross-gcc/bin/arm-linux-gnueabi-objcopy -O binary -R .comment -S vmlinux arch/arm/boot/xipImage && /bin/bash -c '/git/arm-soc/arch/arm/boot/deflate_xip_data.sh vmlinux arch/arm/boot/xipImage || { rm -f arch/arm/boot/xipImage; false; }' > make -f /git/arm-soc/scripts/Makefile.modpost > + sym_val __data_loc > + sed -n / __data_loc$/{s/ .*$//p;q} > + /home/arnd/cross-gcc/bin/arm-linux-gnueabi-gcc-nm vmlinux > /home/arnd/cross-gcc/lib/gcc/arm-linux-gnueabi/8.0.1/../../../../arm-linux-gnueabi/bin/nm terminated with signal 13 [Broken pipe] > + local val=ac74c0f4 > + [ ac74c0f4 ] > + echo 2893332724 > + __data_loc=2893332724 > + sym_val _edata_loc > + /home/arnd/cross-gcc/bin/arm-linux-gnueabi-gcc-nm vmlinux > + sed -n / _edata_loc$/{s/ .*$//p;q} > /home/arnd/cross-gcc/lib/gcc/arm-linux-gnueabi/8.0.1/../../../../arm-linux-gnueabi/bin/nm terminated with signal 13 [Broken pipe] > + local val=ac7b8744 > + [ ac7b8744 ] > + echo 2893776708 > + _edata_loc=2893776708 > + sym_val _xiprom > + sed -n / _xiprom$/{s/ .*$//p;q} > + /home/arnd/cross-gcc/bin/arm-linux-gnueabi-gcc-nm vmlinux > /home/arnd/cross-gcc/lib/gcc/arm-linux-gnueabi/8.0.1/../../../../arm-linux-gnueabi/bin/nm terminated with signal 13 [Broken pipe] > > Obviously we want to make the combination work, no idea why it doesn't. Well, it does work regardless of the noise. Here the nm output is piped into sed, and the later exits early when it finds what it is looking for, causing nm to complain about the broken pipe. Here's a patch silencing this bogus error message and fixing other minor issues. ----- >8 Subject: [PATCH] ARM: deflate_xip_data.sh: minor fixes Send nm complaints about broken pipe (when sed exits early) to /dev/null. All errors should be printed to stderr. Don't trap on normal exit so the trap can return an error code. Signed-off-by: Nicolas Pitre Tested-by: Arnd Bergmann diff --git a/arch/arm/boot/deflate_xip_data.sh b/arch/arm/boot/deflate_xip_data.sh index 1189598a25..5e7d758ebd 100755 --- a/arch/arm/boot/deflate_xip_data.sh +++ b/arch/arm/boot/deflate_xip_data.sh @@ -30,7 +30,7 @@ esac sym_val() { # extract hex value for symbol in $1 - local val=$($NM "$VMLINUX" | sed -n "/ $1$/{s/ .*$//p;q}") + local val=$($NM "$VMLINUX" 2>/dev/null | sed -n "/ $1\$/{s/ .*$//p;q}") [ "$val" ] || { echo "can't find $1 in $VMLINUX" 1>&2; exit 1; } # convert from hex to decimal echo $((0x$val)) @@ -48,12 +48,12 @@ data_end=$(($_edata_loc - $base_offset)) file_end=$(stat -c "%s" "$XIPIMAGE") if [ "$file_end" != "$data_end" ]; then printf "end of xipImage doesn't match with _edata_loc (%#x vs %#x)\n" \ - $(($file_end + $base_offset)) $_edata_loc 2>&1 + $(($file_end + $base_offset)) $_edata_loc 1>&2 exit 1; fi # be ready to clean up -trap 'rm -f "$XIPIMAGE.tmp"' 0 1 2 3 +trap 'rm -f "$XIPIMAGE.tmp"; exit 1' 1 2 3 # substitute the data section by a compressed version $DD if="$XIPIMAGE" count=$data_start iflag=count_bytes of="$XIPIMAGE.tmp"