summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2005-03-19 21:04:10 +0000
committerJakub Jelinek <jakub@redhat.com>2005-03-19 21:04:10 +0000
commit8f8ebbc438fcb4b22fba8beb3ef3d1aa59d9d7bf (patch)
treeb7091affa76bbaf47e78a59dfc72b2102554eaf9
parentf5c3480e830e94e0e51a0bdb1053944daed8bc58 (diff)
Updated to fedora-glibc-20050319T1907cvs/fedora-glibc-2_3_4-15
-rw-r--r--ChangeLog351
-rw-r--r--config.make.in1
-rwxr-xr-xconfigure13
-rw-r--r--configure.in10
-rw-r--r--debug/pread64_chk.c2
-rw-r--r--debug/pread_chk.c2
-rw-r--r--debug/recv_chk.c9
-rw-r--r--debug/recvfrom_chk.c10
-rw-r--r--debug/tst-chk1.c2
-rw-r--r--elf/Makefile32
-rw-r--r--elf/circleload1.c26
-rw-r--r--elf/dl-addr.c3
-rw-r--r--elf/dl-close.c355
-rw-r--r--elf/dl-deps.c6
-rw-r--r--elf/dl-error.c6
-rw-r--r--elf/dl-fini.c185
-rw-r--r--elf/dl-load.c5
-rw-r--r--elf/dl-lookup.c21
-rw-r--r--elf/dl-open.c187
-rw-r--r--elf/dl-version.c10
-rw-r--r--elf/do-lookup.h11
-rw-r--r--elf/dynamic-link.h12
-rw-r--r--elf/elf.h17
-rw-r--r--elf/loadtest.c8
-rw-r--r--elf/neededtest.c2
-rw-r--r--elf/neededtest2.c2
-rw-r--r--elf/neededtest3.c2
-rw-r--r--elf/neededtest4.c2
-rw-r--r--elf/order2.c46
-rw-r--r--elf/order2mod1.c8
-rw-r--r--elf/order2mod2.c18
-rw-r--r--elf/order2mod3.c14
-rw-r--r--elf/order2mod4.c16
-rw-r--r--elf/rtld.c144
-rw-r--r--elf/testobj2.c1
-rw-r--r--elf/tls-macros.h4
-rw-r--r--elf/unload.c4
-rw-r--r--elf/unload2.c4
-rw-r--r--elf/unload3mod4.c2
-rw-r--r--elf/unload4.c48
-rw-r--r--elf/unload4mod1.c10
-rw-r--r--elf/unload4mod2.c8
-rw-r--r--elf/unload4mod3.c16
-rw-r--r--elf/unload4mod4.c16
-rw-r--r--elf/unload5.c42
-rw-r--r--fedora/branch.mk4
-rw-r--r--iconv/gconv_simple.c4
-rw-r--r--include/libc-symbols.h77
-rw-r--r--include/link.h5
-rw-r--r--include/wchar.h1
-rw-r--r--inet/test-ifaddrs.c9
-rw-r--r--inet/test_ifindex.c9
-rw-r--r--libidn/ChangeLog10
-rw-r--r--libidn/iconvme.c18
-rw-r--r--libio/bits/stdio2.h56
-rw-r--r--libio/iofwide.c32
-rw-r--r--linuxthreads/ChangeLog11
-rw-r--r--linuxthreads/sysdeps/i386/Makefile2
-rw-r--r--locale/weightwc.h14
-rw-r--r--localedata/ChangeLog8
-rw-r--r--localedata/SUPPORTED1
-rw-r--r--localedata/locales/pa_IN8
-rw-r--r--malloc/arena.c11
-rw-r--r--malloc/malloc.c85
-rw-r--r--malloc/malloc.h1
-rw-r--r--math/test-misc.c42
-rw-r--r--misc/sys/cdefs.h7
-rw-r--r--nptl/ChangeLog4
-rw-r--r--nptl/tst-getpid1.c4
-rw-r--r--nscd/aicache.c2
-rw-r--r--posix/bits/unistd.h96
-rw-r--r--posix/regcomp.c12
-rw-r--r--posix/regex_internal.c42
-rw-r--r--posix/regexec.c6
-rw-r--r--socket/bits/socket2.h39
-rw-r--r--stdio-common/printf-prs.c7
-rw-r--r--string/bits/string3.h27
-rw-r--r--string/strcoll.c6
-rw-r--r--sunrpc/Makefile5
-rw-r--r--sunrpc/des_impl.c6
-rw-r--r--sunrpc/key_call.c83
-rw-r--r--sysdeps/alpha/dl-machine.h5
-rw-r--r--sysdeps/arm/dl-machine.h17
-rw-r--r--sysdeps/generic/dl-machine.h9
-rw-r--r--sysdeps/generic/ldsodefs.h10
-rw-r--r--sysdeps/generic/strchrnul.c6
-rw-r--r--sysdeps/generic/tls-macros.h12
-rw-r--r--sysdeps/generic/wordexp.c2
-rw-r--r--sysdeps/gnu/errlist-compat.awk7
-rw-r--r--sysdeps/gnu/errlist.awk7
-rw-r--r--sysdeps/gnu/errlist.c5
-rwxr-xr-xsysdeps/hppa/configure1
-rw-r--r--sysdeps/hppa/configure.in1
-rw-r--r--sysdeps/i386/Makefile2
-rwxr-xr-xsysdeps/i386/configure3
-rw-r--r--sysdeps/i386/configure.in3
-rw-r--r--sysdeps/i386/dl-machine.h2
-rw-r--r--sysdeps/i386/i486/Makefile4
-rw-r--r--sysdeps/i386/i686/hp-timing.h24
-rw-r--r--sysdeps/powerpc/bits/link.h7
-rw-r--r--sysdeps/powerpc/powerpc64/dl-trampoline.S441
-rw-r--r--sysdeps/sparc/sparc32/dl-machine.h11
-rw-r--r--sysdeps/sparc/sparc64/dl-machine.h11
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips32/kern64/sysdep.h0
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h4
-rw-r--r--sysdeps/unix/sysv/linux/sh/bits/mman.h4
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/mman.h6
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/makecontext.c20
-rw-r--r--sysdeps/x86_64/hp-timing.h10
-rw-r--r--test-skeleton.c6
-rw-r--r--time/mktime.c5
-rw-r--r--wcsmbs/mbrtowc.c6
-rw-r--r--wcsmbs/mbsnrtowcs.c6
-rw-r--r--wcsmbs/mbsrtowcs_l.c12
-rw-r--r--wcsmbs/wcrtomb.c6
-rw-r--r--wcsmbs/wcscoll.c3
-rw-r--r--wcsmbs/wcsnrtombs.c6
-rw-r--r--wcsmbs/wcsrtombs.c6
-rw-r--r--wcsmbs/wctob.c4
119 files changed, 2021 insertions, 1120 deletions
diff --git a/ChangeLog b/ChangeLog
index 043c0d90af..1bd2b68cb6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,15 +1,358 @@
-2005-03-05 Jakub Jelinek <jakub@redhat.com>
+2005-03-19 Ulrich Drepper <drepper@redhat.com>
- * Makerules ($(inst_libdir)/libc.so): Use $(slibdir) instead of
- $(inst_slibdir) in AS_NEEDED directive.
+ * inet/test-ifaddrs.c: Use test-skeleton.
+ * inet/test_ifindex.c: Likewise.
+
+ * elf/dl-lookup.c (add_dependency): Always search l_initfini if
+ the list exists.
+
+ * elf/Makefile: Add rules to build and run order2.
+ * elf/order2.c: New file.
+ * elf/order2mod1.c: New file.
+ * elf/order2mod2.c: New file.
+ * elf/order2mod3.c: New file.
+ * elf/order2mod4.c: New file.
+
+2005-03-19 Jakub Jelinek <jakub@redhat.com>
+
+ * elf/dl-open.c (dl_open_worker): Print exact l_direct_opencount value,
+ it has been incremented before.
+
+2005-03-18 Ulrich Drepper <drepper@redhat.com>
+
+ * elf/dl-fini.c (_dl_fini): Split sorting of the maps in separate
+ function _dl_sort_fini.
+ (_dl_sort_fini): New function.
+ * sysdeps/generic/ldsodefs.h: Declare _dl_sort_fini.
+ * elf/dl-close.c (_dl_close): Call _dl_sort_fini before running
+ destructors to call them in the right order.
+
+2005-02-07 Steven Munroe <sjmunroe@us.ibm.com>
+
+ * sysdeps/powerpc/bits/link.h (La_ppc64_regs): Add lr_vrsave.
+ (La_ppc64_retval): Correct size of lrc_fp.
+ * sysdeps/powerpc/powerpc64/dl-trampoline.S (_dl_profile_resolve):
+ Fix up ABI problems and complete function.
+
+2005-03-10 Jakub Jelinek <jakub@redhat.com>
+
+ * math/test-misc.c (main): Add some more tests.
+
+2005-03-17 Jakub Jelinek <jakub@redhat.com>
+
+ * posix/regcomp.c (re_compile_fastmap_iter): Fix check for failed
+ __wcrtomb. Check return values of other __wcrtomb calls.
+ * posix/regex_internal.c (build_wcs_buffer, re_string_skip_chars):
+ Change mbclen type to size_t.
+ (build_wcs_upper_buffer): Change mbclen and mbcdlen type to size_t.
+ Handle mb chars whose upper case doesn't have multibyte representation
+ in locale's charset.
+
+2005-03-15 Jakub Jelinek <jakub@redhat.com>
+
+ * malloc/malloc.c (_int_icalloc, _int_icomalloc, iALLOc,
+ public_iCALLOc, public_iCALLOc, public_iCOMALLOc): Protect with
+ #ifndef _LIBC.
+
+ [BZ #779]
+ * malloc/malloc.c (public_mTRIm): Initialize malloc if not yet
+ initialized.
+
+2005-03-10 Jakub Jelinek <jakub@redhat.com>
+
+ * misc/sys/cdefs.h (__always_inline): Define.
+ * posix/bits/unistd.h (read, pread, pread64, readlink, getcwd, getwd):
+ Use __always_inline instead of __inline.
+ * socket/bits/socket2.h (recv, recvfrom): Likewise.
+ * libio/bits/stdio2.h (gets, fgets, fgets_unlocked): Likewise.
+ * string/bits/string3.h (__memcpy_ichk, __memmove_ichk, __mempcpy_ichk,
+ __memset_ichk, __strcpy_ichk, __stpcpy_ichk, __strncpy_ichk,
+ __strcat_ichk, __strncat_ichk): Use __always_inline instead of
+ __inline__ __attribute__ ((__always_inline__)).
+
+2005-03-09 Jakub Jelinek <jakub@redhat.com>
+
+ * debug/tst-chk1.c: Include sys/socket.h and sys/un.h.
+ (do_test): Add new tests for recv, recvfrom, getcwd, getwd and
+ readlink. Add some more tests for read, pread, pread64, fgets and
+ fgets_unlocked.
+
+ * posix/bits/unistd.h (read, pread, pread64, readlink,
+ getcwd, getwd): Change macros into extern inline functions.
+ (__read_alias, __pread_alias, __pread64_alias, __readlink_alias,
+ __getcwd_alias, __getwd_alias): New prototypes.
+ * socket/bits/socket2.h (recv, recvfrom): Change macros into
+ extern inline functions.
+ (__recv_alias, __recvfrom_alias): New prototypes.
+ * libio/bits/stdio2.h (gets, fgets, fgets_unlocked): Change macros
+ into extern inline functions.
+ (__gets_alias, __fgets_alias, __fgets_unlocked_alias): New prototypes.
+
+ * debug/pread_chk.c (__pread_chk): Fix order of arguments passed
+ to __pread.
+ * debug/pread64_chk.c (__pread64_chk): Fix order of arguments passed
+ to __pread64.
+
+2005-03-18 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * configure.in: Use %function instead of @function.
+
+2005-03-18 Ulrich Drepper <drepper@redhat.com>
+
+ * include/link.h (struct link_map): Remove l_opencount. Add l_removed.
+ Change type of l_idx to int.
+ * elf/dl-close.c: Basically rewrite. Do not use l_opencount to
+ determine whether a DSO has to be unloaded. Instead compute this
+ in this function.
+ * elf/dl-deps.c: No need to manipulate l_opencount anymore.
+ * elf/dl-lookup.c: Likewise.
+ * elf/rtld.c: Likewise
+ * elf/dl-open.c: Likewise. Use l_init_called to determine whether
+ object was just loaded.
+ * elf/dl-fini.c: Bump l_direct_opencount instead of l_opencount.
+ * elf/dl-load.c (_dl_map_object_from_fd): Do not recognize DSO which
+ is about to be unloaded as a match.
+ (_dl_map_object): Likewise.
+ * elf/do-lookup.h (do_lookup_x): Do not look into DSO which is about
+ to be unloaded.
+ * elf/circleload1.c: Don't use l_opencount anymore.
+ * elf/neededtest.c: Likewise.
+ * elf/neededtest2.c: Likewise.
+ * elf/neededtest3.c: Likewise.
+ * elf/neededtest4.c: Likewise.
+ * elf/unload.c: Likewise.
+ * elf/unload2.c: Likewise.
+ * elf/loadtest.c: Likewise.
+
+ * elf/rtld.c: Preloading errors are now never fatal.
+
+2005-03-08 Jakub Jelinek <jakub@redhat.com>
+
+ * elf/Makefile: Add rules to build and run unload5 test.
+ * elf/unload5.c: New file.
+
+2005-03-08 Jakub Jelinek <jakub@redhat.com>
+
+ * elf/Makefile: Add rules to build and run unload4 test.
+ * elf/unload4.c: New file.
+ * elf/unload4mod1.c: New file.
+ * elf/unload4mod2.c: New file.
+ * elf/unload4mod3.c: New file.
+ * elf/unload4mod4.c: New file.
+
+2005-03-17 Roland McGrath <roland@redhat.com>
+
+ * nscd/aicache.c (addhstaiX): Tweak type to avoid warning.
+
+2005-03-16 Richard Henderson <rth@redhat.com>
+
+ * include/libc-symbols.h (__hidden_proto): Remove bogus declaration
+ of internal.
+ (__hidden_def1, __hidden_dot_def1): Remove.
+ (__hidden_def2, __hidden_def3): Remove.
+ (__hidden_ver1): New.
+ (hidden_ver, hidden_def, hidden_weak): Use it.
+ (hidden_data_ver, hidden_data_ver, hidden_data_weak): Use non-data
+ version of the macro.
+
+ * include/wchar.h (__wcscoll): Remove.
+ * wcsmbs/wcscoll.c: Define wcscoll directly instead of via __wcscoll.
+ * string/strcoll.c: Don't issue libc_hidden_def STRCOLL redefined.
+
+2005-03-16 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * elf/elf.h: Define MIPS TLS relocations.
+
+2005-03-16 Ulrich Drepper <drepper@redhat.com>
+
+ * elf/circleload1.c (main): Pretty printing.
+
+2005-03-15 Jakub Jelinek <jakub@redhat.com>
+
+ * sysdeps/generic/wordexp.c (exec_comm_child): Add inline keyword.
+ Patch by Dan Kegel <dank@kegel.com>.
+
+ * elf/dynamic-link.h (elf_machine_rel, elf_machine_rel_relative,
+ elf_machine_rela, elf_machine_rela_relative, elf_machine_lazy_rel):
+ Add inline keyword.
+ * sysdeps/alpha/dl-machine.h (elf_machine_rela,
+ elf_machine_rela_relative, elf_machine_lazy_rel): Add always_inline
+ attribute.
+ * sysdeps/sparc/sparc32/dl-machine.h (elf_machine_rela,
+ elf_machine_rela_relative, elf_machine_lazy_rel): Likewise. Change
+ static inline into auto inline.
+ * sysdeps/sparc/sparc64/dl-machine.h (elf_machine_rela,
+ elf_machine_rela_relative, elf_machine_lazy_rel): Likewise.
+ * sysdeps/generic/dl-machine.h (elf_machine_rel, elf_machine_rela):
+ Likewise.
+ * sysdeps/arm/dl-machine.h (elf_machine_rel, elf_machine_rel_relative,
+ elf_machine_rela, elf_machine_rela_relative, elf_machine_lazy_rel):
+ Likewise.
+
+2005-03-15 Jakub Jelinek <jakub@redhat.com>
+
+ [BZ #789]
+ * sysdeps/i386/i686/hp-timing.h (HP_TIMING_ACCUM): Fix asm constraints.
+ Remove memory clobber.
+
+ * sysdeps/x86_64/hp-timing.h (HP_TIMING_ACCUM): Make the addition
+ thread-safe. Subtract GLRO(dl_hp_timing_overhead) from Diff.
+
+2005-03-14 Jakub Jelinek <jakub@redhat.com>
+
+ * sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h: Don't include
+ asm/types.h.
+
+2005-03-10 GOTO Masanori <gotom@debian.or.jp>
+
+ * sysdeps/unix/sysv/linux/sh/bits/mman.h: Define MAP_POPULATE and
+ MAP_NONBLOCK.
+ * sysdeps/unix/sysv/linux/sparc/bits/mman.h: Likewise.
+ Correct MAP_GROWSDOWN value.
+
+2005-03-13 Roland McGrath <roland@redhat.com>
+
+ * elf/tls-macros.h: #include_next <tls-macros.h> to get a sysdeps
+ version if there is one. Only #error if macros are then undefined.
+ * sysdeps/generic/tls-macros.h: New file.
+
+2005-03-10 GOTO Masanori <gotom@debian.or.jp>
+
+ * sysdeps/hppa/configure.in: Remove old Makefile leftovers.
+ * sysdeps/hppa/configure: Regenerated.
+
+2005-03-08 Roland McGrath <roland@redhat.com>
+
+ * sysdeps/gnu/errlist-compat.awk: Use NERR in all array decls, so
+ array types match exactly in C alias decls.
+
+2005-03-07 Ulrich Drepper <drepper@redhat.com>
+
+ * malloc/arena.c (ptmalloc_init): Recognize MALLOC_PERTURB_ and call
+ mallopt appropriately.
+ * malloc/malloc.h: Define M_PERTURB.
+ * malloc/malloc.c (perturb_byte): New variable.
+ (alloc_perturb, free_perturb): New macros.
+ (_int_malloc): Before returning, overwrite the memory if this is
+ requested.
+ (_int_free): Overwrite freed memory if requested.
+ (mALLOPt): Handle M_PERTURB.
+ * test-skeleton.c: Add call to mallopt with M_PERTURB command.
+
+ * elf/dl-close.c (_dl_close): Decrement l_opencount before
+ printing debug message.
+ * elf/dl-open.c (dl_open_worker): Always print the new opencount
+ in debug messages.
+
+2005-03-06 Ulrich Drepper <drepper@redhat.com>
+
+ * elf/dl-close.c (_dl_close): Unify debug message format.
+
+ * elf/dl-close.c (_dl_close): Print debug message just before
+ destroying a link map.
+
+ * elf/do-lookup.h (do_lookup_x): Add namespace info to debug output.
+ * elf/dl-version.c (match_symbol): Likewise.
+
+ * posix/bits/unistd.h (pread): Fix typo in __USE_FILE_OFFSET64 code.
+
+ * debug/recv_chk.c (__recv_chk): Always fail if request could
+ overflow the buffer.
+ * debug/recvfrom_chk.c (__recvfrom_chk): Likewise.
+ * socket/bits/socket2.h (recv): Avoid calls to the _chk variant if
+ we know the call succeeds.
+ (recvfrom): Likewise.
+
+2005-03-05 Ulrich Drepper <drepper@redhat.com>
+
+ * posix/regexec.c (check_node_accept_bytes): Correct cast to avoid
+ warning.
+ * posix/regex_internal.c (re_string_reconstruct): Add cast to
+ avoid warning.
+ (build_wcs_upper_buffer): Change type of bug to plain char.
+ * locale/weightwc.h (findidx): Add casts to avoid warnings.
+ * time/mktime.c (ranged_convert): Initialize tm to make the
+ compiler happy.
+ * wcsmbs/mbsrtowcs_l.c (__mbsrtowcs_l): Add casts to avoid warnings.
+ * wcsmbs/wcsnrtombs.c (__wcsnrtombs): Add casts to avoid warnings.
+ * wcsmbs/mbsnrtowcs.c: Add casts to avoid warnings.
+ * wcsmbs/wcsrtombs.c (__wcsrtombs): Add casts to avoid warnings.
+ * wcsmbs/wcrtomb.c (__wcrtomb): Add casts to avoid warnings.
+ * wcsmbs/mbrtowc.c (__mbrtowc): Use unsigned char for outbuf.
+ * wcsmbs/wctob.c (wctob): Make buf array of unsigned char.
+ * sysdeps/generic/strchrnul.c: Add cast to avoid warning.
+ * libio/iofwide.c: Add casts to avoid warnings.
+ * stdio-common/printf-prs.c (parse_printf_format): Introduce new
+ variable f to avoid warnings.
+ * sysdeps/unix/sysv/linux/x86_64/makecontext.c (__makecontext):
+ Fix a few casts to avoid warnings.
+ * iconv/gconv_simple.c (internal_utf8_loop): Make start unsigned
+ to avoid warning.
+
+ * posix/regex_internal.c [_LIBC] (build_wcs_buffer): Avoid using
+ dynamically sized array.
+ (build_wcs_upper_buffer): Likewise.
+
+2005-03-05 Jakub Jelinek <jakub@redhat.com>
* include/bits/unistd.h: New file.
* include/bits/socket2.h: New file.
+2005-03-05 Ulrich Drepper <drepper@redhat.com>
+
+ * sunrpc/key_call.c: Remove doors support.
+ * sunrpc/Makefile: Remove CPPFLAGS-key_call.c definition.
+ * configure.in: Remove test for doors support which never existed.
+ * config.make.in: Remove have_doors entry.
+
+ * configure.in: Make sure at least gcc 3.4 is used. Undo last change.
+ * config.make.in: Undo last change.
+
+ * sysdeps/i386/Makefile (CFLAGS-initfini.s): Unconditionally use
+ -mtune.
+
+2005-03-05 Roland McGrath <roland@redhat.com>
+
+ * sysdeps/generic/ldsodefs.h (_dl_out_of_memory_internal): Remove decl.
+ (_dl_out_of_memory): Use rtld_hidden_proto.
+ * elf/dl-error.c (_dl_out_of_memory): Use rtld_hidden_data_def.
+ (_dl_signal_error): Don't use INTUSE on _dl_out_of_memory.
+ * elf/dl-open.c (_dl_open): Likewise.
+ * elf/dl-deps.c (_dl_map_object_deps): Likewise.
+
+ * sunrpc/des_impl.c (des_set_key): Make first argument unsigned char *.
+
+ * elf/dl-addr.c (_dl_addr): Add a cast.
+
+ * elf/unload3mod4.c: Declare foo.
+ * elf/testobj2.c: Include <stdio.h>.
+
+ * sysdeps/gnu/errlist.awk: Emit NERR macro for _sys_nerr_internal
+ value constant, and use it in the defn.
+ * sysdeps/gnu/errlist-compat.awk: Use NERR in array decl.
+ Use actual size for compat array decls.
+
+ * config.make.in (cc-mtune): New substituted variable.
+ * configure.in (libc_cv_cc_mtune): New test for -mtune= switch,
+ done only if libc_mtune_example is defined.
+ * sysdeps/i386/configure.in (libc_mtune_example): Set it.
+ * sysdeps/i386/Makefile (CFLAGS-initfini.s): Use $(cc-mtune).
+
+2005-03-05 Jakub Jelinek <jakub@redhat.com>
+
* sysdeps/i386/dl-machine.h (ELF_MACHINE_NO_RELA): Define
unconditionally to (defined RTLD_BOOTSTRAP).
* sysdeps/arm/dl-machine.h (ELF_MACHINE_NO_RELA): Likewise.
+2005-03-05 Jakub Jelinek <jakub@redhat.com>
+
+ * Makerules ($(inst_libdir)/libc.so): Use $(slibdir) instead of
+ $(inst_slibdir) in AS_NEEDED directive.
+
+2005-03-03 Jakub Jelinek <jakub@redhat.com>
+
+ * posix/bits/unistd.h (pread, pread64): Don't swap function arguments.
+
2005-03-01 H.J. Lu <hongjiu.lu@intel.com>
[BZ #776]
@@ -52,9 +395,11 @@
2005-03-01 Alfred M. Szmidt <ams@gnu.org>
+ [BZ #777]
* elf/dl-load.c (__stack_prot) [!PROT_GROWSUP && !PROT_GROWSDOWN]:
Add missing initializer.
+ [BZ #777]
* malloc/arena.c: #include <stdbool.h> outside of [SHARED &&
USE_TLS && !USE___THREAD].
diff --git a/config.make.in b/config.make.in
index 81cb95b77f..1bd025e97e 100644
--- a/config.make.in
+++ b/config.make.in
@@ -69,7 +69,6 @@ versioning = @VERSIONING@
oldest-abi = @oldest_abi@
no-whole-archive = @no_whole_archive@
exceptions = @exceptions@
-have_doors = @linux_doors@
mach-interface-list = @mach_interface_list@
diff --git a/configure b/configure
index 1e9e50c491..e7f1afb18a 100755
--- a/configure
+++ b/configure
@@ -313,7 +313,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs enable_check_abi oldest_abi bindnow force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os subdirs add_ons base_machine sysnames INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX AR OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF SYSINCLUDES libc_cv_gcc_static_libgcc BASH libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO BISON VERSIONING libc_cv_asm_protected_directive libc_cv_initfinit_array libc_cv_cc_with_libunwind libc_cv_z_nodelete libc_cv_z_nodlopen libc_cv_z_initfirst libc_cv_z_relro libc_cv_Bgroup libc_cv_libgcc_s_suffix libc_cv_as_needed ASFLAGS_config libc_cv_z_combreloc libc_cv_z_execstack libc_cv_fpie fno_unit_at_a_time libc_cv_have_initfini no_whole_archive exceptions LIBGD have_selinux EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir libc_cv_forced_unwind use_ldconfig ldd_rewrite_script gnu_ld gnu_as elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES linux_doors mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs enable_check_abi oldest_abi bindnow force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os subdirs add_ons base_machine sysnames INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX AR OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF SYSINCLUDES libc_cv_gcc_static_libgcc BASH libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO BISON VERSIONING libc_cv_asm_protected_directive libc_cv_initfinit_array libc_cv_cc_with_libunwind libc_cv_z_nodelete libc_cv_z_nodlopen libc_cv_z_initfirst libc_cv_z_relro libc_cv_Bgroup libc_cv_libgcc_s_suffix libc_cv_as_needed ASFLAGS_config libc_cv_z_combreloc libc_cv_z_execstack libc_cv_fpie fno_unit_at_a_time libc_cv_have_initfini no_whole_archive exceptions LIBGD have_selinux EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir libc_cv_forced_unwind use_ldconfig ldd_rewrite_script gnu_ld gnu_as elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -4101,7 +4101,7 @@ echo $ECHO_N "checking version of $CC... $ECHO_C" >&6
ac_prog_version=`$CC -v 2>&1 | sed -n 's/^.*version \([egcygnustpi-]*[0-9.]*\).*$/\1/p'`
case $ac_prog_version in
'') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
- 3.[2-9]* | 4.[0-9]* )
+ 3.4* | 4.[0-9]* )
ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
*) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
@@ -6065,7 +6065,7 @@ if test "${libc_cv_asm_cfi_directives+set}" = set; then
else
cat > conftest.s <<EOF
.text
- .type func,@function
+ .type func,%function
func:
.cfi_startproc
.cfi_remember_state
@@ -7623,12 +7623,6 @@ echo "${ECHO_T}$pic_default" >&6
-case "$add_ons" in
- *door*) linux_doors=yes ;;
- *) linux_doors=no ;;
-esac
-
-
if test "`(cd $srcdir; pwd)`" = "`pwd`"; then
@@ -8377,7 +8371,6 @@ s,@bounded@,$bounded,;t t
s,@static_nss@,$static_nss,;t t
s,@nopic_initfini@,$nopic_initfini,;t t
s,@DEFINES@,$DEFINES,;t t
-s,@linux_doors@,$linux_doors,;t t
s,@mach_interface_list@,$mach_interface_list,;t t
s,@VERSION@,$VERSION,;t t
s,@RELEASE@,$RELEASE,;t t
diff --git a/configure.in b/configure.in
index 11f78b0ec3..098e0dae74 100644
--- a/configure.in
+++ b/configure.in
@@ -760,7 +760,7 @@ fi
# These programs are version sensitive.
AC_CHECK_TOOL_PREFIX
AC_CHECK_PROG_VER(CC, ${ac_tool_prefix}gcc ${ac_tool_prefix}cc, -v,
- [version \([egcygnustpi-]*[0-9.]*\)], [3.[2-9]* | 4.[0-9]* ],
+ [version \([egcygnustpi-]*[0-9.]*\)], [3.4* | 4.[0-9]* ],
critic_missing="$critic_missing gcc")
AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
[GNU Make[^0-9]*\([0-9][0-9.]*\)],
@@ -1632,7 +1632,7 @@ fi
AC_CACHE_CHECK(whether CFI directives are supported, libc_cv_asm_cfi_directives, [dnl
cat > conftest.s <<EOF
.text
- .type func,@function
+ .type func,%function
func:
.cfi_startproc
.cfi_remember_state
@@ -2124,12 +2124,6 @@ AC_SUBST(nopic_initfini)
AC_SUBST(DEFINES)
-case "$add_ons" in
- *door*) linux_doors=yes ;;
- *) linux_doors=no ;;
-esac
-AC_SUBST(linux_doors)
-
dnl See sysdeps/mach/configure.in for this variable.
AC_SUBST(mach_interface_list)
diff --git a/debug/pread64_chk.c b/debug/pread64_chk.c
index d281ad54af..c0e0efdf85 100644
--- a/debug/pread64_chk.c
+++ b/debug/pread64_chk.c
@@ -26,6 +26,6 @@ __pread64_chk (int fd, void *buf, size_t nbytes, off64_t offset, size_t buflen)
if (nbytes > buflen)
__chk_fail ();
- return __pread64 (fd, buf, offset, nbytes);
+ return __pread64 (fd, buf, nbytes, offset);
}
#endif
diff --git a/debug/pread_chk.c b/debug/pread_chk.c
index cf4f9f203c..702fddaaa3 100644
--- a/debug/pread_chk.c
+++ b/debug/pread_chk.c
@@ -26,6 +26,6 @@ __pread_chk (int fd, void *buf, size_t nbytes, off_t offset, size_t buflen)
if (nbytes > buflen)
__chk_fail ();
- return __pread (fd, buf, offset, nbytes);
+ return __pread (fd, buf, nbytes, offset);
}
#endif
diff --git a/debug/recv_chk.c b/debug/recv_chk.c
index f83bd3ed2f..090e63c5b9 100644
--- a/debug/recv_chk.c
+++ b/debug/recv_chk.c
@@ -23,12 +23,9 @@
ssize_t
__recv_chk (int fd, void *buf, size_t n, size_t buflen, int flags)
{
- /* In case N is greater than BUFLEN, we read BUFLEN+1 bytes.
- This might overflow the buffer but the damage is reduced to just
- one byte. And the program will terminate right away. */
- ssize_t nrecv = __recv (fd, buf, MIN (n, buflen + 1), flags);
- if (nrecv > 0 && (size_t) nrecv > buflen)
+ if (n > buflen)
__chk_fail ();
- return nrecv;
+
+ return __recv (fd, buf, n, flags);
}
#endif
diff --git a/debug/recvfrom_chk.c b/debug/recvfrom_chk.c
index 9403479c00..6fefcbd767 100644
--- a/debug/recvfrom_chk.c
+++ b/debug/recvfrom_chk.c
@@ -24,13 +24,9 @@ ssize_t
__recvfrom_chk (int fd, void *buf, size_t n, size_t buflen, int flags,
__SOCKADDR_ARG addr, socklen_t *addr_len)
{
- /* In case N is greater than BUFLEN, we read BUFLEN+1 bytes.
- This might overflow the buffer but the damage is reduced to just
- one byte. And the program will terminate right away. */
- ssize_t nrecv = __recvfrom (fd, buf, MIN (n, buflen + 1), flags,
- addr, addr_len);
- if (nrecv > 0 && (size_t) nrecv > buflen)
+ if (n > buflen)
__chk_fail ();
- return nrecv;
+
+ return __recvfrom (fd, buf, n, flags, addr, addr_len);
}
#endif
diff --git a/debug/tst-chk1.c b/debug/tst-chk1.c
index dca41ab6dc..a9a7761f9e 100644
--- a/debug/tst-chk1.c
+++ b/debug/tst-chk1.c
@@ -771,7 +771,7 @@ do_test (void)
|| strcmp (getcwdbuf + 1, fname) != 0)
FAIL ();
-#if __USE_FORTIFY_LEVEL >= 1
+#if 0 && __USE_FORTIFY_LEVEL >= 1
CHK_FAIL_START
if (getwd (getcwdbuf + 2) != getcwdbuf + 2)
FAIL ();
diff --git a/elf/Makefile b/elf/Makefile
index 6822d1f02c..80a3f6cb19 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -85,7 +85,9 @@ distribute := rtld-Rules \
check-textrel.c dl-sysdep.h test-dlopenrpathmod.c \
tst-deep1mod1.c tst-deep1mod2.c tst-deep1mod3.c \
unload3mod1.c unload3mod2.c unload3mod3.c unload3mod4.c \
- tst-auditmod1.c
+ unload4mod1.c unload4mod2.c unload4mod3.c unload4mod4.c \
+ tst-auditmod1.c \
+ order2mod1.c order2mod2.c order2mod3.c order2mod4.c
CFLAGS-dl-runtime.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-dl-lookup.c = -fexceptions -fasynchronous-unwind-tables
@@ -160,7 +162,7 @@ tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
tst-tls10 tst-tls11 tst-tls12 tst-tls13 tst-tls14 tst-align \
tst-align2 $(tests-execstack-$(have-z-execstack)) tst-dlmodcount \
tst-dlopenrpath tst-deep1 tst-dlmopen1 tst-dlmopen2 tst-dlmopen3 \
- unload3 tst-audit1 tst-global1
+ unload3 unload4 unload5 tst-audit1 tst-global1 order2
# reldep9
test-srcs = tst-pathopt
tests-vis-yes = vismain
@@ -196,7 +198,9 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
$(modules-execstack-$(have-z-execstack)) \
tst-dlopenrpathmod tst-deep1mod1 tst-deep1mod2 tst-deep1mod3 \
tst-dlmopen1mod tst-auditmod1 \
- unload3mod1 unload3mod2 unload3mod3 unload3mod4
+ unload3mod1 unload3mod2 unload3mod3 unload3mod4 \
+ unload4mod1 unload4mod2 unload4mod3 unload4mod4 \
+ order2mod1 order2mod2 order2mod3 order2mod4
ifeq (yes,$(have-initfini-array))
modules-names += tst-array2dep
endif
@@ -431,6 +435,8 @@ $(objpfx)reldep9mod3.so: $(objpfx)reldep9mod1.so $(objpfx)reldep9mod2.so
$(objpfx)unload3mod1.so: $(objpfx)unload3mod3.so
$(objpfx)unload3mod2.so: $(objpfx)unload3mod3.so
$(objpfx)unload3mod3.so: $(objpfx)unload3mod4.so
+$(objpfx)unload4mod1.so: $(objpfx)unload4mod2.so $(objpfx)unload4mod3.so
+$(objpfx)unload4mod2.so: $(objpfx)unload4mod4.so $(objpfx)unload4mod3.so
LDFLAGS-tst-tlsmod5.so = -nostdlib
LDFLAGS-tst-tlsmod6.so = -nostdlib
@@ -471,6 +477,7 @@ circlemod3a.so-no-z-defs = yes
reldep8mod2.so-no-z-defs = yes
reldep9mod1.so-no-z-defs = yes
unload3mod4.so-no-z-defs = yes
+unload4mod1.so-no-z-defs = yes
# filtmod1.so has a special rule
$(filter-out $(objpfx)filtmod1.so, $(test-modules)): $(objpfx)%.so: $(objpfx)%.os
@@ -691,6 +698,13 @@ $(objpfx)unload3: $(libdl)
$(objpfx)unload3.out: $(objpfx)unload3mod1.so $(objpfx)unload3mod2.so \
$(objpfx)unload3mod3.so $(objpfx)unload3mod4.so
+$(objpfx)unload4: $(libdl)
+$(objpfx)unload4.out: $(objpfx)unload4mod1.so $(objpfx)unload4mod3.so
+
+$(objpfx)unload5: $(libdl)
+$(objpfx)unload5.out: $(objpfx)unload3mod1.so $(objpfx)unload3mod2.so \
+ $(objpfx)unload3mod3.so $(objpfx)unload3mod4.so
+
ifdef libdl
$(objpfx)tst-tls9-static: $(common-objpfx)dlfcn/libdl.a
$(objpfx)tst-tls9-static.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
@@ -804,3 +818,15 @@ tst-audit1-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so
$(objpfx)tst-global1: $(libdl)
$(objpfx)tst-global1.out: $(objpfx)testobj6.so $(objpfx)testobj2.so
+
+$(objpfx)order2: $(libdl)
+$(objpfx)order2.out: $(objpfx)order2 $(objpfx)order2mod1.so \
+ $(objpfx)order2mod2.so
+ $(elf-objpfx)$(rtld-installed-name) \
+ --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
+ $(objpfx)order2 > $@
+ (echo "12345" | cmp $@ -) > /dev/null
+$(objpfx)order2mod1.so: $(objpfx)order2mod4.so
+$(objpfx)order2mod4.so: $(objpfx)order2mod3.so
+$(objpfx)order2mod2.so: $(objpfx)order2mod3.so
+order2mod2.so-no-z-defs = yes
diff --git a/elf/circleload1.c b/elf/circleload1.c
index 7ac101a799..f5f886a1da 100644
--- a/elf/circleload1.c
+++ b/elf/circleload1.c
@@ -27,7 +27,7 @@ check_loaded_objects (const char **loaded)
for (lm = _r_debug.r_map; lm; lm = lm->l_next)
{
if (lm->l_name && lm->l_name[0])
- printf(" %s, count = %d\n", lm->l_name, (int) lm->l_opencount);
+ printf(" %s, count = %d\n", lm->l_name, (int) lm->l_direct_opencount);
if (lm->l_type == lt_loaded && lm->l_name)
{
int match = 0;
@@ -72,9 +72,9 @@ load_dso (const char **loading, int undef, int flag)
printf ("\nThis is what is in memory now:\n");
errors += check_loaded_objects (loaded);
- printf ("Loading shared object %s: %s\n", loading [0],
+ printf ("Loading shared object %s: %s\n", loading[0],
flag == RTLD_LAZY ? "RTLD_LAZY" : "RTLD_NOW");
- obj = dlopen (loading [0], flag);
+ obj = dlopen (loading[0], flag);
if (obj == NULL)
{
if (flag == RTLD_LAZY)
@@ -120,15 +120,15 @@ load_dso (const char **loading, int undef, int flag)
}
}
- loaded[0] = loading [0];
- loaded[1] = loading [1];
- loaded[2] = loading [2];
+ loaded[0] = loading[0];
+ loaded[1] = loading[1];
+ loaded[2] = loading[2];
}
errors += check_loaded_objects (loaded);
if (obj)
{
- printf ("UnLoading shared object %s\n", loading [0]);
+ printf ("UnLoading shared object %s\n", loading[0]);
dlclose (obj);
loaded[0] = NULL;
loaded[1] = NULL;
@@ -145,15 +145,15 @@ main (void)
int errors = 0;
const char *loading[3];
- loading [0] = "circlemod1a.so";
- loading [1] = "circlemod2a.so";
- loading [2] = "circlemod3a.so";
+ loading[0] = "circlemod1a.so";
+ loading[1] = "circlemod2a.so";
+ loading[2] = "circlemod3a.so";
errors += load_dso (loading, 0, RTLD_LAZY);
errors += load_dso (loading, 0, RTLD_NOW);
- loading [0] = "circlemod1.so";
- loading [1] = "circlemod2.so";
- loading [2] = "circlemod3.so";
+ loading[0] = "circlemod1.so";
+ loading[1] = "circlemod2.so";
+ loading[2] = "circlemod3.so";
errors += load_dso (loading, 1, RTLD_LAZY);
errors += load_dso (loading, 1, RTLD_NOW);
diff --git a/elf/dl-addr.c b/elf/dl-addr.c
index c56736ceb1..6bd7f7b69c 100644
--- a/elf/dl-addr.c
+++ b/elf/dl-addr.c
@@ -68,7 +68,8 @@ _dl_addr (const void *address, Dl_info *info,
&& match->l_type == lt_executable)
info->dli_fname = _dl_argv[0];
- const ElfW(Sym) *symtab = D_PTR (match, l_info[DT_SYMTAB]);
+ const ElfW(Sym) *symtab
+ = (const ElfW(Sym) *) D_PTR (match, l_info[DT_SYMTAB]);
const char *strtab = (const char *) D_PTR (match, l_info[DT_STRTAB]);
ElfW(Word) strtabsize = match->l_info[DT_STRSZ]->d_un.d_val;
diff --git a/elf/dl-close.c b/elf/dl-close.c
index 7ad486a5a2..cd4fa7cfbe 100644
--- a/elf/dl-close.c
+++ b/elf/dl-close.c
@@ -102,19 +102,9 @@ remove_slotinfo (size_t idx, struct dtv_slotinfo_list *listp, size_t disp,
void
_dl_close (void *_map)
{
- struct reldep_list
- {
- struct link_map **rellist;
- unsigned int nrellist;
- unsigned int nhandled;
- struct reldep_list *next;
- bool handled[0];
- } *reldeps = NULL;
- struct link_map **list;
struct link_map *map = _map;
Lmid_t ns = map->l_ns;
unsigned int i;
- unsigned int *new_opencount;
#ifdef USE_TLS
bool any_tls = false;
#endif
@@ -125,169 +115,142 @@ _dl_close (void *_map)
/* Nope. Do nothing. */
return;
- if (__builtin_expect (map->l_opencount, 1) == 0)
+ if (__builtin_expect (map->l_direct_opencount, 1) == 0)
GLRO(dl_signal_error) (0, map->l_name, NULL, N_("shared object not open"));
/* Acquire the lock. */
__rtld_lock_lock_recursive (GL(dl_load_lock));
/* One less direct use. */
- assert (map->l_direct_opencount > 0);
--map->l_direct_opencount;
/* Decrement the reference count. */
- if (map->l_opencount > 1 || map->l_type != lt_loaded)
+ if (map->l_direct_opencount > 1 || map->l_type != lt_loaded)
{
/* There are still references to this object. Do nothing more. */
if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
- _dl_debug_printf ("\nclosing file=%s; opencount == %u\n",
- map->l_name, map->l_opencount);
-
- /* Decrement the object's reference counter, not the dependencies'. */
- --map->l_opencount;
-
- /* If the direct use counter reaches zero we have to decrement
- all the dependencies' usage counter. */
- if (map->l_direct_opencount == 0)
- for (i = 1; i < map->l_searchlist.r_nlist; ++i)
- --map->l_searchlist.r_list[i]->l_opencount;
+ _dl_debug_printf ("\nclosing file=%s; direct_opencount=%u\n",
+ map->l_name, map->l_direct_opencount);
__rtld_lock_unlock_recursive (GL(dl_load_lock));
return;
}
- list = map->l_initfini;
+ const unsigned int nloaded = GL(dl_ns)[ns]._ns_nloaded;
+ char used[nloaded];
+ char done[nloaded];
+ struct link_map *maps[nloaded];
- /* Compute the new l_opencount values. */
- i = map->l_searchlist.r_nlist;
- if (__builtin_expect (i == 0, 0))
- /* This can happen if we handle relocation dependencies for an
- object which wasn't loaded directly. */
- for (i = 1; list[i] != NULL; ++i)
- ;
+ /* Run over the list and assign indeces to the link maps and enter
+ them into the MAPS array. */
+ int idx = 0;
+ for (struct link_map *l = GL(dl_ns)[ns]._ns_loaded; l != NULL; l = l->l_next)
+ {
+ l->l_idx = idx;
+ maps[idx] = l;
+ ++idx;
+ }
+ assert (idx == nloaded);
- unsigned int nopencount = i;
- new_opencount = (unsigned int *) alloca (i * sizeof (unsigned int));
+ /* Prepare the bitmaps. */
+ memset (used, '\0', sizeof (used));
+ memset (done, '\0', sizeof (done));
- for (i = 0; list[i] != NULL; ++i)
+ /* Keep track of the lowest index link map we have covered already. */
+ int done_index = -1;
+ while (++done_index < nloaded)
{
- list[i]->l_idx = i;
- new_opencount[i] = list[i]->l_opencount;
- }
- --new_opencount[0];
- for (i = 1; list[i] != NULL; ++i)
- if ((list[i]->l_flags_1 & DF_1_NODELETE) == 0
- /* Decrement counter. */
- && (assert (new_opencount[i] > 0), --new_opencount[i] == 0))
- {
- void mark_removed (struct link_map *remmap)
- {
- /* Test whether this object was also loaded directly. */
- if (remmap->l_searchlist.r_list != NULL
- && remmap->l_direct_opencount > 0)
- {
- /* In this case we have to decrement all the dependencies of
- this object. They are all in MAP's dependency list. */
- unsigned int j;
- struct link_map **dep_list = remmap->l_searchlist.r_list;
-
- for (j = 1; j < remmap->l_searchlist.r_nlist; ++j)
- if (! (dep_list[j]->l_flags_1 & DF_1_NODELETE)
- || ! dep_list[j]->l_init_called)
+ struct link_map *l = maps[done_index];
+
+ if (done[done_index])
+ /* Already handled. */
+ continue;
+
+ /* Check whether this object is still used. */
+ if (l->l_type == lt_loaded
+ && l->l_direct_opencount == 0
+ && (l->l_flags_1 & DF_1_NODELETE) == 0
+ && !used[done_index])
+ continue;
+
+ /* We need this object and we handle it now. */
+ done[done_index] = 1;
+ used[done_index] = 1;
+ /* Signal the object is still needed. */
+ l->l_idx = -1;
+
+ /* Mark all dependencies as used. */
+ if (l->l_initfini != NULL)
+ {
+ struct link_map **lp = &l->l_initfini[1];
+ while (*lp != NULL)
+ {
+ if ((*lp)->l_idx != -1)
{
- assert (dep_list[j]->l_idx < map->l_searchlist.r_nlist);
- assert (new_opencount[dep_list[j]->l_idx] > 0);
- if (--new_opencount[dep_list[j]->l_idx] == 0)
+ assert ((*lp)->l_idx >= 0 && (*lp)->l_idx < nloaded);
+
+ if (!used[(*lp)->l_idx])
{
- assert (dep_list[j]->l_type == lt_loaded);
- mark_removed (dep_list[j]);
+ used[(*lp)->l_idx] = 1;
+ if ((*lp)->l_idx - 1 < done_index)
+ done_index = (*lp)->l_idx - 1;
}
}
- }
- if (remmap->l_reldeps != NULL)
+ ++lp;
+ }
+ }
+ /* And the same for relocation dependencies. */
+ if (l->l_reldeps != NULL)
+ for (unsigned int j = 0; j < l->l_reldepsact; ++j)
+ {
+ struct link_map *jmap = l->l_reldeps[j];
+
+ if (jmap->l_idx != -1)
{
- unsigned int j;
- for (j = 0; j < remmap->l_reldepsact; ++j)
+ assert (jmap->l_idx >= 0 && jmap->l_idx < nloaded);
+
+ if (!used[jmap->l_idx])
{
- struct link_map *depmap = remmap->l_reldeps[j];
-
- /* Find out whether this object is in our list. */
- if (depmap->l_idx < nopencount
- && list[depmap->l_idx] == depmap)
- {
- /* Yes, it is. If is has a search list, make a
- recursive call to handle this. */
- if (depmap->l_searchlist.r_list != NULL)
- {
- assert (new_opencount[depmap->l_idx] > 0);
- if (--new_opencount[depmap->l_idx] == 0)
- {
- /* This one is now gone, too. */
- assert (depmap->l_type == lt_loaded);
- mark_removed (depmap);
- }
- }
- else
- {
- /* Otherwise we have to handle the dependency
- deallocation here. */
- unsigned int k;
- for (k = 0; depmap->l_initfini[k] != NULL; ++k)
- {
- struct link_map *rl = depmap->l_initfini[k];
-
- if (rl->l_idx < nopencount
- && list[rl->l_idx] == rl)
- {
- assert (new_opencount[rl->l_idx] > 0);
- if (--new_opencount[rl->l_idx] == 0)
- {
- /* Another module to remove. */
- assert (rl->l_type == lt_loaded);
- mark_removed (rl);
- }
- }
- else
- {
- assert (rl->l_opencount > 0);
- if (--rl->l_opencount == 0)
- mark_removed (rl);
- }
- }
- }
- }
+ used[jmap->l_idx] = 1;
+ if (jmap->l_idx - 1 < done_index)
+ done_index = jmap->l_idx - 1;
}
}
}
+ }
- mark_removed (list[i]);
- }
- assert (new_opencount[0] == 0);
+ /* Sort the entries. */
+ _dl_sort_fini (GL(dl_ns)[ns]._ns_loaded, maps, nloaded, used, ns);
/* Call all termination functions at once. */
#ifdef SHARED
bool do_audit = GLRO(dl_naudit) > 0 && !GL(dl_ns)[ns]._ns_loaded->l_auditing;
#endif
- for (i = 0; list[i] != NULL; ++i)
+ bool unload_any = false;
+ unsigned int first_loaded = ~0;
+ for (i = 0; i < nloaded; ++i)
{
- struct link_map *imap = list[i];
+ struct link_map *imap = maps[i];
/* All elements must be in the same namespace. */
assert (imap->l_ns == ns);
- if (new_opencount[i] == 0 && imap->l_type == lt_loaded
- && (imap->l_flags_1 & DF_1_NODELETE) == 0)
+ if (!used[i])
{
- /* When debugging print a message first. */
- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0))
- _dl_debug_printf ("\ncalling fini: %s [%lu]\n\n",
- imap->l_name, ns);
+ assert (imap->l_type == lt_loaded
+ && (imap->l_flags_1 & DF_1_NODELETE) == 0);
/* Call its termination function. Do not do it for
half-cooked objects. */
if (imap->l_init_called)
{
+ /* When debugging print a message first. */
+ if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS,
+ 0))
+ _dl_debug_printf ("\ncalling fini: %s [%lu]\n\n",
+ imap->l_name, ns);
+
if (imap->l_info[DT_FINI_ARRAY] != NULL)
{
ElfW(Addr) *array =
@@ -323,42 +286,60 @@ _dl_close (void *_map)
}
#endif
- /* This object must not be used anymore. We must remove the
- reference from the scope. */
- unsigned int j;
- struct link_map **searchlist = map->l_searchlist.r_list;
- unsigned int nsearchlist = map->l_searchlist.r_nlist;
-
-#ifndef NDEBUG
- bool found = false;
-#endif
- for (j = 0; j < nsearchlist; ++j)
- if (imap == searchlist[j])
- {
- /* This is the object to remove. Copy all the
- following ones. */
- while (++j < nsearchlist)
- searchlist[j - 1] = searchlist[j];
+ /* This object must not be used anymore. */
+ imap->l_removed = 1;
- searchlist[j - 1] = NULL;
+ /* We indeed have an object to remove. */
+ unload_any = true;
- --map->l_searchlist.r_nlist;
-
-#ifndef NDEBUG
- found = true;
-#endif
- break;
- }
- assert (found);
+ /* Remember where the first dynamically loaded object is. */
+ if (i < first_loaded)
+ first_loaded = i;
}
+ /* Else used[i]. */
+ else if (imap->l_type == lt_loaded)
+ {
+ if (imap->l_searchlist.r_list == NULL
+ && imap->l_initfini != NULL)
+ {
+ /* The object is still used. But the object we are
+ unloading right now is responsible for loading it. If
+ the current object does not have it's own scope yet we
+ have to create one. This has to be done before running
+ the finalizers.
+
+ To do this count the number of dependencies. */
+ unsigned int cnt;
+ for (cnt = 1; imap->l_initfini[cnt] != NULL; ++cnt)
+ ;
+
+ /* We simply reuse the l_initfini list. */
+ imap->l_searchlist.r_list = &imap->l_initfini[cnt + 1];
+ imap->l_searchlist.r_nlist = cnt;
+
+ for (cnt = 0; imap->l_scope[cnt] != NULL; ++cnt)
+ if (imap->l_scope[cnt] == &map->l_searchlist)
+ {
+ imap->l_scope[cnt] = &imap->l_searchlist;
+ break;
+ }
+ }
- /* Store the new l_opencount value. */
- imap->l_opencount = new_opencount[i];
+ /* The loader is gone, so mark the object as not having one.
+ Note: l_idx == -1 -> object will be removed. */
+ if (imap->l_loader != NULL && imap->l_loader->l_idx != -1)
+ imap->l_loader = NULL;
- /* Just a sanity check. */
- assert (imap->l_type == lt_loaded || imap->l_opencount > 0);
+ /* Remember where the first dynamically loaded object is. */
+ if (i < first_loaded)
+ first_loaded = i;
+ }
}
+ /* If there are no objects to unload, do nothing further. */
+ if (!unload_any)
+ goto out;
+
#ifdef SHARED
/* Auditing checkpoint: we will start deleting objects. */
if (__builtin_expect (do_audit, 0))
@@ -392,12 +373,12 @@ _dl_close (void *_map)
/* Check each element of the search list to see if all references to
it are gone. */
- for (i = 0; list[i] != NULL; ++i)
+ for (i = first_loaded; i < nloaded; ++i)
{
- struct link_map *imap = list[i];
- if (imap->l_opencount == 0 && imap->l_type == lt_loaded)
+ struct link_map *imap = maps[i];
+ if (!used[i])
{
- struct libname_list *lnp;
+ assert (imap->l_type == lt_loaded);
/* That was the last reference, and this was a dlopen-loaded
object. We can unmap it. */
@@ -526,39 +507,18 @@ _dl_close (void *_map)
if (imap->l_origin != (char *) -1)
free ((char *) imap->l_origin);
- /* If the object has relocation dependencies save this
- information for latter. */
- if (__builtin_expect (imap->l_reldeps != NULL, 0))
- {
- struct reldep_list *newrel;
-
- newrel = (struct reldep_list *) alloca (sizeof (*reldeps)
- + (imap->l_reldepsact
- * sizeof (bool)));
- newrel->rellist = imap->l_reldeps;
- newrel->nrellist = imap->l_reldepsact;
- newrel->next = reldeps;
-
- newrel->nhandled = imap->l_reldepsact;
- unsigned int j;
- for (j = 0; j < imap->l_reldepsact; ++j)
- {
- /* Find out whether this object is in our list. */
- if (imap->l_reldeps[j]->l_idx < nopencount
- && list[imap->l_reldeps[j]->l_idx] == imap->l_reldeps[j])
- /* Yes, it is. */
- newrel->handled[j] = true;
- else
- newrel->handled[j] = false;
- }
+ free (imap->l_reldeps);
- reldeps = newrel;
- }
+ /* Print debugging message. */
+ if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
+ _dl_debug_printf ("\nfile=%s [%lu]; destroying link map\n",
+ imap->l_name, imap->l_ns);
/* This name always is allocated. */
free (imap->l_name);
/* Remove the list with all the names of the shared object. */
- lnp = imap->l_libname;
+
+ struct libname_list *lnp = imap->l_libname;
do
{
struct libname_list *this = lnp;
@@ -569,8 +529,7 @@ _dl_close (void *_map)
while (lnp != NULL);
/* Remove the searchlists. */
- if (imap != map)
- free (imap->l_initfini);
+ free (imap->l_initfini);
/* Remove the scope array if we allocated it. */
if (imap->l_scope != imap->l_scope_mem)
@@ -624,26 +583,8 @@ _dl_close (void *_map)
r->r_state = RT_CONSISTENT;
_dl_debug_state ();
- /* Now we can perhaps also remove the modules for which we had
- dependencies because of symbol lookup. */
- while (__builtin_expect (reldeps != NULL, 0))
- {
- while (reldeps->nrellist-- > 0)
- /* Some of the relocation dependencies might be on the
- dependency list of the object we are closing right now.
- They were already handled. Do not close them again. */
- if (reldeps->nrellist < reldeps->nhandled
- && ! reldeps->handled[reldeps->nrellist])
- _dl_close (reldeps->rellist[reldeps->nrellist]);
-
- free (reldeps->rellist);
-
- reldeps = reldeps->next;
- }
-
- free (list);
-
/* Release the lock. */
+ out:
__rtld_lock_unlock_recursive (GL(dl_load_lock));
}
diff --git a/elf/dl-deps.c b/elf/dl-deps.c
index a1c16d7310..50d7a0e71c 100644
--- a/elf/dl-deps.c
+++ b/elf/dl-deps.c
@@ -1,5 +1,5 @@
/* Load the dependencies of a mapped object.
- Copyright (C) 1996-2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1996-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
@@ -307,7 +307,7 @@ _dl_map_object_deps (struct link_map *map,
{
/* We are not interested in the error message. */
assert (errstring != NULL);
- if (errstring != INTUSE(_dl_out_of_memory))
+ if (errstring != _dl_out_of_memory)
free ((char *) errstring);
/* Simply ignore this error and continue the work. */
@@ -566,8 +566,6 @@ Filters not supported with LD_TRACE_PRELINKING"));
{
/* A direct or transitive dependency is also on the list
of relocation dependencies. Remove the latter. */
- --map->l_reldeps[i]->l_opencount;
-
for (j = i + 1; j < map->l_reldepsact; ++j)
map->l_reldeps[j - 1] = map->l_reldeps[j];
diff --git a/elf/dl-error.c b/elf/dl-error.c
index 0ef76c82ee..993b7c29ab 100644
--- a/elf/dl-error.c
+++ b/elf/dl-error.c
@@ -1,5 +1,5 @@
/* Error handling for runtime dynamic linker.
- Copyright (C) 1995-2002,2004 Free Software Foundation, Inc.
+ Copyright (C) 1995-2002,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
@@ -45,7 +45,7 @@ struct catch
variable since we have to avoid freeing it and so have to enable
a pointer comparison. See below and in dlfcn/dlerror.c. */
const char _dl_out_of_memory[] = "out of memory";
-INTVARDEF(_dl_out_of_memory)
+rtld_hidden_data_def (_dl_out_of_memory)
/* This points to a function which is called when an continuable error is
@@ -95,7 +95,7 @@ _dl_signal_error (int errcode, const char *objname, const char *occation,
{
/* This is better than nothing. */
lcatch->objname = "";
- lcatch->errstring = INTUSE(_dl_out_of_memory);
+ lcatch->errstring = _dl_out_of_memory;
}
longjmp (lcatch->env, errcode ?: -1);
}
diff --git a/elf/dl-fini.c b/elf/dl-fini.c
index b3282089a9..3cd7e7bbff 100644
--- a/elf/dl-fini.c
+++ b/elf/dl-fini.c
@@ -29,6 +29,94 @@ typedef void (*fini_t) (void);
void
internal_function
+_dl_sort_fini (struct link_map *l, struct link_map **maps, size_t nmaps,
+ char *used, Lmid_t ns)
+{
+ if (ns == LM_ID_BASE)
+ /* The main executable always comes first. */
+ l = l->l_next;
+
+ for (; l != NULL; l = l->l_next)
+ /* Do not handle ld.so in secondary namespaces and object which
+ are not removed. */
+ if (l == l->l_real && l->l_idx != -1)
+ {
+ /* Find the place in the 'maps' array. */
+ unsigned int j;
+ for (j = ns == LM_ID_BASE ? 1 : 0; maps[j] != l; ++j)
+ assert (j < nmaps);
+
+ /* Find all object for which the current one is a dependency
+ and move the found object (if necessary) in front. */
+ for (unsigned int k = j + 1; k < nmaps; ++k)
+ {
+ struct link_map **runp = maps[k]->l_initfini;
+ if (runp != NULL)
+ {
+ while (*runp != NULL)
+ if (*runp == l)
+ {
+ struct link_map *here = maps[k];
+
+ /* Move it now. */
+ memmove (&maps[j] + 1,
+ &maps[j], (k - j) * sizeof (struct link_map *));
+ maps[j] = here;
+
+ if (used != NULL)
+ {
+ char here_used = used[k];
+
+ memmove (&used[j] + 1,
+ &used[j], (k - j) * sizeof (char));
+ used[j] = here_used;
+ }
+
+ ++j;
+
+ break;
+ }
+ else
+ ++runp;
+ }
+
+ if (__builtin_expect (maps[k]->l_reldeps != NULL, 0))
+ {
+ unsigned int m = maps[k]->l_reldepsact;
+ struct link_map **relmaps = maps[k]->l_reldeps;
+
+ while (m-- > 0)
+ {
+ if (relmaps[m] == l)
+ {
+ struct link_map *here = maps[k];
+
+ /* Move it now. */
+ memmove (&maps[j] + 1,
+ &maps[j],
+ (k - j) * sizeof (struct link_map *));
+ maps[j] = here;
+
+ if (used != NULL)
+ {
+ char here_used = used[k];
+
+ memmove (&used[j] + 1,
+ &used[j], (k - j) * sizeof (char));
+ used[j] = here_used;
+ }
+
+ break;
+ }
+ }
+ }
+ }
+ }
+}
+
+
+void
+internal_function
_dl_fini (void)
{
/* Lots of fun ahead. We have to call the destructors for all still
@@ -52,25 +140,25 @@ _dl_fini (void)
int do_audit = 0;
again:
#endif
- for (Lmid_t cnt = DL_NNS - 1; cnt >= 0; --cnt)
+ for (Lmid_t ns = DL_NNS - 1; ns >= 0; --ns)
{
/* Protect against concurrent loads and unloads. */
__rtld_lock_lock_recursive (GL(dl_load_lock));
unsigned int nmaps = 0;
- unsigned int nloaded = GL(dl_ns)[cnt]._ns_nloaded;
+ unsigned int nloaded = GL(dl_ns)[ns]._ns_nloaded;
/* No need to do anything for empty namespaces or those used for
auditing DSOs. */
if (nloaded == 0
#ifdef SHARED
- || GL(dl_ns)[cnt]._ns_loaded->l_auditing != do_audit
+ || GL(dl_ns)[ns]._ns_loaded->l_auditing != do_audit
#endif
)
goto out;
/* XXX Could it be (in static binaries) that there is no object
loaded? */
- assert (cnt != LM_ID_BASE || nloaded > 0);
+ assert (ns != LM_ID_BASE || nloaded > 0);
/* Now we can allocate an array to hold all the pointers and copy
the pointers in. */
@@ -89,87 +177,28 @@ _dl_fini (void)
unsigned int i;
struct link_map *l;
- assert (nloaded != 0 || GL(dl_ns)[cnt]._ns_loaded == NULL);
- for (l = GL(dl_ns)[cnt]._ns_loaded, i = 0; l != NULL; l = l->l_next)
+ assert (nloaded != 0 || GL(dl_ns)[ns]._ns_loaded == NULL);
+ for (l = GL(dl_ns)[ns]._ns_loaded, i = 0; l != NULL; l = l->l_next)
/* Do not handle ld.so in secondary namespaces. */
if (l == l->l_real)
{
assert (i < nloaded);
- maps[i++] = l;
+ maps[i] = l;
+ l->l_idx = i;
+ ++i;
- /* Bump l_opencount of all objects so that they are not
- dlclose()ed from underneath us. */
- ++l->l_opencount;
+ /* Bump l_direct_opencount of all objects so that they are
+ not dlclose()ed from underneath us. */
+ ++l->l_direct_opencount;
}
- assert (cnt != LM_ID_BASE || i == nloaded);
- assert (cnt == LM_ID_BASE || i == nloaded || i == nloaded - 1);
+ assert (ns != LM_ID_BASE || i == nloaded);
+ assert (ns == LM_ID_BASE || i == nloaded || i == nloaded - 1);
nmaps = i;
if (nmaps != 0)
- {
- /* Now we have to do the sorting. */
- l = GL(dl_ns)[cnt]._ns_loaded;
- if (cnt == LM_ID_BASE)
- /* The main executable always comes first. */
- l = l->l_next;
- for (; l != NULL; l = l->l_next)
- /* Do not handle ld.so in secondary namespaces. */
- if (l == l->l_real)
- {
- /* Find the place in the 'maps' array. */
- unsigned int j;
- for (j = cnt == LM_ID_BASE ? 1 : 0; maps[j] != l; ++j)
- assert (j < nmaps);
-
- /* Find all object for which the current one is a dependency
- and move the found object (if necessary) in front. */
- for (unsigned int k = j + 1; k < nmaps; ++k)
- {
- struct link_map **runp = maps[k]->l_initfini;
- if (runp != NULL)
- {
- while (*runp != NULL)
- if (*runp == l)
- {
- struct link_map *here = maps[k];
-
- /* Move it now. */
- memmove (&maps[j] + 1,
- &maps[j],
- (k - j) * sizeof (struct link_map *));
- maps[j++] = here;
-
- break;
- }
- else
- ++runp;
- }
-
- if (__builtin_expect (maps[k]->l_reldeps != NULL, 0))
- {
- unsigned int m = maps[k]->l_reldepsact;
- struct link_map **relmaps = maps[k]->l_reldeps;
-
- while (m-- > 0)
- {
- if (relmaps[m] == l)
- {
- struct link_map *here = maps[k];
-
- /* Move it now. */
- memmove (&maps[j] + 1,
- &maps[j],
- (k - j) * sizeof (struct link_map *));
- maps[j] = here;
-
- break;
- }
- }
- }
- }
- }
- }
+ /* Now we have to do the sorting. */
+ _dl_sort_fini (GL(dl_ns)[ns]._ns_loaded, maps, nmaps, NULL, ns);
/* We do not rely on the linked list of loaded object anymore from
this point on. We have our own list here (maps). The various
@@ -200,7 +229,7 @@ _dl_fini (void)
& DL_DEBUG_IMPCALLS, 0))
_dl_debug_printf ("\ncalling fini: %s [%lu]\n\n",
l->l_name[0] ? l->l_name : rtld_progname,
- cnt);
+ ns);
/* First see whether an array is given. */
if (l->l_info[DT_FINI_ARRAY] != NULL)
@@ -237,7 +266,7 @@ _dl_fini (void)
}
/* Correct the previous increment. */
- --l->l_opencount;
+ --l->l_direct_opencount;
}
}
@@ -247,7 +276,6 @@ _dl_fini (void)
do_audit = 1;
goto again;
}
-#endif
if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_STATISTICS, 0))
_dl_debug_printf ("\nruntime linker statistics:\n"
@@ -255,4 +283,5 @@ _dl_fini (void)
"final number of relocations from cache: %lu\n",
GL(dl_num_relocations),
GL(dl_num_cache_relocations));
+#endif
}
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 97e1e0089c..d9c2da2ac7 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -849,7 +849,7 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
/* Look again to see if the real name matched another already loaded. */
for (l = GL(dl_ns)[nsid]._ns_loaded; l; l = l->l_next)
- if (l->l_ino == st.st_ino && l->l_dev == st.st_dev)
+ if (l->l_removed == 0 && l->l_ino == st.st_ino && l->l_dev == st.st_dev)
{
/* The object is already loaded.
Just bump its reference count and return it. */
@@ -1914,7 +1914,8 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded,
/* If the requested name matches the soname of a loaded object,
use that object. Elide this check for names that have not
yet been opened. */
- if (__builtin_expect (l->l_faked, 0) != 0)
+ if (__builtin_expect (l->l_faked, 0) != 0
+ || __builtin_expect (l->l_removed, 0) != 0)
continue;
if (!_dl_name_match_p (name, l))
{
diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
index 24fc89af10..130453ca24 100644
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -91,11 +91,6 @@ add_dependency (struct link_map *undef_map, struct link_map *map)
/* Make sure nobody can unload the object while we are at it. */
__rtld_lock_lock_recursive (GL(dl_load_lock));
- /* Don't create cross-reference between modules which are
- dynamically loaded by the same dlopen() call. */
- if (undef_map->l_opencount == 0 && map->l_opencount == 0)
- goto out;
-
/* Avoid references to objects which cannot be unloaded anyway. */
if (map->l_type != lt_loaded
|| (map->l_flags_1 & DF_1_NODELETE) != 0)
@@ -107,14 +102,13 @@ add_dependency (struct link_map *undef_map, struct link_map *map)
if (undef_map->l_type != lt_loaded
|| (undef_map->l_flags_1 & DF_1_NODELETE) != 0)
{
- ++map->l_opencount;
map->l_flags_1 |= DF_1_NODELETE;
goto out;
}
/* Determine whether UNDEF_MAP already has a reference to MAP. First
look in the normal dependencies. */
- if (undef_map->l_searchlist.r_list != NULL)
+ if (undef_map->l_initfini != NULL)
{
list = undef_map->l_initfini;
@@ -172,19 +166,6 @@ add_dependency (struct link_map *undef_map, struct link_map *map)
if (__builtin_expect (act < undef_map->l_reldepsmax, 1))
undef_map->l_reldeps[undef_map->l_reldepsact++] = map;
- if (map->l_searchlist.r_list != NULL)
- /* And increment the counter in the referenced object. */
- ++map->l_opencount;
- else
- /* We have to bump the counts for all dependencies since so far
- this object was only a normal or transitive dependency.
- Now it might be closed with _dl_close() directly. */
- for (list = map->l_initfini; *list != NULL; ++list)
- ++(*list)->l_opencount;
-
- /* As if it is opened through _dl_open. */
- ++map->l_direct_opencount;
-
/* Display information if we are debugging. */
if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
_dl_debug_printf ("\
diff --git a/elf/dl-open.c b/elf/dl-open.c
index 4de20720ed..7433d99ff9 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -281,23 +281,14 @@ dl_open_worker (void *a)
{
/* Let the user know about the opencount. */
if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
- _dl_debug_printf ("opening file=%s [%lu]; opencount=%u\n\n",
- new->l_name, new->l_ns, new->l_opencount);
+ _dl_debug_printf ("opening file=%s [%lu]; direct_opencount=%u\n\n",
+ new->l_name, new->l_ns, new->l_direct_opencount);
/* If the user requested the object to be in the global namespace
but it is not so far, add it now. */
if ((mode & RTLD_GLOBAL) && new->l_global == 0)
(void) add_to_global (new);
- if (new->l_direct_opencount == 1)
- /* This is the only direct reference. Increment all the
- dependencies' reference counter. */
- for (i = 0; i < new->l_searchlist.r_nlist; ++i)
- ++new->l_searchlist.r_list[i]->l_opencount;
- else
- /* Increment just the reference counter of the object. */
- ++new->l_opencount;
-
assert (_dl_debug_initialize (0, args->nsid)->r_state == RT_CONSISTENT);
return;
@@ -386,94 +377,92 @@ dl_open_worker (void *a)
l = l->l_prev;
}
- /* Increment the open count for all dependencies. If the file is
- not loaded as a dependency here add the search list of the newly
- loaded object to the scope. */
+ /* If the file is not loaded now as a dependency, add the search
+ list of the newly loaded object to the scope. */
for (i = 0; i < new->l_searchlist.r_nlist; ++i)
- if (++new->l_searchlist.r_list[i]->l_opencount > 1
- && new->l_real->l_searchlist.r_list[i]->l_type == lt_loaded)
- {
- struct link_map *imap = new->l_searchlist.r_list[i];
- struct r_scope_elem **runp = imap->l_scope;
- size_t cnt = 0;
-
- while (*runp != NULL)
- {
- /* This can happen if imap was just loaded, but during
- relocation had l_opencount bumped because of relocation
- dependency. Avoid duplicates in l_scope. */
- if (__builtin_expect (*runp == &new->l_searchlist, 0))
- break;
-
- ++cnt;
- ++runp;
- }
-
- if (*runp != NULL)
- /* Avoid duplicates. */
- continue;
-
- if (__builtin_expect (cnt + 1 >= imap->l_scope_max, 0))
- {
- /* The 'r_scope' array is too small. Allocate a new one
- dynamically. */
- struct r_scope_elem **newp;
- size_t new_size = imap->l_scope_max * 2;
-
- if (imap->l_scope == imap->l_scope_mem)
- {
- newp = (struct r_scope_elem **)
- malloc (new_size * sizeof (struct r_scope_elem *));
- if (newp == NULL)
- _dl_signal_error (ENOMEM, "dlopen", NULL,
- N_("cannot create scope list"));
- imap->l_scope = memcpy (newp, imap->l_scope,
- cnt * sizeof (imap->l_scope[0]));
- }
- else
- {
- newp = (struct r_scope_elem **)
- realloc (imap->l_scope,
- new_size * sizeof (struct r_scope_elem *));
- if (newp == NULL)
- _dl_signal_error (ENOMEM, "dlopen", NULL,
- N_("cannot create scope list"));
- imap->l_scope = newp;
- }
-
- imap->l_scope_max = new_size;
- }
-
- imap->l_scope[cnt++] = &new->l_searchlist;
- imap->l_scope[cnt] = NULL;
- }
+ {
+ struct link_map *imap = new->l_searchlist.r_list[i];
+
+ /* If the initializer has been called already, the object has
+ not been loaded here and now. */
+ if (imap->l_init_called && imap->l_type == lt_loaded)
+ {
+ struct r_scope_elem **runp = imap->l_scope;
+ size_t cnt = 0;
+
+ while (*runp != NULL)
+ {
+ ++cnt;
+ ++runp;
+ }
+
+ if (*runp != NULL)
+ /* Avoid duplicates. */
+ continue;
+
+ if (__builtin_expect (cnt + 1 >= imap->l_scope_max, 0))
+ {
+ /* The 'r_scope' array is too small. Allocate a new one
+ dynamically. */
+ struct r_scope_elem **newp;
+ size_t new_size = imap->l_scope_max * 2;
+
+ if (imap->l_scope == imap->l_scope_mem)
+ {
+ newp = (struct r_scope_elem **)
+ malloc (new_size * sizeof (struct r_scope_elem *));
+ if (newp == NULL)
+ _dl_signal_error (ENOMEM, "dlopen", NULL,
+ N_("cannot create scope list"));
+ imap->l_scope = memcpy (newp, imap->l_scope,
+ cnt * sizeof (imap->l_scope[0]));
+ }
+ else
+ {
+ newp = (struct r_scope_elem **)
+ realloc (imap->l_scope,
+ new_size * sizeof (struct r_scope_elem *));
+ if (newp == NULL)
+ _dl_signal_error (ENOMEM, "dlopen", NULL,
+ N_("cannot create scope list"));
+ imap->l_scope = newp;
+ }
+
+ imap->l_scope_max = new_size;
+ }
+
+ imap->l_scope[cnt++] = &new->l_searchlist;
+ imap->l_scope[cnt] = NULL;
+ }
#if USE_TLS
- else if (new->l_searchlist.r_list[i]->l_opencount == 1
- /* Only if the module defines thread local data. */
- && __builtin_expect (new->l_searchlist.r_list[i]->l_tls_blocksize
- > 0, 0))
- {
- /* Now that we know the object is loaded successfully add
- modules containing TLS data to the slot info table. We
- might have to increase its size. */
- _dl_add_to_slotinfo (new->l_searchlist.r_list[i]);
-
- if (new->l_searchlist.r_list[i]->l_need_tls_init)
- {
- new->l_searchlist.r_list[i]->l_need_tls_init = 0;
+ /* Only add TLS memory if this object is loaded now and
+ therefore is not yet initialized. */
+ else if (! imap->l_init_called
+ /* Only if the module defines thread local data. */
+ && __builtin_expect (imap->l_tls_blocksize > 0, 0))
+ {
+ /* Now that we know the object is loaded successfully add
+ modules containing TLS data to the slot info table. We
+ might have to increase its size. */
+ _dl_add_to_slotinfo (imap);
+
+ if (imap->l_need_tls_init)
+ {
+ imap->l_need_tls_init = 0;
# ifdef SHARED
- /* Update the slot information data for at least the
- generation of the DSO we are allocating data for. */
- _dl_update_slotinfo (new->l_searchlist.r_list[i]->l_tls_modid);
+ /* Update the slot information data for at least the
+ generation of the DSO we are allocating data for. */
+ _dl_update_slotinfo (imap->l_tls_modid);
# endif
- GL(dl_init_static_tls) (new->l_searchlist.r_list[i]);
- assert (new->l_searchlist.r_list[i]->l_need_tls_init == 0);
- }
+ GL(dl_init_static_tls) (imap);
+ assert (imap->l_need_tls_init == 0);
+ }
- /* We have to bump the generation counter. */
- any_tls = true;
- }
+ /* We have to bump the generation counter. */
+ any_tls = true;
+ }
+ }
/* Bump the generation number if necessary. */
if (any_tls && __builtin_expect (++GL(dl_tls_generation) == 0, 0))
@@ -504,8 +493,8 @@ TLS generation counter wrapped! Please report this."));
/* Let the user know about the opencount. */
if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
- _dl_debug_printf ("opening file=%s [%lu]; opencount=%u\n\n",
- new->l_name, new->l_ns, new->l_opencount);
+ _dl_debug_printf ("opening file=%s [%lu]; direct_opencount=%u\n\n",
+ new->l_name, new->l_ns, new->l_direct_opencount);
}
@@ -581,12 +570,6 @@ no more namespaces available for dlmopen()"));
state if relocation failed, for example. */
if (args.map)
{
- /* Increment open counters for all objects since this
- sometimes has not happened yet. */
- if (args.map->l_searchlist.r_list[0]->l_opencount == 0)
- for (unsigned int i = 0; i < args.map->l_searchlist.r_nlist; ++i)
- ++args.map->l_searchlist.r_list[i]->l_opencount;
-
#ifdef USE_TLS
/* Maybe some of the modules which were loaded use TLS.
Since it will be removed in the following _dl_close call
@@ -618,7 +601,7 @@ no more namespaces available for dlmopen()"));
memcpy (local_errstring, errstring, len_errstring);
}
- if (errstring != INTUSE(_dl_out_of_memory))
+ if (errstring != _dl_out_of_memory)
free ((char *) errstring);
assert (_dl_debug_initialize (0, args.nsid)->r_state == RT_CONSISTENT);
diff --git a/elf/dl-version.c b/elf/dl-version.c
index d5fe2f49bd..9e881162a6 100644
--- a/elf/dl-version.c
+++ b/elf/dl-version.c
@@ -1,5 +1,5 @@
/* Handle symbol and library versioning.
- Copyright (C) 1997-2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1997-2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -77,7 +77,7 @@ find_needed (const char *name, struct link_map *map)
static int
internal_function
-match_symbol (const char *name, ElfW(Word) hash, const char *string,
+match_symbol (const char *name, Lmid_t ns, ElfW(Word) hash, const char *string,
struct link_map *map, int verbose, int weak)
{
const char *strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
@@ -90,9 +90,9 @@ match_symbol (const char *name, ElfW(Word) hash, const char *string,
/* Display information about what we are doing while debugging. */
if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_VERSIONS, 0))
_dl_debug_printf ("\
-checking for version `%s' in file %s required by file %s\n",
+checking for version `%s' in file %s [%lu] required by file %s [%lu]\n",
string, map->l_name[0] ? map->l_name : rtld_progname,
- name);
+ map->l_ns, name, ns);
if (__builtin_expect (map->l_info[VERSYMIDX (DT_VERDEF)] == NULL, 0))
{
@@ -242,7 +242,7 @@ _dl_check_map_versions (struct link_map *map, int verbose, int trace_mode)
/* Match the symbol. */
result |= match_symbol ((*map->l_name
? map->l_name : rtld_progname),
- aux->vna_hash,
+ map->l_ns, aux->vna_hash,
strtab + aux->vna_name,
needed->l_real, verbose,
aux->vna_flags & VER_FLG_WEAK);
diff --git a/elf/do-lookup.h b/elf/do-lookup.h
index e57d9df26d..62755ea013 100644
--- a/elf/do-lookup.h
+++ b/elf/do-lookup.h
@@ -1,5 +1,5 @@
/* Look up a symbol in the loaded objects.
- Copyright (C) 1995-2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1995-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
@@ -52,11 +52,16 @@ do_lookup_x (const char *undef_name, unsigned long int hash,
if ((type_class & ELF_RTYPE_CLASS_COPY) && map->l_type == lt_executable)
continue;
+ /* Do not look into objects which are going to be removed. */
+ if (map->l_removed)
+ continue;
+
/* Print some debugging info if wanted. */
if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_SYMBOLS, 0))
- _dl_debug_printf ("symbol=%s; lookup in file=%s\n",
+ _dl_debug_printf ("symbol=%s; lookup in file=%s [%lu]\n",
undef_name,
- map->l_name[0] ? map->l_name : rtld_progname);
+ map->l_name[0] ? map->l_name : rtld_progname,
+ map->l_ns);
symtab = (const void *) D_PTR (map, l_info[DT_SYMTAB]);
strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
diff --git a/elf/dynamic-link.h b/elf/dynamic-link.h
index 1d6806f50c..cf0d223c45 100644
--- a/elf/dynamic-link.h
+++ b/elf/dynamic-link.h
@@ -32,29 +32,29 @@
copying memory, breaking the very code written to handle the
unaligned cases. */
# if ! ELF_MACHINE_NO_REL
-auto void __attribute__((always_inline))
+auto inline void __attribute__((always_inline))
elf_machine_rel (struct link_map *map, const ElfW(Rel) *reloc,
const ElfW(Sym) *sym, const struct r_found_version *version,
void *const reloc_addr);
-auto void __attribute__((always_inline))
+auto inline void __attribute__((always_inline))
elf_machine_rel_relative (ElfW(Addr) l_addr, const ElfW(Rel) *reloc,
void *const reloc_addr);
# endif
# if ! ELF_MACHINE_NO_RELA
-auto void __attribute__((always_inline))
+auto inline void __attribute__((always_inline))
elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
const ElfW(Sym) *sym, const struct r_found_version *version,
void *const reloc_addr);
-auto void __attribute__((always_inline))
+auto inline void __attribute__((always_inline))
elf_machine_rela_relative (ElfW(Addr) l_addr, const ElfW(Rela) *reloc,
void *const reloc_addr);
# endif
# if ELF_MACHINE_NO_RELA || defined ELF_MACHINE_PLT_REL
-auto void __attribute__((always_inline))
+auto inline void __attribute__((always_inline))
elf_machine_lazy_rel (struct link_map *map,
ElfW(Addr) l_addr, const ElfW(Rel) *reloc);
# else
-auto void __attribute__((always_inline))
+auto inline void __attribute__((always_inline))
elf_machine_lazy_rel (struct link_map *map,
ElfW(Addr) l_addr, const ElfW(Rela) *reloc);
# endif
diff --git a/elf/elf.h b/elf/elf.h
index 0daff76a41..b84cc0e3ad 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -1,5 +1,5 @@
/* This file defines standard ELF types, structures, and macros.
- Copyright (C) 1995-2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1995-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
@@ -1491,8 +1491,21 @@ typedef struct
#define R_MIPS_PJUMP 35
#define R_MIPS_RELGOT 36
#define R_MIPS_JALR 37
+#define R_MIPS_TLS_DTPMOD32 38 /* Module number 32 bit */
+#define R_MIPS_TLS_DTPREL32 39 /* Module-relative offset 32 bit */
+#define R_MIPS_TLS_DTPMOD64 40 /* Module number 64 bit */
+#define R_MIPS_TLS_DTPREL64 41 /* Module-relative offset 64 bit */
+#define R_MIPS_TLS_GD 42 /* 16 bit GOT offset for GD */
+#define R_MIPS_TLS_LDM 43 /* 16 bit GOT offset for LDM */
+#define R_MIPS_TLS_DTPREL_HI16 44 /* Module-relative offset, high 16 bits */
+#define R_MIPS_TLS_DTPREL_LO16 45 /* Module-relative offset, low 16 bits */
+#define R_MIPS_TLS_GOTTPREL 46 /* 16 bit GOT offset for IE */
+#define R_MIPS_TLS_TPREL32 47 /* TP-relative offset, 32 bit */
+#define R_MIPS_TLS_TPREL64 48 /* TP-relative offset, 64 bit */
+#define R_MIPS_TLS_TPREL_HI16 49 /* TP-relative offset, high 16 bits */
+#define R_MIPS_TLS_TPREL_LO16 50 /* TP-relative offset, low 16 bits */
/* Keep this the last entry. */
-#define R_MIPS_NUM 38
+#define R_MIPS_NUM 51
/* Legal values for p_type field of Elf32_Phdr. */
diff --git a/elf/loadtest.c b/elf/loadtest.c
index 6b8f4bb7d0..ee106ea152 100644
--- a/elf/loadtest.c
+++ b/elf/loadtest.c
@@ -73,8 +73,8 @@ static const struct
#define OUT \
for (map = _r_debug.r_map; map != NULL; map = map->l_next) \
if (map->l_type == lt_loaded) \
- printf ("name = \"%s\", opencount = %d\n", \
- map->l_name, (int) map->l_opencount); \
+ printf ("name = \"%s\", direct_opencount = %d\n", \
+ map->l_name, (int) map->l_direct_opencount); \
fflush (stdout)
@@ -183,8 +183,8 @@ main (int argc, char *argv[])
for (map = _r_debug.r_map; map != NULL; map = map->l_next)
if (map->l_type == lt_loaded)
{
- printf ("name = \"%s\", opencount = %d\n",
- map->l_name, (int) map->l_opencount);
+ printf ("name = \"%s\", direct_opencount = %d\n",
+ map->l_name, (int) map->l_direct_opencount);
result = 1;
}
diff --git a/elf/neededtest.c b/elf/neededtest.c
index e6e99bfc6d..6c7a952066 100644
--- a/elf/neededtest.c
+++ b/elf/neededtest.c
@@ -27,7 +27,7 @@ check_loaded_objects (const char **loaded)
for (lm = _r_debug.r_map; lm; lm = lm->l_next)
{
if (lm->l_name && lm->l_name[0])
- printf(" %s, count = %d\n", lm->l_name, (int) lm->l_opencount);
+ printf(" %s, count = %d\n", lm->l_name, (int) lm->l_direct_opencount);
if (lm->l_type == lt_loaded && lm->l_name)
{
int match = 0;
diff --git a/elf/neededtest2.c b/elf/neededtest2.c
index cf111bc303..b682f15792 100644
--- a/elf/neededtest2.c
+++ b/elf/neededtest2.c
@@ -27,7 +27,7 @@ check_loaded_objects (const char **loaded)
for (lm = _r_debug.r_map; lm; lm = lm->l_next)
{
if (lm->l_name && lm->l_name[0])
- printf(" %s, count = %d\n", lm->l_name, (int) lm->l_opencount);
+ printf(" %s, count = %d\n", lm->l_name, (int) lm->l_direct_opencount);
if (lm->l_type == lt_loaded && lm->l_name)
{
int match = 0;
diff --git a/elf/neededtest3.c b/elf/neededtest3.c
index 38b3c6c6b7..ea1dcf4794 100644
--- a/elf/neededtest3.c
+++ b/elf/neededtest3.c
@@ -27,7 +27,7 @@ check_loaded_objects (const char **loaded)
for (lm = _r_debug.r_map; lm; lm = lm->l_next)
{
if (lm->l_name && lm->l_name[0])
- printf(" %s, count = %d\n", lm->l_name, (int) lm->l_opencount);
+ printf(" %s, count = %d\n", lm->l_name, (int) lm->l_direct_opencount);
if (lm->l_type == lt_loaded && lm->l_name)
{
int match = 0;
diff --git a/elf/neededtest4.c b/elf/neededtest4.c
index 04ab10e4c9..7514bed499 100644
--- a/elf/neededtest4.c
+++ b/elf/neededtest4.c
@@ -27,7 +27,7 @@ check_loaded_objects (const char **loaded)
for (lm = _r_debug.r_map; lm; lm = lm->l_next)
{
if (lm->l_name && lm->l_name[0])
- printf(" %s, count = %d\n", lm->l_name, (int) lm->l_opencount);
+ printf(" %s, count = %d\n", lm->l_name, (int) lm->l_direct_opencount);
if (lm->l_type == lt_loaded && lm->l_name)
{
int match = 0;
diff --git a/elf/order2.c b/elf/order2.c
new file mode 100644
index 0000000000..3dbfdd153e
--- /dev/null
+++ b/elf/order2.c
@@ -0,0 +1,46 @@
+#include <dlfcn.h>
+#include <stdio.h>
+
+
+int call_puts;
+
+static int
+do_test (void)
+{
+ call_puts = 1;
+
+ void *h1 = dlopen ("$ORIGIN/order2mod1.so", RTLD_LAZY | RTLD_GLOBAL);
+ if (h1 == NULL)
+ {
+ puts ("cannot load order2mod1");
+ return 1;
+ }
+ void *h2 = dlopen ("$ORIGIN/order2mod2.so", RTLD_LAZY);
+ if (h2 == NULL)
+ {
+ puts ("cannot load order2mod2");
+ return 1;
+ }
+ if (dlclose (h1) != 0)
+ {
+ puts ("dlclose order2mod1 failed");
+ return 1;
+ }
+ if (dlclose (h2) != 0)
+ {
+ puts ("dlclose order2mod2 failed");
+ return 1;
+ }
+ return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
+
+static void
+__attribute__ ((destructor))
+fini (void)
+{
+ if (call_puts)
+ puts ("5");
+}
diff --git a/elf/order2mod1.c b/elf/order2mod1.c
new file mode 100644
index 0000000000..b695db29b7
--- /dev/null
+++ b/elf/order2mod1.c
@@ -0,0 +1,8 @@
+#include <stdio.h>
+
+static void
+__attribute__ ((destructor))
+fini (void)
+{
+ putchar ('1');
+}
diff --git a/elf/order2mod2.c b/elf/order2mod2.c
new file mode 100644
index 0000000000..b03fb60fa3
--- /dev/null
+++ b/elf/order2mod2.c
@@ -0,0 +1,18 @@
+#include <stdio.h>
+
+extern int foo (void);
+extern int bar (void);
+
+void
+__attribute__ ((constructor))
+init (void)
+{
+ foo () - bar ();
+}
+
+static void
+__attribute__ ((destructor))
+fini (void)
+{
+ putchar ('2');
+}
diff --git a/elf/order2mod3.c b/elf/order2mod3.c
new file mode 100644
index 0000000000..7913a79925
--- /dev/null
+++ b/elf/order2mod3.c
@@ -0,0 +1,14 @@
+#include <stdio.h>
+
+int
+bar (void)
+{
+ return 1;
+}
+
+static void
+__attribute__ ((destructor))
+fini (void)
+{
+ putchar ('4');
+}
diff --git a/elf/order2mod4.c b/elf/order2mod4.c
new file mode 100644
index 0000000000..4f2026f041
--- /dev/null
+++ b/elf/order2mod4.c
@@ -0,0 +1,16 @@
+#include <stdio.h>
+
+extern int bar (void);
+
+int
+foo (void)
+{
+ return 42 + bar ();
+}
+
+static void
+__attribute__ ((destructor))
+fini (void)
+{
+ putchar ('3');
+}
diff --git a/elf/rtld.c b/elf/rtld.c
index b72216ba96..720029dfc9 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -267,7 +267,6 @@ _dl_start_final (void *arg, struct dl_start_final_info *info)
#endif
_dl_setup_hash (&GL(dl_rtld_map));
GL(dl_rtld_map).l_real = &GL(dl_rtld_map);
- GL(dl_rtld_map).l_opencount = 1;
GL(dl_rtld_map).l_map_start = (ElfW(Addr)) _begin;
GL(dl_rtld_map).l_map_end = (ElfW(Addr)) _end;
GL(dl_rtld_map).l_text_end = (ElfW(Addr)) _etext;
@@ -764,14 +763,48 @@ _dl_initial_error_catch_tsd (void)
}
#endif
+
+static unsigned int
+do_preload (char *fname, struct link_map *main_map, const char *where)
+{
+ const char *objname;
+ const char *err_str = NULL;
+ struct map_args args;
+
+ args.str = fname;
+ args.loader = main_map;
+ args.is_preloaded = 1;
+ args.mode = 0;
+
+ unsigned int old_nloaded = GL(dl_ns)[LM_ID_BASE]._ns_nloaded;
+
+ (void) _dl_catch_error (&objname, &err_str, map_doit, &args);
+ if (__builtin_expect (err_str != NULL, 0))
+ {
+ _dl_error_printf ("\
+ERROR: ld.so: object '%s' from %s cannot be preloaded: ignored.\n",
+ fname, where);
+ /* No need to call free, this is still before
+ the libc's malloc is used. */
+ }
+ else if (GL(dl_ns)[LM_ID_BASE]._ns_nloaded != old_nloaded)
+ /* It is no duplicate. */
+ return 1;
+
+ /* Nothing loaded. */
+ return 0;
+}
+
#if defined SHARED && defined _LIBC_REENTRANT \
&& defined __rtld_lock_default_lock_recursive
-static void rtld_lock_default_lock_recursive (void *lock)
+static void
+rtld_lock_default_lock_recursive (void *lock)
{
__rtld_lock_default_lock_recursive (lock);
}
-static void rtld_lock_default_unlock_recursive (void *lock)
+static void
+rtld_lock_default_unlock_recursive (void *lock)
{
__rtld_lock_default_unlock_recursive (lock);
}
@@ -792,8 +825,6 @@ dl_main (const ElfW(Phdr) *phdr,
{
const ElfW(Phdr) *ph;
enum mode mode;
- struct link_map **preloads;
- unsigned int npreloads;
struct link_map *main_map;
size_t file_size;
char *file;
@@ -1024,8 +1055,6 @@ of this helper program; chances are you did not intend to run this program.\n\
main_map->l_text_end = 0;
/* Perhaps the executable has no PT_LOAD header entries at all. */
main_map->l_map_start = ~0;
- /* We opened the file, account for it. */
- ++main_map->l_opencount;
/* And it was opened directly. */
++main_map->l_direct_opencount;
@@ -1496,8 +1525,9 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
/* We have two ways to specify objects to preload: via environment
variable and via the file /etc/ld.so.preload. The latter can also
be used when security is enabled. */
- preloads = NULL;
- npreloads = 0;
+ assert (GL(dl_rtld_map).l_next == NULL);
+ struct link_map **preloads = NULL;
+ unsigned int npreloads = 0;
if (__builtin_expect (preloadlist != NULL, 0))
{
@@ -1516,14 +1546,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
if (p[0] != '\0'
&& (__builtin_expect (! INTUSE(__libc_enable_secure), 1)
|| strchr (p, '/') == NULL))
- {
- struct link_map *new_map = _dl_map_object (main_map, p, 1,
- lt_library, 0, 0,
- LM_ID_BASE);
- if (++new_map->l_opencount == 1)
- /* It is no duplicate. */
- ++npreloads;
- }
+ npreloads += do_preload (p, main_map, "LD_PRELOAD");
HP_TIMING_NOW (stop);
HP_TIMING_DIFF (diff, start, stop);
@@ -1595,41 +1618,14 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
runp = file;
while ((p = strsep (&runp, ": \t\n")) != NULL)
if (p[0] != '\0')
- {
- const char *objname;
- const char *err_str = NULL;
- struct map_args args;
-
- args.str = p;
- args.loader = main_map;
- args.is_preloaded = 1;
- args.mode = 0;
-
- (void) _dl_catch_error (&objname, &err_str, map_doit,
- &args);
- if (__builtin_expect (err_str != NULL, 0))
- {
- _dl_error_printf ("\
-ERROR: ld.so: object '%s' from %s cannot be preloaded: ignored.\n",
- p, preload_file);
- /* No need to call free, this is still before
- the libc's malloc is used. */
- }
- else if (++args.map->l_opencount == 1)
- /* It is no duplicate. */
- ++npreloads;
- }
+ npreloads += do_preload (p, main_map, preload_file);
}
if (problem != NULL)
{
char *p = strndupa (problem, file_size - (problem - file));
- struct link_map *new_map = _dl_map_object (main_map, p, 1,
- lt_library, 0, 0,
- LM_ID_BASE);
- if (++new_map->l_opencount == 1)
- /* It is no duplicate. */
- ++npreloads;
+
+ npreloads += do_preload (p, main_map, preload_file);
}
HP_TIMING_NOW (stop);
@@ -1641,7 +1637,6 @@ ERROR: ld.so: object '%s' from %s cannot be preloaded: ignored.\n",
}
}
-
#if defined(__i386__) || defined(__alpha__) || (defined(__sparc__) && !defined(__arch64__))
/*
* Modifications by Red Hat Software
@@ -1683,26 +1678,17 @@ ERROR: ld.so: object '%s' from %s cannot be preloaded: ignored.\n",
if (test_fd >= 0) /* open did no fail.. */
__close(test_fd); /* avoid fd leaks */
- if (can_load != 0) {
- struct link_map *new_map;
- new_map = _dl_map_object (main_map, LIB_NOVERSION,
- 1, lt_library, 0, 0, LM_ID_BASE);
- if (++new_map->l_opencount == 1) {
- /* It is no duplicate. */
- ++npreloads;
-/* _dl_sysdep_message(" DONE\n", NULL); */
- } else {
-/* _dl_sysdep_message(" FAILED\n", NULL); */
- }
- }
-
+ if (can_load != 0)
+ npreloads += do_preload (LIB_NOVERSION, main_map,
+ "nonversioned binary");
+
HP_TIMING_NOW (stop);
HP_TIMING_DIFF (diff, start, stop);
HP_TIMING_ACCUM_NT (load_time, diff);
}
#endif
- if (__builtin_expect (npreloads, 0) != 0)
+ if (__builtin_expect (GL(dl_rtld_map).l_next != NULL, 0))
{
/* Set up PRELOADS with a vector of the preloaded libraries. */
struct link_map *l;
@@ -1802,14 +1788,9 @@ ERROR: ld.so: object '%s' from %s cannot be preloaded: ignored.\n",
HP_TIMING_DIFF (diff, start, stop);
HP_TIMING_ACCUM_NT (load_time, diff);
- /* Mark all objects as being in the global scope and set the open
- counter. */
+ /* Mark all objects as being in the global scope. */
for (i = main_map->l_searchlist.r_nlist; i > 0; )
- {
- --i;
- main_map->l_searchlist.r_list[i]->l_global = 1;
- ++main_map->l_searchlist.r_list[i]->l_opencount;
- }
+ main_map->l_searchlist.r_list[--i]->l_global = 1;
#ifndef MAP_ANON
/* We are done mapping things, so close the zero-fill descriptor. */
@@ -1819,18 +1800,22 @@ ERROR: ld.so: object '%s' from %s cannot be preloaded: ignored.\n",
/* Remove _dl_rtld_map from the chain. */
GL(dl_rtld_map).l_prev->l_next = GL(dl_rtld_map).l_next;
- if (GL(dl_rtld_map).l_next)
+ if (GL(dl_rtld_map).l_next != NULL)
GL(dl_rtld_map).l_next->l_prev = GL(dl_rtld_map).l_prev;
- if (__builtin_expect (GL(dl_rtld_map).l_opencount > 1, 1))
+ for (i = 1; i < main_map->l_searchlist.r_nlist; ++i)
+ if (main_map->l_searchlist.r_list[i] == &GL(dl_rtld_map))
+ break;
+
+ bool rtld_multiple_ref = false;
+ if (__builtin_expect (i < main_map->l_searchlist.r_nlist, 1))
{
/* Some DT_NEEDED entry referred to the interpreter object itself, so
put it back in the list of visible objects. We insert it into the
chain in symbol search order because gdb uses the chain's order as
its symbol search order. */
- i = 1;
- while (main_map->l_searchlist.r_list[i] != &GL(dl_rtld_map))
- ++i;
+ rtld_multiple_ref = true;
+
GL(dl_rtld_map).l_prev = main_map->l_searchlist.r_list[i - 1];
if (__builtin_expect (mode, normal) == normal)
{
@@ -2002,7 +1987,7 @@ ERROR: ld.so: object '%s' from %s cannot be preloaded: ignored.\n",
}
else
{
- /* If LD_WARN is set warn about undefined symbols. */
+ /* If LD_WARN is set, warn about undefined symbols. */
if (GLRO(dl_lazy) >= 0 && GLRO(dl_verbose))
{
/* We have to do symbol dependency testing. */
@@ -2012,7 +1997,7 @@ ERROR: ld.so: object '%s' from %s cannot be preloaded: ignored.\n",
args.lazy = GLRO(dl_lazy);
l = main_map;
- while (l->l_next)
+ while (l->l_next != NULL)
l = l->l_next;
do
{
@@ -2023,10 +2008,11 @@ ERROR: ld.so: object '%s' from %s cannot be preloaded: ignored.\n",
&args);
}
l = l->l_prev;
- } while (l);
+ }
+ while (l != NULL);
if ((GLRO(dl_debug_mask) & DL_DEBUG_PRELINK)
- && GL(dl_rtld_map).l_opencount > 1)
+ && rtld_multiple_ref)
{
/* Mark the link map as not yet relocated again. */
GL(dl_rtld_map).l_relocated = 0;
@@ -2306,7 +2292,7 @@ ERROR: ld.so: object '%s' from %s cannot be preloaded: ignored.\n",
/* We must prepare the profiling. */
_dl_start_profile ();
- if (GL(dl_rtld_map).l_opencount > 1)
+ if (rtld_multiple_ref)
{
/* There was an explicit ref to the dynamic linker as a shared lib.
Re-relocate ourselves with user-controlled symbol definitions. */
diff --git a/elf/testobj2.c b/elf/testobj2.c
index f00ba9f3e6..7e4b610982 100644
--- a/elf/testobj2.c
+++ b/elf/testobj2.c
@@ -1,5 +1,6 @@
#include <dlfcn.h>
#include <stdlib.h>
+#include <stdio.h>
#include "testobj.h"
diff --git a/elf/tls-macros.h b/elf/tls-macros.h
index bed2e14899..c6626c2e75 100644
--- a/elf/tls-macros.h
+++ b/elf/tls-macros.h
@@ -16,6 +16,7 @@
/* XXX Until we get compiler support we don't need declarations. */
#define VAR_INT_DECL(x)
+#include_next <tls-macros.h>
/* XXX Each architecture must have its own asm for now. */
#ifdef __i386__
@@ -731,6 +732,7 @@ register void *__gp __asm__("$29");
__result; \
})
-#else
+#elif !defined TLS_LE || !defined TLS_IE \
+ || !defined TLS_LD || !defined TLS_GD(x)
# error "No support for this architecture so far."
#endif
diff --git a/elf/unload.c b/elf/unload.c
index 4fd82b7e3a..ffb33482c0 100644
--- a/elf/unload.c
+++ b/elf/unload.c
@@ -12,8 +12,8 @@
#define OUT \
for (map = _r_debug.r_map; map != NULL; map = map->l_next) \
if (map->l_type == lt_loaded) \
- printf ("name = \"%s\", opencount = %d\n", \
- map->l_name, (int) map->l_opencount); \
+ printf ("name = \"%s\", direct_opencount = %d\n", \
+ map->l_name, (int) map->l_direct_opencount); \
fflush (stdout)
typedef struct
diff --git a/elf/unload2.c b/elf/unload2.c
index 7a38053433..e14c6f06af 100644
--- a/elf/unload2.c
+++ b/elf/unload2.c
@@ -9,8 +9,8 @@
#define OUT \
for (map = _r_debug.r_map; map != NULL; map = map->l_next) \
if (map->l_type == lt_loaded) \
- printf ("name = \"%s\", opencount = %d\n", \
- map->l_name, (int) map->l_opencount); \
+ printf ("name = \"%s\", direct_opencount = %d\n", \
+ map->l_name, (int) map->l_direct_opencount); \
fflush (stdout)
int
diff --git a/elf/unload3mod4.c b/elf/unload3mod4.c
index 4586ff7383..52f808e79b 100644
--- a/elf/unload3mod4.c
+++ b/elf/unload3mod4.c
@@ -1,5 +1,7 @@
#include <stdio.h>
+extern int foo (int x);
+
int
bar (int x)
{
diff --git a/elf/unload4.c b/elf/unload4.c
new file mode 100644
index 0000000000..6e171a22e0
--- /dev/null
+++ b/elf/unload4.c
@@ -0,0 +1,48 @@
+#include <dlfcn.h>
+#include <stdio.h>
+#include <malloc.h>
+
+int
+main (void)
+{
+#ifdef M_PERTURB
+ mallopt (M_PERTURB, 0xaa);
+#endif
+
+ void *h;
+ int (*fn) (int);
+ h = dlopen ("unload4mod1.so", RTLD_LAZY);
+ if (h == NULL)
+ {
+ puts ("1st dlopen failed");
+ return 1;
+ }
+ fn = dlsym (h, "foo");
+ if (fn == NULL)
+ {
+ puts ("dlsym failed");
+ return 1;
+ }
+ int n = fn (10);
+ if (n != 28)
+ {
+ printf ("foo (10) returned %d != 28\n", n);
+ return 1;
+ }
+ dlclose (h);
+ h = dlopen ("unload4mod3.so", RTLD_LAZY);
+ fn = dlsym (h, "mod3fn2");
+ if (fn == NULL)
+ {
+ puts ("second dlsym failed");
+ return 1;
+ }
+ n = fn (10);
+ if (n != 22)
+ {
+ printf ("mod3fn2 (10) returned %d != 22\n", n);
+ return 1;
+ }
+ dlclose (h);
+ return 0;
+}
diff --git a/elf/unload4mod1.c b/elf/unload4mod1.c
new file mode 100644
index 0000000000..38c5b0168d
--- /dev/null
+++ b/elf/unload4mod1.c
@@ -0,0 +1,10 @@
+#include <stdio.h>
+
+extern int bar (int);
+
+int
+foo (int x)
+{
+ puts ("in foo");
+ return bar (x / 2) + 2;
+}
diff --git a/elf/unload4mod2.c b/elf/unload4mod2.c
new file mode 100644
index 0000000000..497ef5d93b
--- /dev/null
+++ b/elf/unload4mod2.c
@@ -0,0 +1,8 @@
+#include <stdio.h>
+
+int
+baz (int x)
+{
+ puts ("in baz");
+ return x * 4;
+}
diff --git a/elf/unload4mod3.c b/elf/unload4mod3.c
new file mode 100644
index 0000000000..4b280bc05b
--- /dev/null
+++ b/elf/unload4mod3.c
@@ -0,0 +1,16 @@
+#include <stdio.h>
+
+int
+__attribute__((noinline))
+mod3fn1 (int x)
+{
+ puts ("in mod3fn1");
+ return x + 6;
+}
+
+int
+mod3fn2 (int x)
+{
+ puts ("in mod3fn2");
+ return mod3fn1 (x / 2) * 2;
+}
diff --git a/elf/unload4mod4.c b/elf/unload4mod4.c
new file mode 100644
index 0000000000..ba5a144d38
--- /dev/null
+++ b/elf/unload4mod4.c
@@ -0,0 +1,16 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+__attribute__((noinline))
+baz (int x)
+{
+ abort ();
+}
+
+int
+bar (int x)
+{
+ puts ("in bar");
+ return baz (x + 1) + 2;
+}
diff --git a/elf/unload5.c b/elf/unload5.c
new file mode 100644
index 0000000000..0555052ce8
--- /dev/null
+++ b/elf/unload5.c
@@ -0,0 +1,42 @@
+#include <dlfcn.h>
+#include <stdio.h>
+
+int
+main (void)
+{
+ void *g = dlopen ("unload3mod1.so", RTLD_GLOBAL | RTLD_NOW);
+ void *h = dlopen ("unload3mod2.so", RTLD_GLOBAL | RTLD_NOW);
+ if (g == NULL || h == NULL)
+ {
+ printf ("dlopen unload3mod{1,2}.so failed: %p %p\n", g, h);
+ return 1;
+ }
+ dlopen ("unload3mod4.so", RTLD_GLOBAL | RTLD_NOW);
+ dlclose (h);
+ dlclose (g);
+
+ g = dlopen ("unload3mod3.so", RTLD_GLOBAL | RTLD_NOW);
+ h = dlopen ("unload3mod4.so", RTLD_GLOBAL | RTLD_NOW);
+ if (g == NULL || h == NULL)
+ {
+ printf ("dlopen unload3mod{3,4}.so failed: %p %p\n", g, h);
+ return 1;
+ }
+
+ int (*fn) (int);
+ fn = dlsym (h, "bar");
+ if (fn == NULL)
+ {
+ puts ("dlsym failed");
+ return 1;
+ }
+
+ int val = fn (16);
+ if (val != 24)
+ {
+ printf ("bar returned %d != 24\n", val);
+ return 1;
+ }
+
+ return 0;
+}
diff --git a/fedora/branch.mk b/fedora/branch.mk
index 5b377a492e..059c5a0d5c 100644
--- a/fedora/branch.mk
+++ b/fedora/branch.mk
@@ -1,5 +1,5 @@
# This file is updated automatically by Makefile.
glibc-branch := fedora
glibc-base := HEAD
-fedora-sync-date := 2005-03-03 13:35 UTC
-fedora-sync-tag := fedora-glibc-20050303T1335
+fedora-sync-date := 2005-03-19 19:07 UTC
+fedora-sync-tag := fedora-glibc-20050319T1907
diff --git a/iconv/gconv_simple.c b/iconv/gconv_simple.c
index e0d14139ba..343c27521f 100644
--- a/iconv/gconv_simple.c
+++ b/iconv/gconv_simple.c
@@ -1,5 +1,5 @@
/* Simple transformations functions.
- Copyright (C) 1997-2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1997-2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -886,7 +886,7 @@ ucs4le_internal_loop_single (struct __gconv_step *step,
else if (__builtin_expect (wc <= 0x7fffffff, 1)) \
{ \
size_t step; \
- char *start; \
+ unsigned char *start; \
\
for (step = 2; step < 6; ++step) \
if ((wc & (~(uint32_t)0 << (5 * step + 1))) == 0) \
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index f3526ca053..cdbc4ef202 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -583,78 +583,23 @@ for linking")
# define hidden_proto(name, attrs...) \
__hidden_proto (name, __GI_##name, ##attrs)
# define __hidden_proto(name, internal, attrs...) \
- extern __typeof (name) internal; \
extern __typeof (name) name __asm__ (__hidden_asmname (#internal)) \
__hidden_proto_hiddenattr (attrs);
# define __hidden_asmname(name) \
__hidden_asmname1 (__USER_LABEL_PREFIX__, name)
# define __hidden_asmname1(prefix, name) __hidden_asmname2(prefix, name)
# define __hidden_asmname2(prefix, name) #prefix name
-# ifdef HAVE_ASM_SET_DIRECTIVE
-# define __hidden_def1(original, alias) \
- ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \
- .set C_SYMBOL_NAME (alias), C_SYMBOL_NAME (original)
-# ifdef HAVE_ASM_GLOBAL_DOT_NAME
-# define __hidden_dot_def1(original, alias) ASM_LINE_SEP \
- ASM_GLOBAL_DIRECTIVE C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \
- .set C_SYMBOL_DOT_NAME (alias), C_SYMBOL_DOT_NAME (original)
-# else
-# define __hidden_dot_def1(original, alias)
-# endif
-# else
-# define __hidden_def1(original, alias) \
- ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \
- C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original)
-# ifdef HAVE_ASM_GLOBAL_DOT_NAME
-# define __hidden_dot_def1(original, alias) ASM_LINE_SEP \
- ASM_GLOBAL_DIRECTIVE C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \
- C_SYMBOL_DOT_NAME (alias) = C_SYMBOL_DOT_NAME (original)
-# else
-# define __hidden_dot_def1(original, alias)
-# endif
-# endif
-# define __hidden_def2(...) #__VA_ARGS__
-# define __hidden_def3(...) __hidden_def2 (__VA_ARGS__)
-# define hidden_def(name) \
- __asm__ (__hidden_def3 (__hidden_def1 (__GI_##name, name) \
- __hidden_dot_def1 (__GI_##name, name)));
-# define hidden_data_def(name) \
- __asm__ (__hidden_def3 (__hidden_def1 (__GI_##name, name)));
-# define hidden_ver(local, name) \
- __asm__ (__hidden_def3 (__hidden_def1 (local, __GI_##name) \
- __hidden_dot_def1 (local, __GI_##name)));
-# define hidden_data_ver(local, name) \
- __asm__ (__hidden_def3 (__hidden_def1 (local, __GI_##name)));
-# ifdef HAVE_WEAK_SYMBOLS
-# ifdef HAVE_ASM_WEAKEXT_DIRECTIVE
-# define __hidden_weak1(original, alias) \
- .weakext C_SYMBOL_NAME (alias), C_SYMBOL_NAME (original)
-# ifdef HAVE_ASM_GLOBAL_DOT_NAME
-# define __hidden_dot_weak1(original, alias) ASM_LINE_SEP \
- .weakext C_SYMBOL_DOT_NAME (alias), C_SYMBOL_DOT_NAME (original)
-# else
-# define __hidden_dot_weak1(original, alias)
-# endif
-# else /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */
-# define __hidden_weak1(original, alias) \
- .weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \
- C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original)
-# ifdef HAVE_ASM_GLOBAL_DOT_NAME
-# define __hidden_dot_weak1(original, alias) ASM_LINE_SEP \
- .weak C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \
- C_SYMBOL_DOT_NAME (alias) = C_SYMBOL_DOT_NAME (original)
-# else
-# define __hidden_dot_weak1(original, alias)
-# endif
-# endif
-# define hidden_weak(name) \
- __asm__ (__hidden_def3 (__hidden_weak1 (__GI_##name, name) \
- __hidden_dot_weak1 (__GI_##name, name)));
-# define hidden_data_weak(name) \
- __asm__ (__hidden_def3 (__hidden_weak1 (__GI_##name, name)));
-# else
-# define hidden_weak(name) hidden_def (name)
-# endif
+# define __hidden_ver1(local, internal, name) \
+ extern __typeof (name) __EI_##name __asm__(__hidden_asmname (#internal)); \
+ extern __typeof (name) __EI_##name \
+ __attribute__((alias (__hidden_asmname (#local))))
+# define hidden_ver(local, name) __hidden_ver1(local, __GI_##name, name);
+# define hidden_data_ver(local, name) hidden_ver(local, name)
+# define hidden_def(name) __hidden_ver1(__GI_##name, name, name);
+# define hidden_data_def(name) hidden_def(name)
+# define hidden_weak(name) \
+ __hidden_ver1(__GI_##name, name, name) __attribute__((weak));
+# define hidden_data_weak(name) hidden_weak(name)
# else
/* For assembly, we need to do the opposite of what we do in C:
in assembly gcc __REDIRECT stuff is not in place, so functions
diff --git a/include/link.h b/include/link.h
index 965419126d..0c35264096 100644
--- a/include/link.h
+++ b/include/link.h
@@ -178,7 +178,6 @@ struct link_map
Elf_Symndx l_nbuckets;
const Elf_Symndx *l_buckets, *l_chain;
- unsigned int l_opencount; /* Counter for direct and indirect usage. */
unsigned int l_direct_opencount; /* Reference count for dlopen/dlclose. */
enum /* Where this object came from. */
{
@@ -203,6 +202,8 @@ struct link_map
unsigned int l_auditing:1; /* Nonzero if the DSO is used in auditing. */
unsigned int l_audit_any_plt:1; /* Nonzero if at least one audit module
is interested in the PLT interception.*/
+ unsigned int l_removed:1; /* Nozero if the object cannot be used anymore
+ since it is removed. */
/* Array with version names. */
unsigned int l_nversions;
@@ -267,7 +268,7 @@ struct link_map
ElfW(Word) l_flags;
/* Temporarily used in `dl_close'. */
- unsigned int l_idx;
+ int l_idx;
struct link_map_machine l_mach;
diff --git a/include/wchar.h b/include/wchar.h
index 73bd4a8fef..0f91114c41 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -56,7 +56,6 @@ extern int __wcscasecmp (__const wchar_t *__s1, __const wchar_t *__s2)
extern int __wcsncasecmp (__const wchar_t *__s1, __const wchar_t *__s2,
size_t __n)
__attribute_pure__;
-extern int __wcscoll (__const wchar_t *__s1, __const wchar_t *__s2);
extern size_t __wcslen (__const wchar_t *__s) __attribute_pure__;
extern size_t __wcsnlen (__const wchar_t *__s, size_t __maxlen)
__attribute_pure__;
diff --git a/inet/test-ifaddrs.c b/inet/test-ifaddrs.c
index 7efca25337..0d30d05b64 100644
--- a/inet/test-ifaddrs.c
+++ b/inet/test-ifaddrs.c
@@ -1,5 +1,5 @@
/* Test listing of network interface addresses.
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 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
@@ -62,8 +62,8 @@ addr_string (struct sockaddr *sa, char *buf, size_t size)
}
-int
-main (void)
+static int
+do_test (void)
{
struct ifaddrs *ifaces, *ifa;
@@ -95,3 +95,6 @@ Name Flags Address Netmask Broadcast/Destination");
return failures ? 1 : 0;
}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/inet/test_ifindex.c b/inet/test_ifindex.c
index 9e081233be..2920494521 100644
--- a/inet/test_ifindex.c
+++ b/inet/test_ifindex.c
@@ -1,5 +1,5 @@
/* Test interface name <-> index conversions.
- Copyright (C) 1997, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2000, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Philip Blundell <Philip.Blundell@pobox.com>.
@@ -24,8 +24,8 @@
#include <string.h>
#include <net/if.h>
-int
-main (void)
+static int
+do_test (void)
{
int failures = 0;
struct if_nameindex *idx = if_nameindex (), *p;
@@ -63,3 +63,6 @@ main (void)
if_freenameindex (idx);
return failures ? 1 : 0;
}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/libidn/ChangeLog b/libidn/ChangeLog
index df3a6269e8..f9303743fc 100644
--- a/libidn/ChangeLog
+++ b/libidn/ChangeLog
@@ -1,3 +1,13 @@
+2005-03-08 Paul Eggert <eggert@cs.ucla.edu>
+
+ * iconvme.c (SIZE_MAX): New macro, if not already defined.
+ (iconv_string): Don't guess a size-zero buffer, as that might cause
+ buffer overrun. Instead, avoid multiplying by MB_LEN_MAX if the
+ result would be 'too large', where 'too large' is (heuristically)
+ the square root of SIZE_MAX, divided by MB_LEN_MAX to allay
+ overflow concerns. This will prevent some unwanted malloc failures
+ when the inputs are very large.
+
2005-02-12 Simon Josefsson <jas@extundo.com >
* iconvme.h: New file, extracted from toutf8.c but improved.
diff --git a/libidn/iconvme.c b/libidn/iconvme.c
index daf0c8e349..cc4dd1daa5 100644
--- a/libidn/iconvme.c
+++ b/libidn/iconvme.c
@@ -41,10 +41,14 @@
#if HAVE_ICONV
/* Get iconv etc. */
# include <iconv.h>
-/* Get MB_LEN_MAX. */
+/* Get MB_LEN_MAX, CHAR_BIT. */
# include <limits.h>
#endif
+#ifndef SIZE_MAX
+# define SIZE_MAX ((size_t) -1)
+#endif
+
/* Convert a zero-terminated string STR from the FROM_CODSET code set
to the TO_CODESET code set. The returned string is allocated using
malloc, and must be dellocated by the caller using free. On
@@ -63,10 +67,18 @@ iconv_string (const char *str, const char *from_codeset,
char *p = (char *) str;
size_t inbytes_remaining = strlen (p);
/* Guess the maximum length the output string can have. */
- size_t outbuf_size = (inbytes_remaining + 1) * MB_LEN_MAX;
- size_t outbytes_remaining = outbuf_size - 1; /* -1 for NUL */
+ size_t outbuf_size = inbytes_remaining + 1;
+ size_t outbytes_remaining;
size_t err;
int have_error = 0;
+
+ /* Use a worst-case output size guess, so long as that wouldn't be
+ too large for comfort. It's OK if the guess is wrong so long as
+ it's nonzero. */
+ size_t approx_sqrt_SIZE_MAX = SIZE_MAX >> (sizeof (size_t) * CHAR_BIT / 2);
+ if (outbuf_size <= approx_sqrt_SIZE_MAX / MB_LEN_MAX)
+ outbuf_size *= MB_LEN_MAX;
+ outbytes_remaining = outbuf_size - 1;
#endif
if (strcmp (to_codeset, from_codeset) == 0)
diff --git a/libio/bits/stdio2.h b/libio/bits/stdio2.h
index 6ab6841c53..a462c1d8cf 100644
--- a/libio/bits/stdio2.h
+++ b/libio/bits/stdio2.h
@@ -83,22 +83,40 @@ extern int __vprintf_chk (int __flag, __const char *__restrict __format,
#endif
-extern char *__gets_chk (char *__str, size_t);
-#define gets(__str) \
- ((__bos (__str) == (size_t) -1) \
- ? gets (__str) : __gets_chk (__str, __bos (__str)))
-
-extern void __chk_fail (void) __attribute__((noreturn));
-#define fgets(__str, __n, __fp) \
- (__extension__ \
- ({ size_t __n_val = (__n); \
- if (__bos (__str) != (size_t) -1 && __bos (__str) < __n_val) \
- __chk_fail (); \
- fgets (__str, __n_val, __fp); }))
-
-#define fgets_unlocked(__str, __n, __fp) \
- (__extension__ \
- ({ size_t __n_val = (__n); \
- if (__bos (__str) != (size_t) -1 && __bos (__str) < __n_val) \
- __chk_fail (); \
- fgets_unlocked (__str, __n_val, __fp); }))
+extern char *__gets_chk (char *__str, size_t) __wur;
+extern char *__REDIRECT (__gets_alias, (char *__str), gets) __wur;
+
+extern __always_inline __wur char *
+gets (char *__str)
+{
+ if (__bos (__str) != (size_t) -1)
+ return __gets_chk (__str, __bos (__str));
+ return __gets_alias (__str);
+}
+
+extern void __chk_fail (void) __attribute__((__noreturn__));
+extern char *__REDIRECT (__fgets_alias,
+ (char *__restrict __s, int __n,
+ FILE *__restrict __stream), fgets) __wur;
+
+extern __always_inline __wur char *
+fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
+{
+ if (__bos (__s) != (size_t) -1 && (size_t) __n > __bos (__s))
+ __chk_fail ();
+ return __fgets_alias (__s, __n, __stream);
+}
+
+#ifdef __USE_GNU
+extern char *__REDIRECT (__fgets_unlocked_alias,
+ (char *__restrict __s, int __n,
+ FILE *__restrict __stream), fgets_unlocked) __wur;
+
+extern __always_inline __wur char *
+fgets_unlocked (char *__restrict __s, int __n, FILE *__restrict __stream)
+{
+ if (__bos (__s) != (size_t) -1 && (size_t) __n > __bos (__s))
+ __chk_fail ();
+ return __fgets_unlocked_alias (__s, __n, __stream);
+}
+#endif
diff --git a/libio/iofwide.c b/libio/iofwide.c
index 03124219ad..7af9a633f8 100644
--- a/libio/iofwide.c
+++ b/libio/iofwide.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2003, 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
@@ -228,8 +228,8 @@ do_out (struct _IO_codecvt *codecvt, __mbstate_t *statep,
size_t dummy;
const unsigned char *from_start_copy = (unsigned char *) from_start;
- codecvt->__cd_out.__cd.__data[0].__outbuf = to_start;
- codecvt->__cd_out.__cd.__data[0].__outbufend = to_end;
+ codecvt->__cd_out.__cd.__data[0].__outbuf = (unsigned char *) to_start;
+ codecvt->__cd_out.__cd.__data[0].__outbufend = (unsigned char *) to_end;
codecvt->__cd_out.__cd.__data[0].__statep = statep;
status = DL_CALL_FCT (gs->__fct,
@@ -238,7 +238,7 @@ do_out (struct _IO_codecvt *codecvt, __mbstate_t *statep,
&dummy, 0, 0));
*from_stop = (wchar_t *) from_start_copy;
- *to_stop = codecvt->__cd_out.__cd.__data[0].__outbuf;
+ *to_stop = (char *) codecvt->__cd_out.__cd.__data[0].__outbuf;
switch (status)
{
@@ -294,15 +294,15 @@ do_unshift (struct _IO_codecvt *codecvt, __mbstate_t *statep,
int status;
size_t dummy;
- codecvt->__cd_out.__cd.__data[0].__outbuf = to_start;
- codecvt->__cd_out.__cd.__data[0].__outbufend = to_end;
+ codecvt->__cd_out.__cd.__data[0].__outbuf = (unsigned char *) to_start;
+ codecvt->__cd_out.__cd.__data[0].__outbufend = (unsigned char *) to_end;
codecvt->__cd_out.__cd.__data[0].__statep = statep;
status = DL_CALL_FCT (gs->__fct,
(gs, codecvt->__cd_out.__cd.__data, NULL, NULL,
NULL, &dummy, 1, 0));
- *to_stop = codecvt->__cd_out.__cd.__data[0].__outbuf;
+ *to_stop = (char *) codecvt->__cd_out.__cd.__data[0].__outbuf;
switch (status)
{
@@ -357,15 +357,16 @@ do_in (struct _IO_codecvt *codecvt, __mbstate_t *statep,
size_t dummy;
const unsigned char *from_start_copy = (unsigned char *) from_start;
- codecvt->__cd_in.__cd.__data[0].__outbuf = (char *) to_start;
- codecvt->__cd_in.__cd.__data[0].__outbufend = (char *) to_end;
+ codecvt->__cd_in.__cd.__data[0].__outbuf = (unsigned char *) to_start;
+ codecvt->__cd_in.__cd.__data[0].__outbufend = (unsigned char *) to_end;
codecvt->__cd_in.__cd.__data[0].__statep = statep;
status = DL_CALL_FCT (gs->__fct,
(gs, codecvt->__cd_in.__cd.__data, &from_start_copy,
- from_end, NULL, &dummy, 0, 0));
+ (const unsigned char *) from_end, NULL,
+ &dummy, 0, 0));
- *from_stop = from_start_copy;
+ *from_stop = (const char *) from_start_copy;
*to_stop = (wchar_t *) codecvt->__cd_in.__cd.__data[0].__outbuf;
switch (status)
@@ -454,13 +455,14 @@ do_length (struct _IO_codecvt *codecvt, __mbstate_t *statep,
int status;
size_t dummy;
- codecvt->__cd_in.__cd.__data[0].__outbuf = (char *) to_buf;
- codecvt->__cd_in.__cd.__data[0].__outbufend = (char *) &to_buf[max];
+ codecvt->__cd_in.__cd.__data[0].__outbuf = (unsigned char *) to_buf;
+ codecvt->__cd_in.__cd.__data[0].__outbufend = (unsigned char *) &to_buf[max];
codecvt->__cd_in.__cd.__data[0].__statep = statep;
status = DL_CALL_FCT (gs->__fct,
- (gs, codecvt->__cd_in.__cd.__data, &cp, from_end,
- NULL, &dummy, 0, 0));
+ (gs, codecvt->__cd_in.__cd.__data, &cp,
+ (const unsigned char *) from_end, NULL,
+ &dummy, 0, 0));
result = cp - (const unsigned char *) from_start;
#else
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index d55879a479..8699564b4c 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,14 +1,25 @@
+2005-03-05 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/i386/Makefile (CFLAGS-pt-initfini.s): Unconditionally
+ use -mtune.
+
+2005-03-05 Roland McGrath <roland@redhat.com>
+
+ * sysdeps/i386/Makefile (CFLAGS-pt-initfini.s): Use $(cc-mtune).
+
2005-03-05 Jakub Jelinek <jakub@redhat.com>
* sysdeps/powerpc/tcb-offsets.sym (thread_offsetof): Rework for GCC 4.
2005-02-09 Daniel Jacobowitz <dan@codesourcery.com>
+ [BZ #740]
* descr.h (__pthread_find_self, thread_self): Mark as pure
instead of const.
2005-02-07 Jakub Jelinek <jakub@redhat.com>
+ [BZ #739]
* specific.c (pthread_key_delete): If pthread_create has not been
called yet, clear p_specific for the current thread.
* Makefile (tests): Add tst-tsd1.
diff --git a/linuxthreads/sysdeps/i386/Makefile b/linuxthreads/sysdeps/i386/Makefile
index 418fa5c6ef..d920e059a2 100644
--- a/linuxthreads/sysdeps/i386/Makefile
+++ b/linuxthreads/sysdeps/i386/Makefile
@@ -1,7 +1,7 @@
ifeq ($(subdir),linuxthreads)
# On i686 we must avoid generating the trampoline functions generated
# to get the GOT pointer.
-CFLAGS-pt-initfini.s += -march=i386 -mcpu=i386
+CFLAGS-pt-initfini.s += -march=i386 -mtune=i386
# Most files must not be compiled without frame pointer since we need
# the frame base address which is stored in %ebp unless the frame pointer
diff --git a/locale/weightwc.h b/locale/weightwc.h
index ff5e63aeef..436aa7e548 100644
--- a/locale/weightwc.h
+++ b/locale/weightwc.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2000, 2001,2003,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2001,2003,2004,2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Ulrich Drepper, <drepper@cygnus.com>.
@@ -22,12 +22,8 @@ auto inline int32_t
__attribute ((always_inline))
findidx (const wint_t **cpp)
{
- int32_t i;
- const wint_t *cp;
- wint_t ch;
-
- ch = *(*cpp)++;
- i = __collidx_table_lookup ((const char *) table, ch);
+ wint_t ch = *(*cpp)++;
+ int32_t i = __collidx_table_lookup ((const char *) table, ch);
if (i >= 0)
/* This is an index into the weight table. Cool. */
@@ -35,11 +31,11 @@ findidx (const wint_t **cpp)
/* Oh well, more than one sequence starting with this byte.
Search for the correct one. */
- cp = &extra[-i];
+ const int32_t *cp = &extra[-i];
while (1)
{
size_t nhere;
- const wint_t *usrc = *cpp;
+ const int32_t *usrc = (const int32_t *) *cpp;
/* The first thing is the index. */
i = *cp++;
diff --git a/localedata/ChangeLog b/localedata/ChangeLog
index 8c8616e7cf..548dc7890c 100644
--- a/localedata/ChangeLog
+++ b/localedata/ChangeLog
@@ -1,3 +1,11 @@
+2005-03-18 Andreas Schwab <schwab@suse.de>
+
+ * locales/pa_IN (am_pm): Fix character names.
+
+2005-03-18 Ulrich Drepper <drepper@redhat.com>
+
+ * SUPPORTED (SUPPORTED-LOCALES): Add af_ZA.UTF-8.
+
2004-12-19 Roland McGrath <roland@frob.com>
* gen-unicode-ctype.c (output_tables): Fix email address in output.
diff --git a/localedata/SUPPORTED b/localedata/SUPPORTED
index b5865ef856..6dafc49f4d 100644
--- a/localedata/SUPPORTED
+++ b/localedata/SUPPORTED
@@ -5,6 +5,7 @@ aa_DJ/ISO-8859-1 \
aa_ER/UTF-8 \
aa_ER@saaho/UTF-8 \
aa_ET/UTF-8 \
+af_ZA.UTF-8/UTF-8 \
af_ZA/ISO-8859-1 \
am_ET/UTF-8 \
an_ES/ISO-8859-15 \
diff --git a/localedata/locales/pa_IN b/localedata/locales/pa_IN
index 2a2072837b..96fa896e85 100644
--- a/localedata/locales/pa_IN
+++ b/localedata/locales/pa_IN
@@ -5,7 +5,7 @@ escape_char /
LC_IDENTIFICATION
title "Punjabi language locale for Indian Punjabi(Gurmukhi)"
-source "IndLinux.org"
+source "IndLinux.org"
address ""
contact ""
email "bug-glibc-locales@gnu.org"
@@ -14,7 +14,7 @@ fax ""
language "Punjabi"
territory "India"
revision "0.2"
-date "2004-09-30"
+date "2004-09-30"
%
category "pa_IN:2000";LC_IDENTIFICATION
category "pa_IN:2000";LC_CTYPE
@@ -122,8 +122,8 @@ mon "<U0A1C><U0A28><U0A35><U0A30><U0A40>";/
%
% Equivalent of AM PM
-am_pm "<U0A38><U035><U0A47><U0A30><U0A47>";/
- "<U0A36><U0A3E><U02E>"
+am_pm "<U0A38><U0035><U0A47><U0A30><U0A47>";/
+ "<U0A36><U0A3E><U002E>"
%
% Appropriate date and time representation
diff --git a/malloc/arena.c b/malloc/arena.c
index 8202aaf01b..8db255966d 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -482,8 +482,13 @@ ptmalloc_init (void)
s = &envline[7];
break;
case 8:
- if (! secure && memcmp (envline, "TOP_PAD_", 8) == 0)
- mALLOPt(M_TOP_PAD, atoi(&envline[9]));
+ if (! secure)
+ {
+ if (memcmp (envline, "TOP_PAD_", 8) == 0)
+ mALLOPt(M_TOP_PAD, atoi(&envline[9]));
+ else if (memcmp (envline, "PERTURB_", 8) == 0)
+ mALLOPt(M_PERTURB, atoi(&envline[9]));
+ }
break;
case 9:
if (! secure && memcmp (envline, "MMAP_MAX_", 9) == 0)
@@ -510,6 +515,8 @@ ptmalloc_init (void)
mALLOPt(M_TRIM_THRESHOLD, atoi(s));
if((s = getenv("MALLOC_TOP_PAD_")))
mALLOPt(M_TOP_PAD, atoi(s));
+ if((s = getenv("MALLOC_PERTURB_")))
+ mALLOPt(M_PERTURB, atoi(s));
if((s = getenv("MALLOC_MMAP_THRESHOLD_")))
mALLOPt(M_MMAP_THRESHOLD, atoi(s));
if((s = getenv("MALLOC_MMAP_MAX_")))
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 5c9e77e9ec..44831bbb1d 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -1006,6 +1006,7 @@ struct mallinfo public_mALLINFo(void);
struct mallinfo public_mALLINFo();
#endif
+#ifndef _LIBC
/*
independent_calloc(size_t n_elements, size_t element_size, Void_t* chunks[]);
@@ -1129,6 +1130,8 @@ Void_t** public_iCOMALLOc(size_t, size_t*, Void_t**);
Void_t** public_iCOMALLOc();
#endif
+#endif /* _LIBC */
+
/*
pvalloc(size_t n);
@@ -1507,8 +1510,10 @@ Void_t* _int_memalign(mstate, size_t, size_t);
Void_t* _int_valloc(mstate, size_t);
static Void_t* _int_pvalloc(mstate, size_t);
/*static Void_t* cALLOc(size_t, size_t);*/
+#ifndef _LIBC
static Void_t** _int_icalloc(mstate, size_t, size_t, Void_t**);
static Void_t** _int_icomalloc(mstate, size_t, size_t*, Void_t**);
+#endif
static int mTRIm(size_t);
static size_t mUSABLe(Void_t*);
static void mSTATs(void);
@@ -2305,7 +2310,9 @@ static void malloc_init_state(av) mstate av;
static Void_t* sYSMALLOc(INTERNAL_SIZE_T, mstate);
static int sYSTRIm(size_t, mstate);
static void malloc_consolidate(mstate);
+#ifndef _LIBC
static Void_t** iALLOc(mstate, size_t, size_t*, int, Void_t**);
+#endif
#else
static Void_t* sYSMALLOc();
static int sYSTRIm();
@@ -2359,6 +2366,14 @@ void weak_variable (*__after_morecore_hook) (void) = NULL;
static int check_action = DEFAULT_CHECK_ACTION;
+/* ------------------ Testing support ----------------------------------*/
+
+static int perturb_byte;
+
+#define alloc_perturb(p, n) memset (p, (perturb_byte ^ 0xff) & 0xff, n)
+#define free_perturb(p, n) memset (p, perturb_byte & 0xff, n)
+
+
/* ------------------- Support for multiple arenas -------------------- */
#include "arena.c"
@@ -3721,6 +3736,8 @@ public_cALLOc(size_t n, size_t elem_size)
return mem;
}
+#ifndef _LIBC
+
Void_t**
public_iCALLOc(size_t n, size_t elem_size, Void_t** chunks)
{
@@ -3751,8 +3768,6 @@ public_iCOMALLOc(size_t n, size_t sizes[], Void_t** chunks)
return m;
}
-#ifndef _LIBC
-
void
public_cFREe(Void_t* m)
{
@@ -3766,6 +3781,8 @@ public_mTRIm(size_t s)
{
int result;
+ if(__malloc_initialized < 0)
+ ptmalloc_init ();
(void)mutex_lock(&main_arena.mutex);
result = mTRIm(s);
(void)mutex_unlock(&main_arena.mutex);
@@ -3859,7 +3876,10 @@ _int_malloc(mstate av, size_t bytes)
chunk2mem (victim));
*fb = victim->fd;
check_remalloced_chunk(av, victim, nb);
- return chunk2mem(victim);
+ void *p = chunk2mem(victim);
+ if (__builtin_expect (perturb_byte, 0))
+ alloc_perturb (p, bytes);
+ return p;
}
}
@@ -3887,7 +3907,10 @@ _int_malloc(mstate av, size_t bytes)
if (av != &main_arena)
victim->size |= NON_MAIN_ARENA;
check_malloced_chunk(av, victim, nb);
- return chunk2mem(victim);
+ void *p = chunk2mem(victim);
+ if (__builtin_expect (perturb_byte, 0))
+ alloc_perturb (p, bytes);
+ return p;
}
}
}
@@ -3958,7 +3981,10 @@ _int_malloc(mstate av, size_t bytes)
set_foot(remainder, remainder_size);
check_malloced_chunk(av, victim, nb);
- return chunk2mem(victim);
+ void *p = chunk2mem(victim);
+ if (__builtin_expect (perturb_byte, 0))
+ alloc_perturb (p, bytes);
+ return p;
}
/* remove from unsorted list */
@@ -3972,7 +3998,10 @@ _int_malloc(mstate av, size_t bytes)
if (av != &main_arena)
victim->size |= NON_MAIN_ARENA;
check_malloced_chunk(av, victim, nb);
- return chunk2mem(victim);
+ void *p = chunk2mem(victim);
+ if (__builtin_expect (perturb_byte, 0))
+ alloc_perturb (p, bytes);
+ return p;
}
/* place chunk in bin */
@@ -4041,8 +4070,6 @@ _int_malloc(mstate av, size_t bytes)
set_inuse_bit_at_offset(victim, size);
if (av != &main_arena)
victim->size |= NON_MAIN_ARENA;
- check_malloced_chunk(av, victim, nb);
- return chunk2mem(victim);
}
/* Split */
else {
@@ -4053,9 +4080,12 @@ _int_malloc(mstate av, size_t bytes)
(av != &main_arena ? NON_MAIN_ARENA : 0));
set_head(remainder, remainder_size | PREV_INUSE);
set_foot(remainder, remainder_size);
- check_malloced_chunk(av, victim, nb);
- return chunk2mem(victim);
}
+ check_malloced_chunk(av, victim, nb);
+ void *p = chunk2mem(victim);
+ if (__builtin_expect (perturb_byte, 0))
+ alloc_perturb (p, bytes);
+ return p;
}
}
@@ -4124,8 +4154,6 @@ _int_malloc(mstate av, size_t bytes)
set_inuse_bit_at_offset(victim, size);
if (av != &main_arena)
victim->size |= NON_MAIN_ARENA;
- check_malloced_chunk(av, victim, nb);
- return chunk2mem(victim);
}
/* Split */
@@ -4142,9 +4170,12 @@ _int_malloc(mstate av, size_t bytes)
(av != &main_arena ? NON_MAIN_ARENA : 0));
set_head(remainder, remainder_size | PREV_INUSE);
set_foot(remainder, remainder_size);
- check_malloced_chunk(av, victim, nb);
- return chunk2mem(victim);
}
+ check_malloced_chunk(av, victim, nb);
+ void *p = chunk2mem(victim);
+ if (__builtin_expect (perturb_byte, 0))
+ alloc_perturb (p, bytes);
+ return p;
}
}
@@ -4176,7 +4207,10 @@ _int_malloc(mstate av, size_t bytes)
set_head(remainder, remainder_size | PREV_INUSE);
check_malloced_chunk(av, victim, nb);
- return chunk2mem(victim);
+ void *p = chunk2mem(victim);
+ if (__builtin_expect (perturb_byte, 0))
+ alloc_perturb (p, bytes);
+ return p;
}
/*
@@ -4194,8 +4228,12 @@ _int_malloc(mstate av, size_t bytes)
/*
Otherwise, relay to handle system-dependent cases
*/
- else
- return sYSMALLOc(nb, av);
+ else {
+ void *p = sYSMALLOc(nb, av);
+ if (__builtin_expect (perturb_byte, 0))
+ alloc_perturb (p, bytes);
+ return p;
+ }
}
}
@@ -4269,6 +4307,10 @@ _int_free(mstate av, Void_t* mem)
errstr = "double free or corruption (fasttop)";
goto errout;
}
+
+ if (__builtin_expect (perturb_byte, 0))
+ free_perturb (mem, size - SIZE_SZ);
+
p->fd = *fb;
*fb = p;
}
@@ -4310,6 +4352,9 @@ _int_free(mstate av, Void_t* mem)
goto errout;
}
+ if (__builtin_expect (perturb_byte, 0))
+ free_perturb (mem, size - SIZE_SZ);
+
/* consolidate backward */
if (!prev_inuse(p)) {
prevsize = p->prev_size;
@@ -4926,6 +4971,7 @@ Void_t* cALLOc(n_elements, elem_size) size_t n_elements; size_t elem_size;
}
#endif /* 0 */
+#ifndef _LIBC
/*
------------------------- independent_calloc -------------------------
*/
@@ -5089,6 +5135,7 @@ mstate av; size_t n_elements; size_t* sizes; int opts; Void_t* chunks[];
return marray;
}
+#endif /* _LIBC */
/*
@@ -5361,6 +5408,10 @@ int mALLOPt(param_number, value) int param_number; int value;
case M_CHECK_ACTION:
check_action = value;
break;
+
+ case M_PERTURB:
+ perturb_byte = value;
+ break;
}
(void)mutex_unlock(&av->mutex);
return res;
diff --git a/malloc/malloc.h b/malloc/malloc.h
index 0f99e837c3..1340aa15bc 100644
--- a/malloc/malloc.h
+++ b/malloc/malloc.h
@@ -122,6 +122,7 @@ extern struct mallinfo mallinfo __MALLOC_P ((void));
#define M_MMAP_THRESHOLD -3
#define M_MMAP_MAX -4
#define M_CHECK_ACTION -5
+#define M_PERTURB -6
/* General SVID/XPG interface to tunable parameters. */
extern int mallopt __MALLOC_P ((int __param, int __val));
diff --git a/math/test-misc.c b/math/test-misc.c
index fa958d486c..d2393cc840 100644
--- a/math/test-misc.c
+++ b/math/test-misc.c
@@ -1,5 +1,5 @@
/* Miscellaneous tests which don't fit anywhere else.
- Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 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
@@ -1143,5 +1143,45 @@ main (void)
}
#endif
+ /* The tests here are very similar to tests earlier in this file,
+ the important difference is just that there are no intervening
+ union variables that cause some GCC versions to hide possible
+ bugs in nextafter* implementation. */
+ if (nextafterf (nextafterf (FLT_MIN, FLT_MIN / 2.0), FLT_MIN) != FLT_MIN)
+ {
+ puts ("nextafterf FLT_MIN test failed");
+ result = 1;
+ }
+ if (nextafterf (nextafterf (-FLT_MIN, -FLT_MIN / 2.0), -FLT_MIN)
+ != -FLT_MIN)
+ {
+ puts ("nextafterf -FLT_MIN test failed");
+ result = 1;
+ }
+ if (nextafter (nextafter (DBL_MIN, DBL_MIN / 2.0), DBL_MIN) != DBL_MIN)
+ {
+ puts ("nextafter DBL_MIN test failed");
+ result = 1;
+ }
+ if (nextafter (nextafter (-DBL_MIN, -DBL_MIN / 2.0), -DBL_MIN) != -DBL_MIN)
+ {
+ puts ("nextafter -DBL_MIN test failed");
+ result = 1;
+ }
+#ifndef NO_LONG_DOUBLE
+ if (nextafterl (nextafterl (LDBL_MIN, LDBL_MIN / 2.0), LDBL_MIN)
+ != LDBL_MIN)
+ {
+ puts ("nextafterl LDBL_MIN test failed");
+ result = 1;
+ }
+ if (nextafterl (nextafterl (-LDBL_MIN, -LDBL_MIN / 2.0), -LDBL_MIN)
+ != -LDBL_MIN)
+ {
+ puts ("nextafterl -LDBL_MIN test failed");
+ result = 1;
+ }
+#endif
+
return result;
}
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index 6f562e56d0..eb192cca49 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -271,6 +271,13 @@
# define __wur /* Ignore */
#endif
+/* Forces a function to be always inlined. */
+#if __GNUC_PREREQ (3,2)
+# define __always_inline __inline __attribute__ ((__always_inline__))
+#else
+# define __always_inline __inline
+#endif
+
/* It is possible to compile containing GCC extensions even if GCC is
run in pedantic mode if the uses are carefully marked using the
`__extension__' keyword. But this is not generally available before
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index df2979e5a4..6e0b5e31a1 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,7 @@
+2005-03-10 Jakub Jelinek <jakub@redhat.com>
+
+ * tst-getpid1.c (do_test): Align stack passed to clone{2,}.
+
2005-02-25 Roland McGrath <roland@redhat.com>
* alloca_cutoff.c: Correct license text.
diff --git a/nptl/tst-getpid1.c b/nptl/tst-getpid1.c
index 497bebed56..f9fd4fc0ca 100644
--- a/nptl/tst-getpid1.c
+++ b/nptl/tst-getpid1.c
@@ -44,10 +44,10 @@ do_test (void)
extern int __clone2 (int (*__fn) (void *__arg), void *__child_stack_base,
size_t __child_stack_size, int __flags,
void *__arg, ...);
- char st[256 * 1024];
+ char st[256 * 1024] __attribute__ ((aligned));
pid_t p = __clone2 (f, st, sizeof (st), TEST_CLONE_FLAGS, 0);
#else
- char st[128 * 1024];
+ char st[128 * 1024] __attribute__ ((aligned));
pid_t p = clone (f, st + sizeof (st), TEST_CLONE_FLAGS, 0);
#endif
if (p == -1)
diff --git a/nscd/aicache.c b/nscd/aicache.c
index bdd2a9b371..fb75dc199d 100644
--- a/nscd/aicache.c
+++ b/nscd/aicache.c
@@ -310,7 +310,7 @@ addhstaiX (struct database_dyn *db, int fd, request_header *req,
*family++ = th[j].h_addrtype;
}
- char *cp = family;
+ void *cp = family;
if (canon != NULL)
cp = mempcpy (cp, canon, canonlen);
diff --git a/posix/bits/unistd.h b/posix/bits/unistd.h
index dab98af569..988f0167ed 100644
--- a/posix/bits/unistd.h
+++ b/posix/bits/unistd.h
@@ -21,44 +21,78 @@
# error "Never include <bits/unistd.h> directly; use <unistd.h> instead."
#endif
-extern void __chk_fail (void) __attribute__((noreturn));
-#define read(fd, buf, nbytes) \
- (__extension__ \
- ({ size_t __nbytes_val = (nbytes); \
- if (__bos0 (buf) != (size_t) -1 && __bos0 (buf) < __nbytes_val) \
- __chk_fail (); \
- read (fd, buf, __nbytes_val); }))
+extern void __chk_fail (void) __attribute__((__noreturn__));
+extern ssize_t __REDIRECT (__read_alias, (int __fd, void *__buf,
+ size_t __nbytes), read) __wur;
+
+extern __always_inline __wur ssize_t
+read (int __fd, void *__buf, size_t __nbytes)
+{
+ if (__bos0 (__buf) != (size_t) -1 && __nbytes > __bos0 (__buf))
+ __chk_fail ();
+ return __read_alias (__fd, __buf, __nbytes);
+}
#ifdef __USE_UNIX98
-# define pread(fd, buf, nbytes, offset) \
- (__extension__ \
- ({ size_t __nbytes_val = (nbytes); \
- if (__bos0 (buf) != (size_t) -1 && __bos0 (buf) < __nbytes_val) \
- __chk_fail (); \
- pread (fd, buf, __nbytes_val, offset); }))
+extern ssize_t __REDIRECT (__pread_alias,
+ (int __fd, void *__buf, size_t __nbytes,
+ __off_t __offset), pread) __wur;
+extern ssize_t __REDIRECT (__pread64_alias,
+ (int __fd, void *__buf, size_t __nbytes,
+ __off64_t __offset), pread64) __wur;
+
+# ifndef __USE_FILE_OFFSET64
+extern __always_inline __wur ssize_t
+pread (int __fd, void *__buf, size_t __nbytes, __off_t __offset)
+{
+ if (__bos0 (__buf) != (size_t) -1 && __nbytes > __bos0 (__buf))
+ __chk_fail ();
+ return __pread_alias (__fd, __buf, __nbytes, __offset);
+}
+# else
+extern __always_inline __wur ssize_t
+pread (int __fd, void *__buf, size_t __nbytes, __off_t __offset)
+{
+ if (__bos0 (__buf) != (size_t) -1 && __nbytes > __bos0 (__buf))
+ __chk_fail ();
+ return __pread64_alias (__fd, __buf, __nbytes, __offset);
+}
+# endif
# ifdef __USE_LARGEFILE64
-# define pread64(fd, buf, nbytes, offset) \
- (__extension__ \
- ({ size_t __nbytes_val = (nbytes); \
- if (__bos0 (buf) != (size_t) -1 && __bos0 (buf) < __nbytes_val) \
- __chk_fail (); \
- pread64 (fd, buf, __nbytes_val, offset); }))
+extern __always_inline __wur ssize_t
+pread64 (int __fd, void *__buf, size_t __nbytes, __off64_t __offset)
+{
+ if (__bos0 (__buf) != (size_t) -1 && __nbytes > __bos0 (__buf))
+ __chk_fail ();
+ return __pread64_alias (__fd, __buf, __nbytes, __offset);
+}
# endif
#endif
#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K
-# define readlink(path, buf, len) \
- (__extension__ \
- ({ size_t __len_val = (len); \
- if (__bos (buf) != (size_t) -1 && __bos (buf) < __len_val) \
- __chk_fail (); \
- readlink (path, buf, __len_val); }))
+extern int __REDIRECT_NTH (__readlink_alias,
+ (__const char *__restrict __path,
+ char *__restrict __buf, size_t __len), readlink)
+ __nonnull ((1, 2)) __wur;
+
+extern __always_inline __nonnull ((1, 2)) __wur int
+__NTH (readlink (__const char *__restrict __path, char *__restrict __buf,
+ size_t __len))
+{
+ if (__bos (__buf) != (size_t) -1 && __len > __bos (__buf))
+ __chk_fail ();
+ return __readlink_alias (__path, __buf, __len);
+}
#endif
-#define getcwd(buf, size) \
- (__extension__ \
- ({ size_t __size_val = (size); \
- if (__bos (buf) != (size_t) -1 && __bos (buf) < __size_val) \
- __chk_fail (); \
- getcwd (buf, __size_val); }))
+extern char *__REDIRECT_NTH (__getcwd_alias,
+ (char *__buf, size_t __size), getcwd) __wur;
+
+extern __always_inline __wur char *
+__NTH (getcwd (char *__buf, size_t __size))
+{
+ if (__bos (__buf) != (size_t) -1 && __size > __bos (__buf))
+ __chk_fail ();
+ return __getcwd_alias (__buf, __size);
+}
diff --git a/posix/regcomp.c b/posix/regcomp.c
index a7112cffdd..68e2bdab92 100644
--- a/posix/regcomp.c
+++ b/posix/regcomp.c
@@ -359,7 +359,8 @@ re_compile_fastmap_iter (bufp, init_state, fastmap)
memset (&state, 0, sizeof (state));
if (mbrtowc (&wc, (const char *) buf, p - buf,
&state) == p - buf
- && __wcrtomb ((char *) buf, towlower (wc), &state) > 0)
+ && (__wcrtomb ((char *) buf, towlower (wc), &state)
+ != (size_t) -1))
re_set_fastmap (fastmap, 0, buf[0]);
}
#endif
@@ -409,12 +410,13 @@ re_compile_fastmap_iter (bufp, init_state, fastmap)
char buf[256];
mbstate_t state;
memset (&state, '\0', sizeof (state));
- __wcrtomb (buf, cset->mbchars[i], &state);
- re_set_fastmap (fastmap, icase, *(unsigned char *) buf);
+ if (__wcrtomb (buf, cset->mbchars[i], &state) != (size_t) -1)
+ re_set_fastmap (fastmap, icase, *(unsigned char *) buf);
if ((bufp->syntax & RE_ICASE) && dfa->mb_cur_max > 1)
{
- __wcrtomb (buf, towlower (cset->mbchars[i]), &state);
- re_set_fastmap (fastmap, 0, *(unsigned char *) buf);
+ if (__wcrtomb (buf, towlower (cset->mbchars[i]), &state)
+ != (size_t) -1)
+ re_set_fastmap (fastmap, 0, *(unsigned char *) buf);
}
}
}
diff --git a/posix/regex_internal.c b/posix/regex_internal.c
index c3295a851c..b3d44c368d 100644
--- a/posix/regex_internal.c
+++ b/posix/regex_internal.c
@@ -1,5 +1,5 @@
/* Extended regular expression matching and search library.
- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
@@ -214,12 +214,14 @@ build_wcs_buffer (pstr)
re_string_t *pstr;
{
#ifdef _LIBC
- unsigned char buf[pstr->mb_cur_max];
+ unsigned char buf[MB_CUR_MAX];
+ assert (MB_CUR_MAX >= pstr->mb_cur_max);
#else
unsigned char buf[64];
#endif
mbstate_t prev_st;
- int byte_idx, end_idx, mbclen, remain_len;
+ int byte_idx, end_idx, remain_len;
+ size_t mbclen;
/* Build the buffers from pstr->valid_len to either pstr->len or
pstr->bufs_len. */
@@ -280,11 +282,13 @@ build_wcs_upper_buffer (pstr)
re_string_t *pstr;
{
mbstate_t prev_st;
- int src_idx, byte_idx, end_idx, mbclen, remain_len;
+ int src_idx, byte_idx, end_idx, remain_len;
+ size_t mbclen;
#ifdef _LIBC
- unsigned char buf[pstr->mb_cur_max];
+ char buf[MB_CUR_MAX];
+ assert (MB_CUR_MAX >= pstr->mb_cur_max);
#else
- unsigned char buf[64];
+ char buf[64];
#endif
byte_idx = pstr->valid_len;
@@ -316,12 +320,12 @@ build_wcs_upper_buffer (pstr)
mbclen = mbrtowc (&wc,
((const char *) pstr->raw_mbs + pstr->raw_mbs_idx
+ byte_idx), remain_len, &pstr->cur_state);
- if (BE (mbclen > 0, 1))
+ if (BE (mbclen + 2 > 2, 1))
{
wchar_t wcu = wc;
if (iswlower (wc))
{
- int mbcdlen;
+ size_t mbcdlen;
wcu = towupper (wc);
mbcdlen = wcrtomb (buf, wcu, &prev_st);
@@ -384,20 +388,20 @@ build_wcs_upper_buffer (pstr)
else
p = (const char *) pstr->raw_mbs + pstr->raw_mbs_idx + src_idx;
mbclen = mbrtowc (&wc, p, remain_len, &pstr->cur_state);
- if (BE (mbclen > 0, 1))
+ if (BE (mbclen + 2 > 2, 1))
{
wchar_t wcu = wc;
if (iswlower (wc))
{
- int mbcdlen;
+ size_t mbcdlen;
wcu = towupper (wc);
mbcdlen = wcrtomb ((char *) buf, wcu, &prev_st);
if (BE (mbclen == mbcdlen, 1))
memcpy (pstr->mbs + byte_idx, buf, mbclen);
- else
+ else if (mbcdlen != (size_t) -1)
{
- int i;
+ size_t i;
if (byte_idx + mbcdlen > pstr->bufs_len)
{
@@ -414,7 +418,7 @@ build_wcs_upper_buffer (pstr)
}
if (!pstr->offsets_needed)
{
- for (i = 0; i < byte_idx; ++i)
+ for (i = 0; i < (size_t) byte_idx; ++i)
pstr->offsets[i] = i;
pstr->offsets_needed = 1;
}
@@ -437,13 +441,15 @@ build_wcs_upper_buffer (pstr)
src_idx += mbclen;
continue;
}
+ else
+ memcpy (pstr->mbs + byte_idx, p, mbclen);
}
else
memcpy (pstr->mbs + byte_idx, p, mbclen);
if (BE (pstr->offsets_needed != 0, 0))
{
- int i;
+ size_t i;
for (i = 0; i < mbclen; ++i)
pstr->offsets[byte_idx + i] = src_idx + i;
}
@@ -494,7 +500,8 @@ re_string_skip_chars (pstr, new_raw_idx, last_wc)
wint_t *last_wc;
{
mbstate_t prev_st;
- int rawbuf_idx, mbclen;
+ int rawbuf_idx;
+ size_t mbclen;
wchar_t wc = 0;
/* Skip the characters which are not necessary to check. */
@@ -666,8 +673,9 @@ re_string_reconstruct (pstr, idx, eflags)
/* XXX Don't use mbrtowc, we know which conversion
to use (UTF-8 -> UCS4). */
memset (&cur_state, 0, sizeof (cur_state));
- mlen = mbrtowc (&wc2, p, mlen, &cur_state)
- - (raw + offset - p);
+ mlen = (mbrtowc (&wc2, (const char *) p, mlen,
+ &cur_state)
+ - (raw + offset - p));
if (mlen >= 0)
{
memset (&pstr->cur_state, '\0',
diff --git a/posix/regexec.c b/posix/regexec.c
index 636396e6f7..3c226e3c20 100644
--- a/posix/regexec.c
+++ b/posix/regexec.c
@@ -1,5 +1,5 @@
/* Extended regular expression matching and search library.
- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
@@ -3781,8 +3781,8 @@ check_node_accept_bytes (dfa, node_idx, input, str_idx)
{
const re_charset_t *cset = node->opr.mbcset;
# ifdef _LIBC
- const unsigned char *pin = ((char *) re_string_get_buffer (input)
- + str_idx);
+ const unsigned char *pin
+ = ((const unsigned char *) re_string_get_buffer (input) + str_idx);
int j;
uint32_t nrules;
# endif /* _LIBC */
diff --git a/socket/bits/socket2.h b/socket/bits/socket2.h
index c7ecac423f..6238163e8c 100644
--- a/socket/bits/socket2.h
+++ b/socket/bits/socket2.h
@@ -21,17 +21,28 @@
# error "Never include <bits/socket2.h> directly; use <sys/socket.h> instead."
#endif
-extern void __chk_fail (void) __attribute__((noreturn));
-#define recv(fd, buf, n, flags) \
- (__extension__ \
- ({ size_t __n_val = (n); \
- if (__bos0 (buf) != (size_t) -1 && __bos0 (buf) < __n_val) \
- __chk_fail (); \
- recv ((fd), (buf), __n_val, (flags)); }))
-
-#define recvfrom(fd, buf, n, flags, addr, addr_len) \
- (__extension__ \
- ({ size_t __n_val = (n); \
- if (__bos0 (buf) != (size_t) -1 && __bos0 (buf) < __n_val) \
- __chk_fail (); \
- recvfrom ((fd), (buf), __n_val, (flags), (addr), (addr_len)); }))
+extern void __chk_fail (void) __attribute__((__noreturn__));
+extern ssize_t __REDIRECT (__recv_alias, (int __fd, void *__buf, size_t __n,
+ int __flags), recv);
+
+extern __always_inline ssize_t
+recv (int __fd, void *__buf, size_t __n, int __flags)
+{
+ if (__bos0 (__buf) != (size_t) -1 && __n > __bos0 (__buf))
+ __chk_fail ();
+ return __recv_alias (__fd, __buf, __n, __flags);
+}
+
+extern ssize_t __REDIRECT (__recvfrom_alias,
+ (int __fd, void *__restrict __buf, size_t __n,
+ int __flags, __SOCKADDR_ARG __addr,
+ socklen_t *__restrict __addr_len), recvfrom);
+
+extern __always_inline ssize_t
+recvfrom (int __fd, void *__buf, size_t __n, int __flags,
+ __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len)
+{
+ if (__bos0 (__buf) != (size_t) -1 && __n > __bos0 (__buf))
+ __chk_fail ();
+ return __recvfrom_alias (__fd, __buf, __n, __flags, __addr, __addr_len);
+}
diff --git a/stdio-common/printf-prs.c b/stdio-common/printf-prs.c
index f3b27d6712..015b01f1ed 100644
--- a/stdio-common/printf-prs.c
+++ b/stdio-common/printf-prs.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1995, 1996, 1999, 2000, 2002, 2003, 2004
+/* Copyright (C) 1991, 1992, 1995, 1996, 1999, 2000, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -67,15 +67,16 @@ parse_printf_format (fmt, n, argtypes)
size_t max_ref_arg; /* Highest index used in a positional arg. */
struct printf_spec spec;
mbstate_t mbstate;
+ const unsigned char *f = (const unsigned char *) fmt;
nargs = 0;
max_ref_arg = 0;
/* Search for format specifications. */
- for (fmt = __find_specmb (fmt, &mbstate); *fmt != '\0'; fmt = spec.next_fmt)
+ for (f = __find_specmb (f, &mbstate); *f != '\0'; f = spec.next_fmt)
{
/* Parse this spec. */
- nargs += __parse_one_specmb (fmt, nargs, &spec, &max_ref_arg, &mbstate);
+ nargs += __parse_one_specmb (f, nargs, &spec, &max_ref_arg, &mbstate);
/* If the width is determined by an argument this is an int. */
if (spec.width_arg != -1 && (size_t) spec.width_arg < n)
diff --git a/string/bits/string3.h b/string/bits/string3.h
index 6c027c23a0..bcda42a232 100644
--- a/string/bits/string3.h
+++ b/string/bits/string3.h
@@ -44,8 +44,7 @@
((__bos0 (dest) != (size_t) -1) \
? __builtin___memcpy_chk (dest, src, len, __bos0 (dest)) \
: __memcpy_ichk (dest, src, len))
-static __inline__ void *
-__attribute__ ((__always_inline__))
+static __always_inline void *
__memcpy_ichk (void *__restrict __dest, const void *__restrict __src,
size_t __len)
{
@@ -57,8 +56,7 @@ __memcpy_ichk (void *__restrict __dest, const void *__restrict __src,
((__bos0 (dest) != (size_t) -1) \
? __builtin___memmove_chk (dest, src, len, __bos0 (dest)) \
: __memmove_ichk (dest, src, len))
-static __inline__ void *
-__attribute__ ((__always_inline__))
+static __always_inline void *
__memmove_ichk (void *__dest, const void *__src, size_t __len)
{
return __builtin___memmove_chk (__dest, __src, __len, __bos0 (__dest));
@@ -70,8 +68,7 @@ __memmove_ichk (void *__dest, const void *__src, size_t __len)
((__bos0 (dest) != (size_t) -1) \
? __builtin___mempcpy_chk (dest, src, len, __bos0 (dest)) \
: __mempcpy_ichk (dest, src, len))
-static __inline__ void *
-__attribute__ ((__always_inline__))
+static __always_inline void *
__mempcpy_ichk (void *__restrict __dest, const void *__restrict __src,
size_t __len)
{
@@ -93,8 +90,7 @@ __warndecl (__warn_memset_zero_len,
: ((__bos0 (dest) != (size_t) -1) \
? __builtin___memset_chk (dest, ch, len, __bos0 (dest)) \
: __memset_ichk (dest, ch, len)))
-static __inline__ void *
-__attribute__ ((__always_inline__))
+static __always_inline void *
__memset_ichk (void *__dest, int __ch, size_t __len)
{
return __builtin___memset_chk (__dest, __ch, __len, __bos0 (__dest));
@@ -116,8 +112,7 @@ __memset_ichk (void *__dest, int __ch, size_t __len)
((__bos (dest) != (size_t) -1) \
? __builtin___strcpy_chk (dest, src, __bos (dest)) \
: __strcpy_ichk (dest, src))
-static __inline__ char *
-__attribute__ ((__always_inline__))
+static __always_inline char *
__strcpy_ichk (char *__restrict __dest, const char *__restrict __src)
{
return __builtin___strcpy_chk (__dest, __src, __bos (__dest));
@@ -129,8 +124,7 @@ __strcpy_ichk (char *__restrict __dest, const char *__restrict __src)
((__bos (dest) != (size_t) -1) \
? __builtin___stpcpy_chk (dest, src, __bos (dest)) \
: __stpcpy_ichk (dest, src))
-static __inline__ char *
-__attribute__ ((__always_inline__))
+static __always_inline char *
__stpcpy_ichk (char *__restrict __dest, const char *__restrict __src)
{
return __builtin___stpcpy_chk (__dest, __src, __bos (__dest));
@@ -142,8 +136,7 @@ __stpcpy_ichk (char *__restrict __dest, const char *__restrict __src)
((__bos (dest) != (size_t) -1) \
? __builtin___strncpy_chk (dest, src, len, __bos (dest)) \
: __strncpy_ichk (dest, src, len))
-static __inline__ char *
-__attribute__ ((__always_inline__))
+static __always_inline char *
__strncpy_ichk (char *__restrict __dest, const char *__restrict __src,
size_t __len)
{
@@ -155,8 +148,7 @@ __strncpy_ichk (char *__restrict __dest, const char *__restrict __src,
((__bos (dest) != (size_t) -1) \
? __builtin___strcat_chk (dest, src, __bos (dest)) \
: __strcat_ichk (dest, src))
-static __inline__ char *
-__attribute__ ((__always_inline__))
+static __always_inline char *
__strcat_ichk (char *__restrict __dest, const char *__restrict __src)
{
return __builtin___strcat_chk (__dest, __src, __bos (__dest));
@@ -167,8 +159,7 @@ __strcat_ichk (char *__restrict __dest, const char *__restrict __src)
((__bos (dest) != (size_t) -1) \
? __builtin___strncat_chk (dest, src, len, __bos (dest)) \
: __strncat_ichk (dest, src, len))
-static __inline__ char *
-__attribute__ ((__always_inline__))
+static __always_inline char *
__strncat_ichk (char *__restrict __dest, const char *__restrict __src,
size_t __len)
{
diff --git a/string/strcoll.c b/string/strcoll.c
index 8a73cae564..8e8fdc7792 100644
--- a/string/strcoll.c
+++ b/string/strcoll.c
@@ -23,6 +23,7 @@
# define STRING_TYPE char
# define STRCOLL strcoll
# define STRCOLL_L __strcoll_l
+# define USE_HIDDEN_DEF
#endif
#include "../locale/localeinfo.h"
@@ -35,6 +36,7 @@ STRCOLL (s1, s2)
{
return STRCOLL_L (s1, s2, _NL_CURRENT_LOCALE);
}
-#if !defined WIDE_CHAR_VERSION
-libc_hidden_def (strcoll)
+
+#ifdef USE_HIDDEN_DEF
+libc_hidden_def (STRCOLL)
#endif
diff --git a/sunrpc/Makefile b/sunrpc/Makefile
index 2a3a22496e..4a2c60eab4 100644
--- a/sunrpc/Makefile
+++ b/sunrpc/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1994-2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright (C) 1994-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
@@ -126,9 +126,6 @@ CFLAGS-pmap_rmt.c = -fexceptions
CFLAGS-clnt_perr.c = -fexceptions
CFLAGS-openchild.c = -fexceptions
-ifeq (yes,$(have_doors))
-CPPFLAGS-key_call.c += -DHAVE_DOORS=1
-endif
CPPFLAGS += -D_RPC_THREAD_SAFE_
include ../Rules
diff --git a/sunrpc/des_impl.c b/sunrpc/des_impl.c
index 702bd02c77..d0004b97f1 100644
--- a/sunrpc/des_impl.c
+++ b/sunrpc/des_impl.c
@@ -391,14 +391,14 @@ static const unsigned long des_skb[8][64] =
static const char shifts2[16] =
{0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0};
-static void des_set_key (char *, unsigned long *) internal_function;
+static void des_set_key (unsigned char *, unsigned long *) internal_function;
static void des_encrypt (unsigned long *, unsigned long *, int)
internal_function;
int _des_crypt (char *, unsigned, struct desparams *);
static void
internal_function
-des_set_key (char *key, unsigned long *schedule)
+des_set_key (unsigned char *key, unsigned long *schedule)
{
register unsigned long c, d, t, s;
register unsigned char *in;
@@ -406,7 +406,7 @@ des_set_key (char *key, unsigned long *schedule)
register int i;
k = (unsigned long *) schedule;
- in = (unsigned char *) key;
+ in = key;
c2l (in, c);
c2l (in, d);
diff --git a/sunrpc/key_call.c b/sunrpc/key_call.c
index 506a99767c..77c0ce18b9 100644
--- a/sunrpc/key_call.c
+++ b/sunrpc/key_call.c
@@ -51,10 +51,6 @@
#include <rpc/key_prot.h>
#include <bits/libc-lock.h>
-#ifdef HAVE_DOORS
-# include "door/door.h"
-#endif
-
#define KEY_TIMEOUT 5 /* per-try timeout in seconds */
#define KEY_NRETRY 12 /* number of retries */
@@ -503,73 +499,6 @@ key_call_socket (u_long proc, xdrproc_t xdr_arg, char *arg,
return result;
}
-#ifdef HAVE_DOORS
-/* returns 0 on failure, 1 on success */
-static int
-internal_function
-key_call_door (u_long proc, xdrproc_t xdr_arg, char *arg,
- xdrproc_t xdr_rslt, char *rslt)
-{
- XDR xdrs;
- int fd, ret;
- door_arg_t args;
- char *data_ptr;
- u_long data_len = 0;
- char res[255];
-
- if ((fd = open("/var/run/keyservdoor", O_RDONLY)) < 0)
- return 0;
- res[0] = 0;
-
- data_len = xdr_sizeof (xdr_arg, arg);
- data_ptr = calloc (1, data_len + 2 * sizeof (u_long));
- if (data_ptr == NULL)
- return 0;
-
- INTUSE(xdrmem_create) (&xdrs, &data_ptr[2 * sizeof (u_long)], data_len,
- XDR_ENCODE);
- if (!xdr_arg (&xdrs, arg))
- {
- xdr_destroy (&xdrs);
- free (data_ptr);
- return 0;
- }
- xdr_destroy (&xdrs);
-
- memcpy (data_ptr, &proc, sizeof (u_long));
- memcpy (&data_ptr[sizeof (proc)], &data_len, sizeof (u_long));
-
- args.data_ptr = data_ptr;
- args.data_size = data_len + 2 * sizeof (u_long);
- args.desc_ptr = NULL;
- args.desc_num = 0;
- args.rbuf = res;
- args.rsize = sizeof (res);
-
- ret = __door_call (fd, &args);
- free (data_ptr);
- close (fd);
-
- if (ret < 0)
- return 0;
-
- memcpy (&data_len, args.data_ptr, sizeof (u_long));
- if (data_len != 0)
- return 0;
-
- memcpy (&data_len, &args.data_ptr[sizeof (u_long)], sizeof (u_long));
- INTUSE(xdrmem_create) (&xdrs, &args.data_ptr[2 * sizeof (u_long)],
- data_len, XDR_DECODE);
- if (!xdr_rslt (&xdrs, rslt))
- {
- xdr_destroy (&xdrs);
- return 0;
- }
- xdr_destroy (&xdrs);
-
- return 1;
-}
-#endif
/* returns 0 on failure, 1 on success */
static int
@@ -580,9 +509,6 @@ key_call (u_long proc, xdrproc_t xdr_arg, char *arg,
#ifndef SO_PASSCRED
static int use_keyenvoy;
#endif
-#ifdef HAVE_DOORS
- static int not_use_doors;
-#endif
if (proc == KEY_ENCRYPT_PK && __key_encryptsession_pk_LOCAL)
{
@@ -606,15 +532,6 @@ key_call (u_long proc, xdrproc_t xdr_arg, char *arg,
return 1;
}
-#ifdef HAVE_DOORS
- if (!not_use_doors)
- {
- if (key_call_door (proc, xdr_arg, arg, xdr_rslt, rslt))
- return 1;
- not_use_doors = 1;
- }
-#endif
-
#ifdef SO_PASSCRED
return key_call_socket (proc, xdr_arg, arg, xdr_rslt, rslt);
#else
diff --git a/sysdeps/alpha/dl-machine.h b/sysdeps/alpha/dl-machine.h
index 4166e8c498..173a4111f8 100644
--- a/sysdeps/alpha/dl-machine.h
+++ b/sysdeps/alpha/dl-machine.h
@@ -1,5 +1,5 @@
/* Machine-dependent ELF dynamic relocation inline functions. Alpha version.
- Copyright (C) 1996-2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1996-2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson <rth@tamu.edu>.
@@ -376,6 +376,7 @@ elf_machine_plt_value (struct link_map *map, const Elf64_Rela *reloc,
/* Perform the relocation specified by RELOC and SYM (which is fully resolved).
MAP is the object containing the reloc. */
auto inline void
+__attribute__ ((always_inline))
elf_machine_rela (struct link_map *map,
const Elf64_Rela *reloc,
const Elf64_Sym *sym,
@@ -504,6 +505,7 @@ elf_machine_rela (struct link_map *map,
#define ELF_MACHINE_REL_RELATIVE 1
auto inline void
+__attribute__ ((always_inline))
elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc,
void *const reloc_addr_arg)
{
@@ -520,6 +522,7 @@ elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc,
}
auto inline void
+__attribute__ ((always_inline))
elf_machine_lazy_rel (struct link_map *map,
Elf64_Addr l_addr, const Elf64_Rela *reloc)
{
diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h
index 7ddd81234b..0fe47b2f80 100644
--- a/sysdeps/arm/dl-machine.h
+++ b/sysdeps/arm/dl-machine.h
@@ -353,7 +353,7 @@ elf_machine_plt_value (struct link_map *map, const Elf32_Rel *reloc,
/* ARM never uses Elf32_Rela relocations for the dynamic linker.
Prelinked libraries may use Elf32_Rela though. */
-#define ELF_MACHINE_NO_RELA (defined RTLD_BOOTSTRAP)
+#define ELF_MACHINE_NO_RELA defined RTLD_BOOTSTRAP
#ifdef RESOLVE
@@ -391,7 +391,8 @@ fix_bad_pc24 (Elf32_Addr *const reloc_addr, Elf32_Addr value)
/* Perform the relocation specified by RELOC and SYM (which is fully resolved).
MAP is the object containing the reloc. */
-static inline void
+auto inline void
+__attribute__ ((always_inline))
elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
const Elf32_Sym *sym, const struct r_found_version *version,
void *const reloc_addr_arg)
@@ -516,7 +517,8 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
}
# ifndef RTLD_BOOTSTRAP
-static inline void
+auto inline void
+__attribute__ ((always_inline))
elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
const Elf32_Sym *sym, const struct r_found_version *version,
void *const reloc_addr_arg)
@@ -596,7 +598,8 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
}
# endif
-static inline void
+auto inline void
+__attribute__ ((always_inline))
elf_machine_rel_relative (Elf32_Addr l_addr, const Elf32_Rel *reloc,
void *const reloc_addr_arg)
{
@@ -605,7 +608,8 @@ elf_machine_rel_relative (Elf32_Addr l_addr, const Elf32_Rel *reloc,
}
# ifndef RTLD_BOOTSTRAP
-static inline void
+auto inline void
+__attribute__ ((always_inline))
elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc,
void *const reloc_addr_arg)
{
@@ -614,7 +618,8 @@ elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc,
}
# endif
-static inline void
+auto inline void
+__attribute__ ((always_inline))
elf_machine_lazy_rel (struct link_map *map,
Elf32_Addr l_addr, const Elf32_Rel *reloc)
{
diff --git a/sysdeps/generic/dl-machine.h b/sysdeps/generic/dl-machine.h
index 8b4425cea4..c3459f5e32 100644
--- a/sysdeps/generic/dl-machine.h
+++ b/sysdeps/generic/dl-machine.h
@@ -1,5 +1,6 @@
/* Machine-dependent ELF dynamic relocation inline functions. Stub version.
- Copyright (C) 1995,1996,1997,1999,2000,2001 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997, 1999, 2000, 2001, 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 +65,8 @@ elf_machine_fixup_plt (struct link_map *map, lookup_t t,
LOADADDR is the load address of the object; INFO is an array indexed
by DT_* of the .dynamic section info. */
-static inline void
+auto inline void
+__attribute__ ((always_inline))
elf_machine_rel (Elf32_Addr loadaddr, Elf32_Dyn *info[DT_NUM],
const Elf32_Rel *reloc, const Elf32_Sym *sym,
Elf32_Addr (*resolve) (const Elf32_Sym **ref,
@@ -87,7 +89,8 @@ elf_machine_rel (Elf32_Addr loadaddr, Elf32_Dyn *info[DT_NUM],
}
-static inline Elf32_Addr
+auto inline Elf32_Addr
+__attribute__ ((always_inline))
elf_machine_rela (Elf32_Addr loadaddr, Elf32_Dyn *info[DT_NUM],
const Elf32_Rel *reloc, const Elf32_Sym *sym,
Elf32_Addr (*resolve) (const Elf32_Sym **ref,
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index 08039e18ca..dd1b2c8345 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -694,10 +694,7 @@ extern char **_dl_argv_internal attribute_hidden
/* The array with message we print as a last resort. */
extern const char _dl_out_of_memory[];
-#ifdef IS_IN_rtld
-/* XXX #ifdef should go away. */
-extern const char _dl_out_of_memory_internal[] attribute_hidden;
-#endif
+rtld_hidden_proto (_dl_out_of_memory)
/* Flag set at startup and cleared when the last initializer has run. */
extern int _dl_starting_up;
@@ -895,6 +892,11 @@ extern void _dl_init (struct link_map *main_map, int argc, char **argv,
initializer functions have completed. */
extern void _dl_fini (void) internal_function;
+/* Sort array MAPS according to dependencies of the contained objects. */
+extern void _dl_sort_fini (struct link_map *l, struct link_map **maps,
+ size_t nmaps, char *used, Lmid_t ns)
+ internal_function;
+
/* The dynamic linker calls this function before and having changing
any shared object mappings. The `r_state' member of `struct r_debug'
says what change is taking place. This function's address is
diff --git a/sysdeps/generic/strchrnul.c b/sysdeps/generic/strchrnul.c
index f04b303b82..88b96dd126 100644
--- a/sysdeps/generic/strchrnul.c
+++ b/sysdeps/generic/strchrnul.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,93,94,95,96,97,99,2000 Free Software Foundation, Inc.
+/* Copyright (C) 1991,1993-1997,99,2000,2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
with help from Dan Sahlin (dan@sics.se) and
@@ -43,8 +43,8 @@ __strchrnul (s, c_in)
/* Handle the first few characters by reading one character at a time.
Do this until CHAR_PTR is aligned on a longword boundary. */
- for (char_ptr = s; ((unsigned long int) char_ptr
- & (sizeof (longword) - 1)) != 0;
+ for (char_ptr = (const unsigned char *) s;
+ ((unsigned long int) char_ptr & (sizeof (longword) - 1)) != 0;
++char_ptr)
if (*char_ptr == c || *char_ptr == '\0')
return (void *) char_ptr;
diff --git a/sysdeps/generic/tls-macros.h b/sysdeps/generic/tls-macros.h
new file mode 100644
index 0000000000..0a08f7c145
--- /dev/null
+++ b/sysdeps/generic/tls-macros.h
@@ -0,0 +1,12 @@
+/* Macros to support TLS testing in times of missing compiler support.
+ Stub version.
+
+ These macros should yield int * expressions for the TLS symbol X
+ accessed using the various TLS access models. Macros for some machines
+ are defined in elf/tls-macros.h, but ports can instead provide this file.
+
+#define TLS_LE(x)
+#define TLS_IE(x)
+#define TLS_LD(x)
+#define TLS_GD(x)
+*/
diff --git a/sysdeps/generic/wordexp.c b/sysdeps/generic/wordexp.c
index c3d382fb95..06d38f6b24 100644
--- a/sysdeps/generic/wordexp.c
+++ b/sysdeps/generic/wordexp.c
@@ -809,7 +809,7 @@ parse_arith (char **word, size_t *word_length, size_t *max_length,
}
/* Function called by child process in exec_comm() */
-static void
+static inline void
internal_function __attribute__ ((always_inline))
exec_comm_child (char *comm, int *fildes, int showerr, int noexec)
{
diff --git a/sysdeps/gnu/errlist-compat.awk b/sysdeps/gnu/errlist-compat.awk
index db827f3f70..2fb5fd906d 100644
--- a/sysdeps/gnu/errlist-compat.awk
+++ b/sysdeps/gnu/errlist-compat.awk
@@ -90,7 +90,7 @@ END {
n = vcount[old];
printf "#if SHLIB_COMPAT (libc, %s, %s)\n", old, new;
printf "# include <bits/wordsize.h>\n";
- printf "extern const char *const __sys_errlist_%s[];\n", old;
+ printf "extern const char *const __sys_errlist_%s[NERR];\n", old;
printf "const int __sys_nerr_%s = %d;\n", old, n;
printf "strong_alias (_sys_errlist_internal, __sys_errlist_%s)\n", old;
printf "declare_symbol (__sys_errlist_%s, object, __WORDSIZE/8*%d)\n", \
@@ -99,7 +99,7 @@ END {
old, old;
printf "compat_symbol (libc, __sys_nerr_%s, sys_nerr, %s);\n", old, old;
- printf "extern const char *const ___sys_errlist_%s[];\n", old;
+ printf "extern const char *const ___sys_errlist_%s[NERR];\n", old;
printf "extern const int __sys_nerr_%s;\n", old;
printf "strong_alias (__sys_errlist_%s, ___sys_errlist_%s)\n", old, old;
printf "strong_alias (__sys_nerr_%s, ___sys_nerr_%s)\n", old, old;
@@ -110,10 +110,11 @@ END {
}
printf "\
-extern const char *const __sys_errlist_internal[];\n\
+extern const char *const __sys_errlist_internal[NERR];\n\
extern const int __sys_nerr_internal;\n\
strong_alias (_sys_errlist_internal, __sys_errlist_internal)\n\
strong_alias (_sys_nerr_internal, __sys_nerr_internal)\n\
+extern const char *const sys_errlist[NERR];\n\
versioned_symbol (libc, _sys_errlist_internal, sys_errlist, %s);\n\
versioned_symbol (libc, __sys_errlist_internal, _sys_errlist, %s);\n\
versioned_symbol (libc, _sys_nerr_internal, sys_nerr, %s);\n\
diff --git a/sysdeps/gnu/errlist.awk b/sysdeps/gnu/errlist.awk
index 3f074ed482..365ac817c7 100644
--- a/sysdeps/gnu/errlist.awk
+++ b/sysdeps/gnu/errlist.awk
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-1999,2002,2004 Free Software Foundation, Inc.
+# Copyright (C) 1991-1999,2002,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
@@ -106,8 +106,9 @@ errnoh == 4 \
END {
print " };";
print "";
- print "const int _sys_nerr_internal";
- print " = sizeof _sys_errlist_internal / sizeof _sys_errlist_internal [0];";
+ print "#define NERR \\";
+ print " (sizeof _sys_errlist_internal / sizeof _sys_errlist_internal [0])";
+ print "const int _sys_nerr_internal = NERR;"
print "";
print "#if !defined NOT_IN_libc && !ERRLIST_NO_COMPAT";
print "# include <errlist-compat.c>";
diff --git a/sysdeps/gnu/errlist.c b/sysdeps/gnu/errlist.c
index 9ae6ec3c1d..1508311a4a 100644
--- a/sysdeps/gnu/errlist.c
+++ b/sysdeps/gnu/errlist.c
@@ -1410,8 +1410,9 @@ TRANS error; @pxref{Cancel AIO Operations}. */
#endif
};
-const int _sys_nerr_internal
- = sizeof _sys_errlist_internal / sizeof _sys_errlist_internal [0];
+#define NERR \
+ (sizeof _sys_errlist_internal / sizeof _sys_errlist_internal [0])
+const int _sys_nerr_internal = NERR;
#if !defined NOT_IN_libc && !ERRLIST_NO_COMPAT
# include <errlist-compat.c>
diff --git a/sysdeps/hppa/configure b/sysdeps/hppa/configure
index 07bde0e0ee..bc01e46b6c 100755
--- a/sysdeps/hppa/configure
+++ b/sysdeps/hppa/configure
@@ -1,6 +1,5 @@
# This file is generated from configure.in by Autoconf. DO NOT EDIT!
-hppa*linux*)
echo "$as_me:$LINENO: checking for assembler line separator" >&5
echo $ECHO_N "checking for assembler line separator... $ECHO_C" >&6
if test "${libc_cv_asm_line_sep+set}" = set; then
diff --git a/sysdeps/hppa/configure.in b/sysdeps/hppa/configure.in
index 1ec6780835..1ec417b947 100644
--- a/sysdeps/hppa/configure.in
+++ b/sysdeps/hppa/configure.in
@@ -2,7 +2,6 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
dnl The standard hppa assembler uses `;' to start comments and `!'
dnl as a line separator.
-hppa*linux*)
AC_CACHE_CHECK(for assembler line separator,
libc_cv_asm_line_sep, [dnl
cat > conftest.s <<EOF
diff --git a/sysdeps/i386/Makefile b/sysdeps/i386/Makefile
index ece94f3610..ddd3d04e07 100644
--- a/sysdeps/i386/Makefile
+++ b/sysdeps/i386/Makefile
@@ -8,7 +8,7 @@ long-double-fcts = yes
ifeq ($(subdir),csu)
# On i686 we must avoid generating the trampoline functions generated
# to get the GOT pointer.
-CFLAGS-initfini.s += -march=i386 -mcpu=i386
+CFLAGS-initfini.s += -march=i386 -mtune=i386
endif
ifeq ($(subdir),gmon)
diff --git a/sysdeps/i386/configure b/sysdeps/i386/configure
index d1d4dc15a7..ecba16645b 100755
--- a/sysdeps/i386/configure
+++ b/sysdeps/i386/configure
@@ -52,3 +52,6 @@ if test $libc_cv_cpp_asm_debuginfo = yes; then
_ACEOF
fi
+
+# Tell top-level configure to try -mtune=i386.
+libc_mtune_example=i386
diff --git a/sysdeps/i386/configure.in b/sysdeps/i386/configure.in
index 028e1ae8e1..93b62b671c 100644
--- a/sysdeps/i386/configure.in
+++ b/sysdeps/i386/configure.in
@@ -33,3 +33,6 @@ rm -f conftest*])AC_SUBST(libc_cv_cpp_asm_debuginfo)
if test $libc_cv_cpp_asm_debuginfo = yes; then
AC_DEFINE(HAVE_CPP_ASM_DEBUGINFO)
fi
+
+# Tell top-level configure to try -mtune=i386.
+libc_mtune_example=i386
diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h
index 367a4fb1a8..df3edf5460 100644
--- a/sysdeps/i386/dl-machine.h
+++ b/sysdeps/i386/dl-machine.h
@@ -301,7 +301,7 @@ elf_machine_plt_value (struct link_map *map, const Elf32_Rel *reloc,
/* The i386 never uses Elf32_Rela relocations for the dynamic linker.
Prelinked libraries may use Elf32_Rela though. */
-#define ELF_MACHINE_NO_RELA (defined RTLD_BOOTSTRAP)
+#define ELF_MACHINE_NO_RELA defined RTLD_BOOTSTRAP
#ifdef RESOLVE_MAP
diff --git a/sysdeps/i386/i486/Makefile b/sysdeps/i386/i486/Makefile
deleted file mode 100644
index 930731a166..0000000000
--- a/sysdeps/i386/i486/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-# Temporary workaround for GCC4 PR debug/19345
-ifeq ($(subdir),string)
-CFLAGS-string-inlines.c += -g0
-endif
diff --git a/sysdeps/i386/i686/hp-timing.h b/sysdeps/i386/i686/hp-timing.h
index a5906835f7..b924869649 100644
--- a/sysdeps/i386/i686/hp-timing.h
+++ b/sysdeps/i386/i686/hp-timing.h
@@ -1,5 +1,5 @@
/* High precision, low overhead timing functions. i686 version.
- Copyright (C) 1998, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -119,26 +119,24 @@ typedef unsigned long long int hp_timing_t;
/* We have to jump through hoops to get this correctly implemented. */
#define HP_TIMING_ACCUM(Sum, Diff) \
do { \
- char __not_done; \
+ int __not_done; \
hp_timing_t __oldval = (Sum); \
hp_timing_t __diff = (Diff) - GLRO(dl_hp_timing_overhead); \
do \
{ \
hp_timing_t __newval = __oldval + __diff; \
int __temp0, __temp1; \
- __asm__ __volatile__ ("xchgl %4, %%ebx\n\t" \
+ __asm__ __volatile__ ("xchgl %0, %%ebx\n\t" \
"lock; cmpxchg8b %1\n\t" \
- "sete %0\n\t" \
- "movl %4, %%ebx" \
- : "=q" (__not_done), "=m" (Sum), \
- "=A" (__oldval), "=c" (__temp0), \
- "=SD" (__temp1) \
- : "1" (Sum), "2" (__oldval), \
- "3" (__newval >> 32), \
- "4" (__newval & 0xffffffff) \
- : "memory"); \
+ "sete %%bl\n\t" \
+ "xchgl %0, %%ebx" \
+ : "=SD" (__not_done), "=m" (Sum), \
+ "=A" (__oldval), "=c" (__temp0) \
+ : "m" (Sum), "2" (__oldval), \
+ "3" ((unsigned int) (__newval >> 32)), \
+ "0" ((unsigned int) __newval)); \
} \
- while (__not_done); \
+ while ((unsigned char) __not_done); \
} while (0)
/* No threads, no extra work. */
diff --git a/sysdeps/powerpc/bits/link.h b/sysdeps/powerpc/bits/link.h
index f8e6734fe0..6c6f6042a1 100644
--- a/sysdeps/powerpc/bits/link.h
+++ b/sysdeps/powerpc/bits/link.h
@@ -71,7 +71,8 @@ typedef struct La_ppc64_regs
{
uint64_t lr_reg[8];
double lr_fp[13];
- uint64_t __padding;
+ uint32_t __padding;
+ uint32_t lr_vrsave;
uint32_t lr_vreg[12][4];
uint64_t lr_r1;
uint64_t lr_lr;
@@ -82,8 +83,8 @@ typedef struct La_ppc64_retval
{
uint64_t lrv_r3;
uint64_t lrv_r4;
- double lrv_fp[8];
- uint32_t lrv_v2[4];
+ double lrv_fp[4]; /* f1-f4, float - complex long double. */
+ uint32_t lrv_v2[4]; /* v2. */
} La_ppc64_retval;
diff --git a/sysdeps/powerpc/powerpc64/dl-trampoline.S b/sysdeps/powerpc/powerpc64/dl-trampoline.S
index 316f17a405..0c617063c9 100644
--- a/sysdeps/powerpc/powerpc64/dl-trampoline.S
+++ b/sysdeps/powerpc/powerpc64/dl-trampoline.S
@@ -18,9 +18,15 @@
02111-1307 USA. */
#include <sysdep.h>
+#include <rtld-global-offsets.h>
- .section ".text"
+ .section ".text"
+/* On entry r0 contains the index of the PLT entry we need to fixup
+ and r11 contains the link_map (from PLT0+16). The link_map becomes
+ parm1 (r3) and the index (r0) need to be converted to an offset
+ (index * 24) in parm2 (r4). */
+
EALIGN(_dl_runtime_resolve, 4, 0)
/* We need to save the registers used to pass parameters, ie. r3 thru
r10; the registers are saved in a stack frame. */
@@ -68,129 +74,362 @@ EALIGN(_dl_runtime_resolve, 4, 0)
bctr
END(_dl_runtime_resolve)
+ /* Stack layout:
+ +592 previous backchain
+ +584 spill_r31
+ +576 spill_r30
+ +560 v1
+ +552 fp4
+ +544 fp3
+ +536 fp2
+ +528 fp1
+ +520 r4
+ +512 r3
+ return values
+ +504 free
+ +496 stackframe
+ +488 lr
+ +480 r1
+ +464 v13
+ +448 v12
+ +432 v11
+ +416 v10
+ +400 v9
+ +384 v8
+ +368 v7
+ +352 v6
+ +336 v5
+ +320 v4
+ +304 v3
+ +288 v2
+ * VMX Parms in V2-V13, V0-V1 are scratch
+ +284 vrsave
+ +280 free
+ +272 fp13
+ +264 fp12
+ +256 fp11
+ +248 fp10
+ +240 fp9
+ +232 fp8
+ +224 fp7
+ +216 fp6
+ +208 fp5
+ +200 fp4
+ +192 fp3
+ +184 fp2
+ +176 fp1
+ * FP Parms in FP1-FP13, FP0 is a scratch register
+ +168 r10
+ +160 r9
+ +152 r8
+ +144 r7
+ +136 r6
+ +128 r5
+ +120 r4
+ +112 r3
+ * Integer parms in R3-R10, R0 is scratch, R1 SP, R2 is TOC
+ +104 parm8
+ +96 parm7
+ +88 parm6
+ +80 parm5
+ +72 parm4
+ +64 parm3
+ +56 parm2
+ +48 parm1
+ * Parameter save area, Allocated by the call, at least 8 double words
+ +40 TOC save area
+ +32 Reserved for linker
+ +24 Reserved for compiler
+ +16 LR save area
+ +8 CR save area
+ r1+0 stack back chain
+ */
+#define FRAME_SIZE 592
+#define INT_RTN 512
+#define FPR_RTN 528
+#define VR_RTN 560
+#define STACK_FRAME 496
+#define CALLING_LR 488
+#define CALLING_SP 480
+#define INT_PARMS 112
+#define FPR_PARMS 176
+#define VR_PARMS 288
+#define VR_VRSAVE 284
+ .section ".toc","aw"
+.LC__dl_hwcap:
+# ifdef SHARED
+ .tc _rtld_global_ro[TC],_rtld_global_ro
+# else
+ .tc _dl_hwcap[TC],_dl_hwcap
+# endif
+ .section ".text"
-
+ .machine "altivec"
+/* On entry r0 contains the index of the PLT entry we need to fixup
+ and r11 contains the link_map (from PLT0+16). The link_map becomes
+ parm1 (r3) and the index (r0) needs to be converted to an offset
+ (index * 24) in parm2 (r4). */
+
EALIGN(_dl_profile_resolve, 4, 0)
+/* Spill r30, r31 to preserve the link_map* and reloc_addr, in case we
+ need to call _dl_call_pltexit. */
+ std r31,-8(r1)
+ std r30,-16(r1)
/* We need to save the registers used to pass parameters, ie. r3 thru
r10; the registers are saved in a stack frame. */
- stdu r1,-448(r1)
- /* Stack layout:
-
- +432 stackframe
- +424 lr
- +416 r1
- +400 v12
- +384 v11
- +368 v10
- +362 v9
- +336 v8
- +320 v7
- +304 v6
- +288 v5
- +272 v4
- +256 v3
- +240 v2
- +224 v1
- +216 free
- +208 fp13
- +200 fp12
- +192 fp11
- +184 fp10
- +176 fp9
- +168 fp8
- +160 fp7
- +152 fp6
- +144 fp5
- +136 fp4
- +128 fp3
- +120 fp2
- +112 fp1
- +104 r10
- +96 r9
- +88 r8
- +80 r7
- +72 r6
- +64 r5
- +56 r4
- +48 r3
- +8 cr
- r1 link
- */
- std r3,48(r1)
+ stdu r1,-FRAME_SIZE(r1)
+ std r3,INT_PARMS+0(r1)
mr r3,r11
- std r4,56(r1)
- sldi r4,r0,1
- std r5,64(r1)
- add r4,r4,0
- std r6,72(r1)
- sldi r4,r4,3
- std r7,80(r1)
+ std r4,INT_PARMS+8(r1)
+ sldi r4,r0,1 /* index * 2 */
+ std r5,INT_PARMS+16(r1)
+ add r4,r4,r0 /* index * 3 */
+ std r6,INT_PARMS+24(r1)
+ sldi r4,r4,3 /* index * 24 == PLT offset */
mflr r5
- std r8,88(r1)
+ std r7,INT_PARMS+32(r1)
+ std r8,INT_PARMS+40(r1)
/* Store the LR in the LR Save area of the previous frame. */
/* XXX Do we have to do this? */
- std r5,448+16(r1)
- std r5,424(r1)
+ la r8,FRAME_SIZE(r1)
+ std r5,FRAME_SIZE+16(r1)
+ std r5,CALLING_LR(r1)
mfcr r0
- std r9,96(r1)
- std r10,104(r1)
+ std r9,INT_PARMS+48(r1)
+ std r10,INT_PARMS+56(r1)
+ std r8,CALLING_SP(r1)
/* I'm almost certain we don't have to save cr... be safe. */
std r0,8(r1)
+ ld r12,.LC__dl_hwcap@toc(r2)
+#ifdef SHARED
+ /* Load _rtld-global._dl_hwcap. */
+ ld r12,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r12)
+#else
+ ld r12,0(r12) /* Load extern _dl_hwcap. */
+#endif
+ andis. r0,r12,(PPC_FEATURE_HAS_ALTIVEC >> 16)
+ beq L(saveFP)
+ la r10,(VR_PARMS+0)(r1)
+ la r9,(VR_PARMS+16)(r1)
+ li r11,32
+ li r12,64
+ stvx v2,0,r10
+ stvx v3,0,r9
+
+ stvx v4,r11,r10
+ stvx v5,r11,r9
+ addi r11,r11,64
+
+ stvx v6,r12,r10
+ stvx v7,r12,r9
+ addi r12,r12,64
+
+ stvx v8,r11,r10
+ stvx v9,r11,r9
+ addi r11,r11,64
+
+ stvx v10,r12,r10
+ stvx v11,r12,r9
+ mfspr r0,VRSAVE
+
+ stvx v12,r11,r10
+ stvx v13,r11,r9
+L(saveFP):
+ stw r0,VR_VRSAVE(r1)
/* Save floating registers. */
- stfd fp1,112(r1)
- stfd fp2,120(r1)
- stfd fp3,128(r1)
- stfd fp4,136(r1)
- stfd fp5,144(r1)
- stfd fp6,152(r1)
- stfd fp7,160(r1)
- stfd fp8,168(r1)
- stfd fp9,176(r1)
- stfd fp10,184(r1)
- stfd fp11,192(r1)
- stfd fp12,200(r1)
- stfd fp13,208(r1)
-/* XXX TODO: store vmx registers. */
-/* Load the extra parameters. */
- addi r6,r1,48
- addi r7,r1,432
+ stfd fp1,FPR_PARMS+0(r1)
+ stfd fp2,FPR_PARMS+8(r1)
+ stfd fp3,FPR_PARMS+16(r1)
+ stfd fp4,FPR_PARMS+24(r1)
+ stfd fp5,FPR_PARMS+32(r1)
+ stfd fp6,FPR_PARMS+40(r1)
+ stfd fp7,FPR_PARMS+48(r1)
+ stfd fp8,FPR_PARMS+56(r1)
+ stfd fp9,FPR_PARMS+64(r1)
+ stfd fp10,FPR_PARMS+72(r1)
+ stfd fp11,FPR_PARMS+80(r1)
li r0,-1
- stdu r0,0(r7)
+ stfd fp12,FPR_PARMS+88(r1)
+ stfd fp13,FPR_PARMS+96(r1)
+/* Load the extra parameters. */
+ addi r6,r1,INT_PARMS
+ addi r7,r1,STACK_FRAME
+/* Save link_map* and reloc_addr parms for later. */
+ mr r31,r3
+ mr r30,r4
+ std r0,0(r7)
bl JUMPTARGET(_dl_profile_fixup)
-/* Put the registers back. */
- ld r0,448+16(r1)
- ld r10,104(r1)
- ld r9,96(r1)
- ld r8,88(r1)
- ld r7,80(r1)
+ nop
+/* Test *framesizep > 0 to see if need to do pltexit processing. */
+ ld r0,STACK_FRAME(r1)
+/* Put the registers back. */
+ lwz r12,VR_VRSAVE(r1)
+ cmpdi cr1,r0,0
+ cmpdi cr0,r12,0
+ bgt cr1,L(do_pltexit)
+ la r10,(VR_PARMS+0)(r1)
+ la r9,(VR_PARMS+16)(r1)
+/* VRSAVE must be non-zero if VMX is present and VRs are in use. */
+ beq L(restoreFXR)
+ li r11,32
+ li r12,64
+ lvx v2,0,r10
+ lvx v3,0,r9
+
+ lvx v4,r11,r10
+ lvx v5,r11,r9
+ addi r11,r11,64
+
+ lvx v6,r12,r10
+ lvx v7,r12,r9
+ addi r12,r12,64
+
+ lvx v8,r11,r10
+ lvx v9,r11,r9
+ addi r11,r11,64
+
+ lvx v10,r12,r10
+ lvx v11,r12,r9
+
+ lvx v12,r11,r10
+ lvx v13,r11,r9
+L(restoreFXR):
+ ld r0,FRAME_SIZE+16(r1)
+ ld r10,INT_PARMS+56(r1)
+ ld r9,INT_PARMS+48(r1)
+ ld r8,INT_PARMS+40(r1)
+ ld r7,INT_PARMS+32(r1)
mtlr r0
ld r0,8(r1)
- ld r6,72(r1)
- ld r5,64(r1)
- ld r4,56(r1)
+ ld r6,INT_PARMS+24(r1)
+ ld r5,INT_PARMS+16(r1)
+ ld r4,INT_PARMS+8(r1)
mtcrf 0xFF,r0
/* Load the target address, toc and static chain reg from the function
descriptor returned by fixup. */
ld r0,0(r3)
ld r2,8(r3)
- mtctr r0
ld r11,16(r3)
- ld r3,48(r1)
+ ld r3,INT_PARMS+0(r1)
+ mtctr r0
/* Load the floating point registers. */
- lfd fp1,112(r1)
- lfd fp2,120(r1)
- lfd fp3,128(r1)
- lfd fp4,136(r1)
- lfd fp5,144(r1)
- lfd fp6,152(r1)
- lfd fp7,160(r1)
- lfd fp8,168(r1)
- lfd fp9,176(r1)
- lfd fp10,184(r1)
- lfd fp11,192(r1)
- lfd fp12,200(r1)
- lfd fp13,208(r1)
+ lfd fp1,FPR_PARMS+0(r1)
+ lfd fp2,FPR_PARMS+8(r1)
+ lfd fp3,FPR_PARMS+16(r1)
+ lfd fp4,FPR_PARMS+24(r1)
+ lfd fp5,FPR_PARMS+32(r1)
+ lfd fp6,FPR_PARMS+40(r1)
+ lfd fp7,FPR_PARMS+48(r1)
+ lfd fp8,FPR_PARMS+56(r1)
+ lfd fp9,FPR_PARMS+64(r1)
+ lfd fp10,FPR_PARMS+72(r1)
+ lfd fp11,FPR_PARMS+80(r1)
+ lfd fp12,FPR_PARMS+88(r1)
+ lfd fp13,FPR_PARMS+96(r1)
/* Unwind the stack frame, and jump. */
- addi r1,r1,448
+ ld r31,584(r1)
+ ld r30,576(r1)
+ addi r1,r1,FRAME_SIZE
bctr
+L(do_pltexit):
+ la r10,(VR_PARMS+0)(r1)
+ la r9,(VR_PARMS+16)(r1)
+ beq L(restoreFXR2)
+ li r11,32
+ li r12,64
+ lvx v2,0,r10
+ lvx v3,0,r9
+
+ lvx v4,r11,r10
+ lvx v5,r11,r9
+ addi r11,r11,64
+
+ lvx v6,r12,r10
+ lvx v7,r12,r9
+ addi r12,r12,64
+
+ lvx v8,r11,r10
+ lvx v9,r11,r9
+ addi r11,r11,64
+
+ lvx v10,r12,r10
+ lvx v11,r12,r9
+
+ lvx v12,r11,r10
+ lvx v13,r11,r9
+L(restoreFXR2):
+ ld r0,FRAME_SIZE+16(r1)
+ ld r10,INT_PARMS+56(r1)
+ ld r9,INT_PARMS+48(r1)
+ ld r8,INT_PARMS+40(r1)
+ ld r7,INT_PARMS+32(r1)
+ mtlr r0
+ ld r0,8(r1)
+ ld r6,INT_PARMS+24(r1)
+ ld r5,INT_PARMS+16(r1)
+ ld r4,INT_PARMS+8(r1)
+ mtcrf 0xFF,r0
+/* Load the target address, toc and static chain reg from the function
+ descriptor returned by fixup. */
+ ld r0,0(r3)
+ std r2,40(r1)
+ ld r2,8(r3)
+ ld r11,16(r3)
+ ld r3,INT_PARMS+0(r1)
+ mtctr r0
+/* Load the floating point registers. */
+ lfd fp1,FPR_PARMS+0(r1)
+ lfd fp2,FPR_PARMS+8(r1)
+ lfd fp3,FPR_PARMS+16(r1)
+ lfd fp4,FPR_PARMS+24(r1)
+ lfd fp5,FPR_PARMS+32(r1)
+ lfd fp6,FPR_PARMS+40(r1)
+ lfd fp7,FPR_PARMS+48(r1)
+ lfd fp8,FPR_PARMS+56(r1)
+ lfd fp9,FPR_PARMS+64(r1)
+ lfd fp10,FPR_PARMS+72(r1)
+ lfd fp11,FPR_PARMS+80(r1)
+ lfd fp12,FPR_PARMS+88(r1)
+ lfd fp13,FPR_PARMS+96(r1)
+/* Call the target function. */
+ bctrl
+ ld r2,40(r1)
+ lwz r12,VR_VRSAVE(r1)
+/* But return here and store the return values. */
+ std r3,INT_RTN(r1)
+ std r4,INT_RTN+8(r1)
+ stfd fp1,FPR_PARMS+0(r1)
+ stfd fp2,FPR_PARMS+8(r1)
+ cmpdi cr0,r12,0
+ la r10,VR_RTN(r1)
+ stfd fp3,FPR_PARMS+16(r1)
+ stfd fp4,FPR_PARMS+24(r1)
+ mr r3,r31
+ mr r4,r30
+ beq L(callpltexit)
+ stvx v2,0,r10
+L(callpltexit):
+ addi r5,r1,INT_PARMS
+ addi r6,r1,INT_RTN
+ bl JUMPTARGET(_dl_call_pltexit)
+ nop
+/* Restore the return values from target function. */
+ lwz r12,VR_VRSAVE(r1)
+ ld r3,INT_RTN(r1)
+ ld r4,INT_RTN+8(r1)
+ lfd fp1,FPR_PARMS+0(r1)
+ lfd fp2,FPR_PARMS+8(r1)
+ cmpdi cr0,r12,0
+ la r10,VR_RTN(r1)
+ lfd fp3,FPR_PARMS+16(r1)
+ lfd fp4,FPR_PARMS+24(r1)
+ beq L(pltexitreturn)
+ lvx v2,0,r10
+L(pltexitreturn):
+ ld r0,FRAME_SIZE+16(r1)
+ ld r31,584(r1)
+ ld r30,576(r1)
+ mtlr r0
+ ld r1,0(r1)
+ blr
END(_dl_profile_resolve)
diff --git a/sysdeps/sparc/sparc32/dl-machine.h b/sysdeps/sparc/sparc32/dl-machine.h
index 52fc6329dd..d0af232d48 100644
--- a/sysdeps/sparc/sparc32/dl-machine.h
+++ b/sysdeps/sparc/sparc32/dl-machine.h
@@ -1,5 +1,5 @@
/* Machine-dependent ELF dynamic relocation inline functions. SPARC version.
- Copyright (C) 1996-2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1996-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
@@ -411,7 +411,8 @@ elf_machine_plt_value (struct link_map *map, const Elf32_Rela *reloc,
/* Perform the relocation specified by RELOC and SYM (which is fully resolved).
MAP is the object containing the reloc. */
-static inline void
+auto inline void
+__attribute__ ((always_inline))
elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
const Elf32_Sym *sym, const struct r_found_version *version,
void *const reloc_addr_arg)
@@ -593,7 +594,8 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
}
}
-static inline void
+auto inline void
+__attribute__ ((always_inline))
elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc,
void *const reloc_addr_arg)
{
@@ -601,7 +603,8 @@ elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc,
*reloc_addr += l_addr + reloc->r_addend;
}
-static inline void
+auto inline void
+__attribute__ ((always_inline))
elf_machine_lazy_rel (struct link_map *map,
Elf32_Addr l_addr, const Elf32_Rela *reloc)
{
diff --git a/sysdeps/sparc/sparc64/dl-machine.h b/sysdeps/sparc/sparc64/dl-machine.h
index 474aa0e6e6..72b88e235c 100644
--- a/sysdeps/sparc/sparc64/dl-machine.h
+++ b/sysdeps/sparc/sparc64/dl-machine.h
@@ -1,5 +1,5 @@
/* Machine-dependent ELF dynamic relocation inline functions. Sparc64 version.
- Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -238,7 +238,8 @@ elf_machine_plt_value (struct link_map *map, const Elf64_Rela *reloc,
/* Perform the relocation specified by RELOC and SYM (which is fully resolved).
MAP is the object containing the reloc. */
-static inline void
+auto inline void
+__attribute__ ((always_inline))
elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
const Elf64_Sym *sym, const struct r_found_version *version,
void *const reloc_addr_arg)
@@ -430,7 +431,8 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
}
}
-static inline void
+auto inline void
+__attribute__ ((always_inline))
elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc,
void *const reloc_addr_arg)
{
@@ -438,7 +440,8 @@ elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc,
*reloc_addr = l_addr + reloc->r_addend;
}
-static inline void
+auto inline void
+__attribute__ ((always_inline))
elf_machine_lazy_rel (struct link_map *map,
Elf64_Addr l_addr, const Elf64_Rela *reloc)
{
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/kern64/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips32/kern64/sysdep.h
deleted file mode 100644
index e69de29bb2..0000000000
--- a/sysdeps/unix/sysv/linux/mips/mips32/kern64/sysdep.h
+++ /dev/null
diff --git a/sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h b/sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h
index a499a80ef9..9eb50aa96b 100644
--- a/sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2002, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2002, 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
@@ -70,8 +70,6 @@ typedef struct
* can be refernced safely only after verifying that PPC_FEATURE_HAS_ALTIVEC
* is set in AT_HWCAP. */
-# include <asm/types.h>
-
/* Number of general registers. */
# define NGREG 48 /* includes r0-r31, nip, msr, lr, etc. */
# define NFPREG 33 /* includes fp0-fp31 &fpscr. */
diff --git a/sysdeps/unix/sysv/linux/sh/bits/mman.h b/sysdeps/unix/sysv/linux/sh/bits/mman.h
index 673c7295fb..656b5b673b 100644
--- a/sysdeps/unix/sysv/linux/sh/bits/mman.h
+++ b/sysdeps/unix/sysv/linux/sh/bits/mman.h
@@ -1,5 +1,5 @@
/* Definitions for POSIX memory map interface. Linux/SH version.
- Copyright (C) 1997, 1999, 2000, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1999, 2000, 2003, 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
@@ -61,6 +61,8 @@
# define MAP_EXECUTABLE 0x1000 /* Mark it as an executable. */
# define MAP_LOCKED 0x2000 /* Lock the mapping. */
# define MAP_NORESERVE 0x4000 /* Don't check for reservations. */
+# define MAP_POPULATE 0x8000 /* Populate (prefault) pagetables. */
+# define MAP_NONBLOCK 0x10000 /* Do not block on IO. */
#endif
/* Flags to `msync'. */
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/mman.h b/sysdeps/unix/sysv/linux/sparc/bits/mman.h
index cc4917a54b..410a38e8a5 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/mman.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/mman.h
@@ -1,5 +1,5 @@
/* Definitions for POSIX memory map interface. Linux/SPARC version.
- Copyright (C) 1997, 1999, 2000, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1999, 2000, 2003, 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
@@ -57,12 +57,14 @@
/* These are Linux-specific. */
#ifdef __USE_MISC
-# define MAP_GROWSDOWN 0x0100 /* Stack-like segment. */
+# define MAP_GROWSDOWN 0x0200 /* Stack-like segment. */
# define MAP_DENYWRITE 0x0800 /* ETXTBSY */
# define MAP_EXECUTABLE 0x1000 /* Mark it as an executable. */
# define MAP_LOCKED 0x0100 /* Lock the mapping. */
# define MAP_NORESERVE 0x0040 /* Don't check for reservations. */
# define _MAP_NEW 0x80000000 /* Binary compatibility with SunOS. */
+# define MAP_POPULATE 0x8000 /* Populate (prefault) pagetables. */
+# define MAP_NONBLOCK 0x10000 /* Do not block on IO. */
#endif
/* Flags to `msync'. */
diff --git a/sysdeps/unix/sysv/linux/x86_64/makecontext.c b/sysdeps/unix/sysv/linux/x86_64/makecontext.c
index c763556b93..6597d8980b 100644
--- a/sysdeps/unix/sysv/linux/x86_64/makecontext.c
+++ b/sysdeps/unix/sysv/linux/x86_64/makecontext.c
@@ -1,5 +1,5 @@
/* Create new context.
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@suse.de>, 2002.
@@ -20,6 +20,7 @@
#include <sysdep.h>
#include <stdarg.h>
+#include <stdint.h>
#include <ucontext.h>
#include "ucontext_i.h"
@@ -52,28 +53,29 @@ void
__makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
{
extern void __start_context (void);
- unsigned long *sp, idx_uc_link;
+ unsigned long int *sp, idx_uc_link;
va_list ap;
int i;
/* Generate room on stack for parameter if needed and uc_link. */
- sp = (long *) ((long) ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size);
+ sp = (unsigned long int *) ((uintptr_t) ucp->uc_stack.ss_sp
+ + ucp->uc_stack.ss_size);
sp -= (argc > 6 ? argc - 6 : 0) + 1;
/* Align stack and make space for trampoline address. */
- sp = (long *) ((((long) sp) & -16L) - 8);
+ sp = (unsigned long int *) ((((uintptr_t) sp) & -16L) - 8);
idx_uc_link = (argc > 6 ? argc - 6 : 0) + 1;
/* Setup context ucp. */
/* Address to jump to. */
- ucp->uc_mcontext.gregs[REG_RIP] = (long) func;
+ ucp->uc_mcontext.gregs[REG_RIP] = (long int) func;
/* Setup rbx.*/
- ucp->uc_mcontext.gregs[REG_RBX] = (long) &sp[idx_uc_link];
- ucp->uc_mcontext.gregs[REG_RSP] = (long) sp;
+ ucp->uc_mcontext.gregs[REG_RBX] = (long int) &sp[idx_uc_link];
+ ucp->uc_mcontext.gregs[REG_RSP] = (long int) sp;
/* Setup stack. */
- sp[0] = (long) &__start_context;
- sp[idx_uc_link] = (long) ucp->uc_link;
+ sp[0] = (unsigned long int) &__start_context;
+ sp[idx_uc_link] = (unsigned long int) ucp->uc_link;
va_start (ap, argc);
/* Handle arguments. */
diff --git a/sysdeps/x86_64/hp-timing.h b/sysdeps/x86_64/hp-timing.h
index e015ff79db..59a29abd45 100644
--- a/sysdeps/x86_64/hp-timing.h
+++ b/sysdeps/x86_64/hp-timing.h
@@ -1,5 +1,5 @@
/* High precision, low overhead timing functions. x86-64 version.
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 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
@@ -31,7 +31,11 @@
/* The funny business for 32-bit mode is not required here. */
# undef HP_TIMING_ACCUM
-# define HP_TIMING_ACCUM(Sum, Diff) ((Sum) += (Diff))
-
+# define HP_TIMING_ACCUM(Sum, Diff) \
+ do { \
+ hp_timing_t __diff = (Diff) - GLRO(dl_hp_timing_overhead); \
+ __asm__ __volatile__ ("lock; addq %1, %0" \
+ : "=m" (Sum) : "r" (__diff), "m" (Sum)); \
+ } while (0)
#endif /* hp-timing.h */
diff --git a/test-skeleton.c b/test-skeleton.c
index 9d9a68b62c..dd5d8041dd 100644
--- a/test-skeleton.c
+++ b/test-skeleton.c
@@ -1,5 +1,5 @@
/* Skeleton for test programs.
- Copyright (C) 1998,2000,2001,2002,2003,2004 Free Software Foundation, Inc.
+ Copyright (C) 1998,2000-2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -20,6 +20,7 @@
#include <errno.h>
#include <getopt.h>
+#include <malloc.h>
#include <search.h>
#include <signal.h>
#include <stdio.h>
@@ -196,6 +197,9 @@ main (int argc, char *argv[])
unsigned int timeoutfactor = 1;
pid_t termpid;
+ /* Make uses of freed and uninitialized memory known. */
+ mallopt (M_PERTURB, 42);
+
#ifdef STDOUT_UNBUFFERED
setbuf (stdout, NULL);
#endif
diff --git a/time/mktime.c b/time/mktime.c
index c6ae56ee60..79221b8a74 100644
--- a/time/mktime.c
+++ b/time/mktime.c
@@ -1,5 +1,5 @@
/* Convert a `struct tm' to a time_t value.
- Copyright (C) 1993-1999, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1993-1999, 2002-2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Paul Eggert (eggert@twinsun.com).
@@ -209,7 +209,8 @@ ranged_convert (struct tm *(*convert) (const time_t *, struct tm *),
{
time_t bad = *t;
time_t ok = 0;
- struct tm tm;
+ /* Initialize to make the compiler happy. */
+ struct tm tm = { 0, };
/* BAD is a known unconvertible time_t, and OK is a known good one.
Use binary search to narrow the range between BAD and OK until
diff --git a/wcsmbs/mbrtowc.c b/wcsmbs/mbrtowc.c
index 6932b047ae..eb2a312b7c 100644
--- a/wcsmbs/mbrtowc.c
+++ b/wcsmbs/mbrtowc.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2002, 2004
+/* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2002, 2004, 2005
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
@@ -42,7 +42,7 @@ __mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
size_t result;
size_t dummy;
const unsigned char *inbuf, *endbuf;
- char *outbuf = (char *) (pwc ?: buf);
+ unsigned char *outbuf = (unsigned char *) (pwc ?: buf);
const struct gconv_fcts *fcts;
/* Set information for this step. */
@@ -56,7 +56,7 @@ __mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
initial state. */
if (s == NULL)
{
- outbuf = (char *) buf;
+ outbuf = (unsigned char *) buf;
s = "";
n = 1;
}
diff --git a/wcsmbs/mbsnrtowcs.c b/wcsmbs/mbsnrtowcs.c
index 9ac06fe6c2..ef5ca06e2f 100644
--- a/wcsmbs/mbsnrtowcs.c
+++ b/wcsmbs/mbsnrtowcs.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996,1997,1998,1999,2000,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2000, 2002, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
@@ -62,7 +62,7 @@ __mbsnrtowcs (dst, src, nmc, len, ps)
if (nmc == 0)
return 0;
- srcend = *src + __strnlen (*src, nmc - 1) + 1;
+ srcend = (const unsigned char *) *src + __strnlen (*src, nmc - 1) + 1;
/* Get the conversion functions. */
fcts = get_gconv_fcts (_NL_CURRENT_DATA (LC_CTYPE));
@@ -74,7 +74,7 @@ __mbsnrtowcs (dst, src, nmc, len, ps)
if (dst == NULL)
{
wchar_t buf[64]; /* Just an arbitrary size. */
- const unsigned char *inbuf = *src;
+ const unsigned char *inbuf = (const unsigned char *) *src;
result = 0;
data.__outbufend = (unsigned char *) buf + sizeof (buf);
diff --git a/wcsmbs/mbsrtowcs_l.c b/wcsmbs/mbsrtowcs_l.c
index 8da3095566..c44c8e5066 100644
--- a/wcsmbs/mbsrtowcs_l.c
+++ b/wcsmbs/mbsrtowcs_l.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 2002.
@@ -70,16 +70,16 @@ __mbsrtowcs_l (dst, src, len, ps, l)
mbstate_t temp_state;
wchar_t buf[64]; /* Just an arbitrary size. */
const unsigned char *inbuf = (const unsigned char *) *src;
- const unsigned char *srcend = inbuf + strlen (inbuf) + 1;
+ const unsigned char *srcend = inbuf + strlen (*src) + 1;
temp_state = *data.__statep;
data.__statep = &temp_state;
result = 0;
- data.__outbufend = (char *) buf + sizeof (buf);
+ data.__outbufend = (unsigned char *) buf + sizeof (buf);
do
{
- data.__outbuf = (char *) buf;
+ data.__outbuf = (unsigned char *) buf;
status = DL_CALL_FCT (towc->__fct,
(towc, &data, &inbuf, srcend, NULL,
@@ -114,7 +114,7 @@ __mbsrtowcs_l (dst, src, len, ps, l)
{
/* Pessimistic guess as to how much input we can use. In the
worst case we need one input byte for one output wchar_t. */
- srcend = srcp + __strnlen (srcp, len) + 1;
+ srcend = srcp + __strnlen ((const char *) srcp, len) + 1;
status = DL_CALL_FCT (towc->__fct,
(towc, &data, &srcp, srcend, NULL,
@@ -131,7 +131,7 @@ __mbsrtowcs_l (dst, src, len, ps, l)
}
/* Make the end if the input known to the caller. */
- *src = srcp;
+ *src = (const char *) srcp;
result = (wchar_t *) data.__outbuf - dst;
diff --git a/wcsmbs/wcrtomb.c b/wcsmbs/wcrtomb.c
index 38144796f8..f7971e704b 100644
--- a/wcsmbs/wcrtomb.c
+++ b/wcsmbs/wcrtomb.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996,1997,1998,2000,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1996,1997,1998,2000,2002,2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -60,8 +60,8 @@ __wcrtomb (char *s, wchar_t wc, mbstate_t *ps)
}
/* Tell where we want to have the result. */
- data.__outbuf = s;
- data.__outbufend = s + MB_CUR_MAX;
+ data.__outbuf = (unsigned char *) s;
+ data.__outbufend = (unsigned char *) s + MB_CUR_MAX;
/* Get the conversion functions. */
fcts = get_gconv_fcts (_NL_CURRENT_DATA (LC_CTYPE));
diff --git a/wcsmbs/wcscoll.c b/wcsmbs/wcscoll.c
index ed6db06e4e..ae3d48c623 100644
--- a/wcsmbs/wcscoll.c
+++ b/wcsmbs/wcscoll.c
@@ -22,12 +22,11 @@
#define STRING_TYPE wchar_t
#define USTRING_TYPE wint_t
-#define STRCOLL __wcscoll
+#define STRCOLL wcscoll
#define STRCOLL_L __wcscoll_l
#include "../string/strcoll.c"
#ifndef USE_IN_EXTENDED_LOCALE_MODEL
-weak_alias (__wcscoll, wcscoll)
libc_hidden_weak (wcscoll)
#endif
diff --git a/wcsmbs/wcsnrtombs.c b/wcsmbs/wcsnrtombs.c
index 0ff26d6671..0252b7fa23 100644
--- a/wcsmbs/wcsnrtombs.c
+++ b/wcsmbs/wcsnrtombs.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2000, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2000, 2002, 2003, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
@@ -104,8 +104,8 @@ __wcsnrtombs (dst, src, nwc, len, ps)
of the string. */
size_t dummy;
- data.__outbuf = dst;
- data.__outbufend = dst + len;
+ data.__outbuf = (unsigned char *) dst;
+ data.__outbufend = (unsigned char *) dst + len;
status = DL_CALL_FCT (tomb->__fct,
(tomb, &data, (const unsigned char **) src,
diff --git a/wcsmbs/wcsrtombs.c b/wcsmbs/wcsrtombs.c
index 8b444ed8a2..d41ca5366b 100644
--- a/wcsmbs/wcsrtombs.c
+++ b/wcsmbs/wcsrtombs.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2000, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2000, 2002, 2003, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
@@ -105,8 +105,8 @@ __wcsrtombs (dst, src, len, ps)
const wchar_t *srcend = *src + __wcsnlen (*src, len) + 1;
size_t dummy;
- data.__outbuf = dst;
- data.__outbufend = dst + len;
+ data.__outbuf = (unsigned char *) dst;
+ data.__outbufend = (unsigned char *) dst + len;
status = DL_CALL_FCT (tomb->__fct,
(tomb, &data, (const unsigned char **) src,
diff --git a/wcsmbs/wctob.c b/wcsmbs/wctob.c
index b85ba6dd8f..854a3f25db 100644
--- a/wcsmbs/wctob.c
+++ b/wcsmbs/wctob.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2000, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2000, 2002, 2003, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
@@ -29,7 +29,7 @@ int
wctob (c)
wint_t c;
{
- char buf[MB_LEN_MAX];
+ unsigned char buf[MB_LEN_MAX];
struct __gconv_step_data data;
wchar_t inbuf[1];
wchar_t *inptr = inbuf;