[gnu.g++.bug] g++,libg++,gcc on 386/ix 2.02

root@amsctg.UUCP (Admin) (11/27/89)

These are the changes I am using to build g++ 1.36.1 on 386/ix
using COFF & collect.  I used "config.g++ i386-sysv".
This set of patches is based on a posting by James Van Artsdalen 
(thanks James) for installing g++ under i386 SysVr3.2. In addition I've
included the patches used for gcc (which installed cleanly) and libg++
(which still isn't 100%, but is pretty good).

This set of patches assumes the native assembler and loader will be used.

The directory structure I used is /usr2/gnu/gcc ...g++ ...libg++ and the
patches reflect this structure. You may need to adjust based on a different
directory structure.

The first set of patches (CUT 1 - END CUT 1) affects g++ (level 1.36.1)

The second set (CUT 2 - END CUT 2) libg++ (1.36.1)

and the third set (CUT 3 - END CUT 3) gcc (1.36)

Note the second set has patches to Makefile and to g++-include/ctype.h

Good luck. I hope this helps someone else get this software installed.

========== CUT 1 ============

RCS file: RCS/cplus-decl.c,v
retrieving revision 1.1
diff -c -r1.1 cplus-decl.c
*** /tmp/,RCSt1a12258	Thu Nov  9 19:17:43 1989
--- cplus-decl.c	Wed Nov  8 21:13:32 1989
***************
*** 4993,4999 ****
  	      assert (TREE_CODE (type) == METHOD_TYPE);
  	      ctype = TYPE_METHOD_BASETYPE (type);
  	    }
! 	  ctype = grok_method_quals (ctype, dummy, quals);
  	  type = TREE_TYPE (dummy);
  	  quals = NULL_TREE;
  	}
--- 4993,4999 ----
  	      assert (TREE_CODE (type) == METHOD_TYPE);
  	      ctype = TYPE_METHOD_BASETYPE (type);
  	    }
! 	  ctype = (tree) grok_method_quals (ctype, dummy, quals);
  	  type = TREE_TYPE (dummy);
  	  quals = NULL_TREE;
  	}
===================================================================
RCS file: RCS/cplus-lex.c,v
retrieving revision 1.1
diff -c -r1.1 cplus-lex.c
*** /tmp/,RCSt1a12258	Thu Nov  9 19:17:48 1989
--- cplus-lex.c	Wed Nov  8 20:43:30 1989
***************
*** 980,987 ****
--- 980,992 ----
        pending_inlines = pending_inlines->next;
        finput = finput2;
  #if defined(i386) && !defined(sequent) && !defined(sun386)
+ #ifndef USG_STDIO
        finput2->_ptr = finput2->_base = t->buf;
        _bufend(finput2) = t->buf + t->len;
+ #else
+       finput2->_ptr = finput2->_base = (unsigned char *) t->buf;
+       _bufend(finput2) = (unsigned char *) t->buf + t->len;
+ #endif
        finput2->_flag = _IOFBF | _IOREAD;
        finput2->_cnt = t->len - 1;
  #else
***************
*** 2078,2085 ****
--- 2083,2095 ----
  		 end of this function.  */
  	      pending_inlines = pending_inlines->next;
  #if defined(i386) && !defined(sequent) && !defined(sun386)
+ #ifndef USG_STDIO
  	      finput2->_ptr = finput2->_base = t->buf;
  	      _bufend(finput2) = t->buf + t->len;
+ #else
+ 	      finput2->_ptr = finput2->_base = (unsigned char *) t->buf;
+ 	      _bufend(finput2) = (unsigned char *) t->buf + t->len;
+ #endif
  	      finput2->_flag = _IOFBF | _IOREAD;
  	      finput2->_cnt = t->len - 1;
  #else
