On Sun, 2026-05-17 at 14:54 +0100, David Laight wrote:
> On Sun, 17 May 2026 12:14:21 +0800
> Mingcong Bai <[email protected]> wrote:
> 
> > Similar to commit b929926f01f2 ("sh: define __BIG_ENDIAN for math-emu"),
> > define __LITTLE_ENDIAN and __BIG_ENDIAN as 0 to mitigate build-time
> > warnings:
> > 
> >   ./include/math-emu/double.h:59:21: error: ‘__BIG_ENDIAN’ is not defined, 
> > evaluates to ‘0’ [-Werror=undef]
> >      59 | #if __BYTE_ORDER == __BIG_ENDIAN
> >         |
> > 
> > Cc: [email protected]
> > Fixes: 13da9e200fe4 ("Revert "endian: #define __BYTE_ORDER"")
> > Reported-by: kernel test robot <[email protected]>
> > Closes: 
> > https://lore.kernel.org/oe-kbuild-all/[email protected]/
> > Signed-off-by: Mingcong Bai <[email protected]>
> > ---
> >  arch/powerpc/include/asm/sfp-machine.h | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/arch/powerpc/include/asm/sfp-machine.h 
> > b/arch/powerpc/include/asm/sfp-machine.h
> > index 8b957aabb826d..db8525605c026 100644
> > --- a/arch/powerpc/include/asm/sfp-machine.h
> > +++ b/arch/powerpc/include/asm/sfp-machine.h
> > @@ -319,10 +319,12 @@
> >  #define abort()                                                            
> > \
> >     return 0
> >  
> > -#ifdef __BIG_ENDIAN
> > +#ifdef __BIG_ENDIAN__
> >  #define __BYTE_ORDER __BIG_ENDIAN
> > +#define __LITTLE_ENDIAN 0
> >  #else
> >  #define __BYTE_ORDER __LITTLE_ENDIAN
> > +#define __BIG_ENDIAN 0
> >  #endif
> 
> I thought the expected/correct value for __BYTE_ORDER__ was either 1234 or 
> 4321.
> (apart from pdp11's 2143).

Should we just do

#define __BYTE_ORDER __BYTE_ORDER__
#define __LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__
#define __BIG_ENDIAN __ORDER_BIG_ENDIAN__

then?  __BYTE_ORDER__ etc. are available since gcc 4.6 and now we
requires gcc >= 8 to build the kernel.


-- 
Xi Ruoyao <[email protected]>

Reply via email to