[comp.lang.c++] Also a G++ 1.32 problem

schwartz@dinl.uucp (Michael Schwartz) (03/07/89)

I have been using version 1.25.0 GNU C++ for our C++ seminar here.

I wished to change to 1.32, since a "working" set of patches were
available for InterViews.

I have been unable to get G++ to generate working code which requires
pre-main() instantiation on our Sun 3's under either SunOS 3.5 or 4.01.

While there are no warning messages, I have noted that Mcrt1.o gets
hauled in, which was never the case under our current version.

Code compiles but dumps core if it uses, say, stream.h.

Also, the libg++ for 1.32 crashes the compiler (unfortunately, the new
library can't be compiled with 1.25.0 successfully either.  We'd really
like to use the protected member implementation for subclassing).

If anyone knows the correction, or can name the next stable version of
GNU C++, please let me know (by Email if this is not of general
interest).

PS: I am very pleased with both G++ and GDB+ version 1.25.0 for most
training purposes.
-- 
Michael Schwartz
ncar!dinl!schwartz
MSchwartz@Dockmaster.ARPA

ckim@esunix.UUCP (Cheol Kim) (03/10/89)

schwartz@dinl.uucp (Michael Schwartz):
> I have been using version 1.25.0 GNU C++ for our C++ seminar here.
> 
> I wished to change to 1.32, since a "working" set of patches were
> available for InterViews.
> 
> I have been unable to get G++ to generate working code which requires
> pre-main() instantiation on our Sun 3's under either SunOS 3.5 or 4.01.
> 
> While there are no warning messages, I have noted that Mcrt1.o gets
> hauled in, which was never the case under our current version.
> 
> Code compiles but dumps core if it uses, say, stream.h.
> 
> Also, the libg++ for 1.32 crashes the compiler (unfortunately, the new
> library can't be compiled with 1.25.0 successfully either.  We'd really
> like to use the protected member implementation for subclassing).
> 
> If anyone knows the correction, or can name the next stable version of
> GNU C++, please let me know (by Email if this is not of general
> interest).
> 
> PS: I am very pleased with both G++ and GDB+ version 1.25.0 for most
> training purposes.
> -- 
> Michael Schwartz
> ncar!dinl!schwartz
> MSchwartz@Dockmaster.ARPA

I tried to get in touch with Mike and could not. Thus, I am posting
some C header files. I hope this is ok. I won't do it again. To Michael
Schwartz, please direct your G++ concerns to 'gnu.g++' and gnu.g++.bug'.

I made G++ and GCC working for Sun3/50 with f68881.  But I had to make 
changes to the original code.  First, you ought to have patched code
to be 1.32.  Second, replace following files with the ones you have.
Also, you ought to keep track of what goes on with GNU software by
reading 'gnu.g++' and 'gnu.g++.bug'.  I hope you can get a working 
compiler.

cheol	
801 582 5847 (ex 3956)

tm.h
---------- cut here -------------------------------------------

/* Definitions of target machine for GNU compiler.  Sun 68000/68020 version.
   Copyright (C) 1987, 1988 Free Software Foundation, Inc.

This file is part of GNU CC.

GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY.  No author or distributor
accepts responsibility to anyone for the consequences of using it
or for whether it serves any particular purpose or works at all,
unless he says so in writing.  Refer to the GNU CC General Public
License for full details.

Everyone is granted permission to copy, modify and redistribute
GNU CC, but only under the conditions described in the
GNU CC General Public License.   A copy of this license is
supposed to have been given to you along with GNU CC so you
can know your rights and responsibilities.  It should be in a
file named COPYING.  Among other things, the copyright notice
and this notice must be preserved on all copies.  */


#include "tm-m68k.h"

/* See tm-m68k.h.  7 means 68020 with 68881.  */

#define TARGET_DEFAULT 7

/* Define __HAVE_FPA__ or __HAVE_68881__ in preprocessor,
   according to the -m flags.
   This will control the use of inline 68881 insns in certain macros.
   Also inform the program which CPU this is for.  */

#if TARGET_DEFAULT & 02

/* -m68881 is the default */
#define CPP_SPEC \
"%{!msoft-float:%{mfpa:-D__HAVE_FPA__ }%{!mfpa:-D__HAVE_68881__ }}\
%{!ansi:%{m68000:-Dmc68010}%{mc68000:-Dmc68010}%{!mc68000:%{!m68000:-Dmc68020}}}"

#else
#if TARGET_DEFAULT & 0100

/* -mfpa is the default */
#define CPP_SPEC \
"%{!msoft-float:%{m68881:-D__HAVE_68881__ }%{!m68881:-D__HAVE_FPA__ }}\
%{!ansi:%{m68000:-Dmc68010}%{mc68000:-Dmc68010}%{!mc68000:%{!m68000:-Dmc68020}}}"

