diff --git a/ChangeLog b/ChangeLog index 5ef2a6099d..783ebfefe3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,31 @@ +1997-05-21 17:50 Ulrich Drepper + + * elf/Makefile (dl-routines): Add dl-sysdepio. + * elf/dl-support.c (_dl_sysdep_fatal): Removed. + * sysdeps/generic/dl-sysdep.c: Move definition of _dl_sysdep_fatal, + _dl_sysdep_error and _dl_sysdep_warning to ... + * sysdeps/generic/dl-sysdepio.c: ...here. + * sysdeps/mach/hurd/dl-sysdep.c: Move the functions to ... + * sysdeps/mach/hurd/dl-sysdepio.c: ...here. + * sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c: Remove definition + of functions. + Bug reported by Marcus G. Daniels . + + * db/Makefile (libdb.so): Depend on libc.so for dynamic loading + and for Linux ld.so. + * login/Makefile (libutil.so): Likewise. + * math/Makefile (libm.so): Likewise. + * md5-crypt/Makefile (libcrypt.so): Likewise. + * nis/Makefile (libnss_%.so): Likewise. + * resolv/Makefile (libnss_dns.so): Likewise. + +1997-05-20 14:01 Miles Bader + + * argp-help.c (_help): Supply STATE to argp_args_usage. + (argp_args_usage): Add filtering of the args doc string. + (comma): Print cluster headers for the first entry too. + * argp.h (ARGP_KEY_HELP_ARGS_DOC): New macro. + 1997-05-21 02:49 Ulrich Drepper * gnu-versions.h (_GNU_OBSTACK_INTERFACE_VERSION): Set to 2 since @@ -20,6 +48,7 @@ * string/tst-svc.c: New file. Test for strverscmp. * string/tst-svc.input: New file. Input data for tst-svc. * string/tst-svc.expect: New file. Expected out from tst-svc. + Patches by Jean-François Bignolles . * math/Makefile (calls): Add s_signbit. @@ -29,7 +58,7 @@ * sunrpc/pmap_rmt.c: Likewise. * string/basename.c: Don't use ISO C definition style. - Include is HAVE_CONFIG_H is defined. + Include if HAVE_CONFIG_H is defined. * sunrpc/proto.h: Add `const' wherever possible. * sunrpc/rpc_cout.c: Likewise. @@ -39,7 +68,7 @@ * sunrpc/xdr_stdio.c: Likewise. * sunrpc/rpc_parse.c: Delete comma from end of enum definition. * sunrpc/xdr.c: Little code cleanups. - * sunrpc/xdr_flaot.c: Likewise. + * sunrpc/xdr_float.c: Likewise. Patches by Matthew Wilcox . * sysdeps/i386/fpu/__math.h (__finite): Fix typo. diff --git a/argp/argp-help.c b/argp/argp-help.c index b17c56d3a5..da6c147c30 100644 --- a/argp/argp-help.c +++ b/argp/argp-help.c @@ -973,8 +973,10 @@ comma (unsigned col, struct pentry_state *pest) if (pest->hhstate->sep_groups && pe && pest->entry->group != pe->group) __argp_fmtstream_putc (pest->stream, '\n'); - if (pe && cl && pe->cluster != cl && cl->header && *cl->header - && !hol_cluster_is_child (pe->cluster, cl)) + if (cl && cl->header && *cl->header + && (!pe + || (pe->cluster != cl + && !hol_cluster_is_child (pe->cluster, cl)))) /* If we're changing clusters, then this must be the start of the ENTRY's cluster unless that is an ancestor of the previous one (in which case we had just popped into a sub-cluster for a bit). @@ -1305,17 +1307,19 @@ argp_args_levels (const struct argp *argp) updated by this routine for the next call if ADVANCE is true. True is returned as long as there are more patterns to output. */ static int -argp_args_usage (const struct argp *argp, char **levels, int advance, - argp_fmtstream_t stream) +argp_args_usage (const struct argp *argp, const struct argp_state *state, + char **levels, int advance, argp_fmtstream_t stream) { char *our_level = *levels; int multiple = 0; const struct argp_child *child = argp->children; - const char *doc = gettext (argp->args_doc), *nl = 0; + const char *tdoc = gettext (argp->args_doc), *nl = 0; + const char *fdoc = filter_doc (tdoc, ARGP_KEY_HELP_ARGS_DOC, + state ? state->argp : 0, state); - if (doc) + if (fdoc) { - nl = strchr (doc, '\n'); + nl = strchr (fdoc, '\n'); if (nl) /* This is a `multi-level' args doc; advance to the correct position as determined by our state in LEVELS, and update LEVELS. */ @@ -1323,22 +1327,24 @@ argp_args_usage (const struct argp *argp, char **levels, int advance, int i; multiple = 1; for (i = 0; i < *our_level; i++) - doc = nl + 1, nl = strchr (doc, '\n'); + fdoc = nl + 1, nl = strchr (fdoc, '\n'); (*levels)++; } if (! nl) - nl = doc + strlen (doc); + nl = fdoc + strlen (fdoc); /* Manually do line wrapping so that it (probably) won't get wrapped at any embedded spaces. */ - space (stream, 1 + nl - doc); + space (stream, 1 + nl - fdoc); - __argp_fmtstream_write (stream, doc, nl - doc); + __argp_fmtstream_write (stream, fdoc, nl - fdoc); } + if (fdoc && fdoc != tdoc) + free ((char *)fdoc); /* Free user's modified doc string. */ if (child) while (child->argp) - advance = !argp_args_usage ((child++)->argp, levels, advance, stream); + advance = !argp_args_usage ((child++)->argp, state, levels, advance, stream); if (advance && multiple) /* Need to increment our level. */ @@ -1517,7 +1523,7 @@ _help (const struct argp *argp, const struct argp_state *state, FILE *stream, flags |= ARGP_HELP_SHORT_USAGE; /* But only do so once. */ } - more_patterns = argp_args_usage (argp, &levels, 1, fs); + more_patterns = argp_args_usage (argp, state, &levels, 1, fs); __argp_fmtstream_set_wmargin (fs, old_wm); __argp_fmtstream_set_lmargin (fs, old_lm); diff --git a/argp/argp.h b/argp/argp.h index 6f430d4c23..fa09e2aea6 100644 --- a/argp/argp.h +++ b/argp/argp.h @@ -242,6 +242,7 @@ struct argp /* Explanatory note emitted when duplicate option arguments have been suppressed. */ #define ARGP_KEY_HELP_DUP_ARGS_NOTE 0x2000005 +#define ARGP_KEY_HELP_ARGS_DOC 0x2000006 /* Argument doc string. */ /* When an argp has a non-zero CHILDREN field, it should point to a vector of argp_child structures, each of which describes a subsidiary argp. */ diff --git a/db/Makefile b/db/Makefile index 0ed798b6cf..331c8b1d74 100644 --- a/db/Makefile +++ b/db/Makefile @@ -45,3 +45,8 @@ $(objpfx)makedb: $(objpfx)libdb.so$(libdb.so-version) else $(objpfx)makedb: $(objpfx)libdb.a endif + +# Depend on libc.so so a DT_NEEDED is generated in the shared objects. +# This ensures they will load libc.so for needed symbols if loaded by +# a statically-linked program that hasn't already loaded it. +$(objpfx)libdb.so: $(common-objpfx)libc.so diff --git a/elf/Makefile b/elf/Makefile index b69b8a0754..8d644aac8b 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -27,7 +27,7 @@ routines = $(dl-routines) dl-open dl-close dl-symbol dl-support \ # The core dynamic linking functions are in libc for the static and # profiled libraries. dl-routines = $(addprefix dl-,load cache lookup object reloc deps \ - runtime error init fini debug) + runtime error init fini debug sysdepio) # But they are absent from the shared libc, because that code is in ld.so. elide-routines.so = $(dl-routines) dl-support enbl-secure diff --git a/elf/dl-support.c b/elf/dl-support.c index 5c70b4f263..8a52fc7790 100644 --- a/elf/dl-support.c +++ b/elf/dl-support.c @@ -44,13 +44,6 @@ _dl_sysdep_open_zero_fill (void) } #endif -/* This should never be called. */ -void -_dl_sysdep_fatal (void) -{ - assert (! "_dl_sysdep_fatal called"); -} - /* Read the whole contents of FILE into new mmap'd space with given protections. *SIZEP gets the size of the file. */ diff --git a/login/Makefile b/login/Makefile index 65982661b6..6c10a5aff4 100644 --- a/login/Makefile +++ b/login/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1996 Free Software Foundation, Inc. +# Copyright (C) 1996, 1997 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -35,5 +35,9 @@ extra-libs-others := $(extra-libs) libutil-routines:= login login_tty logout logwtmp pty - include ../Rules + +# Depend on libc.so so a DT_NEEDED is generated in the shared objects. +# This ensures they will load libc.so for needed symbols if loaded by +# a statically-linked program that hasn't already loaded it. +$(objpfx)libutil.so: $(common-objpfx)libc.so diff --git a/math/Makefile b/math/Makefile index 87b47ab1b6..c2f3274877 100644 --- a/math/Makefile +++ b/math/Makefile @@ -133,3 +133,8 @@ $(addprefix $(objpfx),$(tests)): $(objpfx)libm.so$(libm.so-version) else $(addprefix $(objpfx),$(tests)): $(objpfx)libm.a endif + +# Depend on libc.so so a DT_NEEDED is generated in the shared objects. +# This ensures they will load libc.so for needed symbols if loaded by +# a statically-linked program that hasn't already loaded it. +$(objpfx)libm.so: $(common-objpfx)libc.so diff --git a/md5-crypt/Makefile b/md5-crypt/Makefile index 0d17af1667..6216ddb437 100644 --- a/md5-crypt/Makefile +++ b/md5-crypt/Makefile @@ -64,3 +64,8 @@ $(objpfx)$(patsubst %,$(libtype$o),md5crypt): \ endef object-suffixes-left = $(object-suffixes) include $(patsubst %,$(..)o-iterator.mk,$(object-suffixes)) + +# Depend on libc.so so a DT_NEEDED is generated in the shared objects. +# This ensures they will load libc.so for needed symbols if loaded by +# a statically-linked program that hasn't already loaded it. +$(objpfx)libcrypt.so: $(common-objpfx)libc.so diff --git a/nis/Makefile b/nis/Makefile index a5a591e1b7..a6d14d0875 100644 --- a/nis/Makefile +++ b/nis/Makefile @@ -73,7 +73,7 @@ $(objpfx)libnss_nisplus.so: $(objpfx)libnsl.so$(libnsl.so-version) # Depend on libc.so so a DT_NEEDED is generated in the shared objects. # This ensures they will load libc.so for needed symbols if loaded by # a statically-linked program that hasn't already loaded it. -$(services:%=$(objpfx)libnss_%.so): $(common-objpfx)libc.so +$(services:%=$(objpfx)libnss_%.so) $(objpfx)libnsl.so: $(common-objpfx)libc.so ifeq ($(build-shared),yes) diff --git a/resolv/Makefile b/resolv/Makefile index 41623cd067..7b99aee550 100644 --- a/resolv/Makefile +++ b/resolv/Makefile @@ -56,4 +56,4 @@ CPPFLAGS += -Dgethostbyname=res_gethostbyname \ $(objpfx)libresolv.so: $(common-objpfx)libc.so # The DNS NSS modules needs the resolver. -$(objpfx)libnss_dns.so: $(objpfx)libresolv.so +$(objpfx)libnss_dns.so: $(objpfx)libresolv.so $(common-objpfx)libc.so diff --git a/sysdeps/generic/dl-sysdep.c b/sysdeps/generic/dl-sysdep.c index e9fbcdf4bc..b7e1410b89 100644 --- a/sysdeps/generic/dl-sysdep.c +++ b/sysdeps/generic/dl-sysdep.c @@ -24,8 +24,6 @@ #include #include #include -#include -#include extern int _dl_argc; @@ -177,52 +175,3 @@ _dl_sysdep_read_whole_file (const char *file, size_t *sizep, int prot) __close (fd); return result; } - -void -_dl_sysdep_fatal (const char *msg, ...) -{ - va_list ap; - - va_start (ap, msg); - do - { - size_t len = strlen (msg); - __write (STDERR_FILENO, msg, len); - msg = va_arg (ap, const char *); - } while (msg); - va_end (ap); - - _exit (127); -} - - -void -_dl_sysdep_error (const char *msg, ...) -{ - va_list ap; - - va_start (ap, msg); - do - { - size_t len = strlen (msg); - __write (STDERR_FILENO, msg, len); - msg = va_arg (ap, const char *); - } while (msg); - va_end (ap); -} - - -void -_dl_sysdep_message (const char *msg, ...) -{ - va_list ap; - - va_start (ap, msg); - do - { - size_t len = strlen (msg); - __write (STDOUT_FILENO, msg, len); - msg = va_arg (ap, const char *); - } while (msg); - va_end (ap); -} diff --git a/sysdeps/generic/dl-sysdepio.c b/sysdeps/generic/dl-sysdepio.c new file mode 100644 index 0000000000..ed6078714d --- /dev/null +++ b/sysdeps/generic/dl-sysdepio.c @@ -0,0 +1,72 @@ +/* Operating I/O support for run-time dynamic linker. Generic Unix version. + Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include + + +void +_dl_sysdep_fatal (const char *msg, ...) +{ + va_list ap; + + va_start (ap, msg); + do + { + size_t len = strlen (msg); + __write (STDERR_FILENO, msg, len); + msg = va_arg (ap, const char *); + } while (msg); + va_end (ap); + + _exit (127); +} + + +void +_dl_sysdep_error (const char *msg, ...) +{ + va_list ap; + + va_start (ap, msg); + do + { + size_t len = strlen (msg); + __write (STDERR_FILENO, msg, len); + msg = va_arg (ap, const char *); + } while (msg); + va_end (ap); +} + + +void +_dl_sysdep_message (const char *msg, ...) +{ + va_list ap; + + va_start (ap, msg); + do + { + size_t len = strlen (msg); + __write (STDOUT_FILENO, msg, len); + msg = va_arg (ap, const char *); + } while (msg); + va_end (ap); +} diff --git a/sysdeps/mach/hurd/dl-sysdep.c b/sysdeps/mach/hurd/dl-sysdep.c index e8388c4191..8d5975cf8b 100644 --- a/sysdeps/mach/hurd/dl-sysdep.c +++ b/sysdeps/mach/hurd/dl-sysdep.c @@ -209,76 +209,6 @@ _dl_sysdep_start_cleanup (void) __mach_port_deallocate (__mach_task_self (), __mach_task_self_); } -void -_dl_sysdep_fatal (const char *msg, ...) -{ - va_list ap; - - va_start (ap, msg); - do - { - size_t len = strlen (msg); - mach_msg_type_number_t nwrote; - do - { - if (__io_write (_hurd_init_dtable[2], msg, len, -1, &nwrote)) - break; - len -= nwrote; - msg += nwrote; - } while (nwrote > 0); - msg = va_arg (ap, const char *); - } while (msg); - va_end (ap); - - _exit (127); -} - - -void -_dl_sysdep_error (const char *msg, ...) -{ - va_list ap; - - va_start (ap, msg); - do - { - size_t len = strlen (msg); - mach_msg_type_number_t nwrote; - do - { - if (__io_write (_hurd_init_dtable[2], msg, len, -1, &nwrote)) - break; - len -= nwrote; - msg += nwrote; - } while (nwrote > 0); - msg = va_arg (ap, const char *); - } while (msg); - va_end (ap); -} - - -void -_dl_sysdep_message (const char *msg, ...) -{ - va_list ap; - - va_start (ap, msg); - do - { - size_t len = strlen (msg); - mach_msg_type_number_t nwrote; - do - { - if (__io_write (_hurd_init_dtable[1], msg, len, -1, &nwrote)) - break; - len -= nwrote; - msg += nwrote; - } while (nwrote > 0); - msg = va_arg (ap, const char *); - } while (msg); - va_end (ap); -} - /* Minimal open/close/mmap implementation sufficient for initial loading of shared libraries. These are weak definitions so that when the dynamic linker re-relocates itself to be user-visible (for -ldl), diff --git a/sysdeps/mach/hurd/dl-sysdepio.c b/sysdeps/mach/hurd/dl-sysdepio.c new file mode 100644 index 0000000000..c177a7796f --- /dev/null +++ b/sysdeps/mach/hurd/dl-sysdepio.c @@ -0,0 +1,107 @@ +/* Operating system support for run-time dynamic linker. Hurd version. + Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "hurdstartup.h" +#include +#include "../stdio-common/_itoa.h" +#include +#include +#include +#include +#include + +void +_dl_sysdep_fatal (const char *msg, ...) +{ + va_list ap; + + va_start (ap, msg); + do + { + size_t len = strlen (msg); + mach_msg_type_number_t nwrote; + do + { + if (__io_write (_hurd_init_dtable[2], msg, len, -1, &nwrote)) + break; + len -= nwrote; + msg += nwrote; + } while (nwrote > 0); + msg = va_arg (ap, const char *); + } while (msg); + va_end (ap); + + _exit (127); +} + + +void +_dl_sysdep_error (const char *msg, ...) +{ + va_list ap; + + va_start (ap, msg); + do + { + size_t len = strlen (msg); + mach_msg_type_number_t nwrote; + do + { + if (__io_write (_hurd_init_dtable[2], msg, len, -1, &nwrote)) + break; + len -= nwrote; + msg += nwrote; + } while (nwrote > 0); + msg = va_arg (ap, const char *); + } while (msg); + va_end (ap); +} + + +void +_dl_sysdep_message (const char *msg, ...) +{ + va_list ap; + + va_start (ap, msg); + do + { + size_t len = strlen (msg); + mach_msg_type_number_t nwrote; + do + { + if (__io_write (_hurd_init_dtable[1], msg, len, -1, &nwrote)) + break; + len -= nwrote; + msg += nwrote; + } while (nwrote > 0); + msg = va_arg (ap, const char *); + } while (msg); + va_end (ap); +} diff --git a/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c b/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c index eb732d6fb1..c33b655705 100644 --- a/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c +++ b/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c @@ -24,8 +24,6 @@ #include #include #include -#include -#include extern int _dl_argc;