about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog61
-rw-r--r--Make-dist3
-rw-r--r--Makeconfig3
-rw-r--r--Makefile12
-rw-r--r--Makerules17
-rw-r--r--elf/dl-close.c34
-rw-r--r--sysdeps/generic/setenv.c17
-rw-r--r--time/tzfile.c10
-rw-r--r--time/tzset.c21
-rw-r--r--timezone/Makefile7
-rw-r--r--timezone/zdump.c12
11 files changed, 128 insertions, 69 deletions
diff --git a/ChangeLog b/ChangeLog
index 4053a097bd..7f3cd2781b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,64 @@
+1998-05-20  Andreas Jaeger  <aj@arthur.rhein-neckar.de>
+
+	* Makeconfig (rpath-link): Add resolvobjdir.
+	(resolvobjdir): New variable.
+	Reported by Peter Breitenlohner <peb@mppmu.mpg.de> [fixes PR libc/633].
+
+1998-05-20 09:36  Ulrich Drepper  <drepper@cygnus.com>
+
+	* elf/dl-close.c: Call shared object terminators at the right time.
+	Patch by Philippe Troin <phil@fifi.org>.
+
+1998-05-20  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* Make-dist (+tsrcs): Also add *.map for every member of
+	$(extra-libs).
+
+	* Makefile (distribute): Don't distribute scripts/printsources and
+	scripts/=__ify.  Distribute FAQ.in.
+	(rpm/%): Don't pass subdirs to sub-make.
+
+	* timezone/Makefile: Protect inclusion of z.* by $(avoid-generated)
+	instead of $(no_deps).
+
+1998-05-19  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* sysdeps/generic/setenv.c: Protect against GNU C extension.
+	(KNOWN_VALUE, STORE_VALUE): Do it right.
+	(setenv): Remove unused variable.
+
+1998-05-18  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* timezone/Makefile (tz-cflags): Define TM_GMTOFF and TM_ZONE.
+	(CFLAGS-zdump.c): Add $(tz-cflags).
+
+	* timezone/zdump.c (abbr): Use TM_ZONE if defined.  Add const to
+	return type.
+
+1998-05-18  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* time/tzfile.c (__tzfile_compute): Undo last change.  Instead
+	take struct tm parameter and set tm_isdst, tm_zone and tm_offset
+	if use_localtime.
+	* time/tzset.c: Update prototype of __tzfile_compute.
+	(__tz_convert): Pass tp to __tzfile_compute.  Don't set tm_isdst,
+	tm_zone and tm_offset here if __use_tzfile.
+
+1998-05-19  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* Makerules: Install libc.a even if there are no object file.
+
+1998-05-18  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* Makerules (do-makelib): Don't force creating library from
+	scratch, to avoid wasting time and space and to get correct
+	behaviour if $(subdirs) is incomplete.
+
+1998-05-19  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* Makerules (do-stamp): Make it work when building in source
+	directory.
+
 1998-05-20 00:10  Ulrich Drepper  <drepper@cygnus.com>
 
 	* elf/dl-load.c: Rename option and variable from ignore-rpath to
diff --git a/Make-dist b/Make-dist
index 13df78abce..30b9749e91 100644
--- a/Make-dist
+++ b/Make-dist
@@ -122,7 +122,8 @@ sources := $(filter-out $(addsuffix .c,$(basename $(.S.s))),$(sources)) $(.S.s)
 	$(+subdir-nodist) $(dont_distribute)
 foo:=$(shell echo '+out=$(+out)' >&2; echo foofoo >&2)
 +tsrcs	:= $(filter-out $(+out), $(sources) $(all-headers) $(distribute)) \
-	   $(foreach l,$(extra-libs),$($l-map)) $(+sysdeps)
+	   $(foreach l,$(extra-libs),$($l-map)) \
+	   $(wildcard $(addsuffix .map,$(extra-libs))) $(+sysdeps)
 foo:=$(shell echo 'made +tsrcs=$(+tsrcs)'>&2)
 foo:=$(shell echo generated='$(generated)' >&2)
 #generated := $(sort $(generated) $(generated:.S=.c) $(generated:.s=.c))
