From patchwork Wed May 30 12:19:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 10438869 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 C0CE5601E9 for ; Wed, 30 May 2018 12:19:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA69B289C9 for ; Wed, 30 May 2018 12:19:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9F572289CE; Wed, 30 May 2018 12:19:41 +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=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 900D3289C9 for ; Wed, 30 May 2018 12:19:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752626AbeE3MTj (ORCPT ); Wed, 30 May 2018 08:19:39 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:35162 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753044AbeE3MTh (ORCPT ); Wed, 30 May 2018 08:19:37 -0400 Received: by mail-pl0-f68.google.com with SMTP id i5-v6so10993459plt.2 for ; Wed, 30 May 2018 05:19:37 -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=4BEMvnbTKNt4IjikEPWjIGiZlNnxo3F9XcCcPndmEz0=; b=f1Yz82bS7kWM1W/ErTGl4H93e7Z0scZGgpCelrWJ/mSNEMF4zxWdu1FPCWmMWM9nEB 4gE0qwErFqgY25K629PHefDe8mW0Nbswk/6xiOPyz0WoBDqctxBQRwX6NPDvSKF+AMtO vE0rQtp/K7kvEPJ/NaRNIp34/FXwOhm4X6sxLahUZqXfwSPQqY4DHwt9xMje5gDFjhOG 8TrK95+lyMFMc0ZnSkxpGU6A48LxDfIt9lvJI3X/6jou36q2WHO0uBuJKOktObavrWFX 6yPxxKt/apf9fP//ZhDG3XeXyFUzolfu/zxeQ9sLq5IVIYuDGGQLPpqIBzN55X+l2QvV xWYA== 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=4BEMvnbTKNt4IjikEPWjIGiZlNnxo3F9XcCcPndmEz0=; b=HwsoLpOKUtBGpVxSwE9wIa/KoaKV7NEhbyvWd8geQbo2E591o1FYLWXla2bo8Qu2IU ao/rp7oQ6WPx+lH1V2mIFCqXzlS+ekuxSOEWo0tbzRJ2OhpjvbkkazGIYxyfDCoVbPZZ vCOVbjJQDfCIu1JpZOInX2f6q8MTdLHx8GYYuT7dcsrmaEO60uRkK3xXB8ANzZ0nwB6/ BpnkVXS5CoWrs3RU7+wUyTymHTRWwDIKEnXci5O5SarY+BIjE15FTV0Y3ya2eoZnyZOG FtaaCaz81YRNagZymLEpFfAgSwoErQvsnz4h6xBzMw/L6UyHZwLYAS+b3BD8MAwhak9O GUDw== X-Gm-Message-State: ALKqPwfoISnQ0572tfZk+poGfcviSu9LT9ryzF8p9isQ3BivOUS/5tho k6TTHY9cjOvoVlQ31i614BYv/w== X-Google-Smtp-Source: ADUXVKKN3ruofZaNEtCMvLgMVOZA9LTp1gyS3iwhK+XInMomZB98AiyhdL90LlIQ8AURrOyJ0qPL6A== X-Received: by 2002:a17:902:7598:: with SMTP id j24-v6mr2655553pll.160.1527682776331; Wed, 30 May 2018 05:19:36 -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 g13-v6sm61518085pfm.67.2018.05.30.05.19.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 May 2018 05:19:35 -0700 (PDT) From: Nicholas Piggin To: linux-kbuild@vger.kernel.org Cc: Nicholas Piggin , linuxppc-dev@lists.ozlabs.org, Masahiro Yamada , Segher Boessenkool Subject: [PATCH v5 1/4] powerpc/kbuild: set default generic machine type for 32-bit compile Date: Wed, 30 May 2018 22:19:19 +1000 Message-Id: <20180530121922.22122-2-npiggin@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180530121922.22122-1-npiggin@gmail.com> References: <20180530121922.22122-1-npiggin@gmail.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Since v1: reworded changelog to explain the cause of the problem (thanks Segher) and moved the flags into the 64-32 cross compile case. --- arch/powerpc/Makefile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile index 95813df90801..d628724087c6 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile @@ -24,6 +24,14 @@ 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