gcc-4.3.0-0.4 and building kernel src.rpm

Jakub Jelinek jakub at redhat.com
Sun Jan 6 13:10:59 UTC 2008


On Sat, Jan 05, 2008 at 07:10:29AM -0800, gjohnson5 wrote:
> 
> I am using gcc-4.3.0-0.4 with glibc-2.7.90-3 (not sure if that matters) with
> rawhide and I am getting this building kernel-2.6.23.12-101.fc8
> 
> drivers/video/cfbimgblt.c:129:12: warning: cast adds address space to
> expression (<asn:2>)
>   CHK     include/linux/compile.h
>   UPD     include/linux/compile.h
> init/version.c:19:5: warning: symbol 'Version_132631' was not declared.
> Should it be static?
> kernel/built-in.o: In function `getnstimeofday':
> (.text+0x1d525): undefined reference to `__umoddi3'
> kernel/built-in.o: In function `do_gettimeofday':
> (.text+0x1d5ef): undefined reference to `__udivdi3'
...

See http://gcc.gnu.org/PR32044
__udivdi3/__umoddi3 are in libgcc.a and gcc relies on it libgcc being
available, but the kernel chooses to link without libgcc - for some routines
it has its own counterparts, for some it chooses not to implement them at
all and just assumes they won't be needed.

The optimization in question without __builtin_expect is a clear win, at
least unless there are really very few iterations or the target has an
instruction to do the division or modulo.  With __builtin_expect saying
that looping is unexpected this is more questionable, see the PR above for
more details.  That said, when kernel intentionally avoids libgcc, IMHO it must
be prepare to tweak its sources to ensure it is not needed.
I think best is to insert an optimization barrier in the 2 or how many loops
are there in the kernel where this optimization turns a loop into > wordsize
division/modulo.

	Jakub




More information about the fedora-test-list mailing list