[OpenBIOS] cross-pcc compilation issue with GCC 4.5.0

Segher Boessenkool segher at kernel.crashing.org
Tue Apr 27 01:44:01 CEST 2010


> I think I can now reproduce the crash, previously I had no problems
> which made debugging a bit difficult.

On sparc64, not PowerPC as we were talking about.  Could be the
same problem, of course.

> I changed gcc's memory model
> flag to -mcmodel=medlow and now Milax crashes in __umodti3 like Igor
> reported. Perhaps this flag may be different when gcc builds libgcc.

Code model on Sparc V9 does not change ABI.

> The problem seems to be that gcc's libgcc divides by zero.
> Breakpoint 10, __umodti3 (u=<value optimized out>,
>     v=0x0000000000000000fffffffffffffffe) at ../../gcc/libgcc2.c:911
> 911     in ../../gcc/libgcc2.c
> 11: $i4 = 0x0
> 10: $i0 = 0x1
> 1: x/i $pc
> 0xffd1f980 <__umodti3+952>:     udivx  %i0, %i4, %g1

Backtrace?

> Why this doesn't happen with our libgcc? Why it doesn't happen with
> -mcmodel=medany? What a puzzle.

My intuition says you are dividing (a value derived from) a pointer by
an integer here, does that ring any bells?

> One solution could be to check for division by zero in mudivmod(),
> which is where __umodti3 is called from.

A better solution is not to divide by zero in the first place ;-)


Segher




More information about the OpenBIOS mailing list