Coda File System

Re: LWP spinoff

From: Greg Troxel <gdt_at_fnord.ir.bbn.com>
Date: 29 Dec 1999 11:05:17 -0500
I'm trying to compile lwp/coda from cvs on NetBSD-1.4.1/sparc (a
Classic and an ELC).  All built fine, and venus segfaulted in some lwp
hair that I didn't understand.  After investigating and trying the lwp
test programs, I found that the statically-linked versions worked, and
the dynamic ones got a segfault.  After poking around with gdb (I know
PDP-11 assembler much better than sparc, so I'm in dangerous territory
here), I tentatively concluded that the dynlinking process wasn't
resolving references to the PRE_Block variable.

I'm guessing there's something that needs to be done in a .o when
putting it in a shlib to cause references to get fixed up; it might be
that the macro used to munge PRE_Block isn't sufficient.  I haven't
tried this on NetBSD/i386; there is no wierdness on FreeBSD/i386 -- the
tests and venus run fine.

Here's the two lines of source (from lwp/src/process.ss in the sparc
section):
	sethi	%hi(NAME(PRE_Block)), %o1
	stb	%o0, [%o1 + %lo(NAME(PRE_Block))]

This ends up in the dynlinked version like this:

(gdb) disass savecontext
Dump of assembler code for function savecontext:
0x10023c68 <savecontext>:       save  %sp, -104, %sp
0x10023c6c <savecontext+4>:     ta  0x83
0x10023c70 <savecontext+8>:     mov  1, %o0
0x10023c74 <savecontext+12>:    sethi  %hi(0), %o1
0x10023c78 <savecontext+16>:    stb  %o0, [ %o1 + 0xb8 ]        ! 0xb8
0x10023c7c <savecontext+20>:    st  %i7, [ %sp + 0x5c ]
0x10023c80 <savecontext+24>:    st  %fp, [ %sp + 0x60 ]
0x10023c84 <savecontext+28>:    tst  %i2
0x10023c88 <savecontext+32>:    be  0x10023c98 <savecontext+48>
0x10023c8c <savecontext+36>:    st  %sp, [ %i1 ]
0x10023c90 <savecontext+40>:    and  %i2, -8, %o0
0x10023c94 <savecontext+44>:    sub  %o0, 0x60, %sp
0x10023c98 <savecontext+48>:    call  0x10023cc4 <.ptr_call>
0x10023c9c <savecontext+52>:    mov  %i0, %g1
0x10023ca0 <savecontext+56>:    unimp  0
End of assembler dump.

and in the static version like this:

0x5248 <savecontext>:    save  %sp, -104, %sp
0x524c <savecontext+4>:  ta  0x83
0x5250 <savecontext+8>:  mov  1, %o0
0x5254 <savecontext+12>: sethi  %hi(0x12000), %o1
0x5258 <savecontext+16>: stb  %o0, [ %o1 + 0x40 ]    ! 0x12040 <PRE_Block>
0x525c <savecontext+20>: st  %i7, [ %sp + 0x5c ]
0x5260 <savecontext+24>: st  %fp, [ %sp + 0x60 ]
0x5264 <savecontext+28>: tst  %i2
0x5268 <savecontext+32>: be  0x5278 <savecontext+48>
0x526c <savecontext+36>: st  %sp, [ %i1 ]
0x5270 <savecontext+40>: and  %i2, -8, %o0
0x5274 <savecontext+44>: sub  %o0, 0x60, %sp
0x5278 <savecontext+48>: call  0x52a4 <.ptr_call>
0x527c <savecontext+52>: mov  %i0, %g1
0x5280 <savecontext+56>: unimp  0


        Greg Troxel <gdt_at_ir.bbn.com>
Received on 1999-12-29 11:21:52