===================================================================
RCS file: RCS/expr.c,v
retrieving revision 1.1
diff -c -r1.1 expr.c
*** /tmp/,RCSt1a12258	Thu Nov  9 19:17:52 1989
--- expr.c	Wed Nov  8 20:43:59 1989
***************
*** 3153,3159 ****
  	  {
  	    tree cleanup = 0;
  	    /* Lose: callback to C++.  */
! 	    parm = get_temp_name (type, 0);
  	    mark_addressable (parm);
  	    target = DECL_RTL (parm);
  	    /* Since this parm is not known to the called function
--- 3153,3159 ----
  	  {
  	    tree cleanup = 0;
  	    /* Lose: callback to C++.  */
! 	    parm = (tree) get_temp_name (type, 0);
  	    mark_addressable (parm);
  	    target = DECL_RTL (parm);
  	    /* Since this parm is not known to the called function
***************
*** 3163,3169 ****
  	       it is very likely that such a reference need not be
  	       built here.  */
  	    if (TREE_OPERAND (exp, 2) == 0)
! 	      TREE_OPERAND (exp, 2) = maybe_build_cleanup (parm);
  	    if (TREE_OPERAND (exp, 2))
  	      cleanups_this_call = tree_cons (0, TREE_OPERAND (exp, 2),
  						 cleanups_this_call);
--- 3163,3169 ----
  	       it is very likely that such a reference need not be
  	       built here.  */
  	    if (TREE_OPERAND (exp, 2) == 0)
! 	      TREE_OPERAND (exp, 2) = (tree) maybe_build_cleanup (parm);
  	    if (TREE_OPERAND (exp, 2))
  	      cleanups_this_call = tree_cons (0, TREE_OPERAND (exp, 2),
  						 cleanups_this_call);
===================================================================
RCS file: RCS/gcc.c,v
retrieving revision 1.1
diff -c -r1.1 gcc.c
*** /tmp/,RCSt1a12258	Thu Nov  9 19:17:55 1989
--- gcc.c	Wed Nov  8 20:49:57 1989
***************
*** 303,316 ****
  char *collect_spec =
    "%{!c:%{!M*:%{!E:%{!S:collect -o %g.S %g.R\n\
  as %g.S -o %g.O\n\
! ld %{o*} %g.R %g.O\n\
  }}}}";
  
  /* Here is the spec for running the linker, after compiling all files.  */
! char *link_spec = "%{!c:%{!M*:%{!E:%{!S:ld -r -o %g.R %l\
   %{A} %{d} %{e*} %{N} %{n} %{r} %{s} %{S} %{T*} %{t} %{u*} %{X} %{x} %{z}\
!  %{y*} %{!nostdlib:%S} \
!  %{L*} %o %{!nostdlib:-lg++ gnulib%s %{g:-lg} %L}\n }}}}";
  #else
  /* Here is the spec for running the linker, after compiling all files.  */
  char *link_spec = "%{!c:%{!M*:%{!E:%{!S:ld %{o*} %l\
--- 303,316 ----
  char *collect_spec =
    "%{!c:%{!M*:%{!E:%{!S:collect -o %g.S %g.R\n\
  as %g.S -o %g.O\n\
! ld %{o*} %{!nostdlib:%S} %g.R %g.O %{!nostdlib:%L}\n\
  }}}}";
  
  /* Here is the spec for running the linker, after compiling all files.  */
! char *link_spec = "%{!c:%{!M*:%{!E:%{!S:ld -r -x -o %g.R %l\
   %{A} %{d} %{e*} %{N} %{n} %{r} %{s} %{S} %{T*} %{t} %{u*} %{X} %{x} %{z}\
!  %{y*} \
!  %{L*} %o %{!nostdlib:libg++.a%s gnulib%s %{g:-lg}}\n }}}}";
  #else
  /* Here is the spec for running the linker, after compiling all files.  */
  char *link_spec = "%{!c:%{!M*:%{!E:%{!S:ld %{o*} %l\
*** RCS/cplus-decl2.c	Wed Nov  8 20:41:15 1989
--- cplus-decl2.c	Wed Nov  8 20:42:49 1989
***************
*** 984,990 ****
--- 984,994 ----
        DECL_RTL (decl) = 0;
        /* @@ Assume names have underscores.  */
        if (asmspec_abort == 0)
+ #ifndef NO_UNDERSCORES
  	asmspec_abort = build_string (strlen ("_abort"), "_abort");
+ #else
+ 	asmspec_abort = build_string (strlen ("abort"), "abort");
+ #endif
        asmspec_tree = asmspec_abort;
        DECL_ABSTRACT_VIRTUAL_P (decl) = 1;
      }
*** RCS/make-links.g++	Wed Nov  8 20:50:34 1989
--- make-links.g++	Wed Nov  8 20:52:16 1989
***************
*** 64,70 ****
    insn-output.c insn-flags.h insn-config.h insn-codes.h"
  
  $remove -f config
! $symbolic_link ${CDIR} ./config 2>/dev/null || $hard_link ${CDIR} ./config
  if [ ! -r ${CDIR} ]
  then
  	echo "$progname: unable to link \`${CDIR}'."
--- 64,80 ----
    insn-output.c insn-flags.h insn-config.h insn-codes.h"
  
  $remove -f config
! $symbolic_link ${CDIR} ./config 2>/dev/null || 
! {
! $remove -rf config
! $make_directory config
! $change_directory config
! THIS=`pwd`
! $change_directory ../${CDIR}
! $symbolic_link * ${THIS} 2>/dev/null || $hard_link * ${THIS}
! $change_directory ${THIS}
! $change_directory ..
! }
  if [ ! -r ${CDIR} ]
  then
  	echo "$progname: unable to link \`${CDIR}'."

==============================================================
 
*** collect.c~	Fri Nov  3 02:13:56 1989
--- collect.c	Wed Nov 22 00:06:52 1989
***************
*** 68,75 ****
--- 68,77 ----
   */
  #ifdef i386
  #define ASM_INT_OP	ASM_LONG
+ #ifndef NO_UNDERSCORES
  #define NO_UNDERSCORES 1
  #endif
+ #endif
  
  #ifndef ASM_OUTPUT_INT_CONST
  #define ASM_OUTPUT_INT_CONST(FILE,VALUE)	\
***************
*** 418,425 ****
  	  
  	  symindex += GCC_SYMINC(symbol);
  	  
! 	  if (! GCC_OK_SYMBOL(symbol)) continue;
! 	  symbol_name = ldgetname(ldptr, &symbol);
  	  
  	  /* Check to see if we have a CTOR/DTOR marker  */
  
--- 420,427 ----
  	  
  	  symindex += GCC_SYMINC(symbol);
  	  
! /*	  if (! GCC_OK_SYMBOL(symbol)) continue;
! */	  symbol_name = ldgetname(ldptr, &symbol);
  	  
  	  /* Check to see if we have a CTOR/DTOR marker  */
  
***************
*** 426,432 ****
  	  if (! strncmp (CTOR_DTOR_MARKER_NAME, symbol_name,
  			 CTOR_DTOR_MARKER_LENGTH))
  	    add_ctor_dtor_elem(symbol_name);
! 	}
        }
      }
      else {
--- 428,435 ----
  	  if (! strncmp (CTOR_DTOR_MARKER_NAME, symbol_name,
  			 CTOR_DTOR_MARKER_LENGTH))
  	    add_ctor_dtor_elem(symbol_name);
! 
!        }
        }
      }
      else {
***************
*** 581,587 ****
--- 584,594 ----
  	  char *p = strtab+strindex;
  #endif /* hp9000s300 */
  
+ #ifdef NO_DOLLAR_IN_LABEL
+ 	  if (! strncmp ("__GLOBAL_.", p, 10))
+ #else
  	  if (! strncmp ("__GLOBAL_$", p, 10))
+ #endif
  	    add_ctor_dtor_elem(p);
  	}
      }

