LKML Archive on
help / color / mirror / Atom feed
From: Arnd Bergmann <>
To: Christoph Hellwig <>
Cc: Linus Torvalds <>,
	Andrew Morton <>,
	Arnd Bergmann <>,
	linux-arch <>,,
	Linux Kernel Mailing List <>
Subject: Re: [PATCH, RFC] byteorder: sanity check toolchain vs kernel endianess
Date: Fri, 12 Apr 2019 16:53:28 +0200	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On Fri, Apr 12, 2019 at 4:36 PM Christoph Hellwig <> wrote:
> When removing some dead big endian checks in the RISC-V code Nick
> suggested that we should have some generic sanity checks.  I don't think
> we should have thos inside the RISC-V code, but maybe it might make
> sense to have these in the generic byteorder headers.  Note that these
> are UAPI headers and some compilers might not actually define
> __BYTE_ORDER__, so we first check that it actually exists.
> Suggested-by: Nick Kossifidis <>
> Signed-off-by: Christoph Hellwig <>

Acked-by: Arnd Bergmann <>

Extra checking like this is good in general, but I'm not sure I see
exactly what kind of issue one might expect to prevent with this:

All architecture asm/byteorder.h headers either include the only
possible option, or they check the compiler defined macros:

arch/arc/include/uapi/asm/byteorder.h:#ifdef __BIG_ENDIAN__
arch/arm/include/uapi/asm/byteorder.h:#ifdef __ARMEB__
arch/arm64/include/uapi/asm/byteorder.h:#ifdef __AARCH64EB__
arch/c6x/include/uapi/asm/byteorder.h:#ifdef _BIG_ENDIAN
arch/microblaze/include/uapi/asm/byteorder.h:#ifdef __MICROBLAZEEL__
arch/mips/include/uapi/asm/byteorder.h:#if defined(__MIPSEB__)
arch/nds32/include/uapi/asm/byteorder.h:#ifdef __NDS32_EB__
arch/powerpc/include/uapi/asm/byteorder.h:#ifdef __LITTLE_ENDIAN__
arch/sh/include/uapi/asm/byteorder.h:#ifdef __LITTLE_ENDIAN__
arch/xtensa/include/uapi/asm/byteorder.h:#ifdef __XTENSA_EL__

Are you worried about toolchains that define those differently
from what these headers expect? Did you encounter such a case?


  reply	other threads:[~2019-04-12 14:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-12 14:35 Christoph Hellwig
2019-04-12 14:53 ` Arnd Bergmann [this message]
2019-04-12 14:55   ` Christoph Hellwig
2019-04-12 15:22     ` Arnd Bergmann
2019-04-12 16:05   ` Nick Kossifidis
2019-05-10 10:53     ` Dmitry Vyukov
2019-05-11  0:51       ` Arnd Bergmann
2019-05-13  7:39         ` Dmitry Vyukov
2019-05-13 11:33           ` Michael Ellerman
2019-05-13 11:50             ` Dmitry Vyukov
2019-05-13 12:04               ` Christoph Hellwig
2019-05-15  6:53                 ` Arnd Bergmann
2019-05-30  1:46 ` Maciej Rozycki
2019-05-30  6:41   ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \
    --subject='Re: [PATCH, RFC] byteorder: sanity check toolchain vs kernel endianess' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).