public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ftp.linux.org.uk>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: Hirokazu Takata <takata@linux-m32r.org>,
	torvalds@odsl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] m32r: set CHECKFLAGS properly
Date: Wed, 28 Sep 2005 02:44:43 +0100	[thread overview]
Message-ID: <20050928014443.GX7992@ftp.linux.org.uk> (raw)
In-Reply-To: <20050927200230.GA8403@mars.ravnborg.org>

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...

  reply	other threads:[~2005-09-28  1:44 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-26  5:18 [PATCH] m32r: set CHECKFLAGS properly Al Viro
2005-09-27  6:13 ` Hirokazu Takata
2005-09-27  7:10   ` Al Viro
2005-09-27 15:13     ` Kyle Moffett
2005-09-27 16:34       ` Al Viro
2005-09-27 17:31         ` Kyle Moffett
2005-09-27 17:55           ` Al Viro
2005-09-27 18:37             ` Kyle Moffett
2005-09-27 23:06               ` Al Viro
2005-09-27 20:02     ` Sam Ravnborg
2005-09-28  1:44       ` Al Viro [this message]
2005-09-27  6:23 ` Hirokazu Takata
2005-09-27 15:00   ` Linus Torvalds
2005-09-28  0:18     ` Al Viro
2005-09-28 10:04       ` Hirokazu Takata
2005-09-29  1:56         ` Al Viro
  -- strict thread matches above, loose matches on Subject: below --
2005-09-26  5:19 Al Viro

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=20050928014443.GX7992@ftp.linux.org.uk \
    --to=viro@ftp.linux.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sam@ravnborg.org \
    --cc=takata@linux-m32r.org \
    --cc=torvalds@odsl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox