Return to BSD News archive
Path: sserve!manuel.anu.edu.au!munnari.oz.au!uunet!cs.utexas.edu!sun-barr!ames!agate!usenet.ins.cwru.edu!ljo
From: ljo@r2d2.eeap.cwru.edu (L. Jonas Olsson)
Newsgroups: comp.unix.bsd
Subject: [386BSD] gcc-2.2.2 patches
Date: 25 Oct 1992 22:29:25 GMT
Organization: Case Western Reserve Univ. Cleveland, Ohio (USA)
Lines: 442
Message-ID: <1cf746INN83e@usenet.INS.CWRU.Edu>
NNTP-Posting-Host: johnny5.eeap.cwru.edu
Summary: gcc-2.2.2 patches for 386BSD
I'm here posting some patches for gcc-2.2.2 that I have used to
successfully compile libg++ and my own programs. The patches are
derived from patches to bsdi by Jon Block that are available at
bsdi.com.
Hopefully other people that have ported gcc-2.2.2 will correct
the errors I've made/overlooked.
These patches would not have been done without the ref machine
that Julian Elischer has so kindly provided.
Jonas Olsson
ljo@po.cwru.edu
Procedure:
==========
get gcc-2.2.2 from a favorite site (Hurry it will be obsolete soon!)
zcat gcc-2.2.2.tar.Z|tar xvf -
patch -p0 < gcc-2.2.2.diffs
cd gcc-2.2.2
sh configure --target=i386--bsd --with-gnu-as --with-gnu-ld
make LANGUAGES=c
make CC="stage1/gcc -Bstage1/" CFLAGS="-g -O"
make stage2
make CC="stage2/gcc -Bstage2/" CFLAGS="-g -O"
make compare
make CC="stage2/gcc -Bstage2/" CFLAGS="-g -O" install
o to be able to compile libg++-2.2 you also need to edit
the float.h file in /usr/local/lib/gcc-lib/i386--bsd/2.2.2/include.
These are the values I use:
#define DBL_MIN 2.2250738585072014e-308
#define DBL_MAX 1.7976931348623157e+308
Diff files:
==========
<start of gcc-2.2.2.diffs>
diff -rc gcc-2.2.2.orig/config/i386.h gcc-2.2.2/config/i386.h
*** gcc-2.2.2.orig/config/i386.h Sun May 3 19:40:28 1992
--- gcc-2.2.2/config/i386.h Sat Oct 24 10:46:59 1992
***************
*** 649,660 ****
{ \
fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n", \
LPREFIX, (LABELNO)); \
! fprintf (FILE, "\tcall *_mcount@GOT(%%ebx)\n"); \
} \
else \
{ \
fprintf (FILE, "\tmovl $%sP%d,%%edx\n", LPREFIX, (LABELNO)); \
! fprintf (FILE, "\tcall _mcount\n"); \
} \
}
--- 649,660 ----
{ \
fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n", \
LPREFIX, (LABELNO)); \
! fprintf (FILE, "\tcall *mcount@GOT(%%ebx)\n"); \
} \
else \
{ \
fprintf (FILE, "\tmovl $%sP%d,%%edx\n", LPREFIX, (LABELNO)); \
! fprintf (FILE, "\tcall mcount\n"); \
} \
}
diff -rc gcc-2.2.2.orig/config/i386.md gcc-2.2.2/config/i386.md
*** gcc-2.2.2.orig/config/i386.md Wed May 27 10:53:14 1992
--- gcc-2.2.2/config/i386.md Fri Oct 23 18:56:11 1992
***************
*** 3879,3885 ****
label = gen_label_rtx ();
output_asm_insn (AS2 (xor%B0,%0,%0), operands);
! output_asm_insn (\"repz\;cmps%B2\", operands);
output_asm_insn (\"je %l0\", &label);
xops[0] = operands[0];
--- 3879,3885 ----
label = gen_label_rtx ();
output_asm_insn (AS2 (xor%B0,%0,%0), operands);
! output_asm_insn (\"repe\;cmps%B2\", operands);
output_asm_insn (\"je %l0\", &label);
xops[0] = operands[0];
***************
*** 3912,3918 ****
xops[1] = CONST0_RTX (QImode);
output_asm_insn (AS2 (test%B0,%1,%0), xops);
! return \"repz\;cmps%B2\";
}")
(define_expand "ffssi2"
--- 3912,3918 ----
xops[1] = CONST0_RTX (QImode);
output_asm_insn (AS2 (test%B0,%1,%0), xops);
! return \"repe\;cmps%B2\";
}")
(define_expand "ffssi2"
***************
*** 4073,4079 ****
xops[0] = operands[0];
xops[1] = constm1_rtx;
output_asm_insn (AS2 (mov%L0,%1,%0), xops);
! return \"repnz\;scas%B2\";
}")
;;- Local variables:
--- 4073,4079 ----
xops[0] = operands[0];
xops[1] = constm1_rtx;
output_asm_insn (AS2 (mov%L0,%1,%0), xops);
! return \"repne\;scas%B2\";
}")
;;- Local variables:
diff -rc gcc-2.2.2.orig/config/i386bsd.h gcc-2.2.2/config/i386bsd.h
*** gcc-2.2.2.orig/config/i386bsd.h Sat Mar 21 12:49:31 1992
--- gcc-2.2.2/config/i386bsd.h Sat Oct 24 11:08:31 1992
***************
*** 1,8 ****
! /* Configuration for an i386 running 386BSD as the target machine. */
! #include "i386mach.h"
#undef CPP_PREDEFINES
! #define CPP_PREDEFINES "-Dunix -Di386"
! /* Specify extra dir to search for include files. */
! #undef SYSTEM_INCLUDE_DIR
--- 1,98 ----
! /* Configuration for an i386 running BSD/386 as the target machine. */
+ #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
! #undef WCHAR_TYPE_SIZE
! #define WCHAR_UNSIGNED 1
! #define WCHAR_TYPE "short unsigned int"
! #define WCHAR_TYPE_SIZE 16
!
! #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; \
! \
! &ostatus; /* guarantee these land in memory */ \
! &nstatus; \
! &ret; \
! \
! asm volatile ("fnstcw %0" : "=m" (ostatus)); \
! nstatus = ostatus | 0x0c00; \
! asm volatile ("fldcw %0" : /* no outputs */ : "m" (nstatus)); \
! asm volatile ("fldl %0" : /* no outputs */ : "m" (a)); \
! asm volatile ("fistpl %0" : "=m" (ret)); \
! asm volatile ("fldcw %0" : /* no outputs */ : "m" (ostatus)); \
! \
! return ret; \
! }
diff -rc gcc-2.2.2.orig/configure gcc-2.2.2/configure
*** gcc-2.2.2.orig/configure Thu Jun 11 12:46:42 1992
--- gcc-2.2.2/configure Fri Oct 23 18:55:39 1992
***************
*** 240,245 ****
--- 240,250 ----
tm_file=seq386.h
fi
;;
+ i386-*-bsdi)
+ xm_file=xm-i386.h
+ tm_file=i386bsdi.h
+ tmake_file=t-libc-ok
+ ;;
i386-*-bsd*)
xm_file=xm-i386.h
tm_file=i386bsd.h
diff -rc gcc-2.2.2.orig/dbxout.c gcc-2.2.2/dbxout.c
*** gcc-2.2.2.orig/dbxout.c Wed Jun 10 13:05:23 1992
--- gcc-2.2.2/dbxout.c Fri Oct 23 18:56:13 1992
***************
*** 676,681 ****
--- 676,682 ----
tree type_encoding;
register tree fndecl;
register tree last;
+ char formatted_type_identifier_length[16];
register int type_identifier_length;
if (methods == NULL_TREE)
***************
*** 704,709 ****
--- 705,712 ----
type_identifier_length = IDENTIFIER_LENGTH (type_encoding);
+ sprintf(formatted_type_identifier_length, "%d", type_identifier_length);
+
if (TREE_CODE (methods) == FUNCTION_DECL)
fndecl = methods;
else if (TREE_VEC_ELT (methods, 0) != NULL_TREE)
***************
*** 747,755 ****
--- 750,762 ----
if (debug_name[0] == '_' && debug_name[1] == '_')
{
char *method_name = debug_name + 2;
+ char *length_ptr = formatted_type_identifier_length;
/* Get past const and volatile qualifiers. */
while (*method_name == 'C' || *method_name == 'V')
method_name++;
+ /* Skip digits for length of type_encoding. */
+ while (*method_name == *length_ptr && *length_ptr)
+ length_ptr++, method_name++;
if (! strncmp (method_name,
IDENTIFIER_POINTER (type_encoding),
type_identifier_length))
***************
*** 761,768 ****
--- 768,779 ----
else if (debug_name[0] == '_' && debug_name[1] == '_')
{
char *ctor_name = debug_name + 2;
+ char *length_ptr = formatted_type_identifier_length;
while (*ctor_name == 'C' || *ctor_name == 'V')
ctor_name++;
+ /* Skip digits for length of type_encoding. */
+ while (*ctor_name == *length_ptr && *length_ptr)
+ length_ptr++, ctor_name++;
if (!strncmp (IDENTIFIER_POINTER (type_encoding), ctor_name,
type_identifier_length))
debug_name = ctor_name + type_identifier_length;
diff -rc gcc-2.2.2.orig/gstdarg.h gcc-2.2.2/gstdarg.h
*** gcc-2.2.2.orig/gstdarg.h Sat Jun 6 11:46:14 1992
--- gcc-2.2.2/gstdarg.h Sat Oct 24 11:10:27 1992
***************
*** 6,11 ****
--- 6,15 ----
#ifndef _STDARG_H
#define _STDARG_H
+ #if defined (bsdi) || defined (BSDI) || defined (__386BSD__)
+ #include <machine/ansi.h>
+ #endif
+
#ifndef __GNUC__
/* Use the system's macros with the system's compiler. */
#include <stdarg.h>
***************
*** 34,43 ****
#endif
/* 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. */
#ifndef _VA_LIST
#define _VA_LIST_
#define _VA_LIST
#ifndef __svr4__
typedef char *va_list;
--- 38,49 ----
#endif
/* The macro _VA_LIST_ is the same thing used by this file in Ultrix. */
! #if !defined (_VA_LIST_) || defined (_ANSI_H) || defined (_ANSI_H_)
/* The macro _VA_LIST is used in SCO Unix 3.2. */
#ifndef _VA_LIST
+ #ifndef _VA_LIST_
#define _VA_LIST_
+ #endif
#define _VA_LIST
#ifndef __svr4__
typedef char *va_list;
diff -rc gcc-2.2.2.orig/gstddef.h gcc-2.2.2/gstddef.h
*** gcc-2.2.2.orig/gstddef.h Thu Jun 11 12:08:00 1992
--- gcc-2.2.2/gstddef.h Sat Oct 24 11:10:30 1992
***************
*** 1,6 ****
--- 1,10 ----
#ifndef _STDDEF_H
#ifndef _STDDEF_H_
+ #if defined (bsdi) || defined (BSDI) || defined (__386BSD__)
+ #include <machine/ansi.h>
+ #endif
+
/* Any one of these symbols __need_* means that GNU libc
wants us just to define one data type. So don't define
the symbols that indicate this file's entire job has been done. */
***************
*** 129,134 ****
--- 133,158 ----
#undef __need_wchar_t
#endif /* __sys_stdtypes_h */
+
+ #if defined (bsdi) || defined (BSDI) || defined (__386BSD__)
+ typedef _PTRDIFF_T_ ptrdiff_t;
+
+ #ifdef _SIZE_T_
+ typedef _SIZE_T_ size_t;
+ #undef _SIZE_T_
+ #endif
+
+ #ifdef _WCHAR_T_
+ typedef _WCHAR_T_ wchar_t;
+ #undef _WCHAR_T_
+ #endif
+
+ #undef NULL
+ #define NULL ((void *)0)
+
+ #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
+
+ #endif
/* A null pointer constant. */
diff -rc gcc-2.2.2.orig/gvarargs.h gcc-2.2.2/gvarargs.h
*** gcc-2.2.2.orig/gvarargs.h Tue May 5 10:22:07 1992
--- gcc-2.2.2/gvarargs.h Sat Oct 24 11:10:30 1992
***************
*** 7,12 ****
--- 7,16 ----
#ifndef _VARARGS_H
#define _VARARGS_H
+ #if defined (bsdi) || defined (BSDI) || defined (__386BSD__)
+ #include <machine/ansi.h>
+ #endif
+
#ifdef __sparc__
#include "va-sparc.h"
#else
***************
*** 67,73 ****
/* The macro _VA_LIST_ is the same thing used by this file in Ultrix. */
/* But in 4.3bsd-net2, _VA_LIST_ has another meaning. So ignore it. */
! #if !defined (_VA_LIST_) || defined (_ANSI_H)
/* The macro _VA_LIST is used in SCO Unix 3.2. */
#ifndef _VA_LIST
#ifndef _VA_LIST_
--- 71,77 ----
/* The macro _VA_LIST_ is the same thing used by this file in Ultrix. */
/* But in 4.3bsd-net2, _VA_LIST_ has another meaning. So ignore it. */
! #if !defined (_VA_LIST_) || defined (_ANSI_H) || defined (_ANSI_H_)
/* The macro _VA_LIST is used in SCO Unix 3.2. */
#ifndef _VA_LIST
#ifndef _VA_LIST_
***************
*** 78,84 ****
#define va_list __va___list
typedef char * __va___list;
#endif /* _VA_LIST */
! #endif /* !defined (_VA_LIST_) || defined (_ANSI_H) */
/* In 4.3bsd-net2, it is said we must #undef this.
I hope this successfully identifies that system.
--- 82,88 ----
#define va_list __va___list
typedef char * __va___list;
#endif /* _VA_LIST */
! #endif /* !defined (_VA_LIST_) || defined (_ANSI_H) || defined (_ANSI_H_) */
/* In 4.3bsd-net2, it is said we must #undef this.
I hope this successfully identifies that system.