2004-06-17 21:13:59

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH] cross-sparse

Hi Linus,

I wanted to give sparse a try on m68k, and noticed the current infrastructure
doesn't handle cross-compilation (no sane m68k people compile kernels natively
anymore, unless they run a Debian autobuilder ;-).

After hacking the include paths in the sparse sources, installing the resulting
binary as m68k-linux-sparse, and applying the following patch, it seems to work
fine!

OK to apply?

--- linux-2.6.7/Makefile 2004-06-16 13:06:15.000000000 +0200
+++ linux-m68k-2.6.7/Makefile 2004-06-17 22:07:27.000000000 +0200
@@ -296,7 +296,7 @@ GENKSYMS = scripts/genksyms/genksyms
DEPMOD = /sbin/depmod
KALLSYMS = scripts/kallsyms
PERL = perl
-CHECK = sparse
+CHECK = $(CROSS_COMPILE)sparse
MODFLAGS = -DMODULE
CFLAGS_MODULE = $(MODFLAGS)
AFLAGS_MODULE = $(MODFLAGS)

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


2004-06-18 16:28:09

by Linus Torvalds

[permalink] [raw]
Subject: Re: [PATCH] cross-sparse



On Thu, 17 Jun 2004, Geert Uytterhoeven wrote:
>
> I wanted to give sparse a try on m68k, and noticed the current infrastructure
> doesn't handle cross-compilation (no sane m68k people compile kernels natively
> anymore, unless they run a Debian autobuilder ;-).
>
> After hacking the include paths in the sparse sources, installing the resulting
> binary as m68k-linux-sparse, and applying the following patch, it seems to work
> fine!

Hmm.. It does make sense, but at the same time, sparse isn't even really
supposed to _care_ about the architecture. Especially not for a kernel
build.

Which part breaks when not just using the native sparse? As far as I know,
a kernel build should use all-kernel header files, with the exception of
"stdarg.h" which I thought was also architecture-independent (but hey,
maybe I'm just a retard, and am wrong).

Linus

2004-06-18 21:39:07

by Herbert Poetzl

[permalink] [raw]
Subject: Re: [PATCH] cross-sparse

On Fri, Jun 18, 2004 at 09:27:22AM -0700, Linus Torvalds wrote:
> On Thu, 17 Jun 2004, Geert Uytterhoeven wrote:
> >
> > I wanted to give sparse a try on m68k, and noticed the current
> > infrastructure doesn't handle cross-compilation (no sane m68k
> > people compile kernels natively anymore, unless they run a
> > Debian autobuilder ;-).
> >
> > After hacking the include paths in the sparse sources, installing
> > the resulting binary as m68k-linux-sparse, and applying the
> > following patch, it seems to work fine!
>
> Hmm.. It does make sense, but at the same time, sparse isn't even really
> supposed to _care_ about the architecture. Especially not for a kernel
> build.

apologies for assasinating this thread ...

I did an 'extensive' search with google (you do not want
to know how many hits you get with 'sparse') and read
most postings on the sparse mailinglist (linux-sparse),
found the freshmeat project pointing me to the 'new url'
http://www.codemonkey.org.uk/projects/sparse/ where I can
download 'sparse-2003-11-27.tar.gz', then found out that
there should be a maintained (up to date) version of it at

http://www.kernel.org/pub/software/devel/sparse/

