[gnu.g++.bug] G++ on USG 5.2.2 system

jkp@SAUNA.HUT.FI (Jyrki Kuoppala) (04/20/89)

Here's a description how I got g++ 1.35.0- up on Altos 3068 (usg 5.2.2
running gcc, gas and GNU binutils).  Most of the diffs are pretty
general for USG systems.

Author: Jyrki Kuoppala (jkp@cs.hut.fi)
Last modified: Thu Apr 20 18:12:51 1989

NOTE for Altos 3068 (and perhaps other SysV machines): Altos symlinks
behave differently than bsd ones.  If you proceed as the README file
says, you'll have the gcc files instead of g++ files.  So, do the
links to the gcc files BEFORE the links to g++ files.  First run make
with maketest target ( ln -s ../src-g++/Makefile ; make maketest ),
then ln -s ../src-g++/*.

Renamed cplus-parse.y to cplus-p.y.
also changed cplus-parse.tab.{c,h,o} to cplus-p.tab.{c,h,o} in Makefile
and cplus-parse.output to cplus-p.output

edit cplus-lex.c to include cplus-p.tab.h

Also ld++ should use shorter tmp file name (C++.hacks); now the last
digit gets truncated.

compiled with gcc 1.34.91

When compiling libg++.a (with -g -O):

I get multiply ___CTOR_LIST__ and ___DTOR_LIST__ messages.
nm -p shows:

0000051a x ___CTOR_LIST__

When g++ is compiled with FASCIST_ASSEMBLER defined, all works fine.
Yes, I am using gas, wonder if there's something wrong with my hacked
ld++.

The file name of CursesWindow.cc is too long; make thinks it's a C
file.

I won't include diffs for the ld++ because it's combined from ld.c
from G++ and a newer ld.c from binutils.  Perhaps it would be time to
publish the current ld.c and binutils, it's been quite a while since
the last release was made.

diff -cr src-g++/Makefile src-g++.a/Makefile
*** src-g++/Makefile	Wed Apr 19 17:38:26 1989
--- src-g++.a/Makefile	Thu Apr 20 10:16:11 1989
***************
*** 52,66 ****
  
  # Variables that exist for you to override.
  
! CFLAGS = -g -DSOS -DESKIT -O
  # CFLAGS = -g -O
  CC = gcc
  BISON = bison
  BISONFLAGS = -v -d
! AR = ar
  SHELL = /bin/sh
  # on sysV, define this as cp.
! INSTALL = install -c
  MAKE = make
  
  # Compiler to use for compiling gnulib.
--- 52,67 ----
  
  # Variables that exist for you to override.
  
! CFLAGS = -I. -DSOS -DESKIT -O -DFASCIST_ASSEMBLER
! #CFLAGS = -g -DSOS -DESKIT -O
  # CFLAGS = -g -O
  CC = gcc
  BISON = bison
  BISONFLAGS = -v -d
! AR = /usr/gbin/ar
  SHELL = /bin/sh
  # on sysV, define this as cp.
! INSTALL = cp
  MAKE = make
  
  # Compiler to use for compiling gnulib.
***************
*** 113,119 ****
  C_OBJS = c-parse.tab.o c-decl.o c-typeck.o c-convert.o
  
  # Language-specific object files for C++.
! CPLUS_OBJS = cplus-parse.tab.o cplus-decl.o cplus-typeck.o \
   cplus-lex.o cplus-class.o cplus-init.o \
   cplus-method.o cplus-cvt.o cplus-search.o cplus-ptree.o
  
--- 114,120 ----
  C_OBJS = c-parse.tab.o c-decl.o c-typeck.o c-convert.o
  
  # Language-specific object files for C++.
! CPLUS_OBJS = cplus-p.tab.o cplus-decl.o cplus-typeck.o \
   cplus-lex.o cplus-class.o cplus-init.o \
   cplus-method.o cplus-cvt.o cplus-search.o cplus-ptree.o
  
***************
*** 180,185 ****
--- 181,188 ----
  		OPTS='-DSUN4=4 -DTARGET=SUN4'; \
  	elif cmp -s tm.h config/tm-encore.h; then \
  		CRT0_OPTIONS='-DUMAX'; \
+ 	elif cmp -s tm.h config/tm-altos3068.h; then \
+ 		OPTS='-DCOFF_ENCAPSULATE -DNON_NATIVE -DUSG -DPORTAR'; \
  	elif cmp -s tm.h tm-i386gas+.h; then \
  		OPTS='-DUSG -DCOFF_ENCAPSULATE -DNON_NATIVE -DPORTAR'; \
  	else \
***************
*** 186,192 ****
  		OPTS='-DTARGET=-1'; \
  	fi; \
  	echo $$OPTS; \
! 	$(CC) -c $$OPTS $(PROFILE) $(CFLAGS) -DSTANDARD_SEARCH_DIRS="\"$(libdir)\", \"/lib\", \"/usr/lib\", \"/usr/local/lib\"" $(CFLAGS)
  
  ld.o: ld.c
  	-if cmp -s tm.h config/tm-sun3+.h; then \
--- 189,195 ----
  		OPTS='-DTARGET=-1'; \
  	fi; \
  	echo $$OPTS; \
! 	$(CC) -c $$OPTS $(PROFILE) $(CFLAGS) -DSTANDARD_SEARCH_DIRS="\"$(libdir)\", \"/lib\", \"/usr/lib\", \"/usr/local/lib\"" $(CFLAGS) newld.c
  
  ld.o: ld.c
  	-if cmp -s tm.h config/tm-sun3+.h; then \
***************
*** 239,244 ****
--- 242,249 ----
  		CRT0_OPTIONS='-Umc68000'; \
  	elif cmp -s tm.h config/tm-sequent.h; then \
  		CRT0_OPTIONS='-DCRT0_DUMMIES= -DDOT_GLOBAL_START'; \
+ 	elif cmp -s tm.h config/tm-altos3068.h; then \
+ 		CRT0_OPTIONS='-DCRT0_DUMMIES= -Umc68000 -Um68k'; \
  	elif cmp -s tm.h tm-i386gas+.h; then \
  		CRT0_OPTIONS='-DCRT0_DUMMIES=bogus_fp, -DDOT_GLOBAL_START'; \
  	else \
***************
*** 267,280 ****
  cplus-ptree.o : cplus-ptree.c $(CONFIG_H) $(TREE_H)
  new-cplus-method.o : new-cplus-method.c $(CONFIG_H) $(CPLUS_TREE_H)
  
! cplus-parse.tab.o : cplus-parse.tab.c $(CONFIG_H) $(CPLUS_TREE_H) cplus-parse.h flags.h
! 	$(CC) -c $(CFLAGS) -Iconfig -DPARSE_OUTPUT=\"$(PWD)/cplus-parse.output\" $<
  
! cplus-parse.tab.c : cplus-parse.y
  	@echo expect 41 shift/reduce conflicts and 4 reduce/reduce conflicts
! 	$(BISON) $(BISONFLAGS) cplus-parse.y
  
! cplus-lex.o : cplus-lex.c $(CONFIG_H) $(CPLUS_TREE_H) cplus-parse.h cplus-parse.tab.h
  rtl.o : rtl.c $(CONFIG_H) $(RTL_H)
  
  # Language-independent files.
--- 272,285 ----
  cplus-ptree.o : cplus-ptree.c $(CONFIG_H) $(TREE_H)
  new-cplus-method.o : new-cplus-method.c $(CONFIG_H) $(CPLUS_TREE_H)
  
! cplus-p.tab.o : cplus-p.tab.c $(CONFIG_H) $(CPLUS_TREE_H) cplus-parse.h flags.h
! 	$(CC) -c $(CFLAGS) -Iconfig -DPARSE_OUTPUT=\"$(PWD)/cplus-p.output\" $<
  
! cplus-p.tab.c : cplus-p.y
  	@echo expect 41 shift/reduce conflicts and 4 reduce/reduce conflicts
! 	$(BISON) $(BISONFLAGS) cplus-p.y
  
! cplus-lex.o : cplus-lex.c $(CONFIG_H) $(CPLUS_TREE_H) cplus-parse.h cplus-p.tab.h
  rtl.o : rtl.c $(CONFIG_H) $(RTL_H)
  
  # Language-independent files.
***************
*** 499,505 ****
  # Get rid of every file that's generated from some other file (except INSTALL).
  realclean: clean
  	-rm -f cpp.aux cpp.cps cpp.fns cpp.info cpp.kys cpp.pgs cpp.tps cpp.vrs
! 	-rm -f cplus-parse.tab.c cplus-parse.output
  	-rm -f errs gnulib cexp.c TAGS tm-*+.h
  	-rm -f g++.info* g++.?? g++.??s g++.log g++.toc g++.*aux
  	-rm -f cccp cpp
--- 504,510 ----
  # Get rid of every file that's generated from some other file (except INSTALL).
  realclean: clean
  	-rm -f cpp.aux cpp.cps cpp.fns cpp.info cpp.kys cpp.pgs cpp.tps cpp.vrs
! 	-rm -f cplus-p.tab.c cplus-p.output
  	-rm -f errs gnulib cexp.c TAGS tm-*+.h
  	-rm -f g++.info* g++.?? g++.??s g++.log g++.toc g++.*aux
  	-rm -f cccp cpp
***************
*** 552,558 ****
  
  TAGS: force
  	mkdir temp
! 	-mv cplus-parse.tab.c cexp.c c-*.c temp
  	etags *.y *.h *.c
  	mv temp/* .
  	rmdir temp
--- 557,563 ----
  
  TAGS: force
  	mkdir temp
! 	-mv cplus-p.tab.c cexp.c c-*.c temp
  	etags *.y *.h *.c
  	mv temp/* .
  	rmdir temp
diff -cr src-g++/cplus-lex.c src-g++.a/cplus-lex.c
*** src-g++/cplus-lex.c	Fri Apr 14 20:07:46 1989
--- src-g++.a/cplus-lex.c	Thu Apr 20 11:04:59 1989
***************
*** 25,31 ****
  #include <errno.h>
  #include "config.h"
  #include "tree.h"
! #include "cplus-parse.tab.h"
  #include "cplus-parse.h"
  #include "cplus-tree.h"
  #include "flags.h"
--- 25,31 ----
  #include <errno.h>
  #include "config.h"
  #include "tree.h"
! #include "cplus-p.tab.h"
  #include "cplus-parse.h"
  #include "cplus-tree.h"
  #include "flags.h"
***************
*** 852,858 ****
        t = pending_inlines;
        pending_inlines = pending_inlines->next;
        finput = finput2;
! #ifdef i386
        finput2->_ptr = finput2->_base = t->buf;
        _bufend(finput2) = t->buf + t->len;
  #ifdef sequent
--- 852,858 ----
        t = pending_inlines;
        pending_inlines = pending_inlines->next;
        finput = finput2;
! #if defined(USG) && !defined(hp9000s300)
        finput2->_ptr = finput2->_base = t->buf;
        _bufend(finput2) = t->buf + t->len;
  #ifdef sequent
***************
*** 863,880 ****
        finput2->_cnt = t->len - 1;
  #else
  #ifndef hp9000s300
- #ifdef USG
-       setvbuf(finput2,t->buf,_IOFBF,t->len);
-       finput2->_cnt = t->len-1;
- #else
        setbuffer (finput2, t->buf, t->len);
        finput2->_cnt = finput2->_bufsiz - 1;
- #endif				/* USG */
  #else
        setvbuf(finput2,t->buf,_IOFBF,t->len);
        finput2->_cnt = t->len-1;
  #endif
