Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5261024yba; Mon, 13 May 2019 08:01:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqzvsgTMe1KhChTPX1Wm/M6+BM92VShCDsfd8KKu2Iwucnadh7xxeA3mHCx72qZ94DKBPgAR X-Received: by 2002:a63:9214:: with SMTP id o20mr31688147pgd.203.1557759668669; Mon, 13 May 2019 08:01:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557759668; cv=none; d=google.com; s=arc-20160816; b=Y6XXCkeN461mTaHoxiRRU1Qr4y+OhNRtXld8/AreU5E5hGCjivKUQwfplKK9s3Ljiy 6Qi2hXmXPxCsGZjS7Rxm5J62NMfnykv4hAq485B64QJ3ZNbTgCTSkisa9RbzSAeHSaQY KfaTu6Y43dYUEIfgf+Mi/a2eOFMi89CnDMoFBr/IyrU++0vTi68HyOJfY+ATuMx3CQ2I 6mQVGaxOd8yvgoELCbOuj8mqxntV735EDsb92XBTI4zkWgWjI79r4W8+aaaU+MjXIDHx k+GiCLgkAqzwWj+CebwZBmXaoFEuWaAM+o2A/QHYcJwmPW1dD+9PSb8gjbSXI26K8hTy E5UQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=WXZNfbk1m2/xSsicHwX+BJ9LVaXXIM0FSe1bjtA51Nw=; b=HWY9p7xBVeg6TFvWiiseGL2xqmUaCVkqiuosq75XQrmduduvGQACsIF1nU78jgnr4r dWdPtOpZ0XQzJDa3U41exaofGBuq/BmMEqJ52xP6onFlw7Pp9ORXcc/+/yvPW+A0RzSe pz2BR+xZ/zqvpZ3bgKjmPI2oSH6AZfUjW4cfuqM8/voXutlv0goa3+DiXEmaz/Ps81en QakHkgzLIFjzKJB5BXKpNmprdb2y/XRo99CRYdIdZSudEK7idt+Cz3V4DCA/O1kzCFm0 KkdTBd5tTWPv11QZq/aDzAWkUmLsc1FO+MZorZMEB8t6KQlZurerz5sGWnfvrkT8rqFM KtbQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r71si17107000pfc.179.2019.05.13.08.00.51; Mon, 13 May 2019 08:01:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729472AbfEMLdo (ORCPT + 99 others); Mon, 13 May 2019 07:33:44 -0400 Received: from ozlabs.org ([203.11.71.1]:37433 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729381AbfEMLdo (ORCPT ); Mon, 13 May 2019 07:33:44 -0400 Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 452dxK1vDjz9s4Y; Mon, 13 May 2019 21:33:41 +1000 (AEST) From: Michael Ellerman To: Dmitry Vyukov , Arnd Bergmann Cc: Nick Kossifidis , Christoph Hellwig , Linus Torvalds , Andrew Morton , linux-arch , Linux Kernel Mailing List , linuxppc-dev Subject: Re: [PATCH, RFC] byteorder: sanity check toolchain vs kernel endianess In-Reply-To: References: <20190412143538.11780-1-hch@lst.de> Date: Mon, 13 May 2019 21:33:39 +1000 Message-ID: <87woiutwq4.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Dmitry Vyukov writes: > From: Arnd Bergmann > Date: Sat, May 11, 2019 at 2:51 AM > To: Dmitry Vyukov > Cc: Nick Kossifidis, Christoph Hellwig, Linus Torvalds, Andrew Morton, > linux-arch, Linux Kernel Mailing List, linuxppc-dev > >> On Fri, May 10, 2019 at 6:53 AM Dmitry Vyukov wrote: >> > > >> > > I think it's good to have a sanity check in-place for consistency. >> > >> > >> > Hi, >> > >> > This broke our cross-builds from x86. I am using: >> > >> > $ powerpc64le-linux-gnu-gcc --version >> > powerpc64le-linux-gnu-gcc (Debian 7.2.0-7) 7.2.0 >> > >> > and it says that it's little-endian somehow: >> > >> > $ powerpc64le-linux-gnu-gcc -dM -E - < /dev/null | grep BYTE_ORDER >> > #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ >> > >> > Is it broke compiler? Or I always hold it wrong? Is there some >> > additional flag I need to add? >> >> It looks like a bug in the kernel Makefiles to me. powerpc32 is always >> big-endian, >> powerpc64 used to be big-endian but is now usually little-endian. There are >> often three separate toolchains that default to the respective user >> space targets >> (ppc32be, ppc64be, ppc64le), but generally you should be able to build >> any of the >> three kernel configurations with any of those compilers, and have the Makefile >> pass the correct -m32/-m64/-mbig-endian/-mlittle-endian command line options >> depending on the kernel configuration. It seems that this is not happening >> here. I have not checked why, but if this is the problem, it should be >> easy enough >> to figure out. > > > Thanks! This clears a lot. > This may be a bug in our magic as we try to build kernel files outside > of make with own flags (required to extract parts of kernel > interfaces). > So don't spend time looking for the Makefile bugs yet. OK :) We did have some bugs in the past (~1-2 y/ago) but AFAIK they are all fixed now. These days I build most of my kernels with a bi-endian 64-bit toolchain, and switching endian without running `make clean` also works. cheers