From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756841AbcBDRKZ (ORCPT ); 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 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 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(-) 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} -- 2.5.0