=================================================================

*** Makefile~	Mon Nov  6 20:33:47 1989
--- Makefile	Wed Nov 22 14:29:16 1989
***************
*** 37,43 ****
  # use `-dy'.
  
  # On COFF systems, use one of the definitions below. (see collect.c)
! # COFFLAGS = -DUSE_COLLECT -DCOFF
  # COFFLAGS = -DUSE_COLLECT -DEXTENDED_COFF
  
  # On some BSD systems (like Vax, unlike Sun), there is no file
--- 37,43 ----
  # use `-dy'.
  
  # On COFF systems, use one of the definitions below. (see collect.c)
! COFFLAGS = -DUSE_COLLECT -DCOFF
  # COFFLAGS = -DUSE_COLLECT -DEXTENDED_COFF
  
  # On some BSD systems (like Vax, unlike Sun), there is no file
***************
*** 46,52 ****
  # HAVE_UNISTD_H = -DNO_UNISTD_H
  
  # CFLAGS = -g -DSOS -DESKIT -O
! CFLAGS = -g -DGATHER_STATISTICS -O -Wunused $(COFFLAGS)
  CC = gcc
  BISON = bison
  BISONFLAGS = -v -d
--- 46,52 ----
  # HAVE_UNISTD_H = -DNO_UNISTD_H
  
  # CFLAGS = -g -DSOS -DESKIT -O
! CFLAGS = -g -DGATHER_STATISTICS -O $(COFFLAGS) -DNO_UNDERSCORES -DNO_DOLLAR_IN_LABEL
  CC = gcc
  BISON = bison
  BISONFLAGS = -v -d
***************
*** 53,61 ****
  AR = ar
  SHELL = /bin/sh
  # on sysV, define this as cp.
! INSTALL = install -c
  # on sysV, define this as ln.
! LINK = ln -s
  
  # Compiler to use for compiling gnulib.
  # OLDCC should not be the GNU C compiler.
--- 53,61 ----
  AR = ar
  SHELL = /bin/sh
  # on sysV, define this as cp.
! INSTALL = cp
  # on sysV, define this as ln.
! LINK = ln
  
  # Compiler to use for compiling gnulib.
  # OLDCC should not be the GNU C compiler.
***************
*** 71,77 ****
  # uncomment the following line.  But turncoats who claim officially
  # to support System V, but really try to be Berkeley (and thus
  # break with USG defined), may need to define this.
! # USG_STDIO = -DUSG_STDIO
  
  prefix = /usr/local
  
--- 71,77 ----
  # uncomment the following line.  But turncoats who claim officially
  # to support System V, but really try to be Berkeley (and thus
  # break with USG defined), may need to define this.
! USG_STDIO = -DUSG_STDIO
  
  prefix = /usr/local
  
***************
*** 96,104 ****
  OBSTACK=obstack.o
  
  # Directory to link to, when using the target `maketest'.
! DIR = ../gcc
  # this is the GNU CC build directory
! TDIR = ../gcc-test
  
  # End of variables for you to override.
  
--- 96,104 ----
  OBSTACK=obstack.o
  
  # Directory to link to, when using the target `maketest'.
! DIR = /usr2/gnu/gcc/gcc-1.36
  # this is the GNU CC build directory
! TDIR = /usr2/gnu/gcc/gcc-1.36
  
  # End of variables for you to override.
  
***************
*** 204,212 ****
  
  # gnulib is not a target because a proper installation of GNU CC
  # will place it where g++ can find it.  Same with cpp
! all: crt1+.o g++ cc1plus ld++ g++filt # collect crt0+.o
  # On COFF systems, use the target below.
! # all: g++ cc1plus collect # crt0+.o crt1+.o
  
  doc: $(srcdir)/cpp.info $(srcdir)/g++.info
  
--- 204,212 ----
  
  # gnulib is not a target because a proper installation of GNU CC
  # will place it where g++ can find it.  Same with cpp
