bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Small modularization patch


From: Jon McClintock
Subject: Small modularization patch
Date: Mon, 11 Dec 2000 11:33:47 -0800
User-agent: Mutt/1.2.5i

Hello,

Attached is a patch  to glibc 2.1.3 that adds the option to build glibc
without some functionality. The patch adds configuration options to remove
Sun RPC support from the compiled library.

Why would you want to use this patch? Well, glibc is quite big. A stripped
Intel binary is almost 900k, and a stripped Arm binary is around 950k. In an
embedded system, this can be a sizable portion of the system's memory.

At this time, there appear to be only two alternatives to the GNU C library.
uC-libc, from Lineo, and Cygnus' newlib. uC-libc appears to still be in
development; attempts to build it were met with successions of compiler
errors. newlib doesn't compile to a shared library, and appears to be lacking
the system glue code to make it part of a functioning system.

I added options to the configuration scripts which in turn affected
variables in the make system and toggled macros in the code. These were then
used to conditionally compile sections of code.

I added options for the following sections of code:
        sunrpc - Sun remote procedure call support.
        nis - Network Information System support.
        nscd - Name Service Caching Daemon support.

Nscd depends upon nis which in turn depends upon sunrpc; disabling nis disables
nscd, and disabling sunrpc disables nis.

Without any options disabled, the stripped library is 950,172 bytes. Disabling
SunRPC support reduces it to 859,824 bytes.

If people show interest in this, I plan on releasing similar patches for
other parts of glibc.

-Jon



diff -Nur glibc-2.1.3/Makeconfig arm-cross-glibc-2.1.3/Makeconfig
--- glibc-2.1.3/Makeconfig      Mon Nov 29 11:19:20 1999
+++ arm-cross-glibc-2.1.3/Makeconfig    Wed Nov  8 09:53:13 2000
@@ -805,6 +805,18 @@
          echo sysd-sorted-done = t;                                      \
        } > address@hidden
        mv -f address@hidden $@
+endif
+
+ifeq (no, $(sunrpc-support))
+subdirs := $(filter-out sunrpc, $(subdirs))
+endif
+
+ifeq (no, $(nscd-support))
+subdirs := $(filter-out nscd, $(subdirs))
+endif
+
+ifeq (no, $(nis-support))
+subdirs := $(filter-out nis, $(subdirs))
 endif
 
 endif # Makeconfig not yet included
diff -Nur glibc-2.1.3/config.h.in arm-cross-glibc-2.1.3/config.h.in
--- glibc-2.1.3/config.h.in     Mon Oct 26 09:58:24 1998
+++ arm-cross-glibc-2.1.3/config.h.in   Wed Nov  8 09:52:37 2000
@@ -70,6 +70,14 @@
    certain registers (CR0, MQ, CTR, LR) in asm statements.  */
 #undef BROKEN_PPC_ASM_CR0
 
+/* Enable sunrpc support. */
+#undef ENABLE_SUNRPC_SUPPORT
+
+/* Enable nscd support. */
+#undef ENABLE_NSCD_SUPPORT
+
+/* Enable nis support. */
+#undef ENABLE_NIS_SUPPORT
 
 /* Defined to some form of __attribute__ ((...)) if the compiler supports
    a different, more efficient calling convention.  */
diff -Nur glibc-2.1.3/configure.in arm-cross-glibc-2.1.3/configure.in
--- glibc-2.1.3/configure.in    Mon Oct  4 17:55:45 1999
+++ arm-cross-glibc-2.1.3/configure.in  Wed Nov  8 09:52:29 2000
@@ -133,6 +133,63 @@
              force_install=$enableval, force_install=yes)
 AC_SUBST(force_install)
 
+dnl Defines to disable various feature sets.
+
+dnl Disable sunrpc support.
+AC_MSG_CHECKING("for sunrpc support")
+AC_ARG_ENABLE(sunrpc-support, dnl
+[  --disable-sunrpc-support  Disable sunrpc support [default=no]],
+               sunrpc_support=$enableval, sunrpc_support=yes)
+if test x"$sunrpc_support" = xyes; then
+  AC_DEFINE(ENABLE_SUNRPC_SUPPORT)
+else
+  nis_support=no
+  nscd_support=no
+
+  config_vars="$config_vars
+nscd-support = $nscd_support"
+  config_vars="$config_vars
+nis-support = $nis_support"
+fi
+config_vars="$config_vars
+sunrpc-support = $sunrpc_support"
+AC_MSG_RESULT($sunrpc_support)
+
+dnl Both nis and nscd depend upon sunrpc, so only make them an option if
+dnl sunrpc is enabled.
+if test x"$sunrpc_support" = xyes; then
+  dnl Disable nis support.
+  AC_MSG_CHECKING("for nis support")
+  AC_ARG_ENABLE(nis-support, dnl
+[  --disable-nis-support  Disable nis support [default=no]],
+               nis_support=$enableval, nis_support=yes)
+  if test x"$nis_support" = xyes; then
+    AC_DEFINE(ENABLE_NIS_SUPPORT)
+  else
+    nscd_support=no
+    config_vars="$config_vars
+nscd-support = $nscd_support"
+  fi
+  config_vars="$config_vars
+nis-support = $nis_support"
+  AC_MSG_RESULT($nis_support)
+
+  dnl nscd depends upon nis, so only make it an option if nis is enabled.
+  if test x"$nis_support" = xyes; then
+    dnl Disable nscd support.
+    AC_MSG_CHECKING("for nscd support")
+    AC_ARG_ENABLE(nscd-support, dnl
+[  --disable-nscd-support  Disable nscd support [default=no]],
+               nscd_support=$enableval, nscd_support=yes)
+    if test x"$nscd_support" = xyes; then
+      AC_DEFINE(ENABLE_NSCD_SUPPORT)
+    fi
+    config_vars="$config_vars
+nscd-support = $nscd_support"
+    AC_MSG_RESULT($nscd_support)
+  fi
+fi
+
 AC_CANONICAL_HOST
 
 # The way shlib-versions is used to generate soversions.mk uses a
diff -Nur glibc-2.1.3/nss/getXXbyYY_r.c arm-cross-glibc-2.1.3/nss/getXXbyYY_r.c
--- glibc-2.1.3/nss/getXXbyYY_r.c       Fri Jul  9 20:40:40 1999
+++ arm-cross-glibc-2.1.3/nss/getXXbyYY_r.c     Thu Nov  2 16:28:38 2000
@@ -17,6 +17,12 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#include <config.h>
+
+#if (!defined(ENABLE_NSCD_SUPPORT)) && defined(USE_NSCD)
+#undef USE_NSCD
+#endif
+
 #include <assert.h>
 #include <errno.h>
 #include "nsswitch.h"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]