Subject: Re: [PATCH] [POWERPC] Fix kernel builds with newer gcc versions and -Os

From: Segher Boessenkool <[email-masked]>
Date: Sat, 3 May 2008 02:15:07 +0200

>> What in libgcc references libc, and why isn't this a problem for
>> Linux/ARM, Linux/SH, U-boot, and the many other libc-less programs 
>> that
>> use libgcc?
>
> The problem only occurs once you reference a function that references
> libc stuff, and those guys are just lucky so far.

The only calls to the C library that GCC ever generates by itself
(for freestanding mode, at least) are calls to memcmp, memcpy, memmove,
memset (and abort, in some circumstances).  This is true whether or
not you link to libgcc.

> It's also one less variable to debug if you put the implementation
> in the kernel, or do you like debugging compiler induced problems?
> I don't :-)

On the other hand, if we opt to re-implement, we have to make sure
the in-kernel version of the GCC support routines is correct.  We
have to trust the compiler everywhere else already, why not here as
well?

Segher

p.s.  I just finished some testing linking a powerpc kernel with
libgcc.  All went fine, as expected.  I also did a stupid test that
actually needed a libgcc routine (__udivdi3); that went fine as well.
And yeah, I know about the modules issue, but that isn't really very
different from the analogue issue with in-kernel library routines.