public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [rfc] built-in native compiler for Linux?
@ 2009-04-22  8:58 Ingo Molnar
  2009-04-23 20:22 ` Anton Ertl
       [not found] ` <alpine.DEB.1.10.0904241429450.19686@qirst.com>
  0 siblings, 2 replies; 7+ messages in thread
From: Ingo Molnar @ 2009-04-22  8:58 UTC (permalink / raw)
  To: Steven Rostedt, Linus Torvalds, Arnaldo Carvalho de Melo,
	Jeff Garzik, Alexander Viro, Alan Cox, Thomas Gleixner, Tejun Heo,
	David S. Miller, Sam Ravnborg, Jonathan Corbet, H. Peter Anvin,
	Greg KH
  Cc: Jeremy Fitzhardinge, Mathieu Desnoyers, linux-kernel,
	Andrew Morton, Thomas Gleixner, Peter Zijlstra,
	Frederic Weisbecker, Theodore Tso, Arjan van de Ven,
	Christoph Hellwig, Lai Jiangshan, Zhaolei, Li Zefan,
	KOSAKI Motohiro, Masami Hiramatsu, Frank Ch. Eigler, Tom Zanussi,
	Jiaying Zhang, Michael Rubin, Martin Bligh, Peter Zijlstra,
	Neil Horman, Andi Kleen, Eduard - Gabriel Munteanu, Pekka Enberg


* Steven Rostedt <rostedt@goodmis.org> wrote:

> I think it was Ingo that let out the idea, and I'm starting to 
> like it.
> 
> Perhaps we should fork off gcc and ship Linux with its own 
> compiler. This way we can optimize it for the kernel and not worry 
> about any userland optimizations.

I didnt suggest forking GCC. A kernel-special GCC would likely just 
become an inferior fork of GCC over time and would fizzle out. 
There's 100 times more user-space code than kernel-space code and 
GCC is too large and too legacy-laden to really be appropriate for 
that purpose.

What i think makes sense is to build a _new_ precompiler / compiler 
/ assembler / linker combo for Linux, from scratch, hosted in the 
kernel proper.

In the past 15 years of Linux we've invested a lot of time and 
effort into working around and dealing with compiler crap. We wasted 
a lot of opportunities waiting years for sane compiler features to 
show up. We might as well have invested that effort into building 
our own compiler and could stop bothering about externalities. The 
Linux kernel project certainly involves the right kind of people who 
could make something like this happen.

A good technical basis for that would be Sparse, and it could start 
by acting as a drop-in replacement for CPP and it could feed its 
output to GCC with little changes. Sparse is small, has a very tidy 
code base and is already useful today as an extended static source 
code checker.

The Sparse codebase could move into the kernel proper, under 
linux/sparse/ or so - so the preprocessor/compiler and the kernel 
could be in precise feature and bugfix lock-step with no artificial 
external synchronization.

We have a lot of annoying preprocessor limitations that Sparse could 
help with straight away. We'd also get Sparse type checking by 
default. So it's helpful even without any code generator support.

Then, if this model works out, we could experiment with adding a 
code generator backend to Sparse. I think Jeff Garzik experimented 
with that in the past with some surprisingly quick (but incomplete) 
results.

Since most of the performance-critical code in Linux is 
hand-optimized already, we dont even need all that many complex, 
exotic optimizations - we want to encourage common-sense coding 
practices. Furthermore, a lot of optimizations in GCC are driven by 
SPECint and SPECfp benchmarketing, with little practical relevance 
to 99% of the apps, including the kernel.

There would always be an 'output to GCC' kind of compatible build 
channel as well, for CPU architectures that dont have native code 
generator support yet. We'd also do that to generally keep our 
options open, in case we are wrong about it all or in case some even 
better compiler project pops up.

	Ingo

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-04-27 18:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-22  8:58 [rfc] built-in native compiler for Linux? Ingo Molnar
2009-04-23 20:22 ` Anton Ertl
     [not found] ` <alpine.DEB.1.10.0904241429450.19686@qirst.com>
2009-04-25  5:29   ` David Miller
2009-04-25  7:06     ` Eric W. Biederman
2009-04-27 13:52       ` Christoph Lameter
2009-04-27 17:34         ` Al Viro
2009-04-27 18:41           ` Eric W. Biederman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox