diff mbox

powerpc/align: Use #ifdef __BIG_ENDIAN__ #else for REG_BYTE

Message ID 7459954.Ax6T6W22CJ@wuerfel (mailing list archive)
State Not Applicable
Headers show

Commit Message

Arnd Bergmann June 17, 2016, 10:46 a.m. UTC
On Friday, June 17, 2016 1:35:35 PM CEST Daniel Axtens wrote:
> > It would be better to fix the sparse compilation so the same endianess
> > is set that you get when calling gcc.
> 
> I will definitely work on a patch to sparse! I'd still like this or
> something like it to go in though, so we can keep working on reducing
> the sparse warning count while the sparse patch is in the works.

I think you just need to fix the Makefile so it sets the right
arguments when calling sparse.

Something like the (untested) patch below, similar to how we
already handle the word size and how some other architectures
handle setting __BIG_ENDIAN__.

	Arnd

Comments

Michael Ellerman June 21, 2016, 12:51 a.m. UTC | #1
On Fri, 2016-06-17 at 12:46 +0200, Arnd Bergmann wrote:
> On Friday, June 17, 2016 1:35:35 PM CEST Daniel Axtens wrote:
> > > It would be better to fix the sparse compilation so the same endianess
> > > is set that you get when calling gcc.
> > 
> > I will definitely work on a patch to sparse! I'd still like this or
> > something like it to go in though, so we can keep working on reducing
> > the sparse warning count while the sparse patch is in the works.
> 
> I think you just need to fix the Makefile so it sets the right
> arguments when calling sparse.
> 
> Something like the (untested) patch below, similar to how we
> already handle the word size and how some other architectures
> handle setting __BIG_ENDIAN__.

Yep that's clearly better. I didn't know we had separate CHECKER_FLAGS.

Daniel can you test that?

Arnd we'll add Suggested-by: you, or send a SOB if you like?

cheers
Daniel Axtens June 21, 2016, 1:11 a.m. UTC | #2
Hi Arnd,

> Something like the (untested) patch below, similar to how we
> already handle the word size and how some other architectures
> handle setting __BIG_ENDIAN__.

I tested this by reverting Michael's patch and applying yours.

Not only does it successfully fix the errors that patch fixes, it
manages to clean up the following four errors as well:

+/scratch/dja/linux/arch/powerpc/lib/sstep.c:371:32: error: cast from unknown type
+/scratch/dja/linux/arch/powerpc/lib/sstep.c:371:59: error: using member 'word' in incomplete struct <unnamed>
+/scratch/dja/linux/arch/powerpc/lib/sstep.c:411:32: error: cast from unknown type
+/scratch/dja/linux/arch/powerpc/lib/sstep.c:411:59: error: using member 'word' in incomplete struct <unnamed>

So:
Tested-by: Daniel Axtens <dja@axtens.net>

(I think the patch also needs your sign-off.)

Regards,
Daniel
Arnd Bergmann June 21, 2016, 9:04 a.m. UTC | #3
On Tuesday, June 21, 2016 10:51:00 AM CEST Michael Ellerman wrote:
> On Fri, 2016-06-17 at 12:46 +0200, Arnd Bergmann wrote:
> > On Friday, June 17, 2016 1:35:35 PM CEST Daniel Axtens wrote:
> > > > It would be better to fix the sparse compilation so the same endianess
> > > > is set that you get when calling gcc.
> > > 
> > > I will definitely work on a patch to sparse! I'd still like this or
> > > something like it to go in though, so we can keep working on reducing
> > > the sparse warning count while the sparse patch is in the works.
> > 
> > I think you just need to fix the Makefile so it sets the right
> > arguments when calling sparse.
> > 
> > Something like the (untested) patch below, similar to how we
> > already handle the word size and how some other architectures
> > handle setting __BIG_ENDIAN__.
> 
> Yep that's clearly better. I didn't know we had separate CHECKER_FLAGS.
> 
> Daniel can you test that?
> 
> Arnd we'll add Suggested-by: you, or send a SOB if you like?
> 

Please use 'Suggested-by', the main work for this patch was in
analysing the problem and writing the changelog, and Daniel did that.

	Arnd
diff mbox

Patch

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 709a22a3e824..8617c71c3bdb 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -181,6 +181,11 @@  KBUILD_CFLAGS	+= -pipe -Iarch/$(ARCH) $(CFLAGS-y)
 CPP		= $(CC) -E $(KBUILD_CFLAGS)
 
 CHECKFLAGS	+= -m$(CONFIG_WORD_SIZE) -D__powerpc__ -D__powerpc$(CONFIG_WORD_SIZE)__
+ifdef CONFIG_CPU_BIG_ENDIAN
+CHECKFLAGS	+= -D__BIG_ENDIAN__
+else
+CHECKFLAGS	+= -D__LITTLE_ENDIAN__
+endif
 
 KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o