From patchwork Wed May 16 14:14:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 914655 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 ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40mGlq2nSMz9s1d for ; Thu, 17 May 2018 00:19:35 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="QwzkBDh+"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40mGlq1J9vzF14t for ; Thu, 17 May 2018 00:19:35 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="QwzkBDh+"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c01::244; helo=mail-pl0-x244.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="QwzkBDh+"; dkim-atps=neutral Received: from mail-pl0-x244.google.com (mail-pl0-x244.google.com [IPv6:2607:f8b0:400e:c01::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40mGfq0t8ZzDr4q for ; Thu, 17 May 2018 00:15:14 +1000 (AEST) Received: by mail-pl0-x244.google.com with SMTP id u6-v6so504273pls.9 for ; Wed, 16 May 2018 07:15:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=1GeBK5SSztMEHl9rgjJyLefK/ad1o6jtXXL8fkHGm5M=; b=QwzkBDh+jN+u0a5XOk40sxbua60Izl5xrS95HDiCqolxnYpHH4KwHYU9QemCsQhWKa uf46EOa/EZOyZo46s9voM3w7DcexiT7A2Y75ccm7ClpXsZ1zjBoaqwRPU2xmtYxmX/8g 3ubugCGf+GRAIMvpO/+E1sOacVCVL8qKap44TyU2Txe+LgHf3QwXyGMFYx0/FVjnt4z+ vd2klPjBWw17RcKYlcjpKLv190RlUNN0eM7uAB18V3sdi3xoXkqkvIwe8vLW4iq6hJMe U/qmlePxzuV1KKmKA/TBNSBdHpVfyh8F9/pVon8W8esVXO+QvNuxP+IkU999lPhifnSz MUhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=1GeBK5SSztMEHl9rgjJyLefK/ad1o6jtXXL8fkHGm5M=; b=mMLWhMw2r/K6srZcfmsuKZNi9Qzi+DcltHOcTzyFR4Qbpl10K7vQ5R2WxEc6Hu4M69 7zEZ69Th6KXGR1h5UCTE008pUUcz7cvMD6ZYAjw9gt6KkGVw0aSTkRdcaDij6gur0itA l8xBv6I94IebhYoBYuzwix9CJ0JkByffRJfRZYk98KkR2mDF9dYPUQmJYeI8n/bueS+O Nbq7MDkziiK25cSB9JBFkh1LjJ59pIxLZC+6xEZWBRbsmqtogL/qsw7fJN2fBQxSupJa MUx3QkO5xBjc3uBAIIv30eitnPpJa4jnJGs+7CiNOIEdoQdr20qk+t6PfzlBQrloqmu0 D+Fw== X-Gm-Message-State: ALKqPwfwD0j1F4A2qtKPx2QF2vRZ3KXO1ZqP0KQuasV6sYFXEuWeBd99 ctJP5T1BCJ9qSpcFU9LEW4I= X-Google-Smtp-Source: AB8JxZqigzwlU+6VGc+WGlouavKlrKF9h1htmy8HzIbe5n85DiezI3FC7SYhydEU1u/tuUjVIo+Vdw== X-Received: by 2002:a17:902:265:: with SMTP id 92-v6mr1121494plc.368.1526480113247; Wed, 16 May 2018 07:15:13 -0700 (PDT) Received: from roar.au.ibm.com (59-102-70-78.tpgi.com.au. [59.102.70.78]) by smtp.gmail.com with ESMTPSA id h130-v6sm7365162pfc.98.2018.05.16.07.15.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 May 2018 07:15:12 -0700 (PDT) From: Nicholas Piggin To: linux-kbuild@vger.kernel.org Subject: [PATCH v4 1/4] powerpc/kbuild: set default generic machine type for 32-bit compile Date: Thu, 17 May 2018 00:14:55 +1000 Message-Id: <20180516141458.18996-2-npiggin@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180516141458.18996-1-npiggin@gmail.com> References: <20180516141458.18996-1-npiggin@gmail.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Masahiro Yamada , linuxppc-dev@lists.ozlabs.org, Nicholas Piggin Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Some 64-bit toolchains uses the wrong ISA variant for compiling 32-bit kernels, even with -m32. Debian's powerpc64le is one such case, and that is because it is built with --with-cpu=power8. So when cross compiling a 32-bit kernel with a 64-bit toolchain, set -mcpu=powerpc initially, which is the generic 32-bit powerpc machine type and scheduling model. CPU and platform code can override this with subsequent -mcpu flags if necessary. This is not done for 32-bit toolchains otherwise it would override their defaults, which are presumably set appropriately for the environment (moreso than a 64-bit cross compiler). This fixes a lot of build failures due to incompatible assembly when compiling 32-bit kernel with th Debian powerpc64le 64-bit toolchain. Cc: Segher Boessenkool Signed-off-by: Nicholas Piggin --- arch/powerpc/Makefile | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile index 95813df90801..15ca4bafad82 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile @@ -24,9 +24,20 @@ ifeq ($(HAS_BIARCH),y) ifeq ($(CROSS32_COMPILE),) CROSS32CC := $(CC) -m32 KBUILD_ARFLAGS += --target=elf32-powerpc + +ifdef CONFIG_PPC32 +# These options will be overridden by any -mcpu option that the CPU +# or platform code sets later on the command line, but they are needed +# to set a sane 32-bit cpu target for the 64-bit cross compiler which +# may default to the wrong ISA. +KBUILD_CFLAGS += -mcpu=powerpc +KBUILD_AFLAGS += -mcpu=powerpc +endif + endif endif + export CROSS32CC CROSS32AR ifeq ($(CROSS_COMPILE),)