hlu@yoda.eecs.wsu.edu (Hongjiu Lu) (06/14/91)
Here is the first part of the patch to g++ 1.39.1 and libg++ 1.39.0 for AT386 clone running AT&T UNIX SVR3.2.2 with the native assembler and linker. It may work for SVR3 from ESIX, SCO and ISC. You have to try it yourself. The main benefit of this is you can use all system libraries without even worrying about the format, including the shared libraries. The first part is for gcc 1.39. You have to apply it to gcc 1.39 source code first. BTW, you have to get gcc 1.39 source code to compile g++ 1.39.1. After restoring the g++ 1.39.1 source code, in the directory of g++ 1.39.1, type mkdir config Then apply the second part of the patch to g++ source code. The third and last patch is for libg++ 1.39.1. There is one file in g++ 1.39.1 with name of more than 14 characters and lots of them in libg++ 1.39.0. I fixed the one in g++, but it is very hard to fix libg++. Those patches are only used for those directories which have no file with long name. After all the patches being applied, you can follow the instructions to build your own g++ and libg++. Your targets of g++ should be g++, cc1plus and collect, which is the default after the patches are applied. To make g++ work on an at386 you have to define COFF, USE_COLLECT and BROKEN_RELOCATION_LD in "Makefile". Also you have to define either UNUSUAL_COFF_DEFINITION or BROKEN_GCC_OK_SYMBOL. I suggest you try UNUSUAL_COFF_DEFINITION first and use BROKEN_GCC_OK_SYMBOL as the last resort. I made some changes to gcc.c. (1) I added one macro, LOCAL_LIBRARY_DIRECTORY, which is used to define the default local library directory. Ld now will check it in addition to /lib and /usr/lib. This macro HAS to be defined in "Makefile" through the variable "locallibdir". The one I use is /usr/local/lib. You can use whatever you want. I put libg++.a in it so that I can use g++ -o xxx xxx.o -lg++ -lc_s without -L/usr/local/lib (2) I took -lg++ out of gcc.c. The main reason to do that is when you use -lm or -lc_s with g++ you have to also add -lg++, like g++ -o xxx xxx.o -lg++ -lm g++ -o xxx xxx.o -lg++ -lc_s g++ -o xxx xxx.o -lg++ -lm -lc_s Without -lg++, like g++ -o xxx xxx.o -lm g++ -o xxx xxx.o -lc_s g++ -o xxx xxx.o -lm -lc_s g++ won't work. It is very likely you want to use the shared library and need to use math library. So now you have to add -lg++ to the g++ command line, which you didn't have to do before in some cases. (3) During the final stage of linking, now g++ will try to link everything from scratch plus the data for global constructor and destructors. Some changes are also made to libg++ 1.39.0. (1) Since there is no flock() in AT&T SVR3.2.2, I added one macro, DO_NOT_HAVE_FLOCK, to the variable OSFLAG in "Makefile". Check your reference manual to see if you have flock(). If you do, undefine it. (2) One USG related bug is fixed. There are no random() and srandom() in USG, but rand() and srand() instead. (3) Bcopy.c in ./src/ didn't compile and I don't like the code. I substitute it with my own code. If you don't like it, define USE_GXX_BCOPY in OSFLAG and try to fix the code yourself. (4) I removed the definition of COFF in ./src/gnulib3.c and added one condition in ./src/xyzzy.cc, which is not needed for COFF. So now in "Makefile" you have to define COFF as XTRAFLAGS. H.J. Lu ---------------------- CUT HERE---------------------------------- diff -rc g++-1.39.1.old/config/tm-att386.h g++-1.39.1/config/tm-att386.h *** g++-1.39.1.old/config/tm-att386.h Wed Jun 12 16:06:56 1991 --- gcc-1.39/config/tm-att386.h Wed Jun 5 18:09:50 1991 *************** *** 22,27 **** --- 22,30 ---- /* Define the syntax of instructions and addresses. */ + /* G++: ATT assemblers *do not* allow '$' in symbol names. (u3b, i386, etc.) */ + #define NO_DOLLAR_IN_LABEL + /* Define some concatenation macros to concatenate an opcode and one, two or three operands. In other assembler syntaxes they may alter the order of ther operands. */