Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753850AbeABLuU (ORCPT + 1 other); Tue, 2 Jan 2018 06:50:20 -0500 Received: from mout.kundenserver.de ([217.72.192.73]:58850 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753051AbeABLrb (ORCPT ); Tue, 2 Jan 2018 06:47:31 -0500 From: Arnd Bergmann To: Michal Simek Cc: Andrew Morton , linux-arch@vger.kernel.org, Babu Moger , linux-kernel@vger.kernel.org, Arnd Bergmann Subject: [PATCH 1/2] microblaze: fix endian handling Date: Tue, 2 Jan 2018 12:47:19 +0100 Message-Id: <20180102114720.3408356-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:dZSzhIcvvnZHyDWOQVeRppQn/NcU6BIqVSq5zi9/i54wgGjLHS0 g6V5ICz70sI8BqfsxeBh8pI6PWbfYfM3RcV4MZ1FBcTQxLbI0MUv8LeNVZP7G7pD43nayGh bhGAgAj68wDRkmjCSbTkaTPfnhNkwSH54J3FS1jPbwZFMUIHfKLG03/Th+11/gCPOWDNOxb SUjRFsX85n+ajoG6JWCjQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:rXZdWfS6cZo=:ZdtR03rzKweprZ+3UqMjrT d4kVHXchM4B/RRe23BJAFs/WxALTu5w6IN1SZ18n6Ybvs4WuOti+x6HcPKCVbZ3DBkCap0HG1 Zk1TX4MjHwsuay8P774KLXsEwy5vQ7OEIf9DRLaEXv+Jx1BLvwJBqEwBRsMwnz5j4YwRQkTys alYaGT1wOX3SATT8aCPxUKtiThFVtmjajcr8KjiO+TEqUAbkudzc9Y2jdc6xvNohW75nM31Ud pT4QhcjbHBDLjtgaNYkHlEM0dlHbFEswDk5uGWptfY5f0Hbti8PJuF9u1L7cd05nVi1HBQ9N2 RTS12nqBSzKlhTQdW4ItxGxRv6ki8rL9ROMOFDnE40YDtrN7tH0dRdRbo5yI0Jhq8KJzdRS1p Nqg0QuSXh9fa1hdje7aybzZvHmiTrLQgyl1SLuuHz0Wgos6SeXgMfzjSqzM2ym+lbIbL5p/x/ AU0Lwe66NaNIwuaTDaeoaUQ6oHdIBqN3QsSdq/322GrVlFwn4LCWbwGlVwKMbMu3Siv8XvYTi 4+Kl+rmKTdYAhfyKTiHQou0v/9CeP0vyZGIbUvJGelPCXsHm3p9rXCjjFCHcYapC7xDvT7nLQ oXgFUkyaQxSWCDvQcj7pmYGirg2sImAvponTlf7sS1D5cUkVIFmjgKaXXx3fKNDtDnxunFXVS eTwrltLKOp+SqrUITadF35yDeblem3THdltIVNODrQ8/abGCiVD3C7MkLUbD/QPGqjsnBKWg/ +LB+JRPRKGCvA1u7xOXDPEpjpvSh1kDY0ti5hKAuB7NEQHrycGXgqsamS04= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: Building an allmodconfig kernel fails horribly because of endian mismatch. It turns out that the -mlittle-endian switch was not honored at all as we were using the wrong Kconfig symbol and failing to apply CPUFLAGS to the CFLAGS. Finally, the linker flags did not get set right. This addresses all three of those issues, which now lets me build both big-endian and little-endian kernels for testing. Fixes: 428dbf156cc5 ("arch: change default endian for microblaze") Fixes: 206d3642d8ee ("arch/microblaze: add choice for endianness and update Makefile") Signed-off-by: Arnd Bergmann --- arch/microblaze/Makefile | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/arch/microblaze/Makefile b/arch/microblaze/Makefile index 830ee7d42fa0..d269dd4b8279 100644 --- a/arch/microblaze/Makefile +++ b/arch/microblaze/Makefile @@ -36,16 +36,21 @@ endif CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_DIV) += -mno-xl-soft-div CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_BARREL) += -mxl-barrel-shift CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_PCMP_INSTR) += -mxl-pattern-compare -CPUFLAGS-$(CONFIG_BIG_ENDIAN) += -mbig-endian -CPUFLAGS-$(CONFIG_LITTLE_ENDIAN) += -mlittle-endian + +ifdef CONFIG_CPU_BIG_ENDIAN +KBUILD_CFLAGS += -mbig-endian +KBUILD_AFLAGS += -mbig-endian +LD += -EB +else +KBUILD_CFLAGS += -mlittle-endian +KBUILD_AFLAGS += -mlittle-endian +LD += -EL +endif CPUFLAGS-1 += $(call cc-option,-mcpu=v$(CPU_VER)) # r31 holds current when in kernel mode -KBUILD_CFLAGS += -ffixed-r31 $(CPUFLAGS-1) $(CPUFLAGS-2) - -LDFLAGS := -LDFLAGS_vmlinux := +KBUILD_CFLAGS += -ffixed-r31 $(CPUFLAGS-y) $(CPUFLAGS-1) $(CPUFLAGS-2) head-y := arch/microblaze/kernel/head.o libs-y += arch/microblaze/lib/ -- 2.9.0