! #endif
        lineno = t->lineno;
        input_filename = t->filename;
  #ifdef DO_INLINES_THE_OLD_WAY
--- 863,875 ----
        finput2->_cnt = t->len - 1;
  #else
  #ifndef hp9000s300
        setbuffer (finput2, t->buf, t->len);
        finput2->_cnt = finput2->_bufsiz - 1;
  #else
        setvbuf(finput2,t->buf,_IOFBF,t->len);
        finput2->_cnt = t->len-1;
  #endif
! #endif /* USG */
        lineno = t->lineno;
        input_filename = t->filename;
  #ifdef DO_INLINES_THE_OLD_WAY
***************
*** 1655,1661 ****
  	      /* The buffer we used will be freed at the
  		 end of this function.  */
  	      pending_inlines = pending_inlines->next;
! #ifdef i386
  	      finput2->_ptr = finput2->_base = t->buf;
  	      _bufend(finput2) = t->buf + t->len;
  	      finput2->_flag = _IOFBF | _IOREAD;
--- 1650,1656 ----
  	      /* The buffer we used will be freed at the
  		 end of this function.  */
  	      pending_inlines = pending_inlines->next;
! #if defined(USG) && !defined(hp9000s300)
  	      finput2->_ptr = finput2->_base = t->buf;
  	      _bufend(finput2) = t->buf + t->len;
  	      finput2->_flag = _IOFBF | _IOREAD;
