summaryrefslogtreecommitdiff
path: root/elf/dl-misc.c
AgeCommit message (Collapse)Author
2018-06-12Avoid cancellable I/O primitives in ld.so.Zack Weinberg
Neither the <dlfcn.h> entry points, nor lazy symbol resolution, nor initial shared library load-up, are cancellation points, so ld.so should exclusively use I/O primitives that are not cancellable. We currently achieve this by having the cancellation hooks compile as no-ops when IS_IN(rtld); this patch changes to using exclusively _nocancel primitives in the source code instead, which makes the intent clearer and significantly reduces the amount of code compiled under IS_IN(rtld) as well as IS_IN(libc) -- in particular, elf/Makefile no longer thinks we require a copy of unwind.c in rtld-libc.a. (The older mechanism is preserved as a backstop.) The bulk of the change is splitting up the files that define the _nocancel I/O functions, so they don't also define the variants that *are* cancellation points; after which, the existing logic for picking out the bits of libc that need to be recompiled as part of ld.so Just Works. I did this for all of the _nocancel functions, not just the ones used by ld.so, for consistency. fcntl was a little tricky because it's only a cancellation point for certain opcodes (F_SETLKW(64), which can block), and the existing __fcntl_nocancel wasn't applying the FCNTL_ADJUST_CMD hook, which strikes me as asking for trouble, especially as the only nontrivial definition of FCNTL_ADJUST_CMD (for powerpc64) changes F_*LK* opcodes. To fix this, fcntl_common moves to fcntl_nocancel.c along with __fcntl_nocancel, and changes its name to the extern (but hidden) symbol __fcntl_nocancel_adjusted, so that regular fcntl can continue calling it. __fcntl_nocancel now applies FCNTL_ADJUST_CMD; so that both both fcntl.c and fcntl_nocancel.c can see it, the only nontrivial definition moves from sysdeps/u/s/l/powerpc/powerpc64/fcntl.c to .../powerpc64/sysdep.h and becomes entirely a macro, instead of a macro that calls an inline function. The nptl version of libpthread also changes a little, because its "compat-routines" formerly included files that defined all the _nocancel functions it uses; instead of continuing to duplicate them, I exported the relevant ones from libc.so as GLIBC_PRIVATE. Since the Linux fcntl.c calls a function defined by fcntl_nocancel.c, it can no longer be used from libpthread.so; instead, introduce a custom forwarder, pt-fcntl.c, and export __libc_fcntl from libc.so as GLIBC_PRIVATE. The nios2-linux ABI doesn't include a copy of vfork() in libpthread, and it was handling that by manipulating libpthread-routines in .../linux/nios2/Makefile; it is cleaner to do what other such ports do, and have a pt-vfork.S that defines no symbols. Right now, it appears that Hurd does not implement _nocancel I/O, so sysdeps/generic/not-cancel.h will forward everything back to the regular functions. This changed the names of some of the functions that sysdeps/mach/hurd/dl-sysdep.c needs to interpose. * elf/dl-load.c, elf/dl-misc.c, elf/dl-profile.c, elf/rtld.c * sysdeps/unix/sysv/linux/dl-sysdep.c Include not-cancel.h. Use __close_nocancel instead of __close, __open64_nocancel instead of __open, __read_nocancel instead of __libc_read, and __write_nocancel instead of __libc_write. * csu/check_fds.c (check_one_fd) * sysdeps/posix/fdopendir.c (__fdopendir) * sysdeps/posix/opendir.c (__alloc_dir): Use __fcntl_nocancel instead of __fcntl and/or __libc_fcntl. * sysdeps/unix/sysv/linux/pthread_setname.c (pthread_setname_np) * sysdeps/unix/sysv/linux/pthread_getname.c (pthread_getname_np) * sysdeps/unix/sysv/linux/i386/smp.h (is_smp_system): Use __open64_nocancel instead of __open_nocancel. * sysdeps/unix/sysv/linux/not-cancel.h: Move all of the hidden_proto declarations to the end and issue them if either IS_IN(libc) or IS_IN(rtld). * sysdeps/unix/sysv/linux/Makefile [subdir=io] (sysdep_routines): Add close_nocancel, fcntl_nocancel, nanosleep_nocancel, open_nocancel, open64_nocancel, openat_nocancel, pause_nocancel, read_nocancel, waitpid_nocancel, write_nocancel. * io/Versions [GLIBC_PRIVATE]: Add __libc_fcntl, __fcntl_nocancel, __open64_nocancel, __write_nocancel. * posix/Versions: Add __nanosleep_nocancel, __pause_nocancel. * nptl/pt-fcntl.c: New file. * nptl/Makefile (pthread-compat-wrappers): Remove fcntl. (libpthread-routines): Add pt-fcntl. * include/fcntl.h (__fcntl_nocancel_adjusted): New function. (__libc_fcntl): Remove attribute_hidden. * sysdeps/unix/sysv/linux/fcntl.c (__libc_fcntl): Call __fcntl_nocancel_adjusted, not fcntl_common. (__fcntl_nocancel): Move to new file fcntl_nocancel.c. (fcntl_common): Rename to __fcntl_nocancel_adjusted; also move to fcntl_nocancel.c. * sysdeps/unix/sysv/linux/fcntl_nocancel.c: New file. * sysdeps/unix/sysv/linux/powerpc/powerpc64/fcntl.c: Remove file. * sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h: Define FCNTL_ADJUST_CMD here, as a self-contained macro. * sysdeps/unix/sysv/linux/close.c: Move __close_nocancel to... * sysdeps/unix/sysv/linux/close_nocancel.c: ...this new file. * sysdeps/unix/sysv/linux/nanosleep.c: Move __nanosleep_nocancel to... * sysdeps/unix/sysv/linux/nanosleep_nocancel.c: ...this new file. * sysdeps/unix/sysv/linux/open.c: Move __open_nocancel to... * sysdeps/unix/sysv/linux/open_nocancel.c: ...this new file. * sysdeps/unix/sysv/linux/open64.c: Move __open64_nocancel to... * sysdeps/unix/sysv/linux/open64_nocancel.c: ...this new file. * sysdeps/unix/sysv/linux/openat.c: Move __openat_nocancel to... * sysdeps/unix/sysv/linux/openat_nocancel.c: ...this new file. * sysdeps/unix/sysv/linux/openat64.c: Move __openat64_nocancel to... * sysdeps/unix/sysv/linux/openat64_nocancel.c: ...this new file. * sysdeps/unix/sysv/linux/pause.c: Move __pause_nocancel to... * sysdeps/unix/sysv/linux/pause_nocancel.c: ...this new file. * sysdeps/unix/sysv/linux/read.c: Move __read_nocancel to... * sysdeps/unix/sysv/linux/read_nocancel.c: ...this new file. * sysdeps/unix/sysv/linux/waitpid.c: Move __waitpid_nocancel to... * sysdeps/unix/sysv/linux/waitpid_nocancel.c: ...this new file. * sysdeps/unix/sysv/linux/write.c: Move __write_nocancel to... * sysdeps/unix/sysv/linux/write_nocancel.c: ...this new file. * sysdeps/unix/sysv/linux/nios2/Makefile: Don't override libpthread-routines. * sysdeps/unix/sysv/linux/nios2/pt-vfork.S: New file which defines nothing. * sysdeps/mach/hurd/dl-sysdep.c: Define __read instead of __libc_read, and __write instead of __libc_write. Define __open64 in addition to __open.
2018-01-01Update copyright dates with scripts/update-copyrights.Joseph Myers
* All files with FSF copyright notices: Update copyright dates using scripts/update-copyrights. * locale/programs/charmap-kw.h: Regenerated. * locale/programs/locfile-kw.h: Likewise.
2017-08-31elf: Remove internal_function attributeFlorian Weimer
2017-06-08ld.so: Consolidate 2 strtouls into _dl_strtoul [BZ #21528]H.J. Lu
There are 2 minimal strtoul implementations in ld.so: 1. __strtoul_internal in elf/dl-minimal.c. 2. tunables_strtoul in elf/dl-tunables.c. This patch adds _dl_strtoul to replace them. Tested builds with and without --enable-tunables. [BZ #21528] * elf/dl-minimal.c (__strtoul_internal): Removed. (strtoul): Likewise. * elf/dl-misc.c (_dl_strtoul): New function. * elf/dl-tunables.c (tunables_strtoul): Removed. (tunable_initialize): Replace tunables_strtoul with _dl_strtoul. * elf/rtld.c (process_envvars): Likewise. * sysdeps/unix/sysv/linux/dl-librecon.h (_dl_osversion_init): Likewise. * sysdeps/generic/ldsodefs.h (_dl_strtoul): New prototype.
2017-04-18Assume that O_CLOEXEC is always defined and worksFlorian Weimer
2017-01-01Update copyright dates with scripts/update-copyrights.Joseph Myers
2016-01-04Update copyright dates with scripts/update-copyrights.Joseph Myers
2015-01-02Update copyright dates with scripts/update-copyrights.Joseph Myers
2014-02-06Revert "Patch 2/4 of the effort to make TLS access async-signal-safe."Allan McRae
This reverts commit 1f33d36a8a9e78c81bed59b47f260723f56bb7e6. Conflicts: elf/dl-misc.c Also reverts the follow commits that were bug fixes to new code introduced in the above commit: 063b2acbce83549df82ab30f5af573f1b9c4bd19 b627fdd58554bc36bd344dc40a8787c4b7a9cc46 e81c64bba13d2d8b2a4e53254a82cc80f27c8497
2014-01-01Update copyright notices with scripts/update-copyrightsAllan McRae
2013-12-19Fix white space as well.Paul Pluzhnikov
2013-12-19Fix incorrect power of 2 check in last commit.Paul Pluzhnikov
2013-12-19Cleanup compile warnings.Paul Pluzhnikov
2013-12-19 Paul Pluzhnikov <ppluzhnikov@google.com> * elf/dl-misc.c (ptr_to_signal_safe_allocator_header): New function. (__signal_safe_memalign, __signal_safe_free): Use it. (__signal_safe_realloc): Likewise.
2013-12-18Patch 2/4 of the effort to make TLS access async-signal-safe.Paul Pluzhnikov
Add a signal-safe malloc replacement. 2013-12-18 Andrew Hunter <ahh@google.com> * sysdeps/generic/ldsodefs.h (__signal_safe_memalign): New prototype. (__signal_safe_malloc, __signal_safe_free): Likewise. (__signal_safe_realloc, __signal_safe_calloc): Likewise. * elf/dl-misc.c (__signal_safe_allocator_header): New struct. (__signal_safe_memalign, __signal_safe_malloc): New function. (__signal_safe_free, __signal_safe_realloc): Likewise. (__signal_safe_calloc): Likewise. * elf/dl-tls.c (allocate_dtv, _dl_clear_dtv): Call signal-safe functions. (_dl_deallocate_tls, _dl_update_slotinfo): Likewise.
2013-05-16Add #include <stdint.h> for uint[32|64]_t usage (except installed headers).Ryan S. Arnold
2013-05-06Split _dl_writev out from _dl_debug_vdprintf.Roland McGrath
2013-01-02Update copyright notices with scripts/update-copyrights.Joseph Myers
2012-03-20Move stdio-common/_itoa.h to sysdeps/genericH.J. Lu
2012-02-09Replace FSF snail mail address with URLs.Paul Eggert
2011-09-05Use O_CLOEXEC when loading ld.so cacheUlrich Drepper
2009-07-16Remove warning and little optimization.Ulrich Drepper
The prototype for _dl_higher_prime_number was missing. While at it, the function is now marked with internal_function.
2009-07-07Clean up code for hash table handling in ld.so.Ulrich Drepper
2009-03-31* elf/dl-load.c: Remove support for systems without MAP_ANON.Ulrich Drepper
* elf/dl-minimal.c: Likewise. * elf/dl-misc.c: Likewise. * elf/rtld.c: Likewise. * sysdeps/generic/ldsodefs.h: Likewise.
2007-08-14* elf/dl-misc.c: Undo last change. The kernel won't allow it.Ulrich Drepper
2007-08-11* elf/dl-misc.c (_dl_sysdep_read_whole_file): We really don't needUlrich Drepper
an atime update for the files we read.
2006-07-10* elf/dl-lookup.c (dl_new_hash): New functions.cvs/fedora-glibc-20060710T2206Ulrich Drepper
(_dl_lookup_symbol_x): Rename hash to old_hash and don't compute value here. Compute new-style hash value. Pass new hash value and reference to variable with the old value to do_lookup_x. (_dl_setup_hash): If DT_GNU_HASH is defined, use it and not old-style hash table. (_dl_debug_bindings): Pass new hash value and reference to variable with the old value to do_lookup_x. * elf/do-lookup.h (do_lookup_x): Accept additional parameter with new-style hash value and change old-style hash value parameter to be a reference. Reoganize functions to determine whether new-style hash table is available. Only fall back on old-style table. If old-style hash value is needed, compute it here. * elf/dynamic-link.h (elf_get_dynamic_info): Relocate DT_GNU_HASH entry. * elf/elf.h: Define SHT_GNU_HASH, DT_GNU_HASH, DT_TLSDEC_PLT, DT_TLSDEC_GOT. Adjust DT_ADDRNUM. * include/link.h (struct link_map): Add l_gnu_bitmask_idxbits, l_gnu_shift, l_gnu_bitmask, l_gnu_buckets and l_gnu_chain_zero. * Makeconfig: If linker supports --hash-style option add it to all linker command lines to build DSOs. * config.make.in: Define have-hash-style. * configure.in: Test whether linker supports --hash-style option. * elf/dl-misc.c (_dl_name_match_p): Make MAP parameter const. * sysdeps/generic/ldsodefs.h: Adjust prototype.
2004-12-22(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.Ulrich Drepper
2007-07-122.5-18.1Jakub Jelinek
2004-07-06Update.Ulrich Drepper
2004-07-05 Ulrich Drepper <drepper@redhat.com> * elf/dl-init.c: Don't define and use _dl_starting_up if HAVE_INLINED_SYSCALLS is defined and the variable is not used. * elf/dl-support.c: Likewise. * elf/rtld.c: Likewise. * elf/dl-misc.c (_dl_debug_vdprintf): Use writev syscall directly if HAVE_INLINED_SYSCALLS is defined. * sysdeps/powerpc/powerpc64/dl-machine.h: Don't rest _dl_starting_up here. * sysdeps/powerpc/powerpc32/dl-start.S: Likewise. * sysdeps/unix/sysv/linux/configure.in: Define HAVE_INLINED_SYSCALLS. * config.h.in: Add entry for HAVE_INLINED_SYSCALLS. * sysdeps/posix/profil.c: If compiled for ld.so, omit code which is needed to stop profiling. * elf/dl-open.c (dl_open_worker): If a newly opened object is to be profile make sure it cannot be unloaded. * sysdeps/unix/sysv/linux/dl-origin.c: Inline readlink syscall. * sysdeps/unix/sysv/linux/fcntl.c: If compiled without cancellation support, make sure the helper function is inlined. * sysdeps/unix/sysv/linux/pread.c: Likewise. * sysdeps/unix/sysv/linux/pwrite.c: Likewise. * sysdeps/unix/sysv/linux/i386/fcntl.c: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/fcntl.c: Likewise.
2004-03-25* Makerules ($(common-objpfx)shlib.lds): Don't use \n in rhs of sedRoland McGrath
substitutions; the semicolon terminators are enough for ld anyway. * elf/dl-deps.c (_dl_map_object_deps): Use alloca instead of dynamically sized auto array in function already using alloca. * locale/programs/ld-ctype.c (ctype_output): Likewise. * locale/programs/ld-time.c (time_output): Likewise. * elf/dl-misc.c (_dl_debug_vdprintf): Use macro instead of const for IOV array size. * locale/programs/charmap.c (charmap_read): Avoid alloca (or strdupa) when also using dynamically-sized auto array. * locale/programs/locfile.c (locfile_read): Likewise. * locale/programs/repertoire.c (repertoire_read): Likewise. * nis/nis_print_group_entry.c (nis_print_group_entry): Likewise. * locale/programs/locarchive.c (enlarge_archive): Likewise. * posix/annexc.c (check_header): Likewise. * iconv/gconv_int.h (norm_add_slashes): Don't handle null SUFFIX. strlen ("") gets optimized away just as well. * intl/loadmsgcat.c (_nl_init_domain_conv): Update caller. * wcsmbs/wcsmbsload.c (__wcsmbs_load_conv): Likewise.
2004-03-06Update.Ulrich Drepper
* elf/Versions: Remove functions which are not exported anymore. * dlfcn/dlerror.c: Call ld.so functions through GLSO. * dlfcn/dlinfo.c: Likewise. * elf/dl-close.c: Likewise. * elf/dl-libc.c: Likewise. * elf/dl-open.c: Likewise. * elf/dl-sym.c: Likewise. * sysdeps/generic/libc-start.c: Likewise. * elf/dl-debug.c: Remove *_internal definition. Don't use INTUSE for functions which are not exported anymore. * elf/dl-deps.c: Likewise. * elf/dl-dst.h: Likewise. * elf/dl-error.c: Likewise. * elf/dl-fini.c: Likewise. * elf/dl-init.c: Likewise. * elf/dl-load.c: Likewise. * elf/dl-lookup.c: Likewise. * elf/dl-misc.c: Likewise. * elf/dl-profile.c: Likewise. * elf/dl-profstub.c: Likewise. * elf/dl-reloc.c: Likewise. * elf/dl-runtime.c: Likewise. * elf/dl-version.c: Likewise. * elf/do-lookup.h: Likewise. * include/dlfcn.h: Likewise. * sysdeps/generic/dl-cache.c: Likewise. * sysdeps/generic/dl-fptr.c: Likewise. * sysdeps/generic/dl-origin.c: Likewise. * sysdeps/generic/dl-sysdep.c: Likewise. * sysdeps/generic/dl-tls.c: Likewise. * sysdeps/generic/ldsodefs.h: Likewise. * sysdeps/i386/dl-tls.h: Likewise. * sysdeps/unix/sysv/linux/dl-origin.c: Likewise. * elf/rtld.c: Likewise. Export function though _rtld_global_ro. * generic/dl-fptr.c: Likewise. * mach/hurd/dl-sysdep.c: Likewise. * unix/sysv/linux/ia64/dl-static.c: Likewise. * unix/sysv/linux/ia64/getpagesize.c: Likewise. * unix/sysv/linux/m68k/getpagesize.c: Likewise. * unix/sysv/linux/sparc/sparc32/getpagesize.c: Likewise.
2004-03-05Update.Ulrich Drepper
* sysdeps/generic/ldsodefs.h (struct rtld_global): Move dl_debug_fd to rtld_global_ro. * elf/rtld.c: Use GLRO instead of GL for dl_debug_fd. * elf/dl-misc.c: Likewise.
2004-03-05Update.Ulrich Drepper
* sysdeps/generic/ldsodefs.h: Don't define _dl_name_match_p as inline. * elf/dl-misc.c: Define _dl_name_match_p here. * elf/dl-open.c (check_libc_caller): Don't use _dl_name_match_p.
2003-01-09Update.Ulrich Drepper
2003-01-08 Ulrich Drepper <drepper@redhat.com> * sysdeps/unix/sysv/linux/arm/sysdep.h (INTERNAL_SYSCALL, INTERNAL_SYSCALL_ERROR_P, INTERNAL_SYSCALL_ERRNO): Add err argument. (INTERNAL_SYSCALL_DECL): Define. 2003-01-06 Jakub Jelinek <jakub@redhat.com> * sysdeps/unix/sysv/linux/ia64/sysdep.h (INTERNAL_SYSCALL, INTERNAL_SYSCALL_ERROR_P, INTERNAL_SYSCALL_ERRNO): Add err argument. (INTERNAL_SYSCALL_DECL): Define. * sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/sparc/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/i386/sysdep.h: Likewise. (INLINE_SYSCALL): Adjust. * sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/m68k/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/x86_64/sysdep.h: Likewise. * elf/dl-misc.c (_dl_debug_vdprintf): Add INTERNAL_SYSCALL_DECL, add err argument to INTERNAL_SYSCALL* macros. * sysdeps/unix/sysv/linux/i386/brk.c (__brk): Likewise. * sysdeps/unix/sysv/linux/i386/system.c (cancel_handler): Likewise. * sysdeps/unix/sysv/linux/m68k/brk.c (__brk): Likewise. * sysdeps/unix/sysv/linux/m68k/getpagesize.c (__getpagesize): Likewise. * sysdeps/unix/sysv/linux/sigwait.c (do_sigwait): Likewise. * sysdeps/unix/sysv/linux/i386/sigaction.c (__libc_sigaction): Use INLINE_SYSCALL instead of INTERNAL_SYSCALL and setting errno.
2003-01-07Update.Ulrich Drepper
* elf/dl-misc.c (_dl_debug_vdprintf): Help PPC port by explcitly taking address of iov in INTERNAL_SYSCALL call. Patch by Franz Sirl.
2002-12-13Update.Ulrich Drepper
* elf/dl-misc.c (_dl_debug_vdprintf): Don't depend on 5-digit PIDs.
2002-12-06Update.Ulrich Drepper
2002-12-06 Ulrich Drepper <drepper@redhat.com> * misc/syslog.c (log_cleanup): New function. (openlog): Use log_cleanup instead of __libc_mutex_unlock. (closelog): Likewise. * elf/dl-close.c: Use __rtld_lock_* macros instead of __libc_lock_*. * elf/dl-iteratephdr.c: Likewise. * elf/dl-lookup.c: Likewise. * elf/dl-misc.c: Likewise. * elf/dl-open.c: Likewise. * elf/dl-support.c: Likewise. * elf/rtld.c: Likewise. * sysdeps/generic/ldsodefs.h: Likewise. * sysdeps/generic/bits/libc-lock.h: Define __rtld_lock_* macros. * sysdeps/mach/bits/libc-lock.h: Likewise. * sysdeps/mach/hurd/bits/libc-lock.h: Likewise. * dirent/bug-readdir1.c (main): Don't call closedir, just close
2002-10-24* elf/dl-misc.c: Include <sysdep.h>.Roland McGrath
(_dl_debug_vdprintf): Only take dl_load_lock if not _dl_starting_up. * sysdeps/generic/ldsodefs.h (_dl_starting_up): Declare it here. * sysdeps/unix/sysv/linux/init-first.c: Not here. * sysdeps/powerpc/elf/libc-start.c: Or here. * sysdeps/unix/sysv/aix/libc-start.c: Or here. * sysdeps/unix/sysv/aix/start-libc.c: Or here. * sysdeps/unix/sysv/aix/init-first.c: Or here. * sysdeps/generic/libc-start.c: Or here. * sysdeps/unix/sysv/linux/init-first.c (init): Protect _dl_starting_up access with [! SHARED]. * sysdeps/unix/sysv/aix/init-first.c (init): Likewise.
2002-10-11* sysdeps/generic/bits/libc-tsd.h [USE___THREAD]: ConditionalRoland McGrath
changed from [USE_TLS && HAVE___THREAD]. * sysdeps/i386/dl-machine.h (elf_machine_type_class, elf_machine_rel): Disable TLS relocs if [RTLD_BOOTSTRAP && !USE___THREAD]. * sysdeps/x86_64/dl-machine.h (elf_machine_type_class, elf_machine_rela): Likewise. * sysdeps/sh/dl-machine.h (elf_machine_type_class, elf_machine_rela): Likewise. * include/link.h (struct link_map): Remove member l_tls_tp_initialized. * elf/rtld.c (_dl_start_final, dl_main): Don't use it. (_dl_start): Conditionalize PT_TLS check on [USE___THREAD]. * sysdeps/i386/dl-tls.h (__TLS_GET_ADDR): Use ___tls_get_addr_internal instead of ___tls_get_addr. (___tls_get_addr_internal): Add attribute_hidden to decl. * sysdeps/generic/ldsodefs.h (struct rtld_global): New variable _dl_error_catch_tsd. * elf/rtld.c (startup_error_tsd): New function. (dl_main): Point _dl_error_catch_tsd at that. * elf/dl-error.c: Don't use libc-tsd.h for DL_ERROR, use new function pointer instead. * elf/dl-tsd.c: New file. * elf/Makefile (routines): Add it. 2002-10-07 Roland McGrath <roland@redhat.com> * elf/dl-misc.c (_dl_debug_vdprintf): Use INTERNAL_SYSCALL macro for writev if it's available. Otherwise if [RTLD_PRIVATE_ERRNO] then take _dl_load_lock around calling __writev. * sysdeps/unix/sysv/linux/i386/sysdep.h (INTERNAL_SYSCALL): New macro. (INLINE_SYSCALL): Use that. * sysdeps/generic/dl-sysdep.h: New file. * sysdeps/mach/hurd/dl-sysdep.h: New file. * sysdeps/generic/ldsodefs.h: Include <dl-sysdep.h>. * include/errno.h [IS_IN_rtld]: Include <dl-sysdep.h> to define ... [RTLD_PRIVATE_ERRNO]: Use a hidden global variable for errno and access it directly. * elf/dl-minimal.c (__errno_location): Removed. * sysdeps/unix/i386/sysdep.S (__syscall_errno) [RTLD_PRIVATE_ERRNO]: Use GOTOFF access for errno. * sysdeps/unix/sysv/linux/i386/sysdep.h [RTLD_PRIVATE_ERRNO] (SYSCALL_ERROR_HANDLER): Likewise. * sysdeps/unix/x86_64/sysdep.S (__syscall_errno) [RTLD_PRIVATE_ERRNO]: Use PC-relative access for errno. * sysdeps/unix/sysv/linux/x86_64/sysdep.h [RTLD_PRIVATE_ERRNO] (SYSCALL_ERROR_HANDLER): Likewise. * include/tls.h: New file. (USE___THREAD): New macro. Define to 1 under [USE_TLS && HAVE___THREAD] and only when compiling libc or libpthread. * sysdeps/unix/sysv/linux/i386/sysdep.h [USE___THREAD]: Conditional changed from [USE_TLS && HAVE___THREAD]. * sysdeps/unix/sysv/linux/x86_64/sysdep.h: Likewise. * sysdeps/unix/i386/sysdep.S: Likewise. * sysdeps/unix/x86_64/sysdep.S: Likewise. * include/errno.h: Likewise. * include/netdb.h: Likewise. * include/resolv.h: Likewise. * sysdeps/generic/errno.c: New file. * csu/Makefile (aux): New variable, list errno. * sysdeps/unix/sysv/linux/i386/sysdep.S (errno, _errno): Remove defns. * sysdeps/unix/sysv/linux/m68k/sysdep.S: Likewise. * sysdeps/unix/sysv/linux/x86_64/sysdep.S: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/sysdep.S: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/sysdep.S: Likewise. * sysdeps/unix/sysv/linux/arm/sysdep.S: Likewise. * sysdeps/unix/sysv/linux/cris/sysdep.S: Likewise. * sysdeps/unix/sysv/linux/hppa/sysdep.c: Likewise. * sysdeps/unix/sysv/linux/ia64/sysdep.S: Likewise. * sysdeps/unix/sysv/linux/powerpc/sysdep.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sysdep.S: Likewise. * sysdeps/unix/sysv/linux/sh/sysdep.S: Likewise. * sysdeps/unix/alpha/sysdep.S: Likewise. * sysdeps/generic/start.c: Likewise. * sysdeps/unix/start.c: Likewise. * sysdeps/unix/arm/start.c: Likewise. * sysdeps/unix/bsd/ultrix4/mips/start.S: Likewise. * sysdeps/unix/sparc/start.c: Likewise. * sysdeps/unix/sysv/irix4/start.c: Likewise. * sysdeps/unix/sysv/linux/mips/sysdep.S: File removed. * manual/search.texi (Tree Search Function, Hash Search Function): Mention search.h clearly. 2002-10-05 Roland McGrath <roland@redhat.com> * elf/dl-fxstat64.c: File removed. * elf/dl-xstat64.c: File removed. * elf/Makefile (rtld-routines): Remove them. * sysdeps/unix/sysv/linux/xstat64.c: Remove RTLD_STAT64 conditionals. Instead, use strong_alias instead of versioned_symbol in the !SHLIB_COMPAT case. * sysdeps/unix/sysv/linux/fxstat64.c: Likewise. * sysdeps/unix/sysv/linux/lxstat64.c: Likewise. * include/shlib-compat.h (SHLIB_COMPAT): Require that IS_IN_##lib be defined nonzero. [! NOT_IN_libc] (IS_IN_libc): Define it. * cppflags-iterator.mk (CPPFLAGS-$(cpp-src)): Use -Dx=1 not just -Dx. * elf/Makefile (CPPFLAGS-.os): Likewise. * sunrpc/rpc_main.c (main): Don't declare with noreturn attribute. Return the status instead of calling exit. * Makeconfig (CFLAGS): Prepend -std=gnu99. * Makerules (+make-deps): Use $(CFLAGS) only for .c sources. Remove superfluous rm command, whose @ plus make bugs hid all these commands from the make output. * include/stubs-prologue.h: New file. Give #error under #ifdef _LIBC. * Makefile ($(inst_includedir)/gnu/stubs.h): Depend on it. Use that file's contents instead of literal echo's for the prologue. * include/features.h: Include <gnu/stubs.h> unconditionally. * include/gnu/stubs.h: New file. 2002-09-30 Roland McGrath <roland@redhat.com> * elf/rtld-Rules: New file. * elf/Makefile ($(objpfx)librtld.map, $(objpfx)librtld.mk, $(objpfx)rtld-libc.a): New targets. (generated): Add them. (reloc-link): Remove -o $@ from the variable. ($(objpfx)dl-allobjs.os): Add -o $@ after $(reloc-link). (distribute): Add rtld-Rules. (CPPFLAGS-.os): Define this instead of CFLAGS-.os. * Makerules ($(+sysdir_pfx)sysd-rules): Emit rules for rtld-% targets. (common-mostlyclean, common-clean): Clean up rtld-* files. * sysdeps/unix/make-syscalls.sh: Add rtld-*.os target name to rules.
2002-08-25Update.Ulrich Drepper
2002-08-24 Ulrich Drepper <drepper@redhat.com> * locale/programs/charmap.c (charmap_new_char): Don't use ULONG_MAX as maximum UCS4 value. * sysdeps/unix/sysv/linux/ia64/sys/user.h: New file. * sysdeps/generic/strtol.c: We don't need the isascii test in glibc. * malloc/hooks.c (public_sET_STATe): use size_t as type for i. * malloc/malloc.c (mALLINFo): Likewise. * libio/wstrops.c (_IO_wstr_pbackfail): Use WEOF in comparison. * libio/wfileops.c (_IO_wfile_overflow): Use EOF not WEOF when examining result of _IO_do_flush call. * stdio-common/vfprintf.c (vfprintf): Use correct type in va_arg. Use prec not spec when sizing buffers. * catgets/open_catalog.c (__open_catalog): Add casts to avoid warnings. * locale/loadarchive.c (_nl_load_locale_from_archive): Likewise. * locale/loadlocale.c (_nl_intern_locale_data): Likewise. * stdio-common/vfscanf.c (inchar): Likewise. * misc/efgcvt_r.c (fcvt_r): Likewise. * elf/dl-misc.c (_dl_debug_vdprintf): Likewise. * elf/readlib.c (process_file): Likewise. * elf/sprof.c (load_profdata): Likewise. * sysdeps/ia64/hp-timing.h (HP_TIMING_PRINT): Likewise. * locale/programs/linereader.c (get_toplvl_escape): Likewise. * locale/programs/charmap.c (charmap_read): Likewise. * libio/fileops.c: Likewise. * libio/fmemopen.c: Likewise. * stdlib/strtod.c: Likewise. * elf/dl-load.c: Likewise. * iconv/iconvconfig.c: Likewise. * iconv/iconv_prog.c (process_block): Likewise. * sysdeps/unix/sysv/linux/ia64/Makefile: Define _ASM_IA64_CURRENT_H macro to calm down the compiler. * iconv/gconv_cache.c (__gconv_load_cache): Add cast to avoid warning. * sysdeps/ia64/elf/initfini.c: Don't use newlines embedded in string. * sysdeps/unix/sysv/linux/i386/sysdep.S: Update comment regarding placement of errno definition. * sysdeps/unix/sysv/linux/m68k/sysdep.S: Likewise. * sysdeps/unix/sysv/linux/mips/sysdep.S: Likewise. * sysdeps/unix/sysv/linux/x86_64/sysdep.S: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/sysdep.S: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/sysdep.S: Likewise. * resolv/nss_dns/dns-host.c (MAXPACKET): Increase minimum value from 1024 to 65536, to avoid buffer overrun. 2002-08-16 Paul Eggert <eggert@twinsun.com> * resolv/gethnamaddr.c (MAXPACKET): Increase minimum value from 1024 to 65536, to avoid buffer overrun. * resolv/res_query.c (MAXPACKET): Likewise. architectures.
2002-02-06Update.Ulrich Drepper
* elf/rtld.c (process_dl_debug): Correct printing help message. * elf/dl-misc.c (_dl_debug_vdprintf): Implement precision handling for %s.
2002-02-03Update.Ulrich Drepper
2002-02-03 Andreas Schwab <schwab@suse.de> * sysdeps/posix/readv.c: Use ssize_t for bytes_read. * sysdeps/posix/writev.c: Use ssize_t for bytes_written. Fix comment. 2002-02-03 Thorsten Kukuk <kukuk@suse.de> * sysdeps/posix/writev.c: Check for ssize_t overflow, don't use alloca if the memory reqirements are too high. 2002-02-03 Ulrich Drepper <drepper@redhat.com> * elf/dl-load.c (decompose_rpath): Avoid using strstr. * elf/dl-minimal.c (_strerror_r): Use _itoa instead of _itoa_word since the former is available anyway and speed isn't important here. * elf/dl-misc.c (_dl_debug_vdprintf): Likewise. * elf/dl-version.c (match_symbol): Likewise. (_dl_check_map_versions): Likewise. * elf/rtld.c (process_envvars): Likewise. (print_statistics): Likewise. * sysdeps/generic/dl-sysdep.c (_dl_show_auxv): Likewise. * elf/dl-minimal.c (_itoa): Always define it. Make it work for all bases. Add assert to catch uses of unimplemented features. (__strsep): Add assert to catch uses of unimplemented features. * elf/dl-object.c (_dl_new_object): Don't use rawmemchr. Use strchr and avoid inline optimization. * elf/rtld.c (process_envvars): Likewise. * elf/dl-open.c: Don't include <stdio-common/_itoa.h>. * elf/dl-profile.c (_dl_start_profile): Help compiler to avoid ffs. * elf/rtld.c (dl_main): Avoid strsep inline optimization. * stdio-common/_itoa.h: Minor simplifications of the code. * stdio-common/_itoa.c: Likewise. * elf/dl-reloc.c (_dl_relocate_object): Use _dl_debug_printf instead of _dl_printf for debugging info output. * sysdeps/mips/atomicity.h (exchange_and_add): Use branch likely.
2002-02-03Update.Ulrich Drepper
Change ld.so to not use functions which are exported. One cannot interpose them anyway. Use INT() to mark uses, INTDEF() to mark definitions. * include/libc-symbols.h: Define INT and INTDEF. * sysdeps/generic/ldsodefs.h: Declare _dl_debug_printf_internal, _dl_signal_error_internal, _dl_map_object_internal, _dl_map_object_deps_internal, _dl_lookup_symbol_internal, _dl_lookup_versioned_symbol_internal, _dl_relocate_object_internal, _dl_debug_state_internal, _dl_start_profile_internal, and _dl_unload_cache_internal. * include/dlfcn.h: Declare _dl_catch_error_internal. * elf/rtld.c: Use INT for calls to any of the *_internal functions above. Add INTDEF to function definitions. * elf/dl-debug.c: Likewise. * elf/dl-deps.c: Likewise. * elf/dl-dst.h: Likewise. * elf/dl-error.c: Likewise. * elf/dl-fini.c: Likewise. * elf/dl-init.c: Likewise. * elf/dl-load.c: Likewise. * elf/dl-lookup.c: Likewise. * elf/dl-misc.c: Likewise. * elf/dl-open.c: Likewise. * elf/dl-profile.c: Likewise. * elf/dl-reloc.c: Likewise. * elf/dl-runtime.c: Likewise. * elf/dl-version.c: Likewise. * elf/do-lookup.h: Likewise. * sysdeps/generic/dl-cache.c: Likewise. * sysdeps/generic/dl-sysdep.c: Likewise. * sysdeps/alpha/dl-machine.h (RTLD_START): Call _dl_init_internal instead of _dl_init. * sysdeps/arm/dl-machine.h: Likewise. * sysdeps/cris/dl-machine.h: Likewise. * sysdeps/hppa/dl-machine.h: Likewise. * sysdeps/i386/dl-machine.h: Likewise. * sysdeps/ia64/dl-machine.h: Likewise. * sysdeps/m68k/dl-machine.h: Likewise. * sysdeps/mips/dl-machine.h: Likewise. * sysdeps/mips/mips64/dl-machine.h: Likewise. * sysdeps/s390/s390-32/dl-machine.h: Likewise. * sysdeps/s390/s390-64/dl-machine.h: Likewise. * sysdeps/sh/dl-machine.h: Likewise. * sysdeps/sparc/sparc32/dl-machine.h: Likewise. * sysdeps/sparc/sparc64/dl-machine.h: Likewise. * sysdeps/x86_64/dl-machine.h: Likewise. * sysdeps/powerpc/dl-start.S (_dl_start_user): Likewise. * elf/Versions: Don't export _dl_check_all_versions, _dl_sysdep_start, and _dl_debug_initialize.
2002-02-01Update.Ulrich Drepper
* sysdeps/generic/ldsodefs.h: Add _dl_load_lock, _dl_lazy, _dl_dynamic_weak, _dl_fpu_control, _dl_cpuclock_offset, and _dl_debug_fd to rtld_global. * elf/Versions: Likewise. * elf/dl-close.c: Likewise. * elf/dl-iteratephdr.c: Likewise. * elf/dl-lookup.c: Likewise. * elf/dl-misc.c: Likewise. * elf/dl-open.c: Likewise. * elf/dl-support.c: Likewise. * elf/do-lookup.h: Likewise. * elf/rtld.c: Likewise. * sysdeps/generic/dl-cache.c: Likewise. * sysdeps/generic/dl-sysdep.c: Likewise. * sysdeps/ia64/Versions: Likewise. * sysdeps/unix/clock_gettime.c: Likewise. * sysdeps/unix/clock_settime.c: Likewise. * sysdeps/unix/sysv/linux/init-first.c: Likewise. * sysdeps/sparc/Versions: Removed. * sysdeps/i386/i686/Versions : Removed. * sysdeps/x86_64/Versions: Removed. * configure.in: Define HAVE_PROTECTED if .protected is available. * config.h.in: Add entry for HAVE_PROTECTED. 2002-01-31 Jakub Jelinek <jakub@redhat.com. * sysdeps/alpha/dl-machine.h: Move global variables for SHARED code in struct _rtld_global. Export this struct, remove all exports for the signal variables. * sysdeps/arm/dl-machine: Likewise. * sysdeps/generic/dl-origin: Likewise. * sysdeps/generic/dl-sysdep: Likewise. * sysdeps/generic/dl-cache: Likewise. * sysdeps/hppa/dl-fptr: Likewise. * sysdeps/hppa/dl-machine: Likewise. * sysdeps/cris/dl-machine: Likewise. * sysdeps/i386/dl-machine: Likewise. * sysdeps/ia64/dl-machine: Likewise. * sysdeps/m68k/dl-machine: Likewise. * sysdeps/mach/hurd/dl-sysdep: Likewise. * sysdeps/mips/mips64/dl-machine: Likewise. * sysdeps/mips/dl-machine: Likewise. * sysdeps/powerpc/elf/libc-start: Likewise. * sysdeps/powerpc/dl-machine: Likewise. * sysdeps/powerpc/dl-start: Likewise. * sysdeps/sparc/sparc32/dl-machine: Likewise. * sysdeps/sparc/sparc64/dl-machine: Likewise. * sysdeps/sh/dl-machine: Likewise. * sysdeps/s390/s390-32/dl-machine: Likewise. * sysdeps/s390/s390-64/dl-machine: Likewise. * sysdeps/unix/sysv/aix/libc-start: Likewise. * sysdeps/unix/sysv/aix/start-libc: Likewise. * sysdeps/unix/sysv/linux/ia64/dl-static: Likewise. * sysdeps/unix/sysv/linux/m68k/getpagesize: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/getpagesize: Likewise. * sysdeps/x86_64/dl-machine: Likewise. 2002-01-31 Ulrich Drepper <drepper@redhat.com>
2001-11-08Update.Ulrich Drepper
* sysdeps/generic/dl-cache.c: Optimize SEARCH_CACHE and HWCAP_CHECK macro code. * elf/dl-misc.c (_dl_sysdep_read_whole_file): Optimize code a bit. Now returns MAP_FAILED on error. * elf/rtld.c: Adjust caller. * sysdeps/generic/dl-cache.c: Likewise. * sysdeps/generic/ldsodefs.h: Adjust description.
2001-08-25Update.Ulrich Drepper
2001-08-24 Ulrich Drepper <drepper@redhat.com> * elf/rtld.c (print_statistics): Printf % after percent values. * elf/dl-misc.c (_dl_debug_vdprintf): Implement %%. * elf/dl-lookup.c (_dl_lookup_symbol): If we use the cache we don't have to compute the hash value and initialize current_value. Move reference_name variable to where it is needed. (_dl_lookup_versioned_symbol): Likewise.
2001-07-06Update to LGPL v2.1.Andreas Jaeger
2001-07-06 Paul Eggert <eggert@twinsun.com> * manual/argp.texi: Remove ignored LGPL copyright notice; it's not appropriate for documentation anyway. * manual/libc-texinfo.sh: "Library General Public License" -> "Lesser General Public License". 2001-07-06 Andreas Jaeger <aj@suse.de> * All files under GPL/LGPL version 2: Place under LGPL version 2.1.
2001-02-28Update.Ulrich Drepper
2001-02-28 Ulrich Drepper <drepper@redhat.com> * sysdeps/alpha/dl-machine.h (elf_machine_rela): Don't handle relocations which are not in ld.so if RTLD_BOOTSTRAP is defined. * sysdeps/powerpc/dl-machine.c (__process_machine_rela): Fix typo. * elf/dl-misc.c (_dl_debug_vdprintf): Fix type visible on 64-bit machines. * sysdeps/unix/sysv/linux/powerpc/sysdep.h (C_TEXT): Define.
2001-02-28Update.Ulrich Drepper
* elf/Versions [ld]: Don't export _dl_debug_message anymore. Export _dl_debug_printf. * elf/dl-misc.c: Remove definition of _dl_sysdep_output and _dl_debug_message. Define _dl_debug_vdprintf, _dl_debug_printf, _dl_debug_printf_c, and _dl_printf. * sysdeps/generic/ldsodefs.h: Don't declare _dl_sysdep_output, _dl_debug_message, _dl_sysdep_message, _dl_sysdep_error, and _dl_sysdep_fatal. Declare _dl_debug_printf, _dl_debug_printf_c, _dl_printf, _dl_error_printf, and _dl_fatal_printf. * elf/dl-close.c: Replace use of old output functions with the new ones. * elf/dl-deps.c: Likewise. * elf/dl-error.c: Likewise. * elf/dl-fini.c: Likewise. * elf/dl-init.c: Likewise. * elf/dl-load.c: Likewise. * elf/dl-lookup.c: Likewise. * elf/dl-minimal.c: Likewise. * elf/dl-open.c: Likewise. * elf/dl-profile.c: Likewise. * elf/dl-reloc.c: Likewise. * elf/dl-version.c: Likewise. * elf/do-lookup.h: Likewise. * elf/rtld.c: Likewise. * sysdeps/generic/dl-cache.c: Likewise. * sysdeps/generic/dl-sysdep.c: Likewise. * sysdeps/generic/libc-start.c: Likewise. * sysdeps/i386/dl-machine.h: Likewise. * sysdeps/unix/sysv/linux/dl-osinfo.h: Likewise. * sysdeps/unix/sysv/linux/i386/dl-librecon.h: Likewise. * sysdeps/unix/sysv/linux/i386/dl-procinfo.h: Likewise. * sysdeps/generic/ldsodefs.h: Remove _dl_secure declaration. * dlfcn/Makefile: Don't run tstatexit test unless .hidden is supported by assembler.
2000-12-05Update.Andreas Jaeger
2000-12-05 Andreas Jaeger <aj@suse.de> * elf/dl-misc.c (_dl_sysdep_read_whole_file): Mark as internal_function. * sysdeps/generic/dl-cache.c (_dl_load_cache_lookup): Likewise. * sysdeps/generic/dl-sysdep.c (_dl_sysdep_start_cleanup): Likewise. * sysdeps/generic/dl-cache.c: Remove declaration of _dl_sysdep_read_whole_file. * elf/dl-load.c (_dl_map_object): Remove declaration of _dl_load_cache_lookup. * sysdeps/generic/ldsodefs.h: Add declarations of _dl_load_cache_lookup, _dl_unload_cache, _dl_sysdep_read_whole_file, _dl_sysdep_start and _dl_sysdep_start_cleanup. * elf/rtld.c: Remove prototypes that are defined in ldsodefs.h now. * elf/dl-misc.c: Include <ldsodefs.h> to get prototypes. * sysdeps/generic/dl-environ.c: Likewise. * stdio-common/printf_fp.c: Include <gmp.h> instead of <stdlib/gmp.h>. * math/atest-exp.c: Likewise. * math/atest-exp2.c: Likewise. * math/atest-sincos.c: Likewise. * stdio-common/_itoa.c: Likewise. * stdio-common/_itowa.c: Likewise. * include/gmp.h: New file with internal prototypes. * sysdeps/generic/longjmp.c: Move _longjmp_unwind declaration from here to... * include/setjmp.h: ...here. * locale/Makefile (routines): Remove codeset_name since it's not needed anywhere. * locale/codeset_name.c: Removed.