*BSD News Article 7375


Return to BSD News archive

Path: sserve!manuel.anu.edu.au!munnari.oz.au!uunet!think.com!linus!agate!usenet.ins.cwru.edu!ljo
From: ljo@r2d2.eeap.cwru.edu (L. Jonas Olsson)
Newsgroups: comp.unix.bsd
Subject: [386BSD] gcc-2.3.1 patches
Date: 3 Nov 1992 20:01:08 GMT
Organization: Case Western Reserve Univ. Cleveland, Ohio (USA)
Lines: 311
Message-ID: <1d6lq4INNncj@usenet.INS.CWRU.Edu>
NNTP-Posting-Host: johnny5.eeap.cwru.edu

Here are some patches that will make gcc-2.3.1 possible to compile.
The patches are also put at agate.berkeley.edu:pub/incoming
in the file gcc-2.3.1-for386BSD. (I also put my other patches
libg++-2.2.diffs and make-3.62.diffs there.)
There are still problems with enquire and the file float.h that it
produces. Perhaps someone else can fix that? The problem might be
in the printf and sscanfs that come with 386BSD.
I have reported the problems to FSF so perhaps gcc-2.3.2 will have
these patches.

	Jonas Olsson
	ljo@po.cwru.edu

Note: compilation will fail for enquire.c because of floating constant out
of range, use cc to compile that file. In the later stages it will compile,
but generate bad results for four constants.


*** gcc-2.3.1.orig/gstddef.h	Thu Oct 29 13:14:26 1992
--- gcc-2.3.1/gstddef.h	Wed Nov  4 06:55:33 1992
***************
*** 19,26 ****
  
  /* On 4.3bsd-net2, make sure ansi.h is included, so we have
     one less case to deal with in the following.  */
! #if defined (__BSD_NET2__) || defined (____386BSD____)
! #include <ansi.h>
  #endif
  
  /* In 4.3bsd-net2, machine/ansi.h defines these symbols, which are
--- 19,26 ----
  
  /* On 4.3bsd-net2, make sure ansi.h is included, so we have
     one less case to deal with in the following.  */
! #if defined (__BSD_NET2__) || defined (__386BSD__)
! #include <machine/ansi.h>
  #endif
  
  /* In 4.3bsd-net2, machine/ansi.h defines these symbols, which are
***************
*** 27,32 ****
--- 27,35 ----
      defined if the corresponding type is *not* defined.  */
  #ifdef _ANSI_H_
  #ifndef _SIZE_T_
+ #define _SIZE_T
+ #else
+ typedef _SIZE_T_ size_t;
  #define _SIZE_T
  #endif
  #ifndef _PTRDIFF_T_
*** gcc-2.3.1.orig/gstdarg.h	Fri Oct 30 01:42:45 1992
--- gcc-2.3.1/gstdarg.h	Wed Nov  4 10:41:59 1992
***************
*** 107,125 ****
  
  /* On 4.3bsd-net2, make sure ansi.h is included, so we have
     one less case to deal with in the following.  */
! #if defined (__BSD_NET2__) || defined (____386BSD____)
! #include <ansi.h>
  #endif
  
! /* In 4.3bsd-net2, machine/ansi.h defines these symbols, which remain
!    defined as long as the corresponding type is *not* defined.  */
! #ifdef _ANSI_H_
! #ifndef _VA_LIST_
! #define _VA_LIST
! #endif
! #undef _VA_LIST_
! #endif /* _ANSI_H_ */
! 
  /* The macro _VA_LIST_ is the same thing used by this file in Ultrix.  */
  #ifndef _VA_LIST_
  /* The macro _VA_LIST is used in SCO Unix 3.2.  */
--- 107,117 ----
  
  /* On 4.3bsd-net2, make sure ansi.h is included, so we have
     one less case to deal with in the following.  */
! #if defined (__BSD_NET2__) || defined (____386BSD____) || defined (__386BSD__)
! #include <machine/ansi.h>
  #endif
  
! #ifndef __386BSD__
  /* The macro _VA_LIST_ is the same thing used by this file in Ultrix.  */
  #ifndef _VA_LIST_
  /* The macro _VA_LIST is used in SCO Unix 3.2.  */
