Ld Got Bus Error When Building G++ 1.39.1 and Libg++ 1.39.0 ONAT386 Running AT&T SVR3.2.2

Ami A. Silberman silber at m.cs.uiuc.edu
Tue Jun 18 06:06:22 AEST 1991


hlu at yoda.eecs.wsu.edu (Hongjiu Lu) writes:

>In my previous article I sent, I forgot mentioning the machine I am 
>trying to build g++ 1.39.1 and libg++ 1.39.0 on, which is an AT386 and
>running AT&T UNIX System V/386 Release 3.2.2. I am using the native
>assembler and linker come with the system.

>I finaly managed to compile everthing. After playing around for
>serveral days I finally passed all the tests of libg++. Also it works
>fine now, I still have somethngs I don't understand.

>It seems that the output of ld -r cannot be used with the later ld run
>everytime. Some of them will produce the error message "Bus error - core
>dumped" during the final ld run to create the executable file. Here is
>the example of a ld run.

>g++ -v -o tPQ tPQ.o -L. -L../src -ltest -lg++ -lm -lc_s

>g++ version 1.39.1 (based on GCC 1.39)
> ld -r -o /usr/tmp/cca00467.R /lib/crt1.o -L. -L../src tPQ.o -ltest -lg++ -lm -lc_s -lg++ /usr/local/lib/gcc-gnulib -lc /lib/crtn.o
> /usr/local/lib/gcc-collect -o /usr/tmp/cca00467.s /usr/tmp/cca00467.R
> as /usr/tmp/cca00467.s -o /usr/tmp/cca00467.O
> ld -o ttt /usr/tmp/cca00467.R /usr/tmp/cca00467.O
>g++: Program ld got fatal signal 10.

>I was wondering under what condition ld will cause the bus error when
>doing a 
>	ld -o xxx xxx.o xxx.o
>Could anyone give me a hint? I got around this by relink everything.
>But I still want to know why I have to do this.

>Thanks in advance.


>H.J. Lu
 
What probably happened was that, due to a bug in your native C compiler,
lines 530-about 532 of expr.c in the gnu assembler code were miscompiled.
the lines read:

	"if (expressionP -> X_subtract_symbol == expressionP ->X_addsymbol
	|| (expressionP->X_subtract_symbol->sy_frag==expressionP->X_add_symbol->sy_frag

and the next line is similar.  If expressionP->X_subtract_symbol == 0,
and expressionP->X_addsymbol != 0, then there will be an attempted
access down a nul pointer and a resulting bus error, signal 10.

The fix is to add the following two lines before the above expression

	if (expressionP-> X_subtract_symbol == NULL) {break;}
        if (expressionP-> X_add_symbol == NULL) {break;}

I found that this works fine.
-- 
ami silberman - janitor of lunacy
	silber at cs.uiuc.edu



More information about the Comp.unix.sysv386 mailing list