Re: [PATCH] m32r: set CHECKFLAGS properly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 27, 2005 at 10:02:30PM +0200, Sam Ravnborg wrote:
>  
> > Sam, any help in that area?  Ideally we want to have something equivalent
> > to
> > PREDEFINED_WE_MIGHT_WANT = __m32r__ __LITTLE_ENDIAN__ __BIG_ENDIAN__
> > and CHECKFLAGS done from that - basically, the subset of cross-gcc
> > predefined symbols reproduced for sparse.  Ideally with -m64 added
> > if we have sizeof(long) == 8 on target, to take care of all that
> > crap in one go.
> > 
> > Suggestions?
> The most simple solution would be to provide a small script that
> create the defines as we need and run it for each invocation of sparse.
> The script should use same trick as scripts/gcc-version.sh does.
> 
> So we could have:
> #!/bin/sh
> compiler="$*"
> 
> BIG=$(echo __BIG_ENDIAN__ | $compiler -E -xc - | tail -n 1)
> LITTLE=$(echo __LITTLE_ENDIAN__ | $compiler -E -xc - | tail -n 1)
> 
> Then BIG would be set to "1" if this is big endian, and "__BIG_ENDIAN__"
> if little endian.
> A little bit of shell script and we have the defines we want for m32r.
> Then we could add calling this script as part of sparse invocation.

Oww...  Somehow that doesn't look like a good idea.  Two spawned gcc
per sparse run?  Not pretty...
 
> The better solution would be to find the relevant flags before we
> start building the kernel. This is not so easy if we want access to
> final CFLAGS. But for the architecture the important ones are
> defined in arch/Makefile so placing this late in the file and
> use $(CC) $(CFLAGS) should be OK in almost all cases.

Alternatively, we could generate something like
#define HAVE(x) -D##x=x
#ifdef <symbol>
HAVE(<symbol>)
#endif
...

into arch/$ARCH/kernel/predefines.S, have arch/$ARCH/kernel/predefines.s
generated by normal rules and have echo `grep -- -D arch/.../predefines.s`
do the rest...
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux