Subject: Re: building -current, CPU optimizations, and the 'sh' problem.
To: None <port-sparc@netbsd.org>
From: Valeriy E. Ushakov <uwe@ptc.spbu.ru>
List: port-sparc
Date: 10/17/2005 18:04:12
On Sat, Oct 15, 2005 at 08:31:30 +0000, Christos Zoulas wrote:

> >Might this be an indication that my system, built entirely with
> >-mcpu=supersparc (except, now, for /bin/sh) is ultimately unstable?
> 
> Where does it segfault? What does gdb say?

I did some initial testing on my Krups, useland cross built with
-mcpu=supersparc

I was able to get sh to core easily by building pkgtools/pkg_chk.  It
always produced exact same backtrace with pc in nowhereland.  I never
managed to reproduce the problem under ktrace.  Then I updated the
kernel and was no longer able to reproduce the problem there.

So I launched build.sh and after a few hours got few cores while
building binutils in tools.

At first glance it looks like the stack is messed up (and hence
registers).  E.g.:

$ gdb /bin/sh obj/sparc/tools/binutils/build/bfd/sh.core
...
Program terminated with signal 10, Bus error.
...
(gdb) x/i $pc
0x14a04 <evalcommand+1320>:     call  %g2
(gdb) p/x $g2
$5 = 0x2

Relevant parts of the assembly are:

0x14838 <evalcommand+860>:      sethi  %hi(0x15400), %g1
...
0x14840 <evalcommand+868>:      or  %g1, 0x1ac, %g1 ! 0x155ac = bltincmd
...
0x14848 <evalcommand+876>:      st  %g1, [ %fp + -52 ]

[...]

0x149f8 <evalcommand+1308>:     ld  [ %fp + -52 ], %g2
...
0x14a04 <evalcommand+1320>:     call  %g2

and indeed

(gdb) x/x $fp-52
0xe7ffcac4:     0x00000002



SY, Uwe
-- 
uwe@ptc.spbu.ru                         |       Zu Grunde kommen
http://www.ptc.spbu.ru/~uwe/            |       Ist zu Grunde gehen