***************
*** 129,139 ****
  typedef __gnuc_va_list va_list;
  #endif /* not _VA_LIST */
  #endif /* not _VA_LIST_ */
! 
! /* On 4.3bsd-net2, leave _VA_LIST_ undef to indicate va_list is defined.  */
! #ifdef _ANSI_H_
! #undef _VA_LIST_
! #endif
  
  #endif /* not __SVR4_2__ */
  
--- 121,132 ----
  typedef __gnuc_va_list va_list;
  #endif /* not _VA_LIST */
  #endif /* not _VA_LIST_ */
! #else
! #ifndef _VA_LIST
! #define _VA_LIST
! typedef __gnuc_va_list va_list;
! #endif /* not _VA_LIST */
! #endif /*__386BSD__*/
  
  #endif /* not __SVR4_2__ */
  
*** gcc-2.3.1.orig/gvarargs.h	Fri Oct 30 01:33:33 1992
--- gcc-2.3.1/gvarargs.h	Wed Nov  4 10:37:31 1992
***************
*** 121,139 ****
  
  /* On 4.3bsd-net2, make sure ansi.h is included, so we have
     one less case to deal with in the following.  */
! #if defined (__BSD_NET2__) || defined (____386BSD____)
! #include <ansi.h>
  #endif
  
! /* In 4.3bsd-net2, machine/ansi.h defines these symbols, which remain
!    defined as long as the corresponding type is *not* defined.  */
! #ifdef _ANSI_H_
! #ifndef _VA_LIST_
! #define _VA_LIST
! #endif
! #undef _VA_LIST_
! #endif /* _ANSI_H_ */
! 
  /* The macro _VA_LIST_ is the same thing used by this file in Ultrix.  */
  #ifndef _VA_LIST_
  /* The macro _VA_LIST is used in SCO Unix 3.2.  */
--- 121,131 ----
  
  /* On 4.3bsd-net2, make sure ansi.h is included, so we have
     one less case to deal with in the following.  */
! #if defined (__BSD_NET2__) || defined (__386BSD__)
! #include <machine/ansi.h>
  #endif
  
! #ifndef __386BSD__
  /* The macro _VA_LIST_ is the same thing used by this file in Ultrix.  */
  #ifndef _VA_LIST_
  /* The macro _VA_LIST is used in SCO Unix 3.2.  */
***************
*** 143,155 ****
  typedef __gnuc_va_list va_list;
  #endif /* not _VA_LIST */
  #endif /* not _VA_LIST_ */
! 
! #endif /* not __SVR4_2__ */
! 
! /* On 4.3bsd-net2, leave _VA_LIST_ undef to indicate va_list is defined.  */
! #ifdef _ANSI_H_
! #undef _VA_LIST_
  #endif
  
  /* The next BSD release (if there is one) wants this symbol to be
     undefined instead of _VA_LIST_.  */
--- 135,147 ----
  typedef __gnuc_va_list va_list;
  #endif /* not _VA_LIST */
  #endif /* not _VA_LIST_ */
! #else
! #ifndef _VA_LIST
! #define _VA_LIST
! typedef __gnuc_va_list va_list;
! #endif /* not _VA_LIST */
  #endif
+ #endif /* not __SVR4_2__ */
  
  /* The next BSD release (if there is one) wants this symbol to be
     undefined instead of _VA_LIST_.  */
*** gcc-2.3.1.orig/config/i386bsd.h	Wed Oct 28 15:01:46 1992
--- gcc-2.3.1/config/i386bsd.h	Mon Nov  2 05:12:08 1992
***************
*** 1,8 ****
! /* Configuration for an i386 running 386BSD as the target machine.  */
! #include "i386mach.h"
  
  #undef CPP_PREDEFINES
! #define CPP_PREDEFINES "-Dunix -Di386 -D____386BSD____"
  
! /* Specify extra dir to search for include files.  */
! #undef SYSTEM_INCLUDE_DIR
--- 1,117 ----
! /* Configuration for an i386 running 386BSD as the target machine.
!  * Copyright (C) 1992 Free Software Foundation, Inc.
!  *
!  */
  
