From patchwork Mon Feb 22 05:13:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Bobroff X-Patchwork-Id: 586013 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 8585F140783 for ; Mon, 22 Feb 2016 16:15:13 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 52B9B1A087B for ; Mon, 22 Feb 2016 16:15:13 +1100 (AEDT) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from e23smtp05.au.ibm.com (e23smtp05.au.ibm.com [202.81.31.147]) (using TLSv1.2 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 8E8331A06C4 for ; Mon, 22 Feb 2016 16:14:10 +1100 (AEDT) Received: from localhost by e23smtp05.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 22 Feb 2016 15:14:09 +1000 Received: from d23dlp01.au.ibm.com (202.81.31.203) by e23smtp05.au.ibm.com (202.81.31.211) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 22 Feb 2016 15:14:06 +1000 X-IBM-Helo: d23dlp01.au.ibm.com X-IBM-MailFrom: sam.bobroff@au1.ibm.com X-IBM-RcptTo: linuxppc-dev@lists.ozlabs.org Received: from d23relay10.au.ibm.com (d23relay10.au.ibm.com [9.190.26.77]) by d23dlp01.au.ibm.com (Postfix) with ESMTP id A84402CE8046 for ; Mon, 22 Feb 2016 16:14:06 +1100 (EST) Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.234.97]) by d23relay10.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u1M5DwTW000258 for ; Mon, 22 Feb 2016 16:14:06 +1100 Received: from d23av03.au.ibm.com (localhost [127.0.0.1]) by d23av03.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u1M5DXI9004211 for ; Mon, 22 Feb 2016 16:13:34 +1100 Received: from ozlabs.au.ibm.com (ozlabs.au.ibm.com [9.192.253.14]) by d23av03.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u1M5DXLO003540; Mon, 22 Feb 2016 16:13:33 +1100 Received: from tungsten.ozlabs.ibm.com (haven.au.ibm.com [9.192.254.114]) (using TLSv1.2 with cipher AES128-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.au.ibm.com (Postfix) with ESMTPSA id 94CB9A01B6; Mon, 22 Feb 2016 16:13:09 +1100 (AEDT) From: Sam Bobroff To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH 1/1] powerpc: Detect broken or mismatched toolchains Date: Mon, 22 Feb 2016 16:13:08 +1100 Message-Id: <5c8ce41d4341aa5c0698abbc0284359a789d2334.1456117980.git.sam.bobroff@au1.ibm.com> X-Mailer: git-send-email 2.1.4 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16022205-0017-0000-0000-000002D87C0B X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: michaele@au1.ibm.com MIME-Version: 1.0 Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" It can currently be difficult to diagnose a build that fails due to the compiler, linker or other parts of the toolchain being unable to build binaries of the type required by the kernel config. For example using a little endian toolchain to build a big endian kernel may produce: as: unrecognized option '-maltivec' This patch adds a basic compile test and error message to arch/powerpc/Makefile so that the above error becomes: *** Sorry, your toolchain seems to be broken or incorrect. *** Make sure it supports your kernel configuration (ppc64). Signed-off-by: Sam Bobroff --- arch/powerpc/Makefile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile index 96efd82..0041cd2 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile @@ -355,6 +355,13 @@ TOUT := .tmp_gas_check # - Require gcc 4.0 or above on 64-bit # - gcc-4.2.0 has issues compiling modules on 64-bit checkbin: + @if test "$(call try-run,echo 'int _start(void) { return 0; }' > \"$$TMP\"; \ + $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -x c -nostdlib \"$$TMP\" \ + -o /dev/null,ok,broken)" = "broken" ; then \ + echo "*** Sorry, your toolchain seems to be broken or incorrect. ***" ; \ + echo "Make sure it supports your kernel configuration ($(UTS_MACHINE))." ; \ + false; \ + fi @if test "$(cc-name)" != "clang" \ && test "$(cc-version)" = "0304" ; then \ if ! /bin/echo mftb 5 | $(AS) -v -mppc -many -o $(TOUT) >/dev/null 2>&1 ; then \