diff --git a/Makeconfig b/Makeconfig
index 8cdf8c6a76..e81005e190 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -413,13 +413,14 @@ else
 default-rpath = $(libdir)
 endif
 # This is how to find at build-time things that will be installed there.
-rpath-link = $(common-objdir):$(mathobjdir):$(elfobjdir):$(nssobjdir):$(nisobjdir):$(dbobjdir):$(rtobjdir)
+rpath-link = $(common-objdir):$(mathobjdir):$(elfobjdir):$(nssobjdir):$(nisobjdir):$(dbobjdir):$(rtobjdir):$(resolvobjdir)
 mathobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)math)
 elfobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)elf)
 nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss)
 nisobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nis)
 dbobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)db2)
 rtobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)rt)
+resolvobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)resolv)
 else
 link-libc = $(common-objpfx)libc.a $(gnulib) $(common-objpfx)libc.a
 endif
diff --git a/Makefile b/Makefile
index dca5009b92..44699ac158 100644
--- a/Makefile
+++ b/Makefile
@@ -234,8 +234,8 @@ parent_echo-distinfo:
 
 # Make the distribution tarfile.
 
-distribute  :=	README README.libm INSTALL FAQ NOTES NEWS PROJECTS	\
-		BUGS COPYING.LIB COPYING ChangeLog ChangeLog.[0-9]	\
+distribute  :=	README README.libm INSTALL FAQ FAQ.in NOTES NEWS BUGS	\
+		PROJECTS COPYING.LIB COPYING ChangeLog ChangeLog.[0-9]	\
 		Makefile Makeconfig Makerules Rules Make-dist MakeTAGS	\
 		extra-lib.mk o-iterator.mk libc.map configure		\
 		configure.in aclocal.m4 config.h.in config.make.in	\
@@ -244,9 +244,9 @@ distribute  :=	README README.libm INSTALL FAQ NOTES NEWS PROJECTS	\
 		rpm/template rpm/rpmrc glibcbug.in abi-tags stub-tag.h	\
 		test-skeleton.c include/des.h				\
 		$(addprefix scripts/,					\
-			rellns-sh config.sub config.guess printsources	\
-			mkinstalldirs move-if-change install-sh	=__ify	\
-			test-installation.pl gen-FAQ.pl)
+			    rellns-sh config.sub config.guess		\
+			    mkinstalldirs move-if-change install-sh	\
+			    test-installation.pl gen-FAQ.pl)
 
 distribute := $(strip $(distribute))
 generated := $(generated) stubs.h
@@ -270,7 +270,7 @@ endif
 FORCE:
 
 rpm/%: subdir_distinfo
