-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]
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].
oldest-abi = @oldest_abi@
no-whole-archive = @no_whole_archive@
exceptions = @exceptions@
-have_doors = @linux_doors@
mach-interface-list = @mach_interface_list@
# 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.
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;;
else
cat > conftest.s <<EOF
.text
- .type func,@function
+ .type func,%function
func:
.cfi_startproc
.cfi_remember_state
-case "$add_ons" in
- *door*) linux_doors=yes ;;
- *) linux_doors=no ;;
-esac
-
-
if test "`(cd $srcdir; pwd)`" = "`pwd`"; then
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
# 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.]*\)],
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
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)
if (nbytes > buflen)
__chk_fail ();
- return __pread64 (fd, buf, offset, nbytes);
+ return __pread64 (fd, buf, nbytes, offset);
}
#endif
if (nbytes > buflen)
__chk_fail ();
- return __pread (fd, buf, offset, nbytes);
+ return __pread (fd, buf, nbytes, offset);
}
#endif
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
__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
|| 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 ();
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
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
$(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
$(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
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
$(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
$(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
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;
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)
}
}
- 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;
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);
&& 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;
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
/* 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 =
}
#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))
/* 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. */
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;
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)
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));
}
/* 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
{
/* 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. */
{
/* 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];
/* 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
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
{
/* 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);
}
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)
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. */
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
& 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)
}
/* Correct the previous increment. */
- --l->l_opencount;
+ --l->l_direct_opencount;
}
}
do_audit = 1;
goto again;
}
-#endif
if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_STATISTICS, 0))
_dl_debug_printf ("\nruntime linker statistics:\n"
"final number of relocations from cache: %lu\n",
GL(dl_num_relocations),
GL(dl_num_cache_relocations));
+#endif
}
/* 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. */
/* 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))
{
/* 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)
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;
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 ("\
{
/* 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;
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))
/* 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);
}
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
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);
/* 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.
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]);
/* 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))
{
/* 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);
/* 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
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]);
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
/* 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
#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. */
#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)
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;
}
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;
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;
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;
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;
--- /dev/null
+#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");
+}
--- /dev/null
+#include <stdio.h>
+
+static void
+__attribute__ ((destructor))
+fini (void)
+{
+ putchar ('1');
+}
--- /dev/null
+#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');
+}
--- /dev/null
+#include <stdio.h>
+
+int
+bar (void)
+{
+ return 1;
+}
+
+static void
+__attribute__ ((destructor))
+fini (void)
+{
+ putchar ('4');
+}
--- /dev/null
+#include <stdio.h>
+
+extern int bar (void);
+
+int
+foo (void)
+{
+ return 42 + bar ();
+}
+
+static void
+__attribute__ ((destructor))
+fini (void)
+{
+ putchar ('3');
+}
#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;
}
#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);
}
{
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;
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;
/* 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))
{
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);
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);
}
}
-
#if defined(__i386__) || defined(__alpha__) || (defined(__sparc__) && !defined(__arch64__))
/*
* Modifications by Red Hat Software
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;
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. */
/* 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)
{
}
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. */
args.lazy = GLRO(dl_lazy);
l = main_map;
- while (l->l_next)
+ while (l->l_next != NULL)
l = l->l_next;
do
{
&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;
/* 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. */
#include <dlfcn.h>
#include <stdlib.h>
+#include <stdio.h>
#include "testobj.h"
/* 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__
__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
#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
#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
#include <stdio.h>
+extern int foo (int x);
+
int
bar (int x)
{
--- /dev/null
+#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;
+}
--- /dev/null
+#include <stdio.h>
+
+extern int bar (int);
+
+int
+foo (int x)
+{
+ puts ("in foo");
+ return bar (x / 2) + 2;
+}
--- /dev/null
+#include <stdio.h>
+
+int
+baz (int x)
+{
+ puts ("in baz");
+ return x * 4;
+}
--- /dev/null
+#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;
+}
--- /dev/null
+#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;
+}
--- /dev/null
+#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;
+}
# 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
/* 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.
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) \
# 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
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. */
{
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;
ElfW(Word) l_flags;
/* Temporarily used in `dl_close'. */
- unsigned int l_idx;
+ int l_idx;
struct link_map_machine l_mach;
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__;
/* 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
}
-int
-main (void)
+static int
+do_test (void)
{
struct ifaddrs *ifaces, *ifa;
return failures ? 1 : 0;
}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
/* 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>.
#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;
if_freenameindex (idx);
return failures ? 1 : 0;
}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
+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.
#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
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)
#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
-/* 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
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,
&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)
{
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)
{
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)
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
+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.
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
-/* 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>.
__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. */
/* 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++;
+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.
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 \
LC_IDENTIFICATION
title "Punjabi language locale for Indian Punjabi(Gurmukhi)"
-source "IndLinux.org"
+source "IndLinux.org"
address ""
contact ""
email "bug-glibc-locales@gnu.org"
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
%
% 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
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)
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_")))
struct mallinfo public_mALLINFo();
#endif
+#ifndef _LIBC
/*
independent_calloc(size_t n_elements, size_t element_size, Void_t* chunks[]);
Void_t** public_iCOMALLOc();
#endif
+#endif /* _LIBC */
+
/*
pvalloc(size_t n);
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);
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();
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"
return mem;
}
+#ifndef _LIBC
+
Void_t**
public_iCALLOc(size_t n, size_t elem_size, Void_t** chunks)
{
return m;
}
-#ifndef _LIBC
-
void
public_cFREe(Void_t* m)
{
{
int result;
+ if(__malloc_initialized < 0)
+ ptmalloc_init ();
(void)mutex_lock(&main_arena.mutex);
result = mTRIm(s);
(void)mutex_unlock(&main_arena.mutex);
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;
}
}
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;
}
}
}
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 */
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 */
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 {
(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;
}
}
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 */
(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;
}
}
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;
}
/*
/*
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;
+ }
}
}
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;
}
goto errout;
}
+ if (__builtin_expect (perturb_byte, 0))
+ free_perturb (mem, size - SIZE_SZ);
+
/* consolidate backward */
if (!prev_inuse(p)) {
prevsize = p->prev_size;
}
#endif /* 0 */
+#ifndef _LIBC
/*
------------------------- independent_calloc -------------------------
*/
return marray;
}
+#endif /* _LIBC */
/*
case M_CHECK_ACTION:
check_action = value;
break;
+
+ case M_PERTURB:
+ perturb_byte = value;
+ break;
}
(void)mutex_unlock(&av->mutex);
return res;
#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));
/* 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
}
#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;
}
# 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
+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.
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)
*family++ = th[j].h_addrtype;
}
- char *cp = family;
+ void *cp = family;
if (canon != NULL)
cp = mempcpy (cp, canon, canonlen);
# 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);
+}
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
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);
}
}
}
/* 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>.
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. */
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;
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);
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)
{
}
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;
}
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;
}
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. */
/* 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',
/* 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>.
{
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 */
# 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);
+}
-/* 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.
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)
((__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)
{
((__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));
((__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)
{
: ((__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));
((__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));
((__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));
((__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)
{
((__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));
((__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)
{
# define STRING_TYPE char
# define STRCOLL strcoll
# define STRCOLL_L __strcoll_l
+# define USE_HIDDEN_DEF
#endif
#include "../locale/localeinfo.h"
{
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
-# 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
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
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;
register int i;
k = (unsigned long *) schedule;
- in = (unsigned char *) key;
+ in = key;
c2l (in, c);
c2l (in, d);
#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 */
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
#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)
{
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
/* 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>.
/* 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,
#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)
{
}
auto inline void
+__attribute__ ((always_inline))
elf_machine_lazy_rel (struct link_map *map,
Elf64_Addr l_addr, const Elf64_Rela *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
/* 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)
}
# 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)
}
# 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)
{
}
# 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)
{
}
# 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)
{
/* 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
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,
}
-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,
/* 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;
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
-/* 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
/* 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;
--- /dev/null
+/* 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)
+*/
}
/* 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)
{
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", \
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;
}
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\
-# 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
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>";
#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>
# 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
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
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)
_ACEOF
fi
+
+# Tell top-level configure to try -mtune=i386.
+libc_mtune_example=i386
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
/* 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
+++ /dev/null
-# Temporary workaround for GCC4 PR debug/19345
-ifeq ($(subdir),string)
-CFLAGS-string-inlines.c += -g0
-endif
/* 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.
/* 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. */
{
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;
{
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;
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. */
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)
/* 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
/* 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)
}
}
-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)
{
*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)
{
/* 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.
/* 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)
}
}
-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)
{
*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)
{
-/* 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
* 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. */
/* 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
# 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'. */
/* 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
/* 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'. */
/* 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.
#include <sysdep.h>
#include <stdarg.h>
+#include <stdint.h>
#include <ucontext.h>
#include "ucontext_i.h"
__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. */
/* 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
/* 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 */
/* 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.
#include <errno.h>
#include <getopt.h>
+#include <malloc.h>
#include <search.h>
#include <signal.h>
#include <stdio.h>
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
/* 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).
{
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
-/* 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.
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. */
initial state. */
if (s == NULL)
{
- outbuf = (char *) buf;
+ outbuf = (unsigned char *) buf;
s = "";
n = 1;
}
-/* 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.
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));
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);
-/* 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.
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,
{
/* 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,
}
/* Make the end if the input known to the caller. */
- *src = srcp;
+ *src = (const char *) srcp;
result = (wchar_t *) data.__outbuf - dst;
-/* 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.
}
/* 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));
#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
-/* 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.
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,
-/* 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.
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,
-/* 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.
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;