Subject: Re: anyone seen this
To: None <current-users@sun-lamp.cs.berkeley.edu>
From: Mark P. Gooderum <mark@aggregate.com>
List: current-users
Date: 06/15/1994 15:53:41
----------

I sent this to Jeffrey Hsu but meant to send to the whole list so other
interested parties could try.

BTW...these patches should work for 2.5.8...the files where effected aren't
really any different where patched.

-Mark

Easy, ftp.cyngnus.com:/pub/reno-1.3.tar.gz

Note I use some funky tabs, so attached patches may need "patch -l" to apply
cleanly.

I've got a set of patches that has me most of the way, problems encountered:

	cygnus makefile uses a special version of byacc that generates some
		bisonisms (byacc is supposed to generate faster parsers, but
		gcc assumes some bisonisms)

		-either use Cygnus byacc (hides on same ftp server under
			/pub/gdb/byacc-940324.tar.gz)

		-fix Makefile to use bison again

	gsttdef.h doesn't grok new BSD_ defines in <machine/ansi.h>
	I sent mail with these patches to current users, but a copy is
	attached.  

	A tm file is needed...this has been used by both me and a few other
	people, again attached at bottom.

	fixincludes breaks stdio.h.  I haven't come up with a "real" patch
	that preserves existing functionality.  The sed replace for the VA_LIST
	stuff breaks the stdio.h vXprintf() protos.  I've just done a quick
	patch that works for NetBSD...the DUMMY line is probably still
	needed by other ports...

	bsd4_4 needs to be defined for a quick workaround for the sys_errlist
	types.

With these patches it builds working binaries, but the relocation 
warnings occur.

BTW...the Cygnus dist is based on 2.5.6.  My reason for using it is
that the Cygnus libg++ supposedly is much better overall, especially
in the iostreams lib.  When I got it all working I'll pass patches to both
Cygnus and FSF.

	-Mark

*** xm-i386.h.orig      Tue Jul 27 11:54:16 1993
--- xm-i386.h   Wed Jun 15 12:41:52 1994
***************
*** 36,41 ****
--- 36,46 ----
  #define SUCCESS_EXIT_CODE 0
  #define FATAL_EXIT_CODE 33
  
+ /* NetBSD-current is near enough to BSD-4.4 when compiling */
+ #if defined (__NetBSD__) && !defined (__386BSD__)
+ #define bsd4_4 1
+ #endif
+ 
  /* target machine dependencies.
     tm.h is a symbolic link to the actual target specific file.   */

	
*** fixincludes.orig    Wed Jun 15 13:12:38 1994
--- fixincludes Wed Jun 15 13:58:05 1994
***************
*** 1126,1141 ****
    sed -e 's@ va_list @ __gnuc_va_list @' \
        -e 's@ va_list)@ __gnuc_va_list)@' \
        -e 's@ _VA_LIST_));@ __gnuc_va_list));@' \
        -e 's@ va_list@ __va_list__@' \
        -e 's@\*va_list@*__va_list__@' \
        -e 's@ __va_list)@ __gnuc_va_list)@' \
        -e 's@_NEED___VA_LIST@_NEED___Va_LIST@' \
        -e 's@_HIDDEN_VA_LIST@_HIDDEN_Va_LIST@' \
!       -e 's@VA_LIST@DUMMY_VA_LIST@' \
        -e 's@_NEED___Va_LIST@_NEED___VA_LIST@' \
        -e 's@_HIDDEN_Va_LIST@_HIDDEN_VA_LIST@' \
      ${LIB}/$file >> ${LIB}/${file}.sed
    
    rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
    if cmp $file ${LIB}/$file >/dev/null 2>&1; then
      rm -f ${LIB}/$file
--- 1126,1144 ----
    sed -e 's@ va_list @ __gnuc_va_list @' \
        -e 's@ va_list)@ __gnuc_va_list)@' \
        -e 's@ _VA_LIST_));@ __gnuc_va_list));@' \
+       -e 's@ _BSD_VA_LIST_));@ __gnuc_va_list));@' \
        -e 's@ va_list@ __va_list__@' \
        -e 's@\*va_list@*__va_list__@' \
        -e 's@ __va_list)@ __gnuc_va_list)@' \
        -e 's@_NEED___VA_LIST@_NEED___Va_LIST@' \
        -e 's@_HIDDEN_VA_LIST@_HIDDEN_Va_LIST@' \