-	$(MAKE) $(PARALLELMFLAGS) -C $(@D) subdirs='$(subdirs)' $(@F)
+	$(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
 
 iconvdata/%:
 	$(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
diff --git a/Makerules b/Makerules
index dadafdbc88..ece8f0610c 100644
--- a/Makerules
+++ b/Makerules
@@ -499,7 +499,7 @@ define o-iterator-doit
 $(objpfx)stamp$o: $(o-objects); $$(do-stamp)
 endef
 define do-stamp
-echo '$(patsubst $(common-objpfx)%,%,$^)' > $@T
+echo '$(patsubst $(objpfx)%,$(addsuffix /,$(subdir))%,$^)' > $@T
 mv -f $@T $@
 endef
 object-suffixes-left := $(object-suffixes-for-libc)
@@ -508,17 +508,15 @@ include $(o-iterator)
 endif
 
 # Now define explicit rules to build the library archives; these depend
-# on the stamp files built above.  The rule always destroys and recreates
-# the library from scratch; it's faster that way.
+# on the stamp files built above.
 define o-iterator-doit
 $(common-objpfx)$(patsubst %,$(libtype$o),c): \
 		$(subdirs-stamp-o) $(common-objpfx)stamp$o; $$(do-makelib)
 endef
 define do-makelib
 cd $(common-objdir) && \
-$(AR) $(CREATE_ARFLAGS) $(@F)T `cat $(patsubst $(common-objpfx)%,%,$^)`
-$(RANLIB) $@T
-mv -f $@T $@
+$(AR) $(CREATE_ARFLAGS) $(@F) `cat $(patsubst $(common-objpfx)%,%,$^)`
+$(RANLIB) $@
 endef
 subdirs-stamps := $(foreach d,$(subdirs),$(common-objpfx)$d/stamp%)
 subdirs-stamp-o = $(subst %,$o,$(subdirs-stamps))
@@ -575,10 +573,8 @@ $(addprefix $(..)./scripts/mkinstalldirs ,\
 	    $(filter-out $(wildcard $(@D:%/=%)),$(@D:%/=%)))
 endef
 
-# Any directory (parent or subdir) that has any object files to build
-# should install libc.a; this way "make install" in a subdir is guaranteed
-# to install everything it changes.
-ifdef objects
+# Any directory (parent or subdir) should install libc.a; this way
+# "make install" in a subdir is guaranteed to install everything it changes.
 installed-libcs := $(foreach o,$(filter-out .os,$(object-suffixes-for-libc)),\
 			     $(inst_libdir)/$(patsubst %,$(libtype$o),\
 						     $(libprefix)$(libc-name)))
@@ -589,7 +585,6 @@ $(installed-libcs): $(inst_libdir)/lib$(libprefix)%: lib $(+force)
 # Running ranlib after installing makes the __.SYMDEF time stamp up to
 # date, which avoids messages from some linkers.
 	$(RANLIB) $@
-endif
 
 define do-install-program
 $(make-target-directory)
diff --git a/elf/dl-close.c b/elf/dl-close.c
index 70b2e6057e..49deb961b3 100644
--- a/elf/dl-close.c
+++ b/elf/dl-close.c
@@ -47,30 +47,39 @@ _dl_close (struct link_map *map)
   __libc_lock_lock (_dl_load_lock);
 
   /* Decrement the reference count.  */
-  if (--map->l_opencount > 0 || map->l_type != lt_loaded)
+  if (map->l_opencount > 1 || map->l_type != lt_loaded)
     {
       /* There are still references to this object.  Do nothing more.  */
+      --map->l_opencount;
       __libc_lock_unlock (_dl_load_lock);
       return;
     }
 
+  list = map->l_searchlist;
+
+  /* Call all termination functions at once.  */
+  for (i = 0; i < map->l_nsearchlist; ++i)
+    {
+      struct link_map *imap = list[i];
+      if (imap->l_opencount == 1 && imap->l_type == lt_loaded)
+	{
+	  if (imap->l_info[DT_FINI])
+	    /* Call its termination function.  */
+	    (*(void (*) (void)) ((void *) imap->l_addr
+				 + imap->l_info[DT_FINI]->d_un.d_ptr)) ();
+	}
+    }
+
   /* Notify the debugger we are about to remove some loaded objects.  */
   _r_debug.r_state = RT_DELETE;
   _dl_debug_state ();
 
-  list = map->l_searchlist;
-
   /* The search list contains a counted reference to each object it
      points to, the 0th elt being MAP itself.  Decrement the reference
      counts on all the objects MAP depends on.  */
-  for (i = 1; i < map->l_nsearchlist; ++i)
+  for (i = 0; i < map->l_nsearchlist; ++i)
     --list[i]->l_opencount;
 
-  /* Clear the search list so it doesn't get freed while we are still
-     using it.  We have cached it in LIST and will free it when
-     finished.  */
-  map->l_searchlist = NULL;
-
   /* Check each element of the search list to see if all references to
      it are gone.  */
   for (i = 0; i < map->l_nsearchlist; ++i)
@@ -84,11 +93,6 @@ _dl_close (struct link_map *map)
 	  const ElfW(Phdr) *first, *last;
 	  ElfW(Addr) mapstart, mapend;
 
-	  if (imap->l_info[DT_FINI])
-	    /* Call its termination function.  */
-	    (*(void (*) (void)) ((void *) imap->l_addr +
-				 imap->l_info[DT_FINI]->d_un.d_ptr)) ();
-
 	  if (imap->l_global)
 	    {
 	      /* This object is in the global scope list.  Remove it.  */
@@ -126,7 +130,7 @@ _dl_close (struct link_map *map)
 	    imap->l_prev->l_next = imap->l_next;
 	  if (imap->l_next)
 	    imap->l_next->l_prev = imap->l_prev;
-	  if (imap->l_searchlist)
+	  if (imap->l_searchlist && imap->l_searchlist != list)
 	    free (imap->l_searchlist);
 	  free (imap);
 	}
diff --git a/sysdeps/generic/setenv.c b/sysdeps/generic/setenv.c
index 22ea7e551f..b2ebbadfaa 100644
--- a/sysdeps/generic/setenv.c
+++ b/sysdeps/generic/setenv.c
@@ -69,7 +69,8 @@ __libc_lock_define_initialized (static, envlock)
    allow arbitrary many changes of the environment given that the used
    values are from a small set.  Outside glibc this will eat up all
    memory after a while.  */
-#if defined _LIBC || (defined HAVE_SEARCH_H && defined HAVE_TSEARCH)
+#if defined _LIBC || (defined HAVE_SEARCH_H && defined HAVE_TSEARCH \
+		      && defined __GNUC__)
 # define USE_TSEARCH	1
 # include <search.h>
 
@@ -79,18 +80,11 @@ static void *known_values;
 
 # define KNOWN_VALUE(Str) \
   ({									      \
-    void **value = tfind (Str, &known_values, (__compar_fn_t) strcmp);	      \
-    if (value != NULL)							      \
-      value = *(const char **) value;					      \
-    value;								      \
+    void *value = tfind (Str, &known_values, (__compar_fn_t) strcmp);	      \
+    value != NULL ? *(char **) value : NULL;				      \
   })
 # define STORE_VALUE(Str) \
-  ({									      \
-    void **value = tsearch (Str, &known_values, (__compar_fn_t) strcmp);      \
-    if (value != NULL)							      \
-      value = *(const char **) value;					      \
-    value;								      \
-  })
+  tsearch (Str, &known_values, (__compar_fn_t) strcmp)
 
 #else
 # undef USE_TSEARCH
@@ -186,7 +180,6 @@ setenv (name, value, replace)
     }
   else if (replace)
     {
-      size_t len = strlen (*ep);
       char *new_value;
       char *np;
 
diff --git a/time/tzfile.c b/time/tzfile.c
index 9fab857ecc..1d51a695ff 100644
--- a/time/tzfile.c
+++ b/time/tzfile.c
@@ -415,13 +415,13 @@ find_transition (time_t timer)
 int
 __tzfile_compute (time_t timer, int use_localtime,
 		  long int *leap_correct, int *leap_hit,
-		  int *isdst, long int *offset)
+		  struct tm *tp)
 {
-  struct ttinfo *info = find_transition (timer);
   register size_t i;
 
   if (use_localtime)
     {
+      struct ttinfo *info = find_transition (timer);
       __daylight = rule_stdoff != rule_dstoff;
       __timezone = -rule_stdoff;
       __tzname[1] = NULL;
@@ -432,11 +432,11 @@ __tzfile_compute (time_t timer, int use_localtime,
       if (__tzname[1] == NULL)
 	/* There is no daylight saving time.  */
 	__tzname[1] = __tzname[0];
+      tp->tm_isdst = info->isdst;
+      tp->tm_zone = &zone_names[info->idx];
+      tp->tm_gmtoff = info->offset;
     }
 
-  *isdst = info->isdst;
-  *offset = info->offset;
-
   *leap_correct = 0L;
   *leap_hit = 0;
 
diff --git a/time/tzset.c b/time/tzset.c
index 251967e5c6..4b8fa41021 100644
--- a/time/tzset.c
+++ b/time/tzset.c
@@ -38,7 +38,7 @@ extern int __use_tzfile;
 extern void __tzfile_read __P ((const char *file));
 extern int __tzfile_compute __P ((time_t timer, int use_localtime,
 				  long int *leap_correct, int *leap_hit,
-				  int *isdst, long int *offset));
+				  struct tm *tp));
 extern void __tzfile_default __P ((const char *std, const char *dst,
 				   long int stdoff, long int dstoff));
 extern char *__tzstring __P ((const char *string));
