[parisc-linux] Re: new debs built, c++ is broken

Alan Modra alan@linuxcare.com.au
Thu, 15 Mar 2001 17:20:32 +1100 (EST)


[copying to the list, as this may help people debug similar problems]

(gdb) bt
#0  0x0000d22c in __register_frame_info (begin=0x42e68, ob=0x4f7cc)
    at /src/parisc/gcc/gcc/frame-dwarf2.c:561
#1  0x0000afe0 in frame_dummy ()
#2  0x0000a4f8 in _init ()

Disassembling the functions in question,

__register_frame_info is PIC
frame_dummy is not PIC, and trashes r19
_init is PIC

which expains the crash.  The next question is why do we have such a mess
of pic/non-pic code?  Running the compile with -Wl,-M to turn on linker
map output helps a bit, and shows that
__register_frame_info comes from /usr/lib/gcc-lib/hppa-linux/2.97/libgcc.a
frame_dummy comes from /usr/lib/gcc-lib/hppa-linux/2.97/crtbegin.o
_init is cobbled together from crti.o, crtbegin.o, crtend.o, crtn.o

So it seems the problem is really a result of our decision to make libgcc 
PIC, and a possible fix is to always link with crtbeginS.o and crtendS.o.
OK, we can do that by editing /usr/lib/gcc-lib/hppa-linux/2.97/specs and
make *startfile: end up with .... crti.o%s crtbeginS.o%s, and *endfile: be
crtendS.o%s crtn.o%s

Now I get a little further

alan@tea:/scsi/tmp$ ./c++hello 
Hello
Segmentation fault (core dumped)

So now we've likely got a problem with destructors.  To be continued...

Alan
-- 
Linuxcare.