!       -e 's@ _BSD_DUMMY_VA_LIST_));@ __gnuc_va_list));@' \
        -e 's@_NEED___Va_LIST@_NEED___VA_LIST@' \
        -e 's@_HIDDEN_Va_LIST@_HIDDEN_VA_LIST@' \
      ${LIB}/$file >> ${LIB}/${file}.sed
    
+ #      -e 's@VA_LIST@DUMMY_VA_LIST@' \
+ 
    rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
    if cmp $file ${LIB}/$file >/dev/null 2>&1; then
      rm -f ${LIB}/$file

*** configure.orig      Thu Feb 17 20:16:37 1994
--- configure   Wed Jun 15 12:42:22 1994
***************
*** 463,468 ****
--- 463,475 ----
                  tm_file=i386/i386-coff.h
                  tmake_file=i386/t-i386bare
                  ;;
+       i[34]86-*-netbsd*)
+               cpu_type=i386
+               tm_file=i386/netbsd.h
+ #             tmake_file=t-libc-ok
+ # Next line turned off because both 386BSD and BSD/386 use GNU ld.
+ #             use_collect2=yes
+               ;;
        i[34]86-*-mach*)
                cpu_type=i386
                tm_file=i386/mach.h



----- End Included Message -----

----------

*** gstddef.h.orig	Mon Dec  6 19:02:10 1993
--- gstddef.h	Mon Jun  6 13:11:48 1994
***************
*** 2,8 ****
  #ifndef _STDDEF_H_
  #ifndef _ANSI_STDDEF_H
  #ifndef __STDDEF_H__
- 
  /* 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.  */
--- 2,7 ----
***************
*** 22,52 ****
  
  /* 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
      defined if the corresponding type is *not* defined.  */
  #ifdef _ANSI_H_
  #ifndef _SIZE_T_
  #define _SIZE_T
  #endif
  #ifndef _PTRDIFF_T_
  #define _PTRDIFF_T
  #endif
  #ifndef _WCHAR_T_
  #define _WCHAR_T
  #endif
  /* Undef _FOO_T_ if we are supposed to define foo_t.  */
  #if defined (__need_ptrdiff_t) || defined (_STDDEF_H_)
  #undef _PTRDIFF_T_
  #endif
  #if defined (__need_size_t) || defined (_STDDEF_H_)
  #undef _SIZE_T_
  #endif
  #if defined (__need_wchar_t) || defined (_STDDEF_H_)
  #undef _WCHAR_T_
  #endif
  #endif /* _ANSI_H_ */
  
--- 21,64 ----
  
  /* 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 (__NetBSD__)
  #include <machine/ansi.h>
+ #ifndef _ANSI_H_
+ #define _ANSI_H_ /* for NetBSD-current */
+ #endif
  #endif
  
+ 
  /* In 4.3bsd-net2, machine/ansi.h defines these symbols, which are
      defined if the corresponding type is *not* defined.  */
  #ifdef _ANSI_H_
  #ifndef _SIZE_T_
+ #ifndef _BSD_SIZE_T_
  #define _SIZE_T
  #endif
+ #endif
  #ifndef _PTRDIFF_T_
+ #ifndef _BSD_PTRDIFF_T_
  #define _PTRDIFF_T
  #endif
+ #endif
  #ifndef _WCHAR_T_
+ #ifndef _BSD_WCHAR_T_
  #define _WCHAR_T
  #endif
+ #endif
  /* Undef _FOO_T_ if we are supposed to define foo_t.  */
  #if defined (__need_ptrdiff_t) || defined (_STDDEF_H_)
  #undef _PTRDIFF_T_
+ #undef _BSD_PTRDIFF_T_
  #endif
  #if defined (__need_size_t) || defined (_STDDEF_H_)
  #undef _SIZE_T_
+ #undef _BSD_SIZE_T_
  #endif
  #if defined (__need_wchar_t) || defined (_STDDEF_H_)
  #undef _WCHAR_T_
+ #undef _BSD_WCHAR_T_
  #endif
  #endif /* _ANSI_H_ */
  
***************
*** 72,77 ****
--- 84,90 ----
  #ifndef _T_PTRDIFF
  #ifndef __PTRDIFF_T
  #ifndef _PTRDIFF_T_
+ #ifndef _BSD_PTRDIFF_T_
  #ifndef ___int_ptrdiff_t_h
  #ifndef _GCC_PTRDIFF_T
  #define _PTRDIFF_T
***************
*** 79,84 ****
--- 92,98 ----
  #define _T_PTRDIFF
  #define __PTRDIFF_T
  #define _PTRDIFF_T_
+ #define _BSD_PTRDIFF_T_
  #define ___int_ptrdiff_t_h
  #define _GCC_PTRDIFF_T
  #ifndef __PTRDIFF_TYPE__
***************
*** 87,92 ****
--- 101,107 ----
  typedef __PTRDIFF_TYPE__ ptrdiff_t;
  #endif /* _GCC_PTRDIFF_T */
  #endif /* ___int_ptrdiff_t_h */
+ #endif /* _BSD_PTRDIFF_T_ */
  #endif /* _PTRDIFF_T_ */
  #endif /* __PTRDIFF_T */
  #endif /* _T_PTRDIFF */
***************
*** 109,114 ****
--- 124,130 ----
  #ifndef _T_SIZE
  #ifndef __SIZE_T
  #ifndef _SIZE_T_
+ #ifndef _BSD_SIZE_T_
  #ifndef ___int_size_t_h
  #ifndef _GCC_SIZE_T
  #ifndef _SIZET_
***************
*** 119,124 ****
--- 135,141 ----
  #define _T_SIZE
  #define __SIZE_T
  #define _SIZE_T_
+ #define _BSD_SIZE_T_
  #define ___int_size_t_h
  #define _GCC_SIZE_T
  #define _SIZET_
***************
*** 133,138 ****
--- 150,156 ----
  #endif /* _SIZET_ */
  #endif /* _GCC_SIZE_T */
  #endif /* ___int_size_t_h */
+ #endif /* _BSD_SIZE_T_ */
  #endif /* _SIZE_T_ */
  #endif /* __SIZE_T */
  #endif /* _T_SIZE */
***************
*** 156,161 ****
--- 174,180 ----
  #ifndef _T_WCHAR
  #ifndef __WCHAR_T
  #ifndef _WCHAR_T_
+ #ifndef _BSD_WCHAR_T_
  #ifndef _WCHAR_T_H
  #ifndef ___int_wchar_t_h
  #ifndef __INT_WCHAR_T_H
***************
*** 165,170 ****
--- 184,190 ----
  #define _T_WCHAR
  #define __WCHAR_T
  #define _WCHAR_T_
+ #define _BSD_WCHAR_T_
  #define _WCHAR_T_H
  #define ___int_wchar_t_h
  #define __INT_WCHAR_T_H
***************
*** 189,194 ****
--- 209,215 ----
  #endif
  #endif
  #endif
+ #endif
  #undef  __need_wchar_t
  #endif /* _STDDEF_H or __need_wchar_t.  */
  
***************
*** 197,208 ****
--- 218,232 ----
  #ifdef _ANSI_H_
  #ifdef _GCC_PTRDIFF_T_
  #undef _PTRDIFF_T_
+ #undef _BSD_PTRDIFF_T_
  #endif
  #ifdef _GCC_SIZE_T_
  #undef _SIZE_T_
+ #undef _BSD_SIZE_T_
  #endif
  #ifdef _GCC_WCHAR_T_
  #undef _WCHAR_T_
+ #undef _BSD_WCHAR_T_
  #endif
  #endif /* _ANSI_H_ */
----------

/* Configuration for an i386 running NetBSD as the target machine. 

	$Id: tm.h,v 1.5 1993/12/06 09:49:15 cgd Exp $
*/


/* This is tested by i386gas.h.  */
#define YES_UNDERSCORES

#include "i386/gstabs.h"

/* Get perform_* macros to build libgcc.a.  */
#include "i386/perform.h"


/* NOTE: Two cases considered
 *          o Compiling on 0.9
 *          o Compiling on current
 *       Compiling on 0.9 for current wasn't considered
 */
#undef CPP_PREDEFINES
#if defined (unix) && defined (i386) && defined (__BSD_NET2__) && defined (__NetBSD__) && defined (__386BSD__)
#define CPP_PREDEFINES "-Dunix -Di386 -D__BSD_NET2__ -D__NetBSD__ -D__386BSD__"
#else
#define CPP_PREDEFINES "-Di386 -D__NetBSD__ -Dunix"
#endif

/* Like the default, except no -lg.  */
#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"

#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

/* NetBSD does have atexit.  */

#define HAVE_ATEXIT

/* Redefine this to use %eax instead of %edx.  */
#undef FUNCTION_PROFILER
#define FUNCTION_PROFILER(FILE, LABELNO)  \
{									\
  if (flag_pic)								\
    {									\
      fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%eax\n",		\
	       LPREFIX, (LABELNO));					\
      fprintf (FILE, "\tcall *mcount@GOT(%%ebx)\n");			\
    }									\
  else									\
    {									\
      fprintf (FILE, "\tmovl $%sP%d,%%eax\n", LPREFIX, (LABELNO));	\
      fprintf (FILE, "\tcall mcount\n");				\
    }									\
}

/* There are conflicting reports about whether this system uses
   a different assembler syntax.  wilson@cygnus.com says # is right.  */
#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"

/* The following macros are stolen from i386v4.h */
/* These have to be defined to get PIC code correct */

/* This is how to output an element of a case-vector that is relative.
   This is only used for PIC code.  See comments by the `casesi' insn in
   i386.md for an explanation of the expression this outputs. */

#undef ASM_OUTPUT_ADDR_DIFF_ELT
#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
  fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE)

/* Indicate that jump tables go in the text section.  This is
   necessary when compiling PIC code.  */

#define JUMP_TABLES_IN_TEXT_SECTION

/* Don't default to pcc-struct-return, because gcc is the only compiler, and
   we want to retain compatibility with older gcc versions.  */
#define DEFAULT_PCC_STRUCT_RETURN 0

/*
 * Some imports from svr4.h in support of shared libraries.
 * Currently, we need the DECLARE_OBJECT_SIZE stuff.
 */

/* Define the strings used for the special svr4 .type and .size directives.
   These strings generally do not vary from one system running svr4 to
   another, but if a given system (e.g. m88k running svr) needs to use
   different pseudo-op names for these, they may be overridden in the
   file which includes this one.  */

#define TYPE_ASM_OP	".type"
#define SIZE_ASM_OP	".size"
#define WEAK_ASM_OP	".weak"

/* The following macro defines the format used to output the second
   operand of the .type assembler directive.  Different svr4 assemblers
   expect various different forms for this operand.  The one given here
   is just a default.  You may need to override it in your machine-
   specific tm.h file (depending upon the particulars of your assembler).  */

#define TYPE_OPERAND_FMT	"@%s"

/* Write the extra assembler code needed to declare a function's result.
   Most svr4 assemblers don't require any special declaration of the
   result value, but there are exceptions.  */

#ifndef ASM_DECLARE_RESULT
#define ASM_DECLARE_RESULT(FILE, RESULT)
#endif

/* These macros generate the special .type and .size directives which
   are used to set the corresponding fields of the linker symbol table
   entries in an ELF object file under SVR4.  These macros also output
   the starting labels for the relevant functions/objects.  */

/* Write the extra assembler code needed to declare a function properly.
   Some svr4 assemblers need to also have something extra said about the
   function's return value.  We allow for that here.  */

#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)			\
  do {									\
    fprintf (FILE, "\t%s\t ", TYPE_ASM_OP);				\
    assemble_name (FILE, NAME);						\
    putc (',', FILE);							\
    fprintf (FILE, TYPE_OPERAND_FMT, "function");			\
    putc ('\n', FILE);							\
    ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL));			\
    ASM_OUTPUT_LABEL(FILE, NAME);					\
  } while (0)

/* Write the extra assembler code needed to declare an object properly.  */

#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL)			\
  do {									\
    fprintf (FILE, "\t%s\t ", TYPE_ASM_OP);				\
    assemble_name (FILE, NAME);						\
    putc (',', FILE);							\
    fprintf (FILE, TYPE_OPERAND_FMT, "object");				\
    putc ('\n', FILE);							\
    if (!flag_inhibit_size_directive)					\
      {									\
	fprintf (FILE, "\t%s\t ", SIZE_ASM_OP);				\
	assemble_name (FILE, NAME);					\
	fprintf (FILE, ",%d\n",  int_size_in_bytes (TREE_TYPE (decl)));	\
      }									\
    ASM_OUTPUT_LABEL(FILE, NAME);					\
  } while (0)

/* This is how to declare the size of a function.  */

#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL)			\
  do {									\
    if (!flag_inhibit_size_directive)					\
      {									\
        char label[256];						\
	static int labelno;						\
	labelno++;							\
	ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno);		\
	ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno);		\
	fprintf (FILE, "\t%s\t ", SIZE_ASM_OP);				\
	assemble_name (FILE, (FNAME));					\
        fprintf (FILE, ",");						\
	assemble_name (FILE, label);					\
        fprintf (FILE, "-");						\
	assemble_name (FILE, (FNAME));					\
	putc ('\n', FILE);						\
      }									\
  } while (0)


------------------------------------------------------------------------------