but what I find there, seems of no use to me ...
(I'm no bitkeeper person) so I'm still looking for an url
where I can get a recent .tar to install that beast.

can anybody point me in the right direction, please?

TIA,
Herbert

> Which part breaks when not just using the native sparse? As far as I know,
> a kernel build should use all-kernel header files, with the exception of
> "stdarg.h" which I thought was also architecture-independent (but hey,
> maybe I'm just a retard, and am wrong).
>
> Linus
> -
> 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/

2004-06-18 21:57:40

by Randy.Dunlap

[permalink] [raw]
Subject: Re: [PATCH] cross-sparse

On Fri, 18 Jun 2004 23:33:38 +0200 Herbert Poetzl wrote:

| On Fri, Jun 18, 2004 at 09:27:22AM -0700, Linus Torvalds wrote:
| > On Thu, 17 Jun 2004, Geert Uytterhoeven wrote:
| > >
| > > I wanted to give sparse a try on m68k, and noticed the current
| > > infrastructure doesn't handle cross-compilation (no sane m68k
| > > people compile kernels natively anymore, unless they run a
| > > Debian autobuilder ;-).
| > >
| > > After hacking the include paths in the sparse sources, installing
| > > the resulting binary as m68k-linux-sparse, and applying the
| > > following patch, it seems to work fine!
| >
| > Hmm.. It does make sense, but at the same time, sparse isn't even really
| > supposed to _care_ about the architecture. Especially not for a kernel
| > build.
|
| apologies for assasinating this thread ...
|
| I did an 'extensive' search with google (you do not want
| to know how many hits you get with 'sparse') and read
| most postings on the sparse mailinglist (linux-sparse),
| found the freshmeat project pointing me to the 'new url'
| http://www.codemonkey.org.uk/projects/sparse/ where I can
| download 'sparse-2003-11-27.tar.gz', then found out that
| there should be a maintained (up to date) version of it at
|
| http://www.kernel.org/pub/software/devel/sparse/
|
| but what I find there, seems of no use to me ...
| (I'm no bitkeeper person) so I'm still looking for an url
| where I can get a recent .tar to install that beast.
|
| can anybody point me in the right direction, please?

sure, get a tarball from here:
http://www.codemonkey.org.uk/projects/bitkeeper/sparse/

--
~Randy

2004-06-18 21:57:49

by Chris Wedgwood

[permalink] [raw]
Subject: Re: [PATCH] cross-sparse

On Fri, Jun 18, 2004 at 11:33:38PM +0200, Herbert Poetzl wrote:

> can anybody point me in the right direction, please?

http://sparse.bkbits.net/sparse/

2004-06-18 21:07:34

by Linus Torvalds

[permalink] [raw]
Subject: Re: [PATCH] cross-sparse



On Fri, 18 Jun 2004, Geert Uytterhoeven wrote:
>
> IIRC, actually the first error I got when using the native sparse was that it
> couldn't find stdarg.h.

Ok.

> And even the non-native sparse doesn't know about architecture-specific defines
> like __mc68000__, causing some code paths being wrong. Guess I have to replace
> them by e.g. CONFIG_M68K.

No, this is handled by fixing up the expected defines in the

arch/xxx/Makefile

thing, ie x86 has this:

CHECK := $(CHECK) -D__i386__=1

exactly because sparse is architecture-agnostic. Same goes for 64-bit
issues (sparse defaults to 32-bit types regardless of what the native
format is), so a 64-bit platform like ppc64 would do:

CHECK := $(CHECK) -m64 -D__powerpc__=1

where that "-m64" is the magic flag to sparse for a 64-bit compile
environment.

But your stdarg.h issue is certainly valid. I'd really like for sparse to
be _totally_ independent of the native compiler install, and I guess we
could do something like

CHECK := $(CHECK) -I$(shell $(CC) -print-file-name=include)

or similar to get this part right too, but then sparse would be hard to
use stand-alone without the Makefile magic. Hmm.

Linus

2004-06-18 23:32:43

by Dave Jones

[permalink] [raw]
Subject: Re: [PATCH] cross-sparse

On Fri, Jun 18, 2004 at 11:33:38PM +0200, Herbert Poetzl wrote:

> I did an 'extensive' search with google (you do not want
> to know how many hits you get with 'sparse') and read
> most postings on the sparse mailinglist (linux-sparse),
> found the freshmeat project pointing me to the 'new url'
> http://www.codemonkey.org.uk/projects/sparse/ where I can
> download 'sparse-2003-11-27.tar.gz', then found out that
> there should be a maintained (up to date) version of it at
>
> http://www.kernel.org/pub/software/devel/sparse/
>
> but what I find there, seems of no use to me ...
> (I'm no bitkeeper person) so I'm still looking for an url
> where I can get a recent .tar to install that beast.
>
> can anybody point me in the right direction, please?

Erk, that's where I originally was snapshotting stuff, then
the box hosting codemonkey.org.uk died, and I had to restore
from backup. It turned a symlink to http://www.codemonkey.org.uk/projects/bitkeeper/sparse/
into a copy of the dir. Oops. I'll go fix that up (By just
killing the old dir).

Dave

2004-06-19 00:13:46

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH] cross-sparse

On Fri, 18 Jun 2004, Linus Torvalds wrote:
> On Thu, 17 Jun 2004, Geert Uytterhoeven wrote:
> > I wanted to give sparse a try on m68k, and noticed the current infrastructure
> > doesn't handle cross-compilation (no sane m68k people compile kernels natively
> > anymore, unless they run a Debian autobuilder ;-).
> >
> > After hacking the include paths in the sparse sources, installing the resulting
> > binary as m68k-linux-sparse, and applying the following patch, it seems to work
> > fine!
>
> Hmm.. It does make sense, but at the same time, sparse isn't even really
> supposed to _care_ about the architecture. Especially not for a kernel
> build.
>
> Which part breaks when not just using the native sparse? As far as I know,
> a kernel build should use all-kernel header files, with the exception of
> "stdarg.h" which I thought was also architecture-independent (but hey,
> maybe I'm just a retard, and am wrong).

IIRC, actually the first error I got when using the native sparse was that it
couldn't find stdarg.h.

And even the non-native sparse doesn't know about architecture-specific defines
like __mc68000__, causing some code paths being wrong. Guess I have to replace
them by e.g. CONFIG_M68K.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2004-06-19 00:45:47

by Al Viro

[permalink] [raw]
Subject: Re: [PATCH] cross-sparse

On Fri, Jun 18, 2004 at 10:49:38PM +0200, Geert Uytterhoeven wrote:
> And even the non-native sparse doesn't know about architecture-specific defines
> like __mc68000__, causing some code paths being wrong. Guess I have to replace
> them by e.g. CONFIG_M68K.

That should be handled in arch/m68k/Makefile - see how it's done on e.g.
i386.