@@ -595,8 +595,6 @@ __tz_convert (const time_t *timer, int use_localtime, struct tm *tp)
 {
   long int leap_correction;
   int leap_extra_secs;
-  int isdst;
-  long int offset;
 
   if (timer == NULL)
     {
@@ -615,8 +613,7 @@ __tz_convert (const time_t *timer, int use_localtime, struct tm *tp)
   if (__use_tzfile)
     {
       if (! __tzfile_compute (*timer, use_localtime,
-			      &leap_correction, &leap_extra_secs,
-			      &isdst, &offset))
+			      &leap_correction, &leap_extra_secs, tp))
 	tp = NULL;
     }
   else
@@ -625,18 +622,20 @@ __tz_convert (const time_t *timer, int use_localtime, struct tm *tp)
 	tp = NULL;
       leap_correction = 0L;
       leap_extra_secs = 0;
-
-      isdst = (*timer >= tz_rules[0].change && *timer < tz_rules[1].change);
-      offset = tz_rules[isdst].offset;
     }
 
   if (tp)
     {
       if (use_localtime)
 	{
-	  tp->tm_isdst = isdst;
-	  tp->tm_zone = __tzname[isdst];
-	  tp->tm_gmtoff = offset;
+	  if (!__use_tzfile)
+	    {
+	      int isdst = (*timer >= tz_rules[0].change
+			   && *timer < tz_rules[1].change);
+	      tp->tm_isdst = isdst;
+	      tp->tm_zone = __tzname[isdst];
+	      tp->tm_gmtoff = tz_rules[isdst].offset;
+	    }
 	}
       else
 	{
diff --git a/timezone/Makefile b/timezone/Makefile
index 3f3f944e8b..410d3834db 100644
--- a/timezone/Makefile
+++ b/timezone/Makefile
@@ -53,7 +53,7 @@ define nl
 
 
 endef
-ifneq ($(no_deps),t)
+ifndef avoid-generated
 -include $(addprefix $(objpfx)z.,$(tzfiles))
 endif
 
@@ -158,9 +158,10 @@ $(objpfx)zic: $(objpfx)scheck.o $(objpfx)ialloc.o
 
 tz-cflags = -DTZDIR='"$(zonedir)"' \
 	    -DTZDEFAULT='"$(localtime-file)"' \
-	    -DTZDEFRULES='"$(posixrules-file)"'
+	    -DTZDEFRULES='"$(posixrules-file)"' \
+	    -DTM_GMTOFF=tm_gmtoff -DTM_ZONE=tm_zone
 
-CFLAGS-zdump.c = -Wno-strict-prototypes -DNOID
+CFLAGS-zdump.c = -Wno-strict-prototypes -DNOID $(tz-cflags)
 CFLAGS-zic.c = -Wno-strict-prototypes -DNOID $(tz-cflags)
 CFLAGS-ialloc.c = -Wno-strict-prototypes -DNOID
 CFLAGS-scheck.c = -Wno-strict-prototypes -DNOID
diff --git a/timezone/zdump.c b/timezone/zdump.c
index f6480bb308..8c4f6ad1df 100644
--- a/timezone/zdump.c
+++ b/timezone/zdump.c
@@ -127,7 +127,7 @@ extern char *	optarg;
 extern int	optind;
 extern char *	tzname[2];
 
-static char *	abbr P((struct tm * tmp));
+static const char *abbr P((struct tm * tmp));
 static long	delta P((struct tm * newp, struct tm * oldp));
 static time_t	hunt P((char * name, time_t lot, time_t	hit));
 static size_t	longest;
@@ -358,15 +358,19 @@ int	v;
 	(void) printf("\n");
 }
 
-static char *
+static const char *
 abbr(tmp)
 struct tm *	tmp;
 {
-	register char *	result;
-	static char	nada;
+	register const char *result;
+	static const char nada;
 
+#ifdef TM_ZONE
+	result = tmp->TM_ZONE;
+#else /* !defined TM_ZONE */
 	if (tmp->tm_isdst != 0 && tmp->tm_isdst != 1)
 		return &nada;
 	result = tzname[tmp->tm_isdst];
+#endif /* !defined TM_ZONE */
 	return (result == NULL) ? &nada : result;
 }