From patchwork Thu Feb 4 17:09:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 61210 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp582050lbl; Thu, 4 Feb 2016 09:10:27 -0800 (PST) X-Received: by 10.66.235.36 with SMTP id uj4mr12713254pac.85.1454605827593; Thu, 04 Feb 2016 09:10:27 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id lh7si10918688pab.112.2016.02.04.09.10.26; Thu, 04 Feb 2016 09:10:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dkim=pass header.i=@linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756932AbcBDRKZ (ORCPT + 30 others); Thu, 4 Feb 2016 12:10:25 -0500 Received: from mail-wm0-f42.google.com ([74.125.82.42]:37851 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754153AbcBDRKX (ORCPT ); Thu, 4 Feb 2016 12:10:23 -0500 Received: by mail-wm0-f42.google.com with SMTP id g62so14276425wme.0 for ; Thu, 04 Feb 2016 09:10:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=W2Jm1Y3OfjEiPVuYJoMVr5qtg1LiZ7imqHTczb3dzB0=; b=BMKfEEebpfUUK1tqldMXJ7nRxSuJxNEWYb7f4k4+puiIIPMN45By+bTFuq4LFvlUL5 3jmuFZRBD3SyzhZrf1ryj/jLYgb8ZCwPCXN3bJcU42wW/jLCuWdvwqf8G+sHi537MMn2 D18NBJJ/rYcQ35e/i9t79Sl0UzejpMSaFhk+8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=W2Jm1Y3OfjEiPVuYJoMVr5qtg1LiZ7imqHTczb3dzB0=; b=QegAzLCX4ewcIcBD19qs/q2KYPU9fUHBNjGltmoXAXIkFaPU27WVnxWsclpSK7XCTL ETx/Q5+fESMVqfd6a7Wtpfgv9raUGXO+jnI8kqzfbNDxB4IpnOUIXDfsqy1cq/XAwp42 BN4rDGX/Ta601GunIGDOkweIlQmtjNNBiV7DWCvET7bNDD87TmO2EihzJZHPbGwtUHHP C0zqj+WgnHamFECbxIv6iM67yRF+XPqZziIfnAJvg3oKzfHPa2YzgRJkPS7gNmaEvHdD yWTJI+HwOMhMIjwJOldxnIsXr+3VEKY5ctjtdtu6wvPzqmdjLPB2ojyB82r1/faXAVWh R01Q== X-Gm-Message-State: AG10YORgzOWt6+6mnrGEU6xSnyF4AxejCmNhdSi8Tp/SeAzgdoOAScGMD0huZsIBVN+hIR7x X-Received: by 10.28.20.83 with SMTP id 80mr12005495wmu.89.1454605822573; Thu, 04 Feb 2016 09:10:22 -0800 (PST) Received: from localhost.localdomain ([195.55.142.58]) by smtp.gmail.com with ESMTPSA id e9sm12176201wja.25.2016.02.04.09.10.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 04 Feb 2016 09:10:21 -0800 (PST) From: Ard Biesheuvel To: linux-kernel@vger.kernel.org, akpm@linux-foundation.org, linux@roeck-us.net, arnd@arndb.de Cc: rusty@rustcorp.com.au, mmarek@suse.cz, Ard Biesheuvel Subject: [PATCH] scripts/link-vmlinux.sh: force error on kallsyms failure Date: Thu, 4 Feb 2016 18:09:39 +0100 Message-Id: <1454605779-30869-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.5.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since the output of the invocation of scripts/kallsyms is piped directly into the assembler, error messages it emits are visible on stderr, but a non-zero return code is ignored, and the build simply proceeds in that case. However, the resulting kernel is most likely broken, and will crash at boot. So capture the return code of scripts/kallsyms explicitly (in a POSIX shell compatible manner), and abort the script if it is non-zero. Signed-off-by: Ard Biesheuvel --- scripts/link-vmlinux.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) -- 2.5.0 diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index b83f918c7830..71882648e064 100755 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh @@ -93,9 +93,12 @@ kallsyms() local aflags="${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL} \ ${NOSTDINC_FLAGS} ${LINUXINCLUDE} ${KBUILD_CPPFLAGS}" - ${NM} -n ${1} | \ - scripts/kallsyms ${kallsymopt} | \ - ${CC} ${aflags} -c -o ${2} -x assembler-with-cpp - + # capture the return code of scripts/kallsyms in $RC + local RC=`(${NM} -n ${1} | \ + (scripts/kallsyms ${kallsymopt}; echo $? 1>&3) | \ + ${CC} ${aflags} -c -o ${2} -x assembler-with-cpp -) 3>&1` + + [ $RC -eq 0 ] } # Create map file with all symbols from ${1}