! # all: crt1+.o g++ cc1plus ld++ g++filt # collect crt0+.o
  # On COFF systems, use the target below.
! all: g++ cc1plus collect # crt0+.o crt1+.o
  
  doc: $(srcdir)/cpp.info $(srcdir)/g++.info
  
***************
*** 286,292 ****
  	else \
  		COLLECT_OPTIONS=''; \
  	fi; \
! 	$(CC) -o collect $(PROFILE) $$COLLECT_OPTIONS $(CFLAGS) -I$(srcdir)/config $< -lg -lc $$COLLECT_LIBS
  
  g++filt: g++filt.o cplus-dem.o
  	$(CC) -o g++filt g++filt.o cplus-dem.o
--- 286,292 ----
  	else \
  		COLLECT_OPTIONS=''; \
  	fi; \
! 	$(CC) -o collect $(PROFILE) $(COLLECT_OPTIONS) $(CFLAGS) -I$(srcdir)/config collect.c -lg -lc -lld
  
  g++filt: g++filt.o cplus-dem.o
  	$(CC) -o g++filt g++filt.o cplus-dem.o

========= END CUT 1 ================================================

========== CUT 2 ===================================================


*** Makefile~	Tue Nov  7 07:04:13 1989
--- Makefile	Wed Nov 22 09:47:13 1989
***************
*** 28,34 ****
  # ------ source locations
  
  # Manually set PWD to *this* directory if you are not using gnu make
! PWD := $(shell pwd)
  
  # source include directory 
  SRCIDIR= $(PWD)/g++-include
--- 28,34 ----
  # ------ source locations
  
  # Manually set PWD to *this* directory if you are not using gnu make
! PWD = /usr2/gnu/libg++/libg++
  
  # source include directory 
  SRCIDIR= $(PWD)/g++-include
***************
*** 40,46 ****
  # set `prefix' to something else if you want to install things
  # in nonstandard places
  
! prefix =/usr/gnu
  
  # libg++.a destination
  LIBDIR = $(prefix)/lib
--- 40,46 ----
  # set `prefix' to something else if you want to install things
  # in nonstandard places
  
! prefix = /usr/local
  
  # libg++.a destination
  LIBDIR = $(prefix)/lib
***************
*** 56,63 ****
  # ------- use the second form of each for SystemV (USG)
  
  # g++ flags
! OSFLAG=
! #OSFLAG = -DUSG
  # use this only if you have a strange stdio implementation
  # -- recommended for DGUX and HPUX
  #OSFLAG = -DDEFAULT_filebuf
--- 56,63 ----
  # ------- use the second form of each for SystemV (USG)
  
  # g++ flags
! #OSFLAG=
! OSFLAG = -DUSG
  # use this only if you have a strange stdio implementation
  # -- recommended for DGUX and HPUX
  #OSFLAG = -DDEFAULT_filebuf
***************
*** 69,80 ****
  #OSLDFLAG= -lPW
  
  # how to install
! INSTALL=install -c
! #INSTALL=cp
  
  # ranlib if necessary
! RANLIB=ranlib
! #RANLIB=echo
  
  # which make?
  MAKE=make
--- 69,80 ----
  #OSLDFLAG= -lPW
  
  # how to install
! #INSTALL=install -c
! INSTALL=cp
  
  # ranlib if necessary
! #RANLIB=ranlib
! RANLIB=echo
  
  # which make?
  MAKE=make
***************
*** 93,100 ****
  CC = gcc
  
  # GNU loader
! LDXX = $(LIBDIR)/gcc-ld
  #LDXX = $(LIBDIR)/gcc-ld++
  
  # crt0+.o location (for dynamic loading tests)
  GXXCRT1=$(LIBDIR)/crt1+.o
--- 93,101 ----
  CC = gcc
  
  # GNU loader
! #LDXX = $(LIBDIR)/gcc-ld
  #LDXX = $(LIBDIR)/gcc-ld++
+ LDXX = ld
  
  # crt0+.o location (for dynamic loading tests)
  GXXCRT1=$(LIBDIR)/crt1+.o
***************
*** 112,122 ****
  #VERBOSITY_FLAGS= -Wall -v 
  VERBOSITY_FLAGS= -Wall
  
! GXX_INCLUDE_DIRS= -I$(SRCIDIR)
  
! GCC_INCLUDE_DIRS= -I$(prefix)/lib/gcc-include -I/usr/include -I$(SRCIDIR)
  
! PIPE_AS= -pipe
  
  # Flags for all C++ compiles
  GXXFLAGS = $(OSFLAG) $(GXX_INCLUDE_DIRS) $(DEBUG_FLAGS) $(GXX_OPTIMIZATION_FLAGS) $(VERBOSITY_FLAGS) $(PIPE_AS)
--- 113,123 ----
  #VERBOSITY_FLAGS= -Wall -v 
  VERBOSITY_FLAGS= -Wall
  
! GXX_INCLUDE_DIRS= -I$(SRCIDIR) -I/usr2/gnu/gcc/gcc-1.36
  
! GCC_INCLUDE_DIRS= -I$(prefix)/lib/gcc-include -I/usr/include -I$(SRCIDIR) -I/usr2/gnu/gcc/gcc-1.36
  
! PIPE_AS= 
  
  # Flags for all C++ compiles
  GXXFLAGS = $(OSFLAG) $(GXX_INCLUDE_DIRS) $(DEBUG_FLAGS) $(GXX_OPTIMIZATION_FLAGS) $(VERBOSITY_FLAGS) $(PIPE_AS)


*** ctype.h~	Wed Nov 22 20:04:31 1989
--- ctype.h	Wed Nov 22 11:19:04 1989
***************
*** 32,40 ****
  #define CTYPE_TYPE	char
  #endif
  
  #if defined(USG) || defined(hpux)
! #define _ctype_ ctype
  #endif
  
  extern	CTYPE_TYPE	_ctype_[];
     
--- 32,40 ----
  #define CTYPE_TYPE	char
  #endif
  
  #if defined(USG) || defined(hpux)
! #define _ctype_ _ctype
  #endif
  
  extern	CTYPE_TYPE	_ctype_[];
     
============== END CUT 2 ==================================

============ CUT 3 =========================================


*** Makefile	Fri Sep 22 17:47:25 1989
--- Makefile~	Tue Nov 14 20:57:52 1989
***************
*** 81,87 ****
  # a non-gcc compiler, and if your system doesn't have a working alloca() in any
  # of the standard libraries (as is true for HP/UX or Genix),
  # then get alloca.c from GNU Emacs and un-comment the following line:
! # ALLOCA = alloca.o
  # But don't do that if compiling using GCC.
  
  # If your system has alloca() in /lib/libPW.a, un-comment the following line:
--- 81,87 ----
  # a non-gcc compiler, and if your system doesn't have a working alloca() in any
  # of the standard libraries (as is true for HP/UX or Genix),
  # then get alloca.c from GNU Emacs and un-comment the following line:
! ALLOCA = alloca.o
  # But don't do that if compiling using GCC.
  
  # If your system has alloca() in /lib/libPW.a, un-comment the following line:
***************
*** 230,236 ****
  #	../hp-bin/hpxt gnulib-hp gnulib
  
  gnulib2: stamp-gnulib2;
! stamp-gnulib2: gnulib2.c gnulib cc1 gcc cpp $(CONFIG_H)
  	for name in $(LIB2FUNCS); \
  	do \
  	  echo $${name}; \
--- 230,236 ----
  #	../hp-bin/hpxt gnulib-hp gnulib
  
  gnulib2: stamp-gnulib2;
! stamp-gnulib2: gnulib2.c $(CONFIG_H)
  	for name in $(LIB2FUNCS); \
  	do \
  	  echo $${name}; \

================END CUT 3=============================