]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Updated to fedora-glibc-20050211T0853
authorJakub Jelinek <jakub@redhat.com>
Fri, 11 Feb 2005 09:01:54 +0000 (09:01 +0000)
committerJakub Jelinek <jakub@redhat.com>
Fri, 11 Feb 2005 09:01:54 +0000 (09:01 +0000)
18 files changed:
ChangeLog
Makeconfig
Makefile
Makerules
Rules
dlfcn/dlfcn.c
fedora/branch.mk
include/libc-symbols.h
linuxthreads/ChangeLog
linuxthreads/descr.h
scripts/lib-names.awk [new file with mode: 0644]
scripts/soversions.awk
shlib-versions
stdlib/Makefile
stdlib/random_r.c
stdlib/tst-random2.c [new file with mode: 0644]
sysdeps/powerpc/bits/link.h [moved from sysdeps/powerpc/powerpc64/bits/link.h with 95% similarity]
sysdeps/powerpc/powerpc32/bits/link.h [deleted file]

index a79fdbe8a4cc21dceef060059fd9db766f6a551e..f37011feb12d28c76f0bf2118d09d906868c11e3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,63 @@
+2005-02-10  Roland McGrath  <roland@redhat.com>
+
+       [BZ #157]
+       * include/libc-symbols.h (stub_warning): Emit a marker section called
+       .gnu.glibc-stub.NAME.
+       * Makerules ($(objpfx)stubs): Depend on object files, not dep files.
+       Use objdump to collect those marker section names.
+       ($(common-objpfx)shlib.lds): Discard .gnu.glibc-stub.* sections.
+
+       * Rules (subdir_objs, subdir_stubs): New phony targets.
+       * Makefile (+subdir_targets): Add them.
+
+       * Makerules ($(common-objpfx)Versions.all): Grok new leading column in
+       soversions.i.
+
+       * scripts/lib-names.awk: Consider [0-9].* a "number", not just [0-9]+.
+       Reported by H.J. Lu <hongjiu.lu@intel.com>.
+
+       * scripts/lib-names.awk: Always print WORDSIZE32 section first when
+       doing two.
+
+2005-02-10  Jakub Jelinek  <jakub@redhat.com>
+
+       * sysdeps/powerpc/powerpc32/bits/link.h: Removed.
+       * sysdeps/powerpc/powerpc64/bits/link.h: Moved to...
+       * sysdeps/powerpc/bits/link.h: ... here.  New file.
+
+2005-02-09  Jakub Jelinek  <jakub@redhat.com>
+
+       [BZ #710]
+       * stdlib/random_r.c (__initstate_r): Save old state.
+       * stdlib/Makefile (tests): Add tst-random2.
+       * stdlib/tst-random2.c: New test.
+       Reported by Peter Bergner <bergner@vnet.ibm.com>.
+
+2005-01-25  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * dlfcn/dlfcn.c (init): Put it in .init_array section.
+
+2005-02-10  Roland McGrath  <roland@redhat.com>
+
+       [BZ #632]
+       * scripts/soversions.awk: Expect cpu, vendor, os as separate variables
+       from command line.
+       Grok shlib-versions lines with WORDSIZE* in second column.
+       Add new leading column to output, DEFAULT for existing output lines.
+       Also emit lines with WORDSIZE* for alternate configurations.
+       * Makeconfig ($(common-objpfx)soversions.i): Pass those variables.
+       ($(common-objpfx)soversions.mk): Grok new column, use only DEFAULT.
+       ($(common-objpfx)gnu/lib-names.stmp): Depend on soversions.i instead
+       of soversions.mk; replace inline shell script with use of ...
+       * scripts/lib-names.awk: New file.  If input has non-DEFAULT lines,
+       emit multiple sets of macros under #if.
+       * shlib-versions (x86_64-.*-.*): Add WORDSIZE32 line mapping to i686.
+       (s390x-.*-.*): Likewise for s390.
+       (powerpc64-.*-.*): Likewise for powerpc.
+       (sparc64-.*-.*): Likewise for sparc.
+       (s390-.*-.*, powerpc.*-.*-.*, sparc.*-.*-.*): Add WORDSIZE64 entries
+       for these mapping back to the above.
+
 2005-02-08  Jakub Jelinek  <jakub@redhat.com>
 
        * elf/dl-load.c (_dl_map_object_from_fd): Fix a typo.
index 5ecda01169ded1f21fee0ed82271f293b62d2b87..306053241d6f0bde8ef9cea45e3e5f062ce9c3d3 100644 (file)
@@ -787,11 +787,14 @@ soversions-default-setname = $(patsubst %, %,\
 $(common-objpfx)soversions.i: $(..)scripts/soversions.awk \
                              $(common-objpfx)shlib-versions.v
        $(AWK) -v default_setname='$(soversions-default-setname)' \
-              -v config='$(config-machine)-$(config-vendor)-$(config-os)' \
+              -v cpu='$(config-machine)' \
+              -v vendor='$(config-vendor)' \
+              -v os='$(config-os)' \
               -f $^ > $@T
        mv -f $@T $@
 $(common-objpfx)soversions.mk: $(common-objpfx)soversions.i
-       (while read lib number setname; do \
+       (while read which lib number setname; do \
+          test x"$$which" = xDEFAULT || continue; \
           case $$number in \
             [0-9]*) echo "$$lib.so-version=.$$number"; \
                     echo "all-sonames+=$$lib=$$lib.so\$$($$lib.so-version)";;\
@@ -812,31 +815,11 @@ postclean-generated += soversions.mk soversions.i \
 before-compile += $(common-objpfx)gnu/lib-names.h
 ifeq ($(soversions.mk-done),t)
 $(common-objpfx)gnu/lib-names.h: $(common-objpfx)gnu/lib-names.stmp; @:
-$(common-objpfx)gnu/lib-names.stmp: $(common-objpfx)soversions.mk
+$(common-objpfx)gnu/lib-names.stmp: $(..)scripts/lib-names.awk \
+                                   $(common-objpfx)soversions.i
        $(make-target-directory)
        @rm -f ${@:stmp=T} $@
-       (echo '/* This file is automatically generated.';\
-        echo '   It defines macros to allow user program to find the shared';\
-        echo '   library files which come as part of GNU libc.  */';\
-        echo '#ifndef __GNU_LIB_NAMES_H'; \
-        echo '#define __GNU_LIB_NAMES_H        1'; \
-        echo; \
-        (libs='$(all-sonames)';\
-         for l in $$libs; do \
-           name=`echo $$l | sed 's/.*=//'`; \
-           upname=`echo $$l | sed 's/=.*//' | \
-                   tr 'abcdefghijklmnopqrstuvwxyz-' \
-                      'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`; \
-           upname2=`echo $$name | sed 's/[.]so.*//' | \
-                    tr 'abcdefghijklmnopqrstuvwxyz-' \
-                       'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`; \
-           echo "#define       $${upname}_SO   \"$$name\""; \
-           if test $$upname != $$upname2; then \
-             echo "#define     $${upname2}_SO  \"$$name\""; \
-           fi; \
-         done;) | sort; \
-        echo; \
-        echo '#endif   /* gnu/lib-names.h */';) > ${@:stmp=T}
+       $(AWK) -f $^ > ${@:stmp=T}
        $(move-if-change) ${@:stmp=T} ${@:stmp=h}
        touch $@
 endif
index 50ee40c26ac0072249caa13960a710208c360a89..c2f4ae32a5b100d2acf930ae9a0ac88a1de19eca 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright (C) 1991-2002, 2003, 2004, 2005 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
@@ -64,7 +64,7 @@ endif # $(AUTOCONF) = no
                   subdir_update-abi subdir_check-abi                   \
                   subdir_echo-headers                                  \
                   subdir_install                                       \
-                  subdir_testclean                                     \
+                  subdir_objs subdir_stubs subdir_testclean            \
                   $(addprefix install-, no-libc.a bin lib data headers others)
 \f
 headers := limits.h values.h features.h gnu-versions.h bits/libc-lock.h \
index 5d7b24f31fb4f84a9dd707f7ea75c2ba06235668..887d7275c35fe6096c3ab554209ff5cc790acc01 100644 (file)
--- a/Makerules
+++ b/Makerules
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright (C) 1991-2002, 2003, 2004, 2005 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
@@ -338,7 +338,8 @@ $(common-objpfx)Versions.def.v.i: $(..)Versions.def \
 $(common-objpfx)Versions.all: $(..)scripts/firstversions.awk \
                              $(common-objpfx)soversions.i \
                              $(common-objpfx)Versions.def.v
-       { while read lib version setname; do \
+       { while read which lib version setname; do \
+           test x"$$which" = xDEFAULT || continue; \
            test -z "$$setname" || echo "$$lib : $$setname"; \
          done < $(word 2,$^); \
          cat $(word 3,$^); \
@@ -491,7 +492,7 @@ $(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules
                 PROVIDE(__start___libc_freeres_ptrs = .); \
                 *(__libc_freeres_ptrs) \
                 PROVIDE(__stop___libc_freeres_ptrs = .);/'\
-             -e 's/^.*\*(\.jcr).*$$/& \
+             -e 's@^.*\*(\.jcr).*$$@& \
                 PROVIDE(__start___libc_subfreeres = .);\
                 __libc_subfreeres : { *(__libc_subfreeres) }\
                 PROVIDE(__stop___libc_subfreeres = .);\
@@ -500,7 +501,8 @@ $(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules
                 PROVIDE(__stop___libc_atexit = .);\
                 PROVIDE(__start___libc_thread_subfreeres = .);\
                 __libc_thread_subfreeres : { *(__libc_thread_subfreeres) }\
-                PROVIDE(__stop___libc_thread_subfreeres = .);/'
+                PROVIDE(__stop___libc_thread_subfreeres = .);\
+                /DISCARD/ : { *(.gnu.glibc-stub.*) }@'
        mv -f $@T $@
 common-generated += shlib.lds
 
@@ -1384,19 +1386,15 @@ ifdef objpfx
 .PHONY: stubs # The parent Makefile calls this target.
 stubs: $(objpfx)stubs
 endif
-$(objpfx)stubs: $(+depfiles)
-ifneq (,$(strip $(+depfiles)))
-# Use /dev/null since `...` might expand to empty.
-       c=`($(patsubst %/,cd % &&,$(objpfx)) \
-           sed -n -e 's@\$$(common-objpfx)@$(common-objpfx)@g' \
-                  -e 's@\$$(objpfx)@$(objpfx)@g' \
-                  -e '/stub-tag\.h/{; g; s/./&/p; }' \
-                  -e '/:/{x; s/^.*$$//; x; }' \
-                  -e 's/^.*://;s/\\$$//;s/^ *\([^ ][^ ]*\) .*$$/\1/' \
-                  -e '/^[^ ][^ ]*$$/{G;s/^.*\n\(..*\)/\1/;s/\n//;h; }' \
-                  $(patsubst $(objpfx)%,%,$^)) | sort | uniq`; \
-       sed -n 's/^stub_warning *(\([^)]*\).*$$/#define __stub_\1/p' \
-           $$c /dev/null > $@T
+objs-for-stubs := $(foreach o,$(object-suffixes-for-libc),$(o-objects)) \
+                 $(addprefix $(objpfx),$(extra-objs))
+$(objpfx)stubs: $(objs-for-stubs)
+ifneq (,$(strip $(objs-for-stubs)))
+       $(OBJDUMP) -h $^ | \
+       $(AWK) '/\.gnu\.glibc-stub\./ { \
+                 sub(/\.gnu\.glibc-stub\./, "", $$2); \
+                 stubs[$$2] = 1; } \
+               END { for (s in stubs) print "#define __stub_" s }' > $@T
        mv -f $@T $@
 else
        > $@
diff --git a/Rules b/Rules
index a29daaa7b5a51f89175b95bd61cb00d5921c33b0..57586110810cdbad14f9f30fbfc936f79ebd83e8 100644 (file)
--- a/Rules
+++ b/Rules
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-2000,2002,2003, 2004 Free Software Foundation, Inc.
+# Copyright (C) 1991-2000,2002,2003, 2004, 2005 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
@@ -165,7 +165,9 @@ distclean: clean
 .PHONY: subdir_install
 subdir_install: install-no-libc.a lib-noranlib stubs
 
-.PHONY: subdir_TAGS
+.PHONY: subdir_objs subdir_stubs subdir_TAGS
+subdir_objs: objs
+subdir_stubs: stubs
 subdir_TAGS: TAGS
 
 # Target required by the Hurd to ensure that all the MiG-generated
index 9c0a84afb82ecf448d8353de78646345dfb7b485..8047150763a370ac9d1970c3cfb5082befb32f24 100644 (file)
 int __dlfcn_argc attribute_hidden;
 char **__dlfcn_argv attribute_hidden;
 
-
-void
-__attribute__ ((constructor))
+#ifdef HAVE_INITFINI_ARRAY
+static void
 init (int argc, char *argv[])
 {
   __dlfcn_argc = argc;
   __dlfcn_argv = argv;
 }
+
+static void (*const init_array []) (int argc, char *argv[])
+     __attribute__ ((section (".init_array"), aligned (sizeof (void *))))
+     __attribute_used__ = { init };
+#else
+# error "Need linker with .init_array support."
+#endif
index 10a2e2b6a4ec60bb11bd6cf74265175d0738d8cb..bdbe9df107af310ad568914d47ac1aca4001ef3f 100644 (file)
@@ -1,5 +1,5 @@
 # This file is updated automatically by Makefile.
 glibc-branch := fedora
 glibc-base := HEAD
-fedora-sync-date := 2005-02-08 22:13 UTC
-fedora-sync-tag := fedora-glibc-20050208T2213
+fedora-sync-date := 2005-02-11 08:53 UTC
+fedora-sync-tag := fedora-glibc-20050211T0853
index dcc46cc80f481bf91bda8ada729378a23634d25a..f3526ca053d13089218f7eb9d1d26097531140c2 100644 (file)
@@ -1,6 +1,6 @@
 /* Support macros for making weak and strong aliases for symbols,
    and for using symbol sets and linker warnings with GNU ld.
-   Copyright (C) 1995-1998,2000-2003,2004 Free Software Foundation, Inc.
+   Copyright (C) 1995-1998,2000-2003,2004, 2005 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
 
 /* A canned warning for sysdeps/stub functions.  */
 #define        stub_warning(name) \
+  __make_section_unallocated (".gnu.glibc-stub." #name) \
   link_warning (name, \
                "warning: " #name " is not implemented and will always fail")
 
index 329f2d8b12132b2f9373f4e162005ed822157ca6..4cbcfbb7a3677fb38a77205e6c224e13fdd6531b 100644 (file)
@@ -1,3 +1,8 @@
+2005-02-09  Daniel Jacobowitz  <dan@codesourcery.com>
+
+       * descr.h (__pthread_find_self, thread_self): Mark as pure
+       instead of const.
+
 2005-02-07  Jakub Jelinek  <jakub@redhat.com>
 
        * specific.c (pthread_key_delete): If pthread_create has not been
index bea8b912f725de524e05dc711686026adcc085ce..2b1e49a0badd9eeb2da47ea21f5327b97890e3c2 100644 (file)
@@ -239,9 +239,9 @@ extern int __pthread_nonstandard_stacks;
 
 /* Recover thread descriptor for the current thread */
 
-extern pthread_descr __pthread_find_self (void) __attribute__ ((const));
+extern pthread_descr __pthread_find_self (void) __attribute__ ((pure));
 
-static inline pthread_descr thread_self (void) __attribute__ ((const));
+static inline pthread_descr thread_self (void) __attribute__ ((pure));
 static inline pthread_descr thread_self (void)
 {
 #ifdef THREAD_SELF
diff --git a/scripts/lib-names.awk b/scripts/lib-names.awk
new file mode 100644 (file)
index 0000000..77e6668
--- /dev/null
@@ -0,0 +1,66 @@
+# awk script for soversions.i -> gnu/lib-names.h; see Makeconfig.
+
+$1 != "DEFAULT" { multi = 1 }
+
+#
+{
+  lib = $2;
+  version = $3;
+  if ($3 !~ /^[0-9]/) {
+    soname = $3;
+    extra = $3;
+    sub(/\.so.*$/, "", extra);
+  }
+  else {
+    soname = lib ".so." $3;
+    extra = "";
+  }
+  soname = "\"" soname "\"";
+  lib = toupper(lib);
+  extra = toupper(extra);
+  gsub(/-/, "_", lib);
+  gsub(/-/, "_", extra);
+  macros[$1 FS lib "_SO"] = soname;
+  if (extra)
+    macros[$1 FS extra "_SO"] = soname;
+}
+
+END {
+  print "/* This file is automatically generated.";
+  print "   It defines macros to allow user program to find the shared";
+  print "   library files which come as part of GNU libc.  */";
+  print "#ifndef __GNU_LIB_NAMES_H";
+  print "#define __GNU_LIB_NAMES_H     1";
+  print "";
+
+  pfx = multi ? "# define " : "#define ";
+  for (elt in macros) {
+    split(elt, x);
+    line = sprintf("%-40s%s", pfx x[2], macros[elt]);
+    if (x[1] in lines)
+      lines[x[1]] = lines[x[1]] "\n" line;
+    else
+      lines[x[1]] = line;
+  }
+
+  if (multi) {
+    # Print these in a fixed order so the result is identical
+    # on both sides of the coin.
+    if (!("WORDSIZE32" in lines))
+      lines["WORDSIZE32"] = lines["DEFAULT"];
+    if (!("WORDSIZE64" in lines))
+      lines["WORDSIZE64"] = lines["DEFAULT"];
+    print "#include <bits/wordsize.h>\n";
+    print "#if __WORDSIZE == 32";
+    cmd = "LC_ALL=C sort"; print lines["WORDSIZE32"] | cmd; close(cmd);
+    print "#else"
+    cmd = "LC_ALL=C sort"; print lines["WORDSIZE64"] | cmd; close(cmd);
+    print "#endif";
+  }
+  else {
+    cmd = "LC_ALL=C sort"; print lines["DEFAULT"] | cmd; close(cmd);
+  }
+
+  print "";
+  print "#endif        /* gnu/lib-names.h */"
+}
index 6207088514a9878b5a3b6cd6b8ab035c89d0cec7..3d50c4deeb63d3e0878aa1167c1c31b76a2113c9 100644 (file)
@@ -1,14 +1,29 @@
-# awk script for shlib-versions.v.i -> soversions.i; see Makeconfig.
+# awk script for shlib-versions.v -> soversions.i; see Makeconfig.
 
-# Only lines matching `config' (set with -v) are relevant to us.
-config !~ $1 { next }
+BEGIN {
+  config = cpu "-" vendor "-" os;
+  configs[config] = "DEFAULT";
+}
+
+{ thiscf = $1 }
+
+$2 ~ /WORDSIZE[3264]/ {
+  if (config ~ thiscf) {
+    othercf = $3;
+    sub(/@CPU@/, cpu, othercf);
+    sub(/@VENDOR@/, vendor, othercf);
+    sub(/@OS@/, os, othercf);
+    configs[othercf] = $2;
+  }
+  next;
+}
 
 # Obey the first matching DEFAULT line.
 $2 == "DEFAULT" {
-  if (!matched_default) {
-    matched_default = 1;
+  if (!matched_default[thiscf]) {
+    matched_default[thiscf] = 1;
     $1 = $2 = "";
-    default_setname = $0;
+    default_set[thiscf] = $0;
   }
   next
 }
@@ -19,20 +34,33 @@ $2 == "DEFAULT" {
   lib = number = $2;
   sub(/=.*$/, "", lib);
   sub(/^.*=/, "", number);
-  if (lib in numbers) next;
-  numbers[lib] = number;
+  if ((thiscf FS lib) in numbers) next;
+  numbers[thiscf FS lib] = number;
+  order[thiscf FS lib] = ++order_n;
   if (NF > 2) {
     $1 = $2 = "";
-    versions[lib] = $0
+    versions[thiscf FS lib] = $0
   }
 }
 
 END {
-  for (lib in numbers) {
-    set = (lib in versions) ? versions[lib] : default_setname;
-    if (set)
-      print lib, numbers[lib], set;
-    else
-      print lib, numbers[lib];
+  for (elt in numbers) {
+    split(elt, x);
+    cf = x[1];
+    lib = x[2];
+    if (default_setname && !(cf in default_set) && config ~ cf)
+      default_set[cf] = default_setname;
+    set = (elt in versions) ? versions[elt] : default_set[cf];
+    line = set ? (lib FS numbers[elt] FS set) : (lib FS numbers[elt]);
+    for (c in configs)
+      if (c ~ cf) {
+       if (!((c FS lib) in lineorder) || order[elt] < lineorder[c FS lib]) {
+         lineorder[c FS lib] = order[elt];
+         lines[c FS lib] = configs[c] FS line;
+       }
+      }
+  }
+  for (c in lines) {
+    print lines[c]
   }
 }
index 72cbb4af0edc367076923f81b92126e1de70bb5b..aaeb9669b2d014e3d27092c54051096317989f89 100644 (file)
 # to apply on matching configurations when the matching entry for a particular
 # library has no third column.  The defaults must precede the entries they
 # apply to.
+#
+# An entry with WORDSIZE* in the second column gives an alternate
+# configuration tuple whose macros will be conditionally defined in
+# gnu/lib-names.h; @CPU@, @VENDOR@, @OS@ can be used in the third
+# column to compose the alternate tuple matched against the patterns here.
 
 # Configuration                DEFAULT                 Earliest symbol set
 # -------------                ---------------         ------------------------------
@@ -27,6 +32,16 @@ x86_64-.*-linux.*       DEFAULT                      GLIBC_2.2.5
 powerpc64-.*-linux.*   DEFAULT                 GLIBC_2.3
 .*-.*-gnu-gnu.*                DEFAULT                 GLIBC_2.2.6
 
+# Configuration                WORDSIZE[32|64]         Alternate configuration
+# -------------                ----------              -----------------------
+x86_64-.*-.*           WORDSIZE32              i686-@VENDOR@-@OS@
+s390x-.*-.*            WORDSIZE32              s390-@VENDOR@-@OS@
+s390-.*-.*             WORDSIZE64              s390x-@VENDOR@-@OS@
+powerpc64-.*-.*                WORDSIZE32              powerpc-@VENDOR@-@OS@
+powerpc.*-.*-.*                WORDSIZE64              powerpc64-@VENDOR@-@OS@
+sparc64-.*-.*          WORDSIZE32              sparc-@VENDOR@-@OS@
+sparc.*-.*-.*          WORDSIZE64              sparc64-@VENDOR@-@OS@
+
 # Configuration                Library=version         Earliest symbol set (optional)
 # -------------                ---------------         ------------------------------
 
index a0c0e71704c1b2ede1230cb8d11ab6d3247e5834..fafe6061a02b733a3a09731a4c5fd86bc0308b80 100644 (file)
@@ -61,9 +61,9 @@ distribute    := exit.h grouping.h abort-instr.h isomac.c tst-fmtmsg.sh   \
 test-srcs      := tst-fmtmsg
 tests          := tst-strtol tst-strtod testmb testrand testsort testdiv   \
                   test-canon test-canon2 tst-strtoll tst-environ           \
-                  tst-xpg-basename tst-random tst-bsearch tst-limits       \
-                  tst-rand48 bug-strtod tst-setcontext test-a64l tst-qsort \
-                  tst-system testmb2
+                  tst-xpg-basename tst-random tst-random2 tst-bsearch      \
+                  tst-limits tst-rand48 bug-strtod tst-setcontext          \
+                  test-a64l tst-qsort tst-system testmb2
 
 include ../Makeconfig
 
index 09677e6077e3e51737a37660a5051971da6a38ca..c85fd5eeef1f6dee9877bbcafdc95064d99a345c 100644 (file)
@@ -1,5 +1,5 @@
 /* 
-   Copyright (C) 1995 Free Software Foundation
+   Copyright (C) 1995, 2005 Free Software Foundation
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -240,10 +240,19 @@ __initstate_r (seed, arg_state, n, buf)
   int degree;
   int separation;
   int32_t *state;
+  int old_type;
+  int32_t *old_state;
 
   if (buf == NULL)
     goto fail;
 
+  old_type = buf->rand_type;
+  old_state = buf->state;
+  if (old_type == TYPE_0)
+    old_state[-1] = TYPE_0;
+  else
+    old_state[-1] = (MAX_TYPES * (buf->rptr - old_state)) + old_type;
+
   if (n >= BREAK_3)
     type = n < BREAK_4 ? TYPE_3 : TYPE_4;
   else if (n < BREAK_1)
diff --git a/stdlib/tst-random2.c b/stdlib/tst-random2.c
new file mode 100644 (file)
index 0000000..aa1b89d
--- /dev/null
@@ -0,0 +1,59 @@
+/* Test initstate saving the old state.
+   Copyright (C) 2005 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2005.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+main (void)
+{
+  int pass;
+  int ret = 0;
+  long int r[2];
+
+  for (pass = 0; pass < 2; pass++)
+    {
+      srandom (0x12344321);
+
+      int j;
+      for (j = 0; j < 3; ++j)
+       random ();
+      if (pass == 1)
+       {
+         char state[128];
+         char *ostate = initstate (0x34562101, state, 128);
+         if (setstate (ostate) != state)
+           {
+             puts ("setstate (ostate) != state");
+             ret = 1;
+           }
+       }
+
+      random ();
+      r[pass] = random ();
+    }
+
+  if (r[0] != r[1])
+    {
+      printf ("%ld != %ld\n", r[0], r[1]);
+      ret = 1;
+    }
+  return ret;
+}
similarity index 95%
rename from sysdeps/powerpc/powerpc64/bits/link.h
rename to sysdeps/powerpc/bits/link.h
index 863336241a1afe180e55fe7e133d2dc2875d907f..f8e6734fe0b1b1797619c0e6e5251c8c49634860 100644 (file)
@@ -1,4 +1,5 @@
-/* Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+/* Machine-specific declarations for dynamic linker interface.  PowerPC version
+   Copyright (C) 2004, 2005 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
diff --git a/sysdeps/powerpc/powerpc32/bits/link.h b/sysdeps/powerpc/powerpc32/bits/link.h
deleted file mode 100644 (file)
index 7f44087..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Copyright (C) 2004, 2005 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 Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 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
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef        _LINK_H
-# error "Never include <bits/link.h> directly; use <link.h> instead."
-#endif
-
-
-/* Registers for entry into PLT on PPC32.  */
-typedef struct La_ppc32_regs
-{
-  uint32_t lr_reg[8];
-  double lr_fp[8];
-  uint32_t lr_vreg[12][4];
-  uint32_t lr_r1;
-  uint32_t lr_lr;
-} La_ppc32_regs;
-
-/* Return values for calls from PLT on PPC32.  */
-typedef struct La_ppc32_retval
-{
-  uint32_t lrv_r3;
-  uint32_t lrv_r4;
-  double lrv_fp[8];
-  uint32_t lrv_v2[4];
-} La_ppc32_retval;
-
-
-__BEGIN_DECLS
-
-extern Elf32_Addr la_ppc32_gnu_pltenter (Elf32_Sym *__sym,
-                                        unsigned int __ndx,
-                                        uintptr_t *__refcook,
-                                        uintptr_t *__defcook,
-                                        La_ppc32_regs *__regs,
-                                        unsigned int *__flags,
-                                        const char *__symname,
-                                        long int *__framesizep);
-extern unsigned int la_ppc32_gnu_pltexit (Elf32_Sym *__sym,
-                                         unsigned int __ndx,
-                                         uintptr_t *__refcook,
-                                         uintptr_t *__defcook,
-                                         const La_ppc32_regs *__inregs,
-                                         La_ppc32_retval *__outregs,
-                                         const char *symname);
-
-__END_DECLS