Subject: bin/4869: gcc uses old vfork
To: None <gnats-bugs@gnats.netbsd.org>
From: None <Anders.Hjalmarsson@economics.gu.se>
List: netbsd-bugs
Date: 01/22/1998 14:09:13
>Number:         4869
>Category:       bin
>Synopsis:       gcc uses old vfork
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 22 05:05:01 1998
>Last-Modified:
>Originator:     Anders Hjalmarsson
>Organization:
>Release:        NetBSD-current 19980121
>Environment:
System: NetBSD econahja.econ.gu.se 1.3B NetBSD 1.3B (ECONAHJA) #78: Thu Jan 22 00:40:44 CET 1998 econahja@econahja.econ.gu.se:/usr/src/sys/arch/i386/compile/ECONAHJA i386


>Description:
	gcc uses the old vfork because it does not include unistd.h
>How-To-Repeat:
	Run nm -u on gcc.o
>Fix:
Include unistd.h, and use _exit, not exit on exec failure.

This patch also includes a few other headers which I noticed are
not included.  __NetBSD__ is probably not the right thing to depend on,
but I do not know what should be used.
Also xm-netbsd.h should define HAVE_PUTENV

--- src/gnu/usr.bin/gcc/cc/gcc.c.orig	Thu Jan 22 13:15:23 1998
+++ src/gnu/usr.bin/gcc/cc/gcc.c	Thu Jan 22 13:31:11 1998
@@ -53,6 +53,12 @@
 #include <varargs.h>
 #endif
 #include <stdio.h>
+#ifdef __NetBSD__
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/wait.h>
+#endif
 
 /* Include multi-lib information.  */
 #include "multilib.h"
@@ -2099,7 +2105,7 @@
       /* Exec the program.  */
       (*func) (program, argv);
       perror_exec (program);
-      exit (-1);
+      _exit (-1);
       /* NOTREACHED */
       return 0;
 
--- src/gnu/usr.bin/gcc/arch/xm-netbsd.h.orig	Fri Jan 16 15:33:02 1998
+++ src/gnu/usr.bin/gcc/arch/xm-netbsd.h	Thu Jan 22 13:26:19 1998
@@ -23,5 +23,6 @@
    instead $xm_file should be CPU/xm-netbsd.h, which should include both
    CPU/xm-CPU.h and this file xm-netbsd.h.  */
    
+#define HAVE_PUTENV
 #define HAVE_STRERROR
 #define HAVE_VPRINTF
>Audit-Trail:
>Unformatted: