Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp656722pxj; Thu, 3 Jun 2021 16:24:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx49ssQMt5UuZJQHlZ16FeWg90p8J1+iZDwN0jR/OlRT7MJoWb2r5xUGtxbWoSjIAzB47LT X-Received: by 2002:a17:906:b6c5:: with SMTP id ec5mr1488052ejb.290.1622762654902; Thu, 03 Jun 2021 16:24:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622762654; cv=none; d=google.com; s=arc-20160816; b=LtTU1DAOBhHY0wkafT4Ys45WVgFtEdI9tb6aJkNHHUcIA3OgLwmaw0aTKVObQ9h+sv 5woUdLL/rneVBpx/rybknu6NDcMx7jwp9P6iM8GR3sllyC6i88Adz9Bf9dYEwp/hOisI cRfFMVObmx3MghCZCq8uo3zmxy5nUZ+S1JGPUyfFsLDJPcDL0eNnMpgW5VD6YlGWKbW5 fGP2dIx1zpRY36SAOd5dFVzVXjVlShu92lsfWLXZ3TwA2qJQ8MKdd3JjExvRta071Q+N ddYFVMlWsPi8uCRebgWJMOEDarH2Ch5pR9A6FJER2YSHnJdGQWymSGxylTVGeOTf/HQu XWwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=EXOT9La8+XXIxW3bXOSmdGcimnnQ90QAJmf1D9koF+g=; b=PaVAUdy0zRlyhCwKx3FGmU/hzBvS0p3Ml4VF1vt4zPeuvBenJ075ihttZFxI6hHMyE /p+WA54lJO4Q2Vi7Ai3rcWWgpw8R10u905WRbH9xQtMr0dPa8GuvL0BzesFDAL2p8mmA kAW35s+6hdOab6kOQ27OdDXXVWAHoNBhGM+ydMZu+jviBqnnMHtsiN79z17gEuGe0j4r hGKV/OOjTNx9BIQu1IOQhYhLoKNHI3DeF2uHUQrs+nN7fMQZ6v8CqthZCO/3KeKGGZTj 3QA/MM18kgzCQtWmPDyhu86R0XZbMiA2OANInBJF7ayUV/6JVYLY2JIl19VMX+iJngFg KDjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=j8pOIRuK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h7si3195497edr.267.2021.06.03.16.23.37; Thu, 03 Jun 2021 16:24:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=j8pOIRuK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229791AbhFCXVf (ORCPT + 99 others); Thu, 3 Jun 2021 19:21:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229576AbhFCXVf (ORCPT ); Thu, 3 Jun 2021 19:21:35 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39AB5C06174A; Thu, 3 Jun 2021 16:19:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To: Subject:Sender:Reply-To:Content-ID:Content-Description; bh=EXOT9La8+XXIxW3bXOSmdGcimnnQ90QAJmf1D9koF+g=; b=j8pOIRuKWI6jM6Gukk/aAkc+iz TabD2ULmBAGbEpx+PAaBNS9jOqflUWzli+HkkwpsT7clsvGl1WK0+cEhbcJIC2aTQAAudt/ozzsoQ qFUkmi2g5bBULlRiAxsU6w8svI1+cMVKAaYAsOtM/xCSFZY4vs+Zq5Oz6VD5Cs8AnmqGRRFx59SjT 7xam4n28lhGiYCcGPQp3Fpfxk+qkywbBTk3dyT8DqGIOKzMUdEDBnkfXycM3C26tHri0h6tn50U7V A86nihcbL90QwGXNiVOE2N3FSO0KRVLvNV5eKosRzlBTe1or58prSWZ4pMHTT6F3CH6ZW/QV/BkXr L13kTLEQ==; Received: from [2601:1c0:6280:3f0::ce7d] by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1lowcs-00Atf5-PU; Thu, 03 Jun 2021 23:19:46 +0000 Subject: Re: [RFC PATCH 3/4] sh: define __BIG_ENDIAN for math-emu To: Geert Uytterhoeven Cc: Linux Kernel Mailing List , Yoshinori Sato , Rich Felker , Linux-sh list References: <20210602231443.4670-1-rdunlap@infradead.org> <20210602231443.4670-3-rdunlap@infradead.org> From: Randy Dunlap Message-ID: Date: Thu, 3 Jun 2021 16:19:44 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/3/21 12:54 AM, Geert Uytterhoeven wrote: > Hi Randy, > > On Thu, Jun 3, 2021 at 1:17 AM Randy Dunlap wrote: >> The headers in include/math-emu/ test for __BYTE_ORDER == __BIG_ENDIAN >> without checking to see if these macros are defined, so add >> a define for __BIG_ENDIAN before pulling in these headers. >> >> This placates these build warnings: >> >> In file included from ../arch/sh/math-emu/math.c:23: >> ../include/math-emu/single.h:50:21: warning: "__BIG_ENDIAN" is not defined, evaluates to 0 [-Wundef] >> 50 | #if __BYTE_ORDER == __BIG_ENDIAN >> In file included from ../arch/sh/math-emu/math.c:24: >> ../include/math-emu/double.h:59:21: warning: "__BIG_ENDIAN" is not defined, evaluates to 0 [-Wundef] >> 59 | #if __BYTE_ORDER == __BIG_ENDIAN >> >> Fixes: 4b565680d163 ("sh: math-emu support") >> Signed-off-by: Randy Dunlap > > Thanks for your patch! > >> --- linux-next-20210528.orig/arch/sh/math-emu/sfp-util.h >> +++ linux-next-20210528/arch/sh/math-emu/sfp-util.h >> @@ -70,4 +70,4 @@ >> >> #define __BYTE_ORDER __LITTLE_ENDIAN >> >> - >> +#define __BIG_ENDIAN 0 > > I don't think this is the right fix. > > I think the right values should be picked up from: > > include/uapi/linux/byteorder/big_endian.h:#define __BIG_ENDIAN 4321 > include/uapi/linux/byteorder/little_endian.h:#define __LITTLE_ENDIAN 1234 > > How is this picked up on other architectures using ? Hi Geert, There isn't very much to compare to in other arch/. I've made a v2 patch that is done like arch/nds32/ does. What do you think about this one? thanks. --- From: Randy Dunlap Subject: [RFC PATCH 2/3 v2] sh: define __BIG_ENDIAN for math-emu Fix this by defining both ENDIAN macros in so that they can be utilized in according to the latter's comment: /* Allow sfp-machine to have its own byte order definitions. */ (This is what is done in arch/nds32/include/asm/sfp-machine.h.) This placates these build warnings: In file included from ../arch/sh/math-emu/math.c:23: ../include/math-emu/single.h:50:21: warning: "__BIG_ENDIAN" is not defined, evaluates to 0 [-Wundef] 50 | #if __BYTE_ORDER == __BIG_ENDIAN In file included from ../arch/sh/math-emu/math.c:24: ../include/math-emu/double.h:59:21: warning: "__BIG_ENDIAN" is not defined, evaluates to 0 [-Wundef] 59 | #if __BYTE_ORDER == __BIG_ENDIAN Fixes: 4b565680d163 ("sh: math-emu support") Signed-off-by: Randy Dunlap Cc: Yoshinori Sato Cc: Rich Felker Cc: linux-sh@vger.kernel.org Cc: Geert Uytterhoeven Cc: John Paul Adrian Glaubitz --- arch/sh/include/asm/sfp-machine.h | 8 ++++++++ 1 file changed, 8 insertions(+) --- linux-next-20210528.orig/arch/sh/include/asm/sfp-machine.h +++ linux-next-20210528/arch/sh/include/asm/sfp-machine.h @@ -13,6 +13,14 @@ #ifndef _SFP_MACHINE_H #define _SFP_MACHINE_H +#ifdef __BIG_ENDIAN__ +#define __BYTE_ORDER __BIG_ENDIAN +#define __LITTLE_ENDIAN 0 +#else +#define __BYTE_ORDER __LITTLE_ENDIAN +#define __BIG_ENDIAN 0 +#endif + #define _FP_W_TYPE_SIZE 32 #define _FP_W_TYPE unsigned long #define _FP_WS_TYPE signed long