🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.help
Article #637

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

#637
From: Ami A. Silberman
Date: Mon, 17 Jun 1991 20:06
56 lines
2954 bytes
hlu@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@cs.uiuc.edu
Technical Details
Message-ID: <1991Jun17.200622.6511@m.cs.uiuc.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!spool.mu.edu!think.com!rpi!uwm.edu!ux1.cso.uiuc.edu!m.cs.uiuc.edu!silber
References: <1991Jun10.050406.5746@serval.net.wsu.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!spool.mu.edu!think.com!rpi!uwm.edu!ux1.cso.uiuc.edu!m.cs.uiuc.edu!silber
From: silber@m.cs.uiuc.edu (Ami A. Silberman)
Newsgroups: gnu.g++.help,comp.bugs.misc,comp.bugs.sys5,comp.unix.wizards,comp.unix.sysv386,comp.unix.questions
Subject: Re: Ld Got Bus Error When Building G++ 1.39.1 and Libg++ 1.39.0 ONAT386 Running AT&T SVR3.2.2
Message-ID: <1991Jun17.200622.6511@m.cs.uiuc.edu>
Date: 17 Jun 91 20:06:22 GMT
References: <1991Jun10.050406.5746@serval.net.wsu.edu>
Organization: University of Illinois, Dept. of Comp. Sci., Urbana, IL
Lines: 56