#else

/* -msoft-float is the default */
#define CPP_SPEC \
"%{m68881:-D__HAVE_68881__ }%{mfpa:-D__HAVE_FPA__ }\
%{!ansi:%{m68000:-Dmc68010}%{mc68000:-Dmc68010}%{!mc68000:%{!m68000:-Dmc68020}}}"

#endif
#endif


/* -m68000 requires special flags to the assembler.  */

#define ASM_SPEC \
 "%{m68000:-mc68010}%{mc68000:-mc68010}%{!mc68000:%{!m68000:-mc68020}}"

/* Names to predefine in the preprocessor for this target machine.  */

#define CPP_PREDEFINES "-Dmc68000 -Dsun -Dunix"

/* STARTFILE_SPEC to include sun floating point initialization
   This is necessary (tr: Sun does it) for both the m68881 and the fpa
   routines.
   Note that includes knowledge of the default specs for gcc, ie. no
   args translates to the same effect as -m68881
   I'm not sure what would happen below if people gave contradictory
   arguments (eg. -msoft-float -mfpa) */

#if TARGET_DEFAULT & 0100
/* -mfpa is the default */
#define STARTFILE_SPEC					\
  "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0+.o%s}}	\
   %{m68881:Mcrt1.o%s}					\
   %{msoft-float:Fcrt1.o%s}				\
   %{!m68881:%{!msoft-float:Wcrt1.o%s}}"
#else
#if TARGET_DEFAULT & 2
/* -m68881 is the default */
#define STARTFILE_SPEC					\
  "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0+.o%s}}	\
   %{mfpa:Wcrt1.o%s}					\
   %{msoft-float:Fcrt1.o%s}				\
   %{!mfpa:%{!msoft-float:Mcrt1.o%s}}"
#else
/* -msoft-float is the default */
#define STARTFILE_SPEC					\
  "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0+.o%s}}	\
   %{m68881:Mcrt1.o%s}					\
   %{mfpa:Wcrt1.o%s}					\
   %{!m68881:%{!mfpa:Fcrt1.o%s}}"
#endif
#endif

/* Every structure or union's size must be a multiple of 2 bytes.  */

#define STRUCTURE_SIZE_BOUNDARY 16

/* This is BSD, so it wants DBX format.  */

#define DBX_DEBUGGING_INFO

/* This is how to output an assembler line defining a `double' constant.  */

#undef ASM_OUTPUT_DOUBLE
#define ASM_OUTPUT_DOUBLE(FILE,VALUE)					\
  (isinf ((VALUE))							\
   ? fprintf (FILE, "\t.double 0r%s99e999\n", ((VALUE) > 0 ? "" : "-")) \
   : fprintf (FILE, "\t.double 0r%.20e\n", (VALUE)))

/* This is how to output an assembler line defining a `float' constant.  */

#undef ASM_OUTPUT_FLOAT
#define ASM_OUTPUT_FLOAT(FILE,VALUE)					\
  (isinf ((VALUE))							\
   ? fprintf (FILE, "\t.single 0r%s99e999\n", ((VALUE) > 0 ? "" : "-")) \
   : fprintf (FILE, "\t.single 0r%.20e\n", (VALUE)))

#undef ASM_OUTPUT_FLOAT_OPERAND
#define ASM_OUTPUT_FLOAT_OPERAND(FILE,VALUE)				\
  (isinf ((VALUE))							\
   ? fprintf (FILE, "#0r%s99e999", ((VALUE) > 0 ? "" : "-")) \
   : fprintf (FILE, "#0r%.9g", (VALUE)))

#undef ASM_OUTPUT_DOUBLE_OPERAND
#define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE)				\
  (isinf ((VALUE))							\
   ? fprintf (FILE, "#0r%s99e999", ((VALUE) > 0 ? "" : "-")) \
   : fprintf (FILE, "#0r%.20g", (VALUE)))
--------------------- end of tm.h -----------------------------

xm-sunos4.h
------------------- cut here ---------------------------------

/* Config file for running GCC on Sunos version 4.
   This file is good for either a Sun 3 or a Sun 4 machine.  */

#ifdef sparc 
#include "xm-sparc.h" 
#else 
#include "xm-m68k.h"
#endif

/* Provide required defaults for linker -e and -d switches.
   Also, it is hard to debug with shared libraries,
   so don't use them if going to debug.  
 */

#define LINK_SPEC "%{!e*:-e __start} -dc -dp %{static:-Bstatic}"
 
------------------------ end of xm-sunos4.h ------------------------