***************
*** 1662,1679 ****
  	      finput2->_cnt = t->len - 1;
  #else
  #ifndef hp9000s300
- #ifdef USG
-       	      setvbuf(finput2,t->buf,_IOFBF,t->len);
-        	      finput2->_cnt = t->len-1;
- #else
    	      setbuffer (finput2, t->buf, t->len);
    	      finput2->_cnt = finput2->_bufsiz - 1;
- #endif				/* USG */
  #else
        	      setvbuf(finput2,t->buf,_IOFBF,t->len);
         	      finput2->_cnt = t->len-1;
  #endif
! #endif
  	    }
  	  else
  	    {
--- 1657,1669 ----
  	      finput2->_cnt = t->len - 1;
  #else
  #ifndef hp9000s300
    	      setbuffer (finput2, t->buf, t->len);
    	      finput2->_cnt = finput2->_bufsiz - 1;
  #else
        	      setvbuf(finput2,t->buf,_IOFBF,t->len);
         	      finput2->_cnt = t->len-1;
  #endif
! #endif /* USG */
  	    }
  	  else
  	    {
diff -cr src-g++/crt0.c src-g++.a/crt0.c
*** src-g++/crt0.c	Tue Apr 11 06:44:01 1989
--- src-g++.a/crt0.c	Thu Apr 20 08:57:15 1989
***************
*** 197,203 ****
  	asm("	.set	_387_flt,0");
  #endif
  
! #if defined(i386)
  _start(arg)
  char *arg;
  {
--- 197,203 ----
  	asm("	.set	_387_flt,0");
  #endif
  
! #if defined(i386) || defined(ALTOS)
  _start(arg)
  char *arg;
  {
***************
*** 717,723 ****
       int status;
  {
    __do_global_cleanup ();
! #if defined(hp9000s300) || defined(i386)
    _cleanup ();
  #endif
    _exit (status);
--- 717,723 ----
       int status;
  {
    __do_global_cleanup ();
! #if defined(hp9000s300) || defined(i386) || defined(ALTOS)
    _cleanup ();
  #endif
    _exit (status);


jkp@cs.hut.fi

//Jyrki