* Re: [PATCH, RFC] byteorder: sanity check toolchain vs kernel endianess [not found] ` <CACT4Y+aKGKm9Wbc1owBr51adkbesHP_Z81pBAoZ5HmJ+uZdsaw@mail.gmail.com> @ 2019-05-11 0:51 ` Arnd Bergmann 2019-05-13 7:39 ` Dmitry Vyukov 0 siblings, 1 reply; 6+ messages in thread From: Arnd Bergmann @ 2019-05-11 0:51 UTC (permalink / raw) To: Dmitry Vyukov Cc: linux-arch, linuxppc-dev, Linux Kernel Mailing List, Nick Kossifidis, Andrew Morton, Linus Torvalds, Christoph Hellwig On Fri, May 10, 2019 at 6:53 AM Dmitry Vyukov <dvyukov@google.com> 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. Arnd ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH, RFC] byteorder: sanity check toolchain vs kernel endianess 2019-05-11 0:51 ` [PATCH, RFC] byteorder: sanity check toolchain vs kernel endianess Arnd Bergmann @ 2019-05-13 7:39 ` Dmitry Vyukov 2019-05-13 11:33 ` Michael Ellerman 0 siblings, 1 reply; 6+ messages in thread From: Dmitry Vyukov @ 2019-05-13 7:39 UTC (permalink / raw) To: Arnd Bergmann Cc: linux-arch, linuxppc-dev, Linux Kernel Mailing List, Nick Kossifidis, Andrew Morton, Linus Torvalds, Christoph Hellwig From: Arnd Bergmann <arnd@arndb.de> 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 <dvyukov@google.com> 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. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH, RFC] byteorder: sanity check toolchain vs kernel endianess 2019-05-13 7:39 ` Dmitry Vyukov @ 2019-05-13 11:33 ` Michael Ellerman 2019-05-13 11:50 ` Dmitry Vyukov 0 siblings, 1 reply; 6+ messages in thread From: Michael Ellerman @ 2019-05-13 11:33 UTC (permalink / raw) To: Dmitry Vyukov, Arnd Bergmann Cc: linux-arch, linuxppc-dev, Linux Kernel Mailing List, Nick Kossifidis, Andrew Morton, Linus Torvalds, Christoph Hellwig Dmitry Vyukov <dvyukov@google.com> writes: > From: Arnd Bergmann <arnd@arndb.de> > 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 <dvyukov@google.com> 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH, RFC] byteorder: sanity check toolchain vs kernel endianess 2019-05-13 11:33 ` Michael Ellerman @ 2019-05-13 11:50 ` Dmitry Vyukov 2019-05-13 12:04 ` Christoph Hellwig 0 siblings, 1 reply; 6+ messages in thread From: Dmitry Vyukov @ 2019-05-13 11:50 UTC (permalink / raw) To: Michael Ellerman Cc: linux-arch, Arnd Bergmann, linuxppc-dev, Linux Kernel Mailing List, Andrew Donnellan, Nick Kossifidis, Andrew Morton, Linus Torvalds, Christoph Hellwig From: Michael Ellerman <mpe@ellerman.id.au> Date: Mon, May 13, 2019 at 1:33 PM To: Dmitry Vyukov, Arnd Bergmann Cc: Nick Kossifidis, Christoph Hellwig, Linus Torvalds, Andrew Morton, linux-arch, Linux Kernel Mailing List, linuxppc-dev > Dmitry Vyukov <dvyukov@google.com> writes: > > From: Arnd Bergmann <arnd@arndb.de> > > 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 <dvyukov@google.com> 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. For the record, yes, it turn out to be a problem in our code (a latent bug). We actually used host (x86) gcc to build as-if ppc code that can run on the host, so it defined neither LE no BE macros. It just happened to work in the past :) +Andrew ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH, RFC] byteorder: sanity check toolchain vs kernel endianess 2019-05-13 11:50 ` Dmitry Vyukov @ 2019-05-13 12:04 ` Christoph Hellwig 2019-05-15 6:53 ` Arnd Bergmann 0 siblings, 1 reply; 6+ messages in thread From: Christoph Hellwig @ 2019-05-13 12:04 UTC (permalink / raw) To: Dmitry Vyukov Cc: linux-arch, Arnd Bergmann, linuxppc-dev, Linux Kernel Mailing List, Andrew Donnellan, Nick Kossifidis, Andrew Morton, Linus Torvalds, Christoph Hellwig On Mon, May 13, 2019 at 01:50:19PM +0200, Dmitry Vyukov wrote: > > 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. > > For the record, yes, it turn out to be a problem in our code (a latent > bug). We actually used host (x86) gcc to build as-if ppc code that can > run on the host, so it defined neither LE no BE macros. It just > happened to work in the past :) So Nick was right and these checks actually are useful.. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH, RFC] byteorder: sanity check toolchain vs kernel endianess 2019-05-13 12:04 ` Christoph Hellwig @ 2019-05-15 6:53 ` Arnd Bergmann 0 siblings, 0 replies; 6+ messages in thread From: Arnd Bergmann @ 2019-05-15 6:53 UTC (permalink / raw) To: Christoph Hellwig Cc: linux-arch, linuxppc-dev, Linux Kernel Mailing List, Andrew Donnellan, Nick Kossifidis, Andrew Morton, Linus Torvalds, Dmitry Vyukov On Mon, May 13, 2019 at 2:04 PM Christoph Hellwig <hch@lst.de> wrote: > > On Mon, May 13, 2019 at 01:50:19PM +0200, Dmitry Vyukov wrote: > > > 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. > > > > For the record, yes, it turn out to be a problem in our code (a latent > > bug). We actually used host (x86) gcc to build as-if ppc code that can > > run on the host, so it defined neither LE no BE macros. It just > > happened to work in the past :) > > So Nick was right and these checks actually are useful.. Yes, definitely. I wonder if we should also bring back the word size check from include/asm-generic/bitsperlong.h, which was disabled right after I originally added that. Arnd ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-05-15 6:55 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20190412143538.11780-1-hch@lst.de>
[not found] ` <CAK8P3a2bg9YkbNpAb9uZkXLFZ3juCmmbF7cRw+Dm9ZiLFno2OQ@mail.gmail.com>
[not found] ` <fd59e6e22594f740eaf86abad76ee04d@mailhost.ics.forth.gr>
[not found] ` <CACT4Y+aKGKm9Wbc1owBr51adkbesHP_Z81pBAoZ5HmJ+uZdsaw@mail.gmail.com>
2019-05-11 0:51 ` [PATCH, RFC] byteorder: sanity check toolchain vs kernel endianess 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
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox