Subject: lib/2758: crt0.o pulls in much of libc during linking
To: None <gnats-bugs@gnats.netbsd.org>
From: Mike Long <mike.long@analog.com>
List: netbsd-bugs
Date: 09/15/1996 23:06:41
>Number:         2758
>Category:       lib
>Synopsis:       crt0.o pulls in much of libc during linking
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people (Library Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Sep 15 21:50:06 1996
>Last-Modified:
>Originator:     Mike Long <mike.long@analog.com>
>Organization:
	We'd tell you, but then we'd have to shoot you
>Release:        1.2_BETA
>Environment:

System: NetBSD azathoth 1.2_BETA NetBSD 1.2_BETA (AZATHOTH) #100: Mon Sep 2 21:56:30 EDT 1996 root@azathoth:/usr/src/sys/arch/i386/compile/AZATHOTH i386

>Description:
	crt0.o is supposed to be a mostly-standalone module.  NetBSD's
violates that rule because it uses strerror(), which uses catopen(),
which uses...you get the idea.

>How-To-Repeat:

# cd /usr/src/bin/sync
# make

Wonder why /bin/sync is 36K when all it does is execute ONE SYSCALL.

>Fix:
	Apply these patches to /usr/src/lib/csu/common.[ch].  After I
did so, /bin/sync shrank from 36K to 12K; all of /bin shrank from
2729K to 2705K.  (All right, so it's not a lot; but it's a start.)

*** /usr/src/lib/csu/common.h.orig	Fri Oct 13 20:37:43 1995
--- /usr/src/lib/csu/common.h	Sat Sep 14 04:48:46 1996
***************
*** 32,35 ****
--- 32,36 ----
  
  #include <string.h>
+ #include <errno.h>
  
  #ifdef DYNAMIC

*** /usr/src/lib/csu/common.c.orig	Fri Oct 13 20:37:42 1995
--- /usr/src/lib/csu/common.c	Sat Sep 14 04:56:41 1996
***************
*** 210,214 ****
  		return "Service unavailable";
  
! 	return (char *)strerror(error);
  }
  
--- 210,217 ----
  		return "Service unavailable";
  
! 	if (error < sys_nerr)
! 	    return (char *)(sys_errlist[error]);
! 	else
! 	    return "Unknown error";
  }
  
>Audit-Trail:
>Unformatted: