steve@hite386.UUCP (Steve Hite) (11/16/89)
The latest release of the GNU C++ Compiler (v1.36.1) successfully compiles and runs with Interactive SysV 3.2 v2.0.2. I applied some patches supplied by James R. Van Artsdalen (james@bigtex.cactus.org) which cleared up some warnings in the lexer and a few other minor things, but it's MUCH better than the hoops 1.35.1 required. I used GCC v1.36 to compile G++ and used collect instead of COFF_ENCAPSULATION. Also, libg++ v1.36.1 compiles just fine. There are some problems (numbers aren't matching up) though with Sample.cc not producing the same results when it was diff'ed with what Doug Lea distributed as the expected output for the tests. Gperf compiled and ran okay. Here is a copy of James's diff file that was posted to gnu.g++ so I don't get inundated with e-mail requests...enjoy! My next big adventure is to use G++ to make Xlib and X toolkit programming more manageable. Have fun and thanks Michael T., Doug L. and others for making a free C++ compiler reality! ------------------------------> cut here <----------------------------------- These are the changes I am using to build g++ 1.36.1 on SysVr3.2 i386v, using COFF & collect. I used "config.g++ i386v". make-links.g++ is changed so that it works, various changes were made to elimiate warning messages, cplus-decl2.c was changed to get rid of a spurious leading underscore, and gcc.c was changed to add the -c option to ld(1), which is necessary to avoid a core dump from ld(1) on my system. I was also real nervous about binding in both /lib/crt1.o and /lib/crtn.o before the link run that actually generated an executable, so I moved the startfile & libfile specs around. It was also easier to have gcc.c simply find libg++.a and pass ld(1) a full path than use the -L flag to send ld(1) looking for -lg++. Lastly, I am including the diffs to my makefile in case anyone wants to try these patches as-is. RCS file: RCS/collect.c,v retrieving revision 1.1 diff -c -r1.1 collect.c *** /tmp/,RCSt1a12258 Thu Nov 9 19:17:40 1989 --- collect.c Wed Nov 8 20:40:16 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) \ *************** *** 581,587 **** --- 583,593 ---- 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); } } =================================================================== 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}'." RCS file: RCS/Makefile,v retrieving revision 1.1 diff -c -r1.1 Makefile *** /tmp/,RCSt1a12282 Thu Nov 9 19:21:26 1989 --- Makefile Thu Nov 9 00:44:36 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 = -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,63 ---- AR = ar SHELL = /bin/sh # on sysV, define this as cp. ! # INSTALL = install -c ! INSTALL = cp # on sysV, define this as ln. ! # LINK = ln -s ! LINK = ln # Compiler to use for compiling gnulib. # OLDCC should not be the GNU C compiler. *************** *** 64,70 **** # CFLAGS for use with OLDCC, for compiling gnulib. # NOTE: -O does not work on some Unix systems! # If you use it here, you are asking for trouble. ! CCLIBFLAGS= # USG_STDIO if for machines which use System V stdio. # In general, if USG is #defined by your system, you should --- 66,73 ---- # CFLAGS for use with OLDCC, for compiling gnulib. # NOTE: -O does not work on some Unix systems! # If you use it here, you are asking for trouble. ! # CCLIBFLAGS= ! CCLIBFLAGS=-O # USG_STDIO if for machines which use System V stdio. # In general, if USG is #defined by your system, you should *************** *** 71,79 **** # 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 # Directory where sources are, from where we are. srcdir = . --- 74,82 ---- # 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 = /nfs/raid # Directory where sources are, from where we are. srcdir = . *************** *** 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. --- 99,107 ---- OBSTACK=obstack.o # Directory to link to, when using the target `maketest'. ! DIR = ../gcc-1.36 # this is the GNU CC build directory ! TDIR = ../gcc-1.36/i386 # End of variables for you to override. *************** *** 129,135 **** # If your system's malloc() routine fails for any reason (as it does on # certain versions of Genix), try getting the files # malloc.c and getpagesize.h from GNU Emacs and un-comment the following line: ! MALLOC = malloc.o # If you are running GCC on an Apollo (SR10.x), # go into a Berkeley environment and use this: --- 132,138 ---- # If your system's malloc() routine fails for any reason (as it does on # certain versions of Genix), try getting the files # malloc.c and getpagesize.h from GNU Emacs and un-comment the following line: ! # MALLOC = malloc.o # If you are running GCC on an Apollo (SR10.x), # go into a Berkeley environment and use this: *************** *** 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 --- 207,215 ---- # 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 -- James R. Van Artsdalen james@bigtex.cactus.org "Live Free or Die" DCC Corporation 9505 Arboretum Blvd Austin TX 78759 512-338-8789 -----------------------------> cut here <------------------------------------ ====================================== Steve Hite ...!gatech!uflorida!unf7!hite386!steve