+ /* This is tested by i386gas.h.  */
+ #define YES_UNDERSCORES
+ 
+ #include "i386gas.h"
+ 
  #undef CPP_PREDEFINES
! #define CPP_PREDEFINES "-Dunix -Di386 -D__386BSD__"
! 
! #undef SIZE_TYPE
! #define SIZE_TYPE "unsigned int"
! 
! #undef PTRDIFF_TYPE
! #define PTRDIFF_TYPE "int"
! 
! #undef WCHAR_TYPE
! #define WCHAR_TYPE "short unsigned int"
! 
! #define WCHAR_UNSIGNED 1
! 
! #undef WCHAR_TYPE_SIZE
! #define WCHAR_TYPE_SIZE 16
! 
! #undef HAVE_ATEXIT
! #define HAVE_ATEXIT
! 
! #undef LIB_SPEC
! #define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
! 
! #undef COMMENT_BEGIN
! #define COMMENT_BEGIN "#"
! 
! #undef ASM_APP_ON
! #define ASM_APP_ON "#APP\n"
! 
! #undef ASM_APP_OFF
! #define ASM_APP_OFF "#NO_APP\n"
! 
! /* Defines to be able to build libgcc.a with GCC.  */
! 
! /* It might seem that these are not important, since gcc 2 will never
!    call libgcc for these functions.  But programs might be linked with
!    code compiled by gcc 1, and then these will be used.  */
! 
! #define perform_udivsi3(a,b)						\
! {									\
!   register int dx asm("dx");						\
!   register int ax asm("ax");						\
! 									\
!   dx = 0;								\
!   ax = a;								\
!   asm ("divl %3" : "=a" (ax), "=d" (dx) : "a" (ax), "g" (b), "d" (dx));	\
!   return ax;								\
! }
! 
! #define perform_divsi3(a,b)						\
! {									\
!   register int dx asm("dx");						\
!   register int ax asm("ax");						\
! 									\
!   ax = a;								\
!   asm ("cltd\n\tidivl %3" : "=a" (ax), "=d" (dx) : "a" (ax), "g" (b));	\
!   return ax;								\
! }
! 
! #define perform_umodsi3(a,b)						\
! {									\
!   register int dx asm("dx");						\
!   register int ax asm("ax");						\
! 									\
!   dx = 0;								\
!   ax = a;								\
!   asm ("divl %3" : "=a" (ax), "=d" (dx) : "a" (ax), "g" (b), "d" (dx));	\
!   return dx;								\
! }
! 
! #define perform_modsi3(a,b)						\
! {									\
!   register int dx asm("dx");						\
!   register int ax asm("ax");						\
! 									\
!   ax = a;								\
!   asm ("cltd\n\tidivl %3" : "=a" (ax), "=d" (dx) : "a" (ax), "g" (b));	\
!   return dx;								\
! }
! 
! 
! #define perform_fixdfsi(a)						\
! {									\
!   auto unsigned short ostatus;						\
!   auto unsigned short nstatus;						\
!   auto int ret;								\
!   auto double tmp;							\
! 									\
!   &ostatus;			/* guarantee these land in memory */	\
!   &nstatus;								\
!   &ret;									\
!   &tmp;									\
! 									\
!   asm volatile ("fnstcw %0" : "=m" (ostatus));				\
!   nstatus = ostatus | 0x0c00;						\
!   asm volatile ("fldcw %0" : /* no outputs */ : "m" (nstatus));		\
!   tmp = a;								\
!   asm volatile ("fldl %0" : /* no outputs */ : "m" (tmp));		\
!   asm volatile ("fistpl %0" : "=m" (ret));				\
!   asm volatile ("fldcw %0" : /* no outputs */ : "m" (ostatus));		\
! 									\
!   return ret;								\
! }
  
! #undef FUNCTION_PROFILER
! #define FUNCTION_PROFILER(FILE, LABELNO)  \
!    fprintf (FILE, "\tmovl $LP%d,%%eax\n\tcall mcount\n", (LABELNO));




-------end of patches-----