* nis/nis_table.c (nis_list): If __follow_path fails in the new

code, make sure the nis_freeresult call doesn't crash and that the
	result is reported correctly.

	* nis/nis_table.c (nis_list): Handle FOLLOW_PATH | ALL_RESULTS
	when callback is NULL.

	* nis/Versions (libnss_nisplus): Add
	_nss_nisplus_initgroups_dyn@@GLIBC_PRIVATE.
	* nis/Makefile (libnss_nisplus-routines): Add nisplus-initgroups.
	* nis/nss_nisplus/nisplus-grp.c (tablename_val, tablename_len,
	_nss_create_tablename): Rename to...
	(grp_tablename_val, grp_tablename_len, _nss_grp_create_tablename):
	... these.  No longer static.
	(internal_setgrent): Adjust users.
	(_nss_nisplus_getgrnam_r, _nss_nisplus_getgrgid_r): Likewise.
	Don't use locking around _nss_grp_create_tablename call.
	* nis/nss_nisplus/nisplus-initgroups.c: New file.
This commit is contained in:
Jakub Jelinek 2007-01-12 14:37:24 +00:00
parent d6220e9ee3
commit 00e3dec802
343 changed files with 19915 additions and 25433 deletions

873
ChangeLog
View File

@ -1,872 +1,5 @@
2007-01-11 Jakub Jelinek <jakub@redhat.com>
[BZ #3855]
* stdlib/strtod_l.c (____STRTOF_INTERNAL): 0x. not followed by
hexadecimal digit should accept just the initial 0.
* stdlib/tst-strtod2.c (tests): New variable.
(do_test): Run several tests rather than just one.
2007-01-11 Jakub Jelinek <jakub@redhat.com>
* sysdeps/i386/soft-fp/sfp-machine.h: Remove.
* sysdeps/x86_64/soft-fp/sfp-machine.h: Likewise.
2007-01-10 Ulrich Drepper <drepper@redhat.com>
* io/fts.c: Make sure fts_cur is always valid after return from
fts_read.
Patch by Miloslav Trmac <mitr@redhat.com>.
2006-10-27 Richard Sandiford <richard@codesourcery.com>
* elf/elf.h (R_MIPS_GLOB_DAT): Define.
(R_MIPS_NUM): Bump by 1.
2007-01-03 Jakub Jelinek <jakub@redhat.com>
* posix/execvp.c: Include alloca.h.
(allocate_scripts_argv): Renamed to...
(scripts_argv): ... this. Don't allocate buffer here nor count
arguments.
(execvp): Use alloca if possible.
* posix/Makefile: Add rules to build and run tst-vfork3 test.
* posix/tst-vfork3.c: New test.
2007-01-03 Ulrich Drepper <drepper@redhat.com>
* string/Makefile (tst-strxfrm2-ENV): Define.
* stdlib/Makefile (tst-strtod3-ENV): Define.
2007-01-02 Ulrich Drepper <drepper@redhat.com>
* posix/getconf.c: Update copyright year.
* nss/getent.c: Likewise.
* iconv/iconvconfig.c: Likewise.
* iconv/iconv_prog.c: Likewise.
* elf/ldconfig.c: Likewise.
* catgets/gencat.c: Likewise.
* csu/version.c: Likewise.
* elf/ldd.bash.in: Likewise.
* elf/sprof.c (print_version): Likewise.
* locale/programs/locale.c: Likewise.
* locale/programs/localedef.c: Likewise.
* nscd/nscd.c (print_version): Likewise.
* debug/xtrace.sh: Likewise.
* malloc/memusage.sh: Likewise.
* malloc/mtrace.pl: Likewise.
* debug/catchsegv.sh: Likewise.
2006-12-24 Ulrich Drepper <drepper@redhat.com>
* malloc/malloc.c (sYSMALLOc): Remove some unnecessary alignment
attempts.
2006-12-23 Ulrich Drepper <drepper@redhat.com>
* posix/wordexp.c: Remove some unnecessary tests.
2006-12-22 Gavin Romig-Koch <gavin@redhat.com>
* nis/nss_compat/compat-grp.c (internal_getgrgid_r): Don't
blacklist the group till after we look it up.
2006-12-21 Ulrich Drepper <drepper@redhat.com>
* include/atomic.h (atomic_forced_read): New macro.
2006-12-20 SUGIOKA Toshinobu <sugioka@itonet.co.jp>
* sysdeps/unix/sysv/linux/sh/bits/shm.h: New file.
2006-12-19 Jakub Jelinek <jakub@redhat.com>
* nss/getXXbyYY_r.c: Include atomic.h.
(INTERNAL (REENTRANT_NAME)): Write startp after start_fct,
add atomic_write_barrier () in between.
* stdlib/Makefile (tests): Add tst-makecontext.
* stdlib/tst-makecontext.c: New test.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S
(__makecontext): Don't realign uc_mcontext.uc_regs.
2006-11-28 Jakub Jelinek <jakub@redhat.com>
* elf/dl-support.c: Include dl-procinfo.h.
* sysdeps/powerpc/dl-procinfo.h (PPC_PLATFORM_POWER4,
PPC_PLATFORM_PPC970, PPC_PLATFORM_POWER5, PPC_PLATFORM_POWER5_PLUS,
PPC_PLATFORM_POWER6, PPC_PLATFORM_CELL_BE, PPC_PLATFORM_POWER6X):
Define.
(_dl_string_platform): Use PPC_PLATFORM_* macros instead of
hardcoded constants.
* sysdeps/powerpc/dl-procinfo.c (_dl_powerpc_platform): Use
PPC_PLATFORM_* macros for array designators.
2006-11-11 Steven Munroe <sjmunroe@us.ibm.com>
* sysdeps/powerpc/dl-procinfo.c (_dl_powerpc_cap_flags): Add 3 new cap
names to the beginning.
(_dl_powerpc_platforms): Add "power6x".
* sysdeps/powerpc/dl-procinfo.h (_DL_HWCAP_FIRST): Decrease.
(HWCAP_IMPORTANT): Add PPC_FEATURE_HAS_DFP.
(_DL_PLATFORMS_COUNT): Increase.
(_dl_string_platform): Handle power6x case.
* sysdeps/powerpc/sysdep.h (PPC_FEATURE_PA6T, PPC_FEATURE_HAS_DFP,
PPC_FEATURE_POWER6_EXT): Define.
(PPC_FEATURE_POWER5, PPC_FEATURE_POWER5_PLUS): Correct Comment.
2006-12-18 Jakub Jelinek <jakub@redhat.com>
[BZ #3747]
* stdlib/jrand48_r.c (__jrand48_r): Make sure result is in the
[-2^31 .. 2^31) range.
* stdlib/tst-rand48.c (main): Fix expected values for 64-bit
targets.
* stdlib/tst-rand48-2.c: New test.
* stdlib/Makefile (tests): Add tst-rand48-2.
2006-12-14 Jakub Jelinek <jakub@redhat.com>
* misc/tst-pselect.c (do_test): Fix sigblock argument.
2006-12-14 Ulrich Drepper <drepper@redhat.com>
* misc/tst-pselect.c (do_test): Make sure the helper process is
terminating when the test is aborted.
2006-12-13 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/bits/statvfs.h: Define ST_RELATIME.
* sysdeps/unix/sysv/linux/internal_statvfs.c (__statvfs_getflags):
Handle relatime mount option.
[BZ #2337]
* libio/Makefile (tests): Add tst-setvbuf1.
* libio/tst-setvbuf1.c: New file.
2006-12-08 Jakub Jelinek <jakub@redhat.com>
[BZ #2337]
* libio/genops.c (__uflow): Fix a typo.
* libio/wfiledoalloc.c (_IO_wfile_doallocate): Don't stat
nor set _IO_LINE_BUF bit here. Size the wide buffer based on
the narrow buffer size.
2006-11-24 Jakub Jelinek <jakub@redhat.com>
[BZ #2337]
* libio/libio.h (_IO_FLAGS2_USER_WBUF): Define.
* libio/wgenops.c (_IO_wsetb, _IO_wdefault_finish): Test and set
_IO_FLAGS2_USER_WBUF bit in _flags2 instead of _IO_USER_BUF bit
in _flags.
* libio/wstrops.c (_IO_wstr_overflow, enlarge_userbuf,
_IO_wstr_finish): Likewise.
* libio/wmemstream.c (open_wmemstream): Likewise.
* libio/fileops.c (_IO_new_file_close_it): Call _IO_set[bgp]
even for wide streams.
2006-12-13 Jakub Jelinek <jakub@redhat.com>
* sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S: Include
kernel-features.h.
2006-12-11 Ulrich Drepper <drepper@redhat.com>
* stdlib/strtod_l.c (____STRTOF_INTERNAL): Parse thousand
separators also if no non-zero digits found.
* stdlib/Makefile (tests): Add tst-strtod3.
2006-12-09 Ulrich Drepper <drepper@redhat.com>
[BZ #3632]
* include/features.h: Fix comment about default value for
_POSIX_C_SOURCE.
[BZ #3664]
* stdlib/strtod_l.c (____STRTOF_INTERNAL): Fix test to recognize
empty parsed strings.
* stdlib/Makefile (tests): Add tst-strtod2.
* stdlib/tst-strtod2.c: New file.
[BZ #3673]
* stdlib/strtod_l.c (____STRTOF_INTERNAL): Fix exp_limit
computation.
* stdlib/Makefile (tests): Add tst-atof2.
* stdlib/tst-atof2.c: New file.
[BZ #3674]
* stdlib/strtod_l.c (____STRTOF_INTERNAL): Adjust exponent value
correctly if removing trailing zero of hex-float.
* stdlib/Makefile (tests): Add tst-atof1.
* stdlib/tst-atof1.c: New file.
2006-12-09 Jakub Jelinek <jakub@redhat.com>
* misc/mntent_r.c (__hasmntopt): Check p[optlen] even when p == rest.
Start searching for next comma at p rather than rest.
* misc/Makefile (tests): Add tst-mntent2.
* misc/tst-mntent2.c: New test.
* misc/getusershell.c (initshells): Check for integer overflows.
Make strings buffer one bigger as fgets always succeeds when second
argument is 1. Don't use calloc for shells array. Disallow
/ as shell.
2006-12-08 Ulrich Drepper <drepper@redhat.com>
* malloc/memusage.c: Handle realloc with new size of zero and
non-NULL pointer correctly.
(me): Really write first record twice.
(struct entry): Make format bi-arch safe.
(dest): Write out more realloc statistics.
* malloc/memusagestat.c (struct entry): Make format bi-arch safe.
2006-12-05 Jakub Jelinek <jakub@redhat.com>
* nis/nis_subr.c (nis_getnames): Revert last change.
2006-12-04 Jakub Jelinek <jakub@redhat.com>
* sysdeps/unix/sysv/linux/ttyname.c: Include termios.h.
(ttyname): Use tcgetattr instead of isatty, don't set errno to ENOTTY.
* sysdeps/unix/sysv/linux/ttyname_r.c: Include termios.h.
(__ttyname_r): Use tcgetattr instead of isatty, don't set errno to
ENOTTY.
* io/Makefile: Add rules to build and run tst-ttyname_r test.
* io/tst-ttyname_r.c: New test.
2006-12-03 Kaz Kojima <kkojima@rr.iij4u.or.jp>
* sysdeps/unix/sysv/linux/sh/sys/io.h: Removed.
2006-11-30 H.J. Lu <hongjiu.lu@intel.com>
* sysdeps/i386/i686/memcmp.S: Use jump table as the base of
jump table entries.
2006-11-30 Jan Kratochvil <jan.kratochvil@redhat.com>
* sysdeps/unix/sysv/linux/i386/clone.S: Provide CFI for the outermost
`clone' function to ensure proper unwinding stop of gdb.
* sysdeps/unix/sysv/linux/x86_64/clone.S: Likewise.
2006-12-01 Ulrich Drepper <drepper@redhat.com>
* nscd/nscd.init: Remove obsolete and commented-out -S option
handling.
2006-11-23 Jakub Jelinek <jakub@redhat.com>
[BZ #3514]
* manual/string.texi (strncmp): Fix pastos from wcscmp description.
[BZ #3515]
* manual/string.texi (strtok): Remove duplicate paragraph.
2006-12-01 Jan Kratochvil <jan.kratochvil@redhat.com>
* sysdeps/unix/sysv/linux/x86_64/sigaction.c: Fix compatibility with
libgcc not supporting `rflags' unwinding (register # >= 17).
2006-11-30 Jakub Jelinek <jakub@redhat.com>
* sunrpc/svc_run.c (svc_run): Set my_pollfd to new_pollfd if realloc
succeeded.
2006-11-29 Daniel Jacobowitz <dan@codesourcery.com>
Jakub Jelinek <jakub@redhat.com>
Jan Kratochvil <jan.kratochvil@redhat.com>
* sysdeps/unix/sysv/linux/x86_64/sigaction.c (restore_rt): Add correct
unwind information.
* sysdeps/unix/sysv/linux/x86_64/Makefile: Provide symbols for
'restore_rt' even in the 'signal' directory.
* sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym: Extend the regs list.
2006-11-27 Jakub Jelinek <jakub@redhat.com>
[BZ #3559]
* sunrpc/svc_run.c (svc_run): Fail instead of segfaulting if
malloc crashed. Don't allocate memory unnecessarily in each
loop.
2006-10-21 Jakub Jelinek <jakub@redhat.com>
* resolv/mapv4v6addr.h (map_v4v6_address): Fix last change.
2006-11-20 Ulrich Drepper <drepper@redhat.com>
* resolv/mapv4v6addr.h (map_v4v6_address): Optimize a bit.
2006-11-18 Bruno Haible <bruno@clisp.org>
* sysdeps/unix/sysv/linux/i386/getgroups.c (__getgroups): Invoke
__sysconf only after having tried to call getgroups32.
2006-11-19 Ulrich Drepper <drepper@redhat.com>
* nss/nss_files/files-hosts.c (LINE_PARSER): Support IPv6-style
addresses for IPv4 queries if they can be mapped.
2006-11-16 Jakub Jelinek <jakub@redhat.com>
* sysdeps/x86_64/fpu/s_copysignf.S (__copysignf): Switch to .text.
* sysdeps/x86_64/fpu/s_copysign.S (__copysign): Likewise.
(signmask): Add .size directive.
(othermask): Add .type directive.
2006-11-14 Ulrich Drepper <drepper@redhat.com>
* po/nl.po: Update from translation team.
* timezone/zdump.c: Redo fix for BZ #3137.
2006-11-14 Jakub Jelinek <jakub@redhat.com>
* nss/nss_files/files-alias.c (get_next_alias): Set line back
to first_unused after parsing :include: file.
2006-11-10 Ulrich Drepper <drepper@redhat.com>
* timezone/africa: Update from tzdata2006o.
* timezone/antarctica: Likewise.
* timezone/asia: Likewise.
* timezone/australasia: Likewise.
* timezone/backward: Likewise.
* timezone/europe: Likewise.
* timezone/iso3166.tab: Likewise.
* timezone/northamerica: Likewise.
* timezone/southamerica: Likewise.
* timezone/zone.tab: Likewise.
* time/tzfile.c (__tzfile_read): Extend to handle new file format
on machines with 64-bit time_t.
* timezone/checktab.awk: Update from tzcode2006o.
* timezone/ialloc.c: Likewise.
* timezone/private.h: Likewise.
* timezone/scheck.c: Likewise.
* timezone/tzfile.h: Likewise.
* timezone/tzselect.ksh: Likewise.
* timezone/zdump.c: Likewise.
* timezone/zic.c: Likewise.
[BZ #3483]
* elf/ldconfig.c (main): Call setlocale and textdomain.
Patch mostly by Benno Schulenberg <bensberg@justemail.net>.
[BZ #3480]
* manual/argp.texi: Fix typos.
* manual/charset.texi: Likewise.
* manual/errno.texi: Likewise.
* manual/filesys.texi: Likewise.
* manual/lang.texi: Likewise.
* manual/maint.texi: Likewise.
* manual/memory.texi: Likewise.
* manual/message.texi: Likewise.
* manual/resource.texi: Likewise.
* manual/search.texi: Likewise.
* manual/signal.texi: Likewise.
* manual/startup.texi: Likewise.
* manual/stdio.texi: Likewise.
* manual/sysinfo.texi: Likewise.
* manual/syslog.texi: Likewise.
* manual/time.texi: Likewise.
Patch by Ralf Wildenhues <Ralf.Wildenhues@gmx.de>.
[BZ #3465]
* sunrpc/clnt_raw.c: Minimal message improvements.
* sunrpc/pm_getmaps.c: Likewise.
* nis/nss_nisplus/nisplus-publickey.c: Likewise.
* nis/nis_print_group_entry.c: Likewise.
* locale/programs/repertoire.c: Likewise.
* locale/programs/charmap.c: Likewise.
* malloc/memusage.sh: Likewise.
* elf/dl-deps.c: Likewise.
* locale/programs/ld-collate.c: Likewise.
* libio/vswprintf.c: Likewise.
* malloc/memusagestat.c: Likewise.
* sunrpc/auth_unix.c: Likewise.
* sunrpc/rpc_main.c: Likewise.
* nscd/cache.c: Likewise.
* locale/programs/repertoire.c: Unify output messages.
* locale/programs/charmap.c: Likewise.
* locale/programs/ld-ctype.c: Likewise.
* locale/programs/ld-monetary.c: Likewise.
* locale/programs/ld-numeric.c: Likewise.
* locale/programs/ld-time.c: Likewise.
* elf/ldconfig.c: Likewise.
* nscd/selinux.c: Likewise.
* elf/cache.c: Likewise.
Patch mostly by Benno Schulenberg <bensberg@justemail.net>.
[BZ #3451]
* sysdeps/i386/fpu/bits/mathinline.h (floor): Make rounding mode
change atomic.
(ceil): Likewise.
2006-11-10 Jakub Jelinek <jakub@redhat.com>
* string/strxfrm_l.c (STRXFRM): Fix trailing \1 optimization
if N is one bigger than return value.
* string/tst-strxfrm2.c (do_test): Also test strxfrm with l1 + 1
and l1 last arguments, if buf is defined, verify the return value
equals to strlen (buf) and verify no byte beyond passed length
is modified.
2006-11-10 Ulrich Drepper <drepper@redhat.com>
* po/sv.po: Update from translation team.
2006-11-09 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/x86_64/sysconf.c (intel_check_word): Add
noinline attribute.
2006-11-10 Jakub Jelinek <jakub@redhat.com>
* sysdeps/unix/sysv/linux/i386/sysconf.c (intel_check_word): Add
noinline attribute.
* sysdeps/gnu/siglist.c (__old_sys_siglist, __old_sys_sigabbrev):
Use __new_sys_siglist instead of _sys_siglist_internal as
second macro argument.
(_old_sys_siglist): Use declare_symbol_alias macro instead of
strong_alias.
2006-11-09 Ulrich Drepper <drepper@redhat.com>
[BZ #3493]
* posix/unistd.h (sysconf): Remove const attribute.
* sysdeps/posix/getaddrinfo.c (getaddrinfo): Fix test for
temporary or deprecated addresses.
Patch by Sridhar Samudrala <sri@us.ibm.com>.
* string/Makefile (tests): Add tst-strxfrm2.
* string/tst-strxfrm2.c: New file.
2006-10-09 Jakub Jelinek <jakub@redhat.com>
* elf/dl-debug.c (_dl_debug_initialize): Check r->r_map for 0
rather than r->r_brk.
2006-11-08 Jakub Jelinek <jakub@redhat.com>
* string/strxfrm_l.c (STRXFRM): Do the trailing \1 removal
optimization even if needed > n.
* elf/dl-load.c (decompose_rpath): Return bool rather than void.
If l->l_name is on inhibit_rpath list, set sps->dirs to -1 and
return false, otherwise return true.
(cache_rpath): Return decompose_rpath return value.
2006-11-07 Jakub Jelinek <jakub@redhat.com>
* include/libc-symbols.h (declare_symbol): Rename to...
(declare_symbol_alias): ... this. Add ORIGINAL argument, imply
strong_alias (ORIGINAL, SYMBOL) in asm to make sure it preceedes
.size directive.
* sysdeps/gnu/errlist-compat.awk: Adjust for declare_symbol_alias
changes.
* sysdeps/gnu/siglist.c: Likewise.
2006-11-03 Steven Munroe <sjmunroe@us.ibm.com>
* sysdeps/powerpc/fpu/bits/mathinline.h
[__LIBC_INTERNAL_MATH_INLINES]: Moved to ...
* sysdeps/powerpc/fpu/math_private.h: ...here. New file.
2006-11-05 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/i386/sysconf.c (intel_check_word):
Update handling of cache descriptor 0x49 for new models.
* sysdeps/unix/sysv/linux/x86_64/sysconf.c (intel_check_word):
Likewise.
2006-11-02 Jakub Jelinek <jakub@redhat.com>
* malloc/memusage.c (dest): Reset not_me back to false after
printing statistics.
2006-11-02 Ulrich Drepper <drepper@redhat.com>
* configure.in: Work around ld --help change and avoid -z relro
test completely if the architecture doesn't care about security.
2006-11-01 Ulrich Drepper <drepper@redhat.com>
* po/sv.po: Update from translation team.
2006-10-31 Ulrich Drepper <drepper@redhat.com>
* stdlib/atexit.c (atexit): Don't mark as hidden when used to
generate compatibility version.
2006-10-29 Ulrich Drepper <drepper@redhat.com>
* configure.in: Relax -z relro requirement a bit.
* po/sv.po: Update from translation team.
2006-10-29 Jakub Jelinek <jakub@redhat.com>
* elf/dl-sym.c (do_sym): Use RTLD_SINGLE_THREAD_P.
* elf/dl-runtime.c (_dl_fixup, _dl_profile_fixup): Likewise.
* elf/dl-close.c (_dl_close_worker): Likewise.
* elf/dl-open.c (_dl_open_worker): Likewise.
* sysdeps/generic/sysdep-cancel.h (RTLD_SINGLE_THREAD_P): Define.
2006-10-27 Ulrich Drepper <drepper@redhat.com>
* configure.in: Require assembler support for visibility, compiler
support for visibility and aliases, linker support for various -z
options.
* Makeconfig: Remove conditional code which now is unnecessary.
* config.h.in: Likewise.
* config.make.in: Likewise.
* dlfcn/Makefile: Likewise.
* elf/Makefile: Likewise.
* elf/dl-load.c: Likewise.
* elf/rtld.c: Likewise.
* include/libc-symbols.h: Likewise.
* include/stdio.h: Likewise.
* io/Makefile: Likewise.
* io/fstat.c: Likewise.
* io/fstat64.c: Likewise.
* io/fstatat.c: Likewise.
* io/fstatat64.c: Likewise.
* io/lstat.c: Likewise.
* io/lstat64.c: Likewise.
* io/mknod.c: Likewise.
* io/mknodat.c: Likewise.
* io/stat.c: Likewise.
* io/stat64.c: Likewise.
* libio/stdio.c: Likewise.
* nscd/Makefile: Likewise.
* stdlib/Makefile: Likewise.
* stdlib/atexit.c: Likewise.
* sysdeps/generic/ldsodefs.h: Likewise.
* sysdeps/i386/dl-machine.h: Likewise.
* sysdeps/i386/sysdep.h: Likewise.
* sysdeps/i386/i686/memcmp.S: Likewise.
* sysdeps/powerpc/powerpc32/sysdep.h: Likewise.
* sysdeps/unix/sysv/linux/i386/sigaction.c: Likewise.
* sysdeps/unix/sysv/linux/x86_64/sigaction.c: Likewise.
* Makerules: USE_TLS support is now default.
* tls.make.c: Likewise.
* csu/Versions: Likewise.
* csu/libc-start.c: Likewise.
* csu/libc-tls.c: Likewise.
* csu/version.c: Likewise.
* dlfcn/dlinfo.c: Likewise.
* elf/dl-addr.c: Likewise.
* elf/dl-cache.c: Likewise.
* elf/dl-close.c: Likewise.
* elf/dl-iteratephdr.c: Likewise.
* elf/dl-load.c: Likewise.
* elf/dl-lookup.c: Likewise.
* elf/dl-object.c: Likewise.
* elf/dl-open.c: Likewise.
* elf/dl-reloc.c: Likewise.
* elf/dl-support.c: Likewise.
* elf/dl-sym.c: Likewise.
* elf/dl-sysdep.c: Likewise.
* elf/dl-tls.c: Likewise.
* elf/ldconfig.c: Likewise.
* elf/rtld.c: Likewise.
* elf/tst-tls-dlinfo.c: Likewise.
* elf/tst-tls1.c: Likewise.
* elf/tst-tls10.h: Likewise.
* elf/tst-tls14.c: Likewise.
* elf/tst-tls2.c: Likewise.
* elf/tst-tls3.c: Likewise.
* elf/tst-tls4.c: Likewise.
* elf/tst-tls5.c: Likewise.
* elf/tst-tls6.c: Likewise.
* elf/tst-tls7.c: Likewise.
* elf/tst-tls8.c: Likewise.
* elf/tst-tls9.c: Likewise.
* elf/tst-tlsmod1.c: Likewise.
* elf/tst-tlsmod13.c: Likewise.
* elf/tst-tlsmod13a.c: Likewise.
* elf/tst-tlsmod14a.c: Likewise.
* elf/tst-tlsmod2.c: Likewise.
* elf/tst-tlsmod3.c: Likewise.
* elf/tst-tlsmod4.c: Likewise.
* elf/tst-tlsmod5.c: Likewise.
* elf/tst-tlsmod6.c: Likewise.
* include/errno.h: Likewise.
* include/link.h: Likewise.
* include/tls.h: Likewise.
* locale/global-locale.c: Likewise.
* locale/localeinfo.h: Likewise.
* malloc/arena.c: Likewise.
* malloc/hooks.c: Likewise.
* malloc/malloc.c: Likewise.
* resolv/Versions: Likewise.
* sysdeps/alpha/dl-machine.h: Likewise.
* sysdeps/alpha/libc-tls.c: Likewise.
* sysdeps/generic/ldsodefs.h: Likewise.
* sysdeps/generic/tls.h: Likewise.
* sysdeps/i386/dl-machine.h: Likewise.
* sysdeps/ia64/dl-machine.h: Likewise.
* sysdeps/ia64/libc-tls.c: Likewise.
* sysdeps/mach/hurd/fork.c: Likewise.
* sysdeps/mach/hurd/i386/tls.h: Likewise.
* sysdeps/powerpc/powerpc32/dl-machine.c: Likwise.
* sysdeps/powerpc/powerpc32/dl-machine.h: Likewise.
* sysdeps/powerpc/powerpc64/dl-machine.h: Likewise.
* sysdeps/s390/libc-tls.c: 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.
* elf/dl-close.c (_dl_close_worker): Renamed from _dl_close and
split out locking and parameter checking.
(_dl_close): Call _dl_close_worker after locking and checking.
* elf/dl-open.c (_dl_open): Call _dl_close_worker instead of
_dl_close.
* elf/Makefile: Add rules to build and run tst-thrlock.
* elf/tst-thrlock.c: New file.
[BZ #3426]
* stdlib/stdlib.h: Adjust comment for canonicalize_file_name to
reality.
[BZ #3429]
* elf/dl-open.c (dl_open_worker): Keep holding dl_load_lock until
we are sure we do not need it anymore for _dl_close. Also move
the asserts inside the lock region.
Patch mostly by Suzuki <suzuki@in.ibm.com>.
2006-10-27 Jakub Jelinek <jakub@redhat.com>
* elf/dl-lookup.c (_dl_debug_bindings): Remove unused symbol_scope
argument.
(_dl_lookup_symbol_x): Adjust caller.
* sysdeps/generic/ldsodefs.h (struct link_namespaces): Remove
_ns_global_scope.
* elf/rtld.c (dl_main): Don't initialize _ns_global_scope.
* elf/dl-libc.c: Revert l_scope name changes.
* elf/dl-load.c: Likewise.
* elf/dl-object.c: Likewise.
* elf/rtld.c: Likewise.
* elf/dl-close.c (_dl_close): Likewise.
* elf/dl-open.c (dl_open_worker): Likewise. If not SINGLE_THREAD_P,
always use __rtld_mrlock_{change,done}. Always free old scope list
here if not l_scope_mem.
* elf/dl-runtime.c (_dl_fixup, _dl_profile_fixup): Revert l_scope name
change. Never free scope list here. Just __rtld_mrlock_lock before
the lookup and __rtld_mrlock_unlock it after the lookup.
* elf/dl-sym.c: Likewise.
* include/link.h (struct r_scoperec): Remove.
(struct link_map): Replace l_scoperec with l_scope, l_scoperec_mem
with l_scope_mem and l_scoperec_lock with l_scope_lock.
2006-10-25 Ulrich Drepper <drepper@redhat.com>
* sysdeps/gnu/netinet/tcp.h: Define TCP_CONGESTION.
2006-10-18 Ulrich Drepper <drepper@redhat.com>
* configure.in: Disable building profile libraries by default.
2006-10-17 Jakub Jelinek <jakub@redhat.com>
* sunrpc/xdr_mem.c (xdrmem_setpos): Don't compare addresses
as signed longs, check for x_base + pos overflow.
* sunrpc/Makefile (tests): Add tst-xdrmem2.
* sunrpc/tst-xdrmem2.c: New test.
2006-10-18 Ulrich Drepper <drepper@redhat.com>
* elf/dl-lookup.c (_dl_lookup_symbol_x): Add warning to
_dl_lookup_symbol_x code.
2006-10-17 Jakub Jelinek <jakub@redhat.com>
* elf/dl-runtime.c: Include sysdep-cancel.h.
(_dl_fixup, _dl_profile_fixup): Use __rtld_mrlock_* and
scoperec->nusers only if !SINGLE_THREAD_P. Use atomic_*
instead of catomic_* macros.
* elf/dl-sym.c: Include sysdep-cancel.h.
(do_sym): Use __rtld_mrlock_* and scoperec->nusers only
if !SINGLE_THREAD_P. Use atomic_* instead of catomic_* macros.
* elf/dl-close.c: Include sysdep-cancel.h.
(_dl_close): Use __rtld_mrlock_* and scoperec->nusers only
if !SINGLE_THREAD_P. Use atomic_* instead of catomic_* macros.
* elf/dl-open.c: Include sysdep-cancel.h.
(dl_open_worker): Use __rtld_mrlock_* and scoperec->nusers only
if !SINGLE_THREAD_P. Use atomic_* instead of catomic_* macros.
2006-10-17 Jakub Jelinek <jakub@redhat.com>
[BZ #3313]
* malloc/malloc.c (malloc_consolidate): Set maxfb to address of last
fastbin rather than end of fastbin array.
2006-10-18 Ulrich Drepper <drepper@redhat.com>
* sysdeps/i386/i486/bits/atomic.h (catomic_decrement): Use correct
body macro.
* sysdeps/x86_64/bits/atomic.h
(__arch_c_compare_and_exchange_val_64_acq): Add missing casts.
(catomic_decrement): Use correct body macro.
2006-10-17 Jakub Jelinek <jakub@redhat.com>
* include/atomic.h: Add a unique prefix to all local variables
in macros.
* csu/tst-atomic.c (do_test): Test also catomic_* macros.
2006-10-16 Ulrich Drepper <drepper@redhat.com>
[BZ #3369]
* sysdeps/posix/getaddrinfo.c (rfc3484_sort): Fix typos in rules 4
and 7.
2006-10-14 Ulrich Drepper <drepper@redhat.com>
* resolv/arpa/nameser.h: Document that ns_t_a6 is deprecated.
2006-10-13 Ulrich Drepper <drepper@redhat.com>
[BZ #3313]
* malloc/malloc.c (malloc_consolidate): Don't use get_fast_max to
determine highest fast bin to consolidate, always look into all of
them.
(do_check_malloc_state): Only require for empty bins for large
sizes in main arena.
* libio/stdio.h: Add more __wur attributes.
* elf/dl-minimal.c (realloc): Optimize last patch.
2006-10-12 Richard Sandiford <richard@codesourcery.com>
[BZ #3352]
* elf/dl-minimal.c (realloc): Let malloc() return a new pointer,
and use memcpy() if it does.
2006-11-12 Andreas Jaeger <aj@suse.de>
[BZ #2510]
* manual/search.texi (Hash Search Function): Clarify.
(Array Search Function): Clarify.
2006-11-12 Joseph Myers <joseph@codesourcery.com>
[BZ #2830]
* math/atest-exp.c (main): Cast hex value to mp_limb_t before
shifting.
* math/atest-exp2.c (read_mpn_hex): Likewise.
* math/atest-sincos.c (main): Likewise.
2006-10-11 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/syscalls.list: Add epoll_pwait.
* sysdeps/unix/sysv/linux/sys/epoll.h: Declare epoll_pwait.
* sysdeps/unix/sysv/linux/Versions (libc): Add epoll_pwait for
version GLIBC_2.6.
* Versions.def: Add GLIBC_2.6 for libc.
* sysdeps/unix/sysv/linux/i386/sysdep.h (DOARGS_6): Fix offset.
* sysdeps/i386/i486/bits/atomic.h: Add catomic_* support.
2006-10-11 Jakub Jelinek <jakub@redhat.com>
* malloc/malloc.c (_int_malloc): Remove unused any_larger variable.
* nis/nis_defaults.c (__nis_default_access): Don't call getenv twice.
* nis/nis_subr.c (nis_getnames): Use __secure_getenv instead of getenv.
* sysdeps/generic/unsecvars.h: Add NIS_PATH.
2006-10-11 Ulrich Drepper <drepper@redhat.com>
* include/atomic.c: Define catomic_* operations.
* sysdeps/x86_64/bits/atomic.h: Likewise. Fix a few minor problems.
* stdlib/cxa_finalize.c: Use catomic_* operations instead of atomic_*.
* malloc/memusage.c: Likewise.
* gmon/mcount.c: Likewise.
* elf/dl-close.c: Likewise.
* elf/dl-open.c: Likewise.
* elf/dl-profile.c: Likewise.
* elf/dl-sym.c: Likewise.
* elf/dl-runtime.c: Likewise.
* elf/dl-fptr.c: Likewise.
* resolv/res_libc.c: Likewise.
2006-10-10 Ulrich Drepper <drepper@redhat.com>
* nis/nis_subr.c (nis_getnames): Add trailing dot to NIS_PATH
components which lack them.
* nis/nis_subr.c (nis_getnames): Make sure that we always return
at least one entry consisting of the parameter concatenated with
the domain.
2006-10-10 Roland McGrath <roland@frob.com>
* sysdeps/mach/hurd/utimes.c: Use a union to avoid an improper cast.
* sysdeps/mach/hurd/futimes.c: Likewise.
* sysdeps/mach/hurd/lutimes.c: Likewise.
2006-10-09 Ulrich Drepper <drepper@redhat.com>
Jakub Jelinek <jakub@redhat.com>
Implement reference counting of scope records.
* elf/dl-close.c (_dl_close): Remove all scopes from removed objects
from the list in objects which remain. Always allocate new scope
record.
* elf/dl-open.c (dl_open_worker): When growing array for scopes,
don't resize, allocate a new one.
* elf/dl-runtime.c: Update reference counters before using a scope
array.
* elf/dl-sym.c: Likewise.
* elf/dl-libc.c: Adjust for l_scope name change.
* elf/dl-load.c: Likewise.
* elf/dl-object.c: Likewise.
* elf/rtld.c: Likewise.
* include/link.h: Include <rtld-lowlevel.h>. Define struct
r_scoperec. Replace r_scope with pointer to r_scoperec structure.
Add l_scoperec_lock.
* sysdeps/generic/ldsodefs.h: Include <rtld-lowlevel.h>.
* sysdeps/generic/rtld-lowlevel.h: New file.
* include/atomic.h: Rename atomic_and to atomic_and_val and
atomic_or to atomic_or_val. Define new macros atomic_and and
atomic_or which do not return values.
* sysdeps/x86_64/bits/atomic.h: Define atomic_and and atomic_or.
Various cleanups.
* sysdeps/i386/i486/bits/atomic.h: Likewise.
* po/sv.po: Update from translation team.
2006-10-07 Ulrich Drepper <drepper@redhat.com>
* Versions.def: Add GLIBC_2.6 to libpthread.
* include/shlib-compat.h (SHLIB_COMPAT): Expand parameters before use.
(versioned_symbol): Likewise.
(compat_symbol): Likewise.
* po/tr.po: Update from translation team.
2006-10-06 Ulrich Drepper <drepper@redhat.com>
* nis/Banner: Removed. It's been integral part forever and the
author info is incomplete anyway.
* libio/Banner: Likewise.
* nis/nis_table.c (nis_list): If __follow_path fails in the new
code, make sure the nis_freeresult call doesn't crash and that the
result is reported correctly.
@ -888,10 +21,6 @@
Don't use locking around _nss_grp_create_tablename call.
* nis/nss_nisplus/nisplus-initgroups.c: New file.
2006-10-06 Ulrich Drepper <drepper@redhat.com>
* version.h (VERSION): Bump to 2.5.90 for new development tree.
2006-10-06 Andreas Jaeger <aj@suse.de>
* include/features.h (__GLIBC_MINOR__): It's glibc 2.5 now.
@ -1526,7 +655,7 @@
* nis/nis_xdr.c: Avoid some function calls.
2006-08-07 Jakub Jelinek <jakub@redhat.com>
Ulrich Drepper <drepper@redhat.com>
Ulrich Drepper <drepper@redhat.com>
* nis/nis_call.c (rec_dirsearch) [case LOWER_NAME]: Don't take
short cut if only one name component is stripped away.

View File

@ -407,9 +407,11 @@ LDFLAGS.so += $(combreloc-LDFLAGS)
LDFLAGS-rtld += $(combreloc-LDFLAGS)
endif
ifeq (yes,$(have-z-relro))
relro-LDFLAGS = -Wl,-z,relro
LDFLAGS.so += $(relro-LDFLAGS)
LDFLAGS-rtld += $(relro-LDFLAGS)
endif
ifeq (yes,$(have-hash-style))
# For the time being we unconditionally use 'both'. At some time we

View File

@ -1233,7 +1233,10 @@ endif
ifeq ($(firstword $(sysd-sorted-done) f)$(firstword $(generating) f),tf)
-include $(common-objpfx)tls.make
config-tls := notls
ifeq ($(use-tls),yes)
config-tls := tls
endif
ifeq ($(use-thread),yes)
config-tls := thread
endif

7
NEWS
View File

@ -1,14 +1,9 @@
GNU C Library NEWS -- history of user-visible changes. 2006-10-11
GNU C Library NEWS -- history of user-visible changes. 2006-09-29
Copyright (C) 1992-2002,2003,2004,2005,2006 Free Software Foundation, Inc.
See the end for copying conditions.
Please send GNU C library bug reports via <http://sources.redhat.com/bugzilla/>
using `glibc' in the "product" field.
Version 2.6
* New Linux interfaces: epoll_pwait.
Version 2.5

View File

@ -22,7 +22,6 @@ libc {
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.5
GLIBC_2.6
%ifdef USE_IN_LIBIO
HURD_CTHREADS_0.3
%endif
@ -83,7 +82,6 @@ libpthread {
GLIBC_2.3.3
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.6
GLIBC_PRIVATE
}
libresolv {

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1996-2005, 2006, 2007 Free Software Foundation, Inc.
/* Copyright (C) 1996-2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 1996.
@ -246,7 +246,7 @@ print_version (FILE *stream, struct argp_state *state)
Copyright (C) %s Free Software Foundation, Inc.\n\
This is free software; see the source for copying conditions. There is NO\n\
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
"), "2007");
"), "2006");
fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper");
}

View File

@ -120,6 +120,23 @@
/* Define if the linker supports the -z combreloc option. */
#undef HAVE_Z_COMBRELOC
/* Define if the assembler supported .protected. */
#undef HAVE_PROTECTED
/* Define if the assembler supported .hidden. */
#undef HAVE_HIDDEN
/* Define if the compiler supports __attribute__ ((visibility (...))). */
#undef HAVE_VISIBILITY_ATTRIBUTE
/* Define if the compiler doesn't support __attribute__ ((visibility (...)))
together with __asm__ redirection properly. */
#undef HAVE_BROKEN_VISIBILITY_ATTRIBUTE
/* Define if the compiler doesn't support __attribute__ ((alias (...)))
together with __asm__ redirection properly. */
#undef HAVE_BROKEN_ALIAS_ATTRIBUTE
/* Define if _rtld_local structure should be forced into .sdata section. */
#undef HAVE_SDATA_SECTION
@ -171,6 +188,9 @@
/* Defined if forced unwind support is available. */
#undef HAVE_FORCED_UNWIND
/* Defined if the linker supports the -z relro option. */
#undef HAVE_Z_RELRO
/* Defined of libidn is available. */
#undef HAVE_LIBIDN

View File

@ -38,9 +38,14 @@ c++-sysincludes = @CXX_SYSINCLUDES@
all-warnings = @all_warnings@
elf = @elf@
have-protected = @libc_cv_asm_protected_directive@
have-z-nodelete = @libc_cv_z_nodelete@
have-z-nodlopen = @libc_cv_z_nodlopen@
have-z-initfirst = @libc_cv_z_initfirst@
have-z-combreloc = @libc_cv_z_combreloc@
have-z-execstack = @libc_cv_z_execstack@
have-initfini = @libc_cv_have_initfini@
have-z-relro = @libc_cv_z_relro@
have-Bgroup = @libc_cv_Bgroup@
have-as-needed = @libc_cv_as_needed@
libgcc_s_suffix = @libc_cv_libgcc_s_suffix@

81
configure vendored
View File

@ -313,7 +313,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs enable_check_abi oldest_abi bindnow force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os subdirs add_ons add_on_subdirs base_machine submachine sysnames sysdeps_add_ons 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 CXX_SYSINCLUDES libc_cv_gcc_static_libgcc BASH libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO BISON VERSIONING libc_cv_cc_with_libunwind 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 libc_cv_hashstyle fno_unit_at_a_time libc_cv_ssp libc_cv_have_initfini no_whole_archive exceptions LIBGD have_libaudit have_libcap 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 elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES 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 add_on_subdirs base_machine submachine sysnames sysdeps_add_ons 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 CXX_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_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 libc_cv_hashstyle fno_unit_at_a_time libc_cv_ssp libc_cv_have_initfini no_whole_archive exceptions LIBGD have_libaudit have_libcap 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 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.
@ -864,7 +864,7 @@ Optional Features:
[default=no]
--enable-shared build shared library [default=yes if GNU ld &
ELF]
--enable-profile build profiled library [default=no]
--enable-profile build profiled library [default=yes]
--enable-omitfp build undebuggable optimized library
[default=no]
--enable-bounded build with runtime bounds checking
@ -1543,7 +1543,7 @@ if test "${enable_profile+set}" = set; then
enableval="$enable_profile"
profile=$enableval
else
profile=no
profile=yes
fi;
# Check whether --enable-omitfp or --disable-omitfp was given.
if test "${enable_omitfp+set}" = set; then
@ -5339,15 +5339,22 @@ EOF
(exit $ac_status); }; }; then
libc_cv_asm_protected_directive=yes
else
{ { echo "$as_me:$LINENO: error: assembler support for symbol visibility is required" >&5
echo "$as_me: error: assembler support for symbol visibility is required" >&2;}
{ (exit 1); exit 1; }; }
libc_cv_asm_protected_directive=no
fi
rm -f conftest*
fi
echo "$as_me:$LINENO: result: $libc_cv_asm_protected_directive" >&5
echo "${ECHO_T}$libc_cv_asm_protected_directive" >&6
cat >>confdefs.h <<\_ACEOF
#define HAVE_PROTECTED 1
_ACEOF
cat >>confdefs.h <<\_ACEOF
#define HAVE_HIDDEN 1
_ACEOF
if test $libc_cv_asm_protected_directive = yes; then
echo "$as_me:$LINENO: checking whether __attribute__((visibility())) is supported" >&5
echo $ECHO_N "checking whether __attribute__((visibility())) is supported... $ECHO_C" >&6
@ -5376,10 +5383,11 @@ EOF
fi
echo "$as_me:$LINENO: result: $libc_cv_visibility_attribute" >&5
echo "${ECHO_T}$libc_cv_visibility_attribute" >&6
if test $libc_cv_visibility_attribute != yes; then
{ { echo "$as_me:$LINENO: error: compiler support for visibility attribute is required" >&5
echo "$as_me: error: compiler support for visibility attribute is required" >&2;}
{ (exit 1); exit 1; }; }
if test $libc_cv_visibility_attribute = yes; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_VISIBILITY_ATTRIBUTE 1
_ACEOF
fi
fi
@ -5411,9 +5419,10 @@ fi
echo "$as_me:$LINENO: result: $libc_cv_broken_visibility_attribute" >&5
echo "${ECHO_T}$libc_cv_broken_visibility_attribute" >&6
if test $libc_cv_broken_visibility_attribute = yes; then
{ { echo "$as_me:$LINENO: error: working compiler support for visibility attribute is required" >&5
echo "$as_me: error: working compiler support for visibility attribute is required" >&2;}
{ (exit 1); exit 1; }; }
cat >>confdefs.h <<\_ACEOF
#define HAVE_BROKEN_VISIBILITY_ATTRIBUTE 1
_ACEOF
fi
fi
@ -5448,9 +5457,10 @@ fi
echo "$as_me:$LINENO: result: $libc_cv_broken_alias_attribute" >&5
echo "${ECHO_T}$libc_cv_broken_alias_attribute" >&6
if test $libc_cv_broken_alias_attribute = yes; then
{ { echo "$as_me:$LINENO: error: working alias attribute support required" >&5
echo "$as_me: error: working alias attribute support required" >&2;}
{ (exit 1); exit 1; }; }
cat >>confdefs.h <<\_ACEOF
#define HAVE_BROKEN_ALIAS_ATTRIBUTE 1
_ACEOF
fi
if test $libc_cv_visibility_attribute = yes; then
@ -5562,15 +5572,14 @@ EOF
then
libc_cv_z_nodelete=yes
else
{ { echo "$as_me:$LINENO: error: linker with -z nodelete support required" >&5
echo "$as_me: error: linker with -z nodelete support required" >&2;}
{ (exit 1); exit 1; }; }
libc_cv_z_nodelete=no
fi
rm -f conftest*
fi
echo "$as_me:$LINENO: result: $libc_cv_z_nodelete" >&5
echo "${ECHO_T}$libc_cv_z_nodelete" >&6
echo "$as_me:$LINENO: checking for -z nodlopen option" >&5
echo $ECHO_N "checking for -z nodlopen option... $ECHO_C" >&6
if test "${libc_cv_z_nodlopen+set}" = set; then
@ -5591,15 +5600,14 @@ EOF
then
libc_cv_z_nodlopen=yes
else
{ { echo "$as_me:$LINENO: error: linker with -z nodlopen support required" >&5
echo "$as_me: error: linker with -z nodlopen support required" >&2;}
{ (exit 1); exit 1; }; }
libc_cv_z_nodlopen=no
fi
rm -f conftest*
fi
echo "$as_me:$LINENO: result: $libc_cv_z_nodlopen" >&5
echo "${ECHO_T}$libc_cv_z_nodlopen" >&6
echo "$as_me:$LINENO: checking for -z initfirst option" >&5
echo $ECHO_N "checking for -z initfirst option... $ECHO_C" >&6
if test "${libc_cv_z_initfirst+set}" = set; then
@ -5620,18 +5628,15 @@ EOF
then
libc_cv_z_initfirst=yes
else
{ { echo "$as_me:$LINENO: error: linker with -z initfirst support required" >&5
echo "$as_me: error: linker with -z initfirst support required" >&2;}
{ (exit 1); exit 1; }; }
libc_cv_z_initfirst=no
fi
rm -f conftest*
fi
echo "$as_me:$LINENO: result: $libc_cv_z_initfirst" >&5
echo "${ECHO_T}$libc_cv_z_initfirst" >&6
case "$base_machine" in
i[34567]86 | x86_64 | powerpc* | s390* | sparc* | alpha*)
echo "$as_me:$LINENO: checking for -z relro option" >&5
echo "$as_me:$LINENO: checking for -z relro option" >&5
echo $ECHO_N "checking for -z relro option... $ECHO_C" >&6
if test "${libc_cv_z_relro+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
@ -5657,14 +5662,13 @@ else
fi
echo "$as_me:$LINENO: result: $libc_cv_z_relro" >&5
echo "${ECHO_T}$libc_cv_z_relro" >&6
if test "$libc_cv_z_relro" = no; then
{ { echo "$as_me:$LINENO: error: linker with -z relro support required" >&5
echo "$as_me: error: linker with -z relro support required" >&2;}
{ (exit 1); exit 1; }; }
fi
;;
*) ;;
esac
if test $libc_cv_z_relro = yes; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_Z_RELRO 1
_ACEOF
fi
echo "$as_me:$LINENO: checking for -Bgroup option" >&5
echo $ECHO_N "checking for -Bgroup option... $ECHO_C" >&6
@ -8506,7 +8510,12 @@ s,@PERL@,$PERL,;t t
s,@INSTALL_INFO@,$INSTALL_INFO,;t t
s,@BISON@,$BISON,;t t
s,@VERSIONING@,$VERSIONING,;t t
s,@libc_cv_asm_protected_directive@,$libc_cv_asm_protected_directive,;t t
s,@libc_cv_cc_with_libunwind@,$libc_cv_cc_with_libunwind,;t t
s,@libc_cv_z_nodelete@,$libc_cv_z_nodelete,;t t
s,@libc_cv_z_nodlopen@,$libc_cv_z_nodlopen,;t t
s,@libc_cv_z_initfirst@,$libc_cv_z_initfirst,;t t
s,@libc_cv_z_relro@,$libc_cv_z_relro,;t t
s,@libc_cv_Bgroup@,$libc_cv_Bgroup,;t t
s,@libc_cv_libgcc_s_suffix@,$libc_cv_libgcc_s_suffix,;t t
s,@libc_cv_as_needed@,$libc_cv_as_needed,;t t

View File

@ -131,9 +131,9 @@ AC_ARG_ENABLE([shared],
[shared=default])
AC_ARG_ENABLE([profile],
AC_HELP_STRING([--enable-profile],
[build profiled library @<:@default=no@:>@]),
[build profiled library @<:@default=yes@:>@]),
[profile=$enableval],
[profile=no])
[profile=yes])
AC_ARG_ENABLE([omitfp],
AC_HELP_STRING([--enable-omitfp],
[build undebuggable optimized library @<:@default=no@:>@]),
@ -1259,9 +1259,12 @@ EOF
if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
libc_cv_asm_protected_directive=yes
else
AC_MSG_ERROR(assembler support for symbol visibility is required)
libc_cv_asm_protected_directive=no
fi
rm -f conftest*])
AC_SUBST(libc_cv_asm_protected_directive)
AC_DEFINE(HAVE_PROTECTED)
AC_DEFINE(HAVE_HIDDEN)
if test $libc_cv_asm_protected_directive = yes; then
AC_CACHE_CHECK(whether __attribute__((visibility())) is supported,
@ -1280,8 +1283,8 @@ EOF
fi
rm -f conftest.[cs]
])
if test $libc_cv_visibility_attribute != yes; then
AC_MSG_ERROR(compiler support for visibility attribute is required)
if test $libc_cv_visibility_attribute = yes; then
AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
fi
fi
@ -1304,7 +1307,7 @@ changequote([,])dnl
rm -f conftest.c conftest.s
])
if test $libc_cv_broken_visibility_attribute = yes; then
AC_MSG_ERROR(working compiler support for visibility attribute is required)
AC_DEFINE(HAVE_BROKEN_VISIBILITY_ATTRIBUTE)
fi
fi
@ -1328,7 +1331,7 @@ EOF
rm -f conftest.c conftest.s
])
if test $libc_cv_broken_alias_attribute = yes; then
AC_MSG_ERROR(working alias attribute support required)
AC_DEFINE(HAVE_BROKEN_ALIAS_ATTRIBUTE)
fi
if test $libc_cv_visibility_attribute = yes; then
@ -1400,9 +1403,10 @@ EOF
then
libc_cv_z_nodelete=yes
else
AC_MSG_ERROR(linker with -z nodelete support required)
libc_cv_z_nodelete=no
fi
rm -f conftest*])
AC_SUBST(libc_cv_z_nodelete)
AC_CACHE_CHECK(for -z nodlopen option,
libc_cv_z_nodlopen, [dnl
@ -1416,9 +1420,10 @@ EOF
then
libc_cv_z_nodlopen=yes
else
AC_MSG_ERROR(linker with -z nodlopen support required)
libc_cv_z_nodlopen=no
fi
rm -f conftest*])
AC_SUBST(libc_cv_z_nodlopen)
AC_CACHE_CHECK(for -z initfirst option,
libc_cv_z_initfirst, [dnl
@ -1432,16 +1437,13 @@ EOF
then
libc_cv_z_initfirst=yes
else
AC_MSG_ERROR(linker with -z initfirst support required)
libc_cv_z_initfirst=no
fi
rm -f conftest*])
AC_SUBST(libc_cv_z_initfirst)
case "$base_machine" in
changequote(,)dnl
i[34567]86 | x86_64 | powerpc* | s390* | sparc* | alpha*)
changequote([,])dnl
AC_CACHE_CHECK(for -z relro option,
libc_cv_z_relro, [dnl
AC_CACHE_CHECK(for -z relro option,
libc_cv_z_relro, [dnl
libc_cv_z_relro=no
if AC_TRY_COMMAND([${CC-cc} -v --help 2>&1|grep "z relro" 1>&AS_MESSAGE_LOG_FD])
then
@ -1450,12 +1452,10 @@ changequote([,])dnl
libc_cv_z_relro=yes
fi
fi])
if test "$libc_cv_z_relro" = no; then
AC_MSG_ERROR(linker with -z relro support required)
fi
;;
*) ;;
esac
AC_SUBST(libc_cv_z_relro)
if test $libc_cv_z_relro = yes; then
AC_DEFINE(HAVE_Z_RELRO)
fi
AC_CACHE_CHECK(for -Bgroup option,
libc_cv_Bgroup, [dnl

View File

@ -5,7 +5,7 @@ libc {
# helper functions
__libc_init_first; __libc_start_main;
%if !HAVE___THREAD
%if !(USE_TLS && HAVE___THREAD)
# global variables
_errno;
@ -18,7 +18,7 @@ libc {
gnu_get_libc_release; gnu_get_libc_version;
}
GLIBC_PRIVATE {
%if HAVE___THREAD
%if USE_TLS && HAVE___THREAD
# This version is for the TLS symbol, GLIBC_2.0 is the old object symbol.
errno;
%endif

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1998-2003, 2004, 2005, 2006 Free Software Foundation, Inc.
/* Copyright (C) 1998-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
@ -30,7 +30,11 @@ extern int __libc_multiple_libcs;
#include <tls.h>
#ifndef SHARED
# include <dl-osinfo.h>
extern void __pthread_initialize_minimal (void);
extern void __pthread_initialize_minimal (void)
# if !(USE_TLS - 0) && !defined NONTLS_INIT_TP
__attribute__ ((weak))
# endif
;
# ifndef THREAD_SET_STACK_GUARD
/* Only exported for architectures that don't store the stack guard canary
in thread local area. */
@ -136,8 +140,13 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
/* Initialize the thread library at least a bit since the libgcc
functions are using thread functions if these are available and
we need to setup errno. */
__pthread_initialize_minimal ();
we need to setup errno. If there is no thread library and we
handle TLS the function is defined in the libc to initialized the
TLS handling. */
# if !(USE_TLS - 0) && !defined NONTLS_INIT_TP
if (__pthread_initialize_minimal)
# endif
__pthread_initialize_minimal ();
#endif
# ifndef SHARED

View File

@ -1,5 +1,5 @@
/* Initialization code for TLS in statically linked application.
Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -29,6 +29,7 @@
#error makefile bug, this file is for static only
#endif
#ifdef USE_TLS
extern ElfW(Phdr) *_dl_phdr;
extern size_t _dl_phnum;
@ -142,19 +143,19 @@ __libc_setup_tls (size_t tcbsize, size_t tcbalign)
The initialized value of _dl_tls_static_size is provided by dl-open.c
to request some surplus that permits dynamic loading of modules with
IE-model TLS. */
#if TLS_TCB_AT_TP
# if TLS_TCB_AT_TP
tcb_offset = roundup (memsz + GL(dl_tls_static_size), tcbalign);
tlsblock = __sbrk (tcb_offset + tcbsize + max_align);
#elif TLS_DTV_AT_TP
# elif TLS_DTV_AT_TP
tcb_offset = roundup (tcbsize, align ?: 1);
tlsblock = __sbrk (tcb_offset + memsz + max_align
+ TLS_PRE_TCB_SIZE + GL(dl_tls_static_size));
tlsblock += TLS_PRE_TCB_SIZE;
#else
# else
/* In case a model with a different layout for the TCB and DTV
is defined add another #elif here and in the following #ifs. */
# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
#endif
# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
# endif
/* Align the TLS block. */
tlsblock = (void *) (((uintptr_t) tlsblock + max_align - 1)
@ -165,16 +166,16 @@ __libc_setup_tls (size_t tcbsize, size_t tcbalign)
// static_dtv[1].counter = 0; would be needed if not already done
/* Initialize the TLS block. */
#if TLS_TCB_AT_TP
# if TLS_TCB_AT_TP
static_dtv[2].pointer.val = ((char *) tlsblock + tcb_offset
- roundup (memsz, align ?: 1));
static_map.l_tls_offset = roundup (memsz, align ?: 1);
#elif TLS_DTV_AT_TP
# elif TLS_DTV_AT_TP
static_dtv[2].pointer.val = (char *) tlsblock + tcb_offset;
static_map.l_tls_offset = tcb_offset;
#else
# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
#endif
# else
# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
# endif
static_dtv[2].pointer.is_static = true;
/* sbrk gives us zero'd memory, so we don't need to clear the remainder. */
memcpy (static_dtv[2].pointer.val, initimage, filesz);
@ -182,16 +183,16 @@ __libc_setup_tls (size_t tcbsize, size_t tcbalign)
/* Install the pointer to the dtv. */
/* Initialize the thread pointer. */
#if TLS_TCB_AT_TP
# if TLS_TCB_AT_TP
INSTALL_DTV ((char *) tlsblock + tcb_offset, static_dtv);
const char *lossage = TLS_INIT_TP ((char *) tlsblock + tcb_offset, 0);
#elif TLS_DTV_AT_TP
# elif TLS_DTV_AT_TP
INSTALL_DTV (tlsblock, static_dtv);
const char *lossage = TLS_INIT_TP (tlsblock, 0);
#else
# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
#endif
# else
# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
# endif
if (__builtin_expect (lossage != NULL, 0))
__libc_fatal (lossage);
@ -211,11 +212,11 @@ __libc_setup_tls (size_t tcbsize, size_t tcbalign)
memsz = roundup (memsz, align ?: 1);
#if TLS_TCB_AT_TP
# if TLS_TCB_AT_TP
memsz += tcbsize;
#elif TLS_DTV_AT_TP
# elif TLS_DTV_AT_TP
memsz += tcb_offset;
#endif
# endif
init_static_tls (memsz, MAX (TLS_TCB_ALIGN, max_align));
}
@ -229,11 +230,11 @@ _dl_tls_setup (void)
{
init_slotinfo ();
init_static_tls (
#if TLS_TCB_AT_TP
# if TLS_TCB_AT_TP
TLS_TCB_SIZE,
#else
# else
0,
#endif
# endif
TLS_TCB_ALIGN);
return 0;
}
@ -247,3 +248,16 @@ __pthread_initialize_minimal (void)
{
__libc_setup_tls (TLS_INIT_TCB_SIZE, TLS_INIT_TCB_ALIGN);
}
#elif defined NONTLS_INIT_TP
/* This is the minimal initialization function used when libpthread is
not used. */
void
__attribute__ ((weak))
__pthread_initialize_minimal (void)
{
NONTLS_INIT_TP;
}
#endif

View File

@ -1,5 +1,5 @@
/* Tests for atomic.h macros.
Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
@ -379,117 +379,6 @@ do_test (void)
}
#endif
#ifdef catomic_compare_and_exchange_val_acq
mem = 24;
if (catomic_compare_and_exchange_val_acq (&mem, 35, 24) != 24
|| mem != 35)
{
puts ("catomic_compare_and_exchange_val_acq test 1 failed");
ret = 1;
}
mem = 12;
if (catomic_compare_and_exchange_val_acq (&mem, 10, 15) != 12
|| mem != 12)
{
puts ("catomic_compare_and_exchange_val_acq test 2 failed");
ret = 1;
}
mem = -15;
if (catomic_compare_and_exchange_val_acq (&mem, -56, -15) != -15
|| mem != -56)
{
puts ("catomic_compare_and_exchange_val_acq test 3 failed");
ret = 1;
}
mem = -1;
if (catomic_compare_and_exchange_val_acq (&mem, 17, 0) != -1
|| mem != -1)
{
puts ("catomic_compare_and_exchange_val_acq test 4 failed");
ret = 1;
}
#endif
mem = 24;
if (catomic_compare_and_exchange_bool_acq (&mem, 35, 24)
|| mem != 35)
{
puts ("catomic_compare_and_exchange_bool_acq test 1 failed");
ret = 1;
}
mem = 12;
if (! catomic_compare_and_exchange_bool_acq (&mem, 10, 15)
|| mem != 12)
{
puts ("catomic_compare_and_exchange_bool_acq test 2 failed");
ret = 1;
}
mem = -15;
if (catomic_compare_and_exchange_bool_acq (&mem, -56, -15)
|| mem != -56)
{
puts ("catomic_compare_and_exchange_bool_acq test 3 failed");
ret = 1;
}
mem = -1;
if (! catomic_compare_and_exchange_bool_acq (&mem, 17, 0)
|| mem != -1)
{
puts ("catomic_compare_and_exchange_bool_acq test 4 failed");
ret = 1;
}
mem = 2;
if (catomic_exchange_and_add (&mem, 11) != 2
|| mem != 13)
{
puts ("catomic_exchange_and_add test failed");
ret = 1;
}
mem = -21;
catomic_add (&mem, 22);
if (mem != 1)
{
puts ("catomic_add test failed");
ret = 1;
}
mem = -1;
catomic_increment (&mem);
if (mem != 0)
{
puts ("catomic_increment test failed");
ret = 1;
}
mem = 2;
if (catomic_increment_val (&mem) != 3)
{
puts ("catomic_increment_val test failed");
ret = 1;
}
mem = 17;
catomic_decrement (&mem);
if (mem != 16)
{
puts ("catomic_decrement test failed");
ret = 1;
}
if (catomic_decrement_val (&mem) != 15)
{
puts ("catomic_decrement_val test failed");
ret = 1;
}
return ret;
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1992-2006, 2007 Free Software Foundation, Inc.
/* Copyright (C) 1992-2002, 2003, 2004, 2006 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
@ -25,7 +25,7 @@ static const char __libc_version[] = VERSION;
static const char banner[] =
"GNU C Library "RELEASE" release version "VERSION", by Roland McGrath et al.\n\
Copyright (C) 2007 Free Software Foundation, Inc.\n\
Copyright (C) 2006 Free Software Foundation, Inc.\n\
This is free software; see the source for copying conditions.\n\
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A\n\
PARTICULAR PURPOSE.\n\
@ -34,6 +34,9 @@ Compiled by GNU CC version "__VERSION__".\n"
#ifdef GLIBC_OLDEST_ABI
"The oldest ABI supported: " GLIBC_OLDEST_ABI ".\n"
#endif
#ifdef USE_TLS
"Thread-local storage support included.\n"
#endif
"For bug reporting instructions, please see:\n\
<http://www.gnu.org/software/libc/bugs.html>.\n";

View File

@ -1,6 +1,5 @@
#! /bin/sh
# Copyright (C) 1998,1999,2001,2003,2004,2006,2007
# Free Software Foundation, Inc.
# Copyright (C) 1998,1999,2001,2003,2004,2006 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@ -40,7 +39,7 @@ if test $# -eq 0; then
;;
--v | --ve | --ver | --vers | --versi | --versio | --version)
echo 'catchsegv (GNU libc) @VERSION@'
echo 'Copyright (C) 2007 Free Software Foundation, Inc.
echo 'Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Ulrich Drepper.'

View File

@ -1,5 +1,5 @@
#! @BASH@
# Copyright (C) 1999, 2001-2006, 2007 Free Software Foundation, Inc.
# Copyright (C) 1999, 2001-2004, 2005, 2006 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# Contributed by Ulrich Drepper <drepper@gnu.org>, 1999.
@ -64,7 +64,7 @@ do_version() {
printf $"Copyright (C) %s Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
" "2007"
" "2006"
printf $"Written by %s.
" "Ulrich Drepper"
exit 0

View File

@ -41,7 +41,10 @@ endif
ifeq (yes,$(build-shared))
tests = glrefmain failtest tst-dladdr default errmsg1 tstcxaatexit \
bug-dlopen1 bug-dlsym1 tst-dlinfo bug-atexit1 bug-atexit2 \
bug-atexit3 tstatexit
bug-atexit3
ifeq (yes,$(have-protected))
tests += tstatexit
endif
endif
modules-names = glreflib1 glreflib2 failtestmod defaultmod1 defaultmod2 \
errmsg1mod modatexit modcxaatexit \

View File

@ -32,7 +32,9 @@ dlinfo (void *handle, int request, void *arg)
#else
# include <dl-tls.h>
# ifdef USE_TLS
# include <dl-tls.h>
# endif
struct dlinfo_args
{
@ -95,14 +97,18 @@ RTLD_SELF used in code not dynamically loaded"));
case RTLD_DI_TLS_MODID:
*(size_t *) args->arg = 0;
#ifdef USE_TLS
*(size_t *) args->arg = l->l_tls_modid;
#endif
break;
case RTLD_DI_TLS_DATA:
{
void *data = NULL;
#ifdef USE_TLS
if (l->l_tls_modid != 0)
data = _dl_tls_get_addr_soft (l);
#endif
*(void **) args->arg = data;
break;
}

View File

@ -159,8 +159,8 @@ endif
ifeq (yes,$(build-shared))
tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
constload1 order $(tests-vis-$(have-protected)) noload filter unload \
reldep reldep2 reldep3 reldep4 nodelete nodelete2 \
nodlopen nodlopen2 neededtest neededtest2 \
reldep reldep2 reldep3 reldep4 $(tests-nodelete-$(have-z-nodelete)) \
$(tests-nodlopen-$(have-z-nodlopen)) neededtest neededtest2 \
neededtest3 neededtest4 unload2 lateglobal initfirst global \
restest2 next dblload dblunload reldep5 reldep6 reldep7 reldep8 \
circleload1 tst-tls3 tst-tls4 tst-tls5 tst-tls6 tst-tls7 tst-tls8 \
@ -171,10 +171,12 @@ tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
tst-dlmopen1 tst-dlmopen2 tst-dlmopen3 \
unload3 unload4 unload5 unload6 unload7 tst-global1 order2 \
tst-audit1 tst-audit2 \
tst-stackguard1 tst-addr1 tst-thrlock
tst-stackguard1 tst-addr1
# reldep9
test-srcs = tst-pathopt
tests-vis-yes = vismain
tests-nodelete-yes = nodelete nodelete2
tests-nodlopen-yes = nodlopen nodlopen2
tests-execstack-yes = tst-execstack tst-execstack-needed tst-execstack-prog
endif
ifeq (yesyes,$(have-fpie)$(build-shared))
@ -184,9 +186,8 @@ tests: $(objpfx)tst-leaks1-mem
modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
testobj1_1 failobj constload2 constload3 unloadmod \
dep1 dep2 dep3 dep4 $(modules-vis-$(have-protected)) \
nodelmod1 nodelmod2 nodelmod3 nodelmod4 \
nodel2mod1 nodel2mod2 nodel2mod3 \
nodlopenmod nodlopenmod2 filtmod1 filtmod2 \
$(modules-nodelete-$(have-z-nodelete)) \
$(modules-nodlopen-$(have-z-nodlopen)) filtmod1 filtmod2 \
reldepmod1 reldepmod2 reldepmod3 reldepmod4 nextmod1 nextmod2 \
reldep4mod1 reldep4mod2 reldep4mod3 reldep4mod4 \
neededobj1 neededobj2 neededobj3 neededobj4 \
@ -220,6 +221,9 @@ ifeq (yesyes,$(have-fpie)$(build-shared))
modules-names += tst-piemod1
endif
modules-vis-yes = vismod1 vismod2 vismod3
modules-nodelete-yes = nodelmod1 nodelmod2 nodelmod3 nodelmod4 \
nodel2mod1 nodel2mod2 nodel2mod3
modules-nodlopen-yes = nodlopenmod nodlopenmod2
modules-execstack-yes = tst-execstack-mod
extra-test-objs += $(addsuffix .os,$(strip $(modules-names)))
# We need this variable to be sure the test modules get the right CPPFLAGS.
@ -912,5 +916,3 @@ $(objpfx)tst-leaks1-mem: $(objpfx)tst-leaks1.out
tst-leaks1-ENV = MALLOC_TRACE=$(objpfx)tst-leaks1.mtrace
$(objpfx)tst-addr1: $(libdl)
$(objpfx)tst-thrlock: $(libdl) $(shared-thread-library)

View File

@ -439,7 +439,7 @@ save_cache (const char *cache_name)
}
if (write (fd, strings, total_strlen) != (ssize_t) total_strlen)
error (EXIT_FAILURE, errno, _("Writing of cache data failed"));
error (EXIT_FAILURE, errno, _("Writing of cache data failed."));
close (fd);

View File

@ -93,7 +93,9 @@ _dl_addr (const void *address, Dl_info *info,
so we can omit that test here. */
if ((symtab[symndx].st_shndx != SHN_UNDEF
|| symtab[symndx].st_value != 0)
#ifdef USE_TLS
&& ELFW(ST_TYPE) (symtab[symndx].st_info) != STT_TLS
#endif
&& DL_ADDR_SYM_MATCH (match, &symtab[symndx],
matchsym, addr)
&& symtab[symndx].st_name < strtabsize)
@ -121,7 +123,9 @@ _dl_addr (const void *address, Dl_info *info,
for (; (void *) symtab < (void *) symtabend; ++symtab)
if ((ELFW(ST_BIND) (symtab->st_info) == STB_GLOBAL
|| ELFW(ST_BIND) (symtab->st_info) == STB_WEAK)
#ifdef USE_TLS
&& ELFW(ST_TYPE) (symtab->st_info) != STT_TLS
#endif
&& (symtab->st_shndx != SHN_UNDEF
|| symtab->st_value != 0)
&& DL_ADDR_SYM_MATCH (match, symtab, matchsym, addr)

View File

@ -256,7 +256,11 @@ _dl_load_cache_lookup (const char *name)
platform = 1ULL << platform;
/* Only accept hwcap if it's for the right platform. */
#define _DL_HWCAP_TLS_MASK (1LL << 63)
#ifdef USE_TLS
# define _DL_HWCAP_TLS_MASK (1LL << 63)
#else
# define _DL_HWCAP_TLS_MASK 0
#endif
#define HWCAP_CHECK \
if (GLRO(dl_osversion) && lib->osversion > GLRO(dl_osversion)) \
continue; \

View File

@ -19,7 +19,6 @@
#include <assert.h>
#include <dlfcn.h>
#include <errno.h>
#include <libintl.h>
#include <stddef.h>
#include <stdio.h>
@ -30,17 +29,13 @@
#include <ldsodefs.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <sysdep-cancel.h>
/* Type of the constructor functions. */
typedef void (*fini_t) (void);
/* Special l_idx value used to indicate which objects remain loaded. */
#define IDX_STILL_USED -1
#ifdef USE_TLS
/* Returns true we an non-empty was found. */
static bool
remove_slotinfo (size_t idx, struct dtv_slotinfo_list *listp, size_t disp,
@ -102,12 +97,26 @@ remove_slotinfo (size_t idx, struct dtv_slotinfo_list *listp, size_t disp,
/* No non-entry in this list element. */
return false;
}
#endif
void
_dl_close_worker (struct link_map *map)
_dl_close (void *_map)
{
struct link_map *map = _map;
Lmid_t ns = map->l_ns;
unsigned int i;
/* First see whether we can remove the object at all. */
if (__builtin_expect (map->l_flags_1 & DF_1_NODELETE, 0)
&& map->l_init_called)
/* Nope. Do nothing. */
return;
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. */
--map->l_direct_opencount;
@ -128,13 +137,16 @@ _dl_close_worker (struct link_map *map)
_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;
}
retry:
dl_close_state = pending;
#ifdef USE_TLS
bool any_tls = false;
#endif
const unsigned int nloaded = GL(dl_ns)[ns]._ns_nloaded;
char used[nloaded];
char done[nloaded];
@ -176,7 +188,7 @@ _dl_close_worker (struct link_map *map)
done[done_index] = 1;
used[done_index] = 1;
/* Signal the object is still needed. */
l->l_idx = IDX_STILL_USED;
l->l_idx = -1;
/* Mark all dependencies as used. */
if (l->l_initfini != NULL)
@ -184,7 +196,7 @@ _dl_close_worker (struct link_map *map)
struct link_map **lp = &l->l_initfini[1];
while (*lp != NULL)
{
if ((*lp)->l_idx != IDX_STILL_USED)
if ((*lp)->l_idx != -1)
{
assert ((*lp)->l_idx >= 0 && (*lp)->l_idx < nloaded);
@ -205,7 +217,7 @@ _dl_close_worker (struct link_map *map)
{
struct link_map *jmap = l->l_reldeps[j];
if (jmap->l_idx != IDX_STILL_USED)
if (jmap->l_idx != -1)
{
assert (jmap->l_idx >= 0 && jmap->l_idx < nloaded);
@ -228,7 +240,7 @@ _dl_close_worker (struct link_map *map)
#endif
bool unload_any = false;
unsigned int first_loaded = ~0;
for (unsigned int i = 0; i < nloaded; ++i)
for (i = 0; i < nloaded; ++i)
{
struct link_map *imap = maps[i];
@ -298,9 +310,8 @@ _dl_close_worker (struct link_map *map)
/* Else used[i]. */
else if (imap->l_type == lt_loaded)
{
struct r_scope_elem *new_list = NULL;
if (imap->l_searchlist.r_list == NULL && imap->l_initfini != NULL)
if (imap->l_searchlist.r_list == NULL
&& imap->l_initfini != NULL)
{
/* The object is still used. But one of the objects we are
unloading right now is responsible for loading it. If
@ -317,108 +328,44 @@ _dl_close_worker (struct link_map *map)
imap->l_searchlist.r_list = &imap->l_initfini[cnt + 1];
imap->l_searchlist.r_nlist = cnt;
new_list = &imap->l_searchlist;
for (cnt = 0; imap->l_scope[cnt] != NULL; ++cnt)
/* This relies on l_scope[] entries being always set either
to its own l_symbolic_searchlist address, or some map's
l_searchlist address. */
if (imap->l_scope[cnt] != &imap->l_symbolic_searchlist)
{
struct link_map *tmap;
tmap = (struct link_map *) ((char *) imap->l_scope[cnt]
- offsetof (struct link_map,
l_searchlist));
assert (tmap->l_ns == ns);
if (tmap->l_idx != -1)
{
imap->l_scope[cnt] = &imap->l_searchlist;
break;
}
}
}
/* Count the number of scopes which remain after the unload.
When we add the local search list count it. Always add
one for the terminating NULL pointer. */
size_t remain = (new_list != NULL) + 1;
bool removed_any = false;
for (size_t cnt = 0; imap->l_scope[cnt] != NULL; ++cnt)
/* This relies on l_scope[] entries being always set either
to its own l_symbolic_searchlist address, or some map's
l_searchlist address. */
if (imap->l_scope[cnt] != &imap->l_symbolic_searchlist)
{
struct link_map *tmap = (struct link_map *)
((char *) imap->l_scope[cnt]
- offsetof (struct link_map, l_searchlist));
assert (tmap->l_ns == ns);
if (tmap->l_idx == IDX_STILL_USED)
++remain;
else
removed_any = true;
}
else
++remain;
if (removed_any)
else
{
/* Always allocate a new array for the scope. This is
necessary since we must be able to determine the last
user of the current array. If possible use the link map's
memory. */
size_t new_size;
struct r_scope_elem **newp;
#define SCOPE_ELEMS(imap) \
(sizeof (imap->l_scope_mem) / sizeof (imap->l_scope_mem[0]))
if (imap->l_scope != imap->l_scope_mem
&& remain < SCOPE_ELEMS (imap))
unsigned int cnt = 0;
while (imap->l_scope[cnt] != NULL)
{
new_size = SCOPE_ELEMS (imap);
newp = imap->l_scope_mem;
}
else
{
new_size = imap->l_scope_max;
newp = (struct r_scope_elem **)
malloc (new_size * sizeof (struct r_scope_elem *));
if (newp == NULL)
_dl_signal_error (ENOMEM, "dlclose", NULL,
N_("cannot create scope list"));
}
/* Copy over the remaining scope elements. */
remain = 0;
for (size_t cnt = 0; imap->l_scope[cnt] != NULL; ++cnt)
{
if (imap->l_scope[cnt] != &imap->l_symbolic_searchlist)
if (imap->l_scope[cnt] == &map->l_searchlist)
{
struct link_map *tmap = (struct link_map *)
((char *) imap->l_scope[cnt]
- offsetof (struct link_map, l_searchlist));
if (tmap->l_idx != IDX_STILL_USED)
{
/* Remove the scope. Or replace with own map's
scope. */
if (new_list != NULL)
{
newp[remain++] = new_list;
new_list = NULL;
}
continue;
}
while ((imap->l_scope[cnt] = imap->l_scope[cnt + 1])
!= NULL)
++cnt;
break;
}
newp[remain++] = imap->l_scope[cnt];
++cnt;
}
newp[remain] = NULL;
struct r_scope_elem **old = imap->l_scope;
if (RTLD_SINGLE_THREAD_P)
imap->l_scope = newp;
else
{
__rtld_mrlock_change (imap->l_scope_lock);
imap->l_scope = newp;
__rtld_mrlock_done (imap->l_scope_lock);
}
/* No user anymore, we can free it now. */
if (old != imap->l_scope_mem)
free (old);
imap->l_scope_max = new_size;
}
/* The loader is gone, so mark the object as not having one.
Note: l_idx != IDX_STILL_USED -> object will be removed. */
if (imap->l_loader != NULL
&& imap->l_loader->l_idx != IDX_STILL_USED)
Note: l_idx != -1 -> object will be removed. */
if (imap->l_loader != NULL && imap->l_loader->l_idx != -1)
imap->l_loader = NULL;
/* Remember where the first dynamically loaded object is. */
@ -456,13 +403,15 @@ _dl_close_worker (struct link_map *map)
r->r_state = RT_DELETE;
_dl_debug_state ();
#ifdef USE_TLS
size_t tls_free_start;
size_t tls_free_end;
tls_free_start = tls_free_end = NO_TLS_OFFSET;
#endif
/* Check each element of the search list to see if all references to
it are gone. */
for (unsigned int i = first_loaded; i < nloaded; ++i)
for (i = first_loaded; i < nloaded; ++i)
{
struct link_map *imap = maps[i];
if (!used[i])
@ -489,6 +438,7 @@ _dl_close_worker (struct link_map *map)
--GL(dl_ns)[ns]._ns_main_searchlist->r_nlist;
}
#ifdef USE_TLS
/* Remove the object from the dtv slotinfo array if it uses TLS. */
if (__builtin_expect (imap->l_tls_blocksize > 0, 0))
{
@ -507,7 +457,7 @@ _dl_close_worker (struct link_map *map)
this search list, going in either direction. When the
whole chunk is at the end of the used area then we can
reclaim it. */
#if TLS_TCB_AT_TP
# if TLS_TCB_AT_TP
if (tls_free_start == NO_TLS_OFFSET
|| (size_t) imap->l_tls_offset == tls_free_start)
{
@ -547,7 +497,7 @@ _dl_close_worker (struct link_map *map)
= tls_free_end - imap->l_tls_blocksize;
}
}
#elif TLS_DTV_AT_TP
# elif TLS_DTV_AT_TP
if ((size_t) imap->l_tls_offset == tls_free_end)
/* Extend the contiguous chunk being reclaimed. */
tls_free_end -= imap->l_tls_blocksize;
@ -564,11 +514,12 @@ _dl_close_worker (struct link_map *map)
tls_free_start = imap->l_tls_offset;
tls_free_end = tls_free_start + imap->l_tls_blocksize;
}
#else
# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
#endif
# else
# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
# endif
}
}
#endif
/* We can unmap all the maps at once. We determined the
start address and length when we loaded the object and
@ -634,6 +585,7 @@ _dl_close_worker (struct link_map *map)
}
}
#ifdef USE_TLS
/* If we removed any object which uses TLS bump the generation counter. */
if (any_tls)
{
@ -643,6 +595,7 @@ _dl_close_worker (struct link_map *map)
if (tls_free_end == GL(dl_tls_static_used))
GL(dl_tls_static_used) = tls_free_start;
}
#endif
#ifdef SHARED
/* Auditing checkpoint: we have deleted all objects. */
@ -674,34 +627,11 @@ _dl_close_worker (struct link_map *map)
goto retry;
dl_close_state = not_pending;
}
void
_dl_close (void *_map)
{
struct link_map *map = _map;
/* First see whether we can remove the object at all. */
if (__builtin_expect (map->l_flags_1 & DF_1_NODELETE, 0))
{
assert (map->l_init_called);
/* Nope. Do nothing. */
return;
}
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));
_dl_close_worker (map);
__rtld_lock_unlock_recursive (GL(dl_load_lock));
}
#ifdef USE_TLS
static bool __libc_freeres_fn_section
free_slotinfo (struct dtv_slotinfo_list **elemp)
{
@ -728,6 +658,7 @@ free_slotinfo (struct dtv_slotinfo_list **elemp)
return true;
}
#endif
libc_freeres_fn (free_mem)
@ -753,20 +684,22 @@ libc_freeres_fn (free_mem)
free (old);
}
#ifdef USE_TLS
if (USE___THREAD || GL(dl_tls_dtv_slotinfo_list) != NULL)
{
/* Free the memory allocated for the dtv slotinfo array. We can do
this only if all modules which used this memory are unloaded. */
#ifdef SHARED
# ifdef SHARED
if (GL(dl_initial_dtv) == NULL)
/* There was no initial TLS setup, it was set up later when
it used the normal malloc. */
free_slotinfo (&GL(dl_tls_dtv_slotinfo_list));
else
#endif
# endif
/* The first element of the list does not have to be deallocated.
It was allocated in the dynamic linker (i.e., with a different
malloc), and in the static library it's in .bss space. */
free_slotinfo (&GL(dl_tls_dtv_slotinfo_list)->next);
}
#endif
}

View File

@ -54,7 +54,7 @@ _dl_debug_initialize (ElfW(Addr) ldbase, Lmid_t ns)
else
r = &GL(dl_ns)[ns]._ns_debug;
if (r->r_map == NULL || ldbase != 0)
if (r->r_brk == 0 || ldbase != 0)
{
/* Tell the debugger where to find the map of loaded objects. */
r->r_version = 1 /* R_DEBUG_VERSION XXX */;

View File

@ -123,7 +123,7 @@ DST not allowed in SUID/SGID programs")); \
processed. */ \
if (fatal) \
_dl_signal_error (0, __str, NULL, N_("\
empty dynamic string token substitution")); \
empty dynamics string token substitution")); \
else \
{ \
/* This is for DT_AUXILIARY. */ \

View File

@ -1,5 +1,5 @@
/* Manage function descriptors. Generic version.
Copyright (C) 1999-2004, 2006 Free Software Foundation, Inc.
Copyright (C) 1999,2000,2001,2002,2003,2004 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
@ -40,7 +40,7 @@
#ifndef COMPARE_AND_SWAP
# define COMPARE_AND_SWAP(ptr, old, new) \
(catomic_compare_and_exchange_bool_acq (ptr, new, old) == 0)
(atomic_compare_and_exchange_bool_acq (ptr, new, old) == 0)
#endif
ElfW(Addr) _dl_boot_fptr_table [ELF_MACHINE_BOOT_FPTR_TABLE_LEN];

View File

@ -70,9 +70,11 @@ __dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info,
info.dlpi_subs = GL(dl_load_adds) - nloaded;
info.dlpi_tls_modid = 0;
info.dlpi_tls_data = NULL;
#ifdef USE_TLS
info.dlpi_tls_modid = l->l_tls_modid;
if (info.dlpi_tls_modid != 0)
info.dlpi_tls_data = _dl_tls_get_addr_soft (l);
#endif
ret = callback (&info, sizeof (struct dl_phdr_info), data);
if (ret)
break;

View File

@ -1,5 +1,5 @@
/* Handle loading and unloading shared objects for internal libc purposes.
Copyright (C) 1999-2002,2004,2005,2006 Free Software Foundation, Inc.
Copyright (C) 1999,2000,2001,2002,2004,2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Zack Weinberg <zack@rabi.columbia.edu>, 1999.

View File

@ -511,7 +511,7 @@ fillin_rpath (char *rpath, struct r_search_path_elem **result, const char *sep,
}
static bool
static void
internal_function
decompose_rpath (struct r_search_path_struct *sps,
const char *rpath, struct link_map *l, const char *what)
@ -546,8 +546,19 @@ decompose_rpath (struct r_search_path_struct *sps,
{
/* This object is on the list of objects for which the
RUNPATH and RPATH must not be used. */
sps->dirs = (void *) -1;
return false;
result = calloc (1, sizeof *result);
if (result == NULL)
{
signal_error_cache:
errstring = N_("cannot create cache for search path");
signal_error:
_dl_signal_error (ENOMEM, NULL, NULL, errstring);
}
sps->dirs = result;
sps->malloced = 1;
return;
}
while (*inhp != '\0')
@ -577,11 +588,7 @@ decompose_rpath (struct r_search_path_struct *sps,
result = (struct r_search_path_elem **) malloc ((nelems + 1 + 1)
* sizeof (*result));
if (result == NULL)
{
errstring = N_("cannot create cache for search path");
signal_error:
_dl_signal_error (ENOMEM, NULL, NULL, errstring);
}
goto signal_error_cache;
fillin_rpath (copy, result, ":", 0, what, where);
@ -592,7 +599,6 @@ decompose_rpath (struct r_search_path_struct *sps,
sps->dirs = result;
/* The caller will change this value if we haven't used a real malloc. */
sps->malloced = 1;
return true;
}
/* Make sure cached path information is stored in *SP
@ -617,9 +623,10 @@ cache_rpath (struct link_map *l,
}
/* Make sure the cache information is available. */
return decompose_rpath (sp, (const char *) (D_PTR (l, l_info[DT_STRTAB])
+ l->l_info[tag]->d_un.d_val),
l, what);
decompose_rpath (sp, (const char *) (D_PTR (l, l_info[DT_STRTAB])
+ l->l_info[tag]->d_un.d_val),
l, what);
return true;
}
@ -1078,6 +1085,7 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
break;
case PT_TLS:
#ifdef USE_TLS
if (ph->p_memsz == 0)
/* Nothing to do for an empty segment. */
break;
@ -1105,7 +1113,7 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
break;
}
#ifdef SHARED
# ifdef SHARED
if (l->l_prev == NULL || (mode & __RTLD_AUDIT) != 0)
/* We are loading the executable itself when the dynamic linker
was executed directly. The setup will happen later. */
@ -1114,7 +1122,7 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
/* In a static binary there is no way to tell if we dynamically
loaded libpthread. */
if (GL(dl_error_catch_tsd) == &_dl_initial_error_catch_tsd)
#endif
# endif
{
/* We have not yet loaded libpthread.
We can do the TLS setup right now! */
@ -1147,6 +1155,7 @@ cannot allocate TLS data structures for initial thread");
_dl_deallocate_tls (tcb, 1);
goto call_lose;
}
#endif
/* Uh-oh, the binary expects TLS support but we cannot
provide it. */
@ -1385,7 +1394,7 @@ cannot allocate TLS data structures for initial thread");
requires that it be executable. We must change the
protection of the variable which contains the flags used in
the mprotect calls. */
#ifdef SHARED
#if defined HAVE_Z_RELRO && defined SHARED
if ((mode & (__RTLD_DLOPEN | __RTLD_AUDIT)) == __RTLD_DLOPEN)
{
const uintptr_t p = (uintptr_t) &__stack_prot & -GLRO(dl_pagesize);
@ -1422,9 +1431,11 @@ cannot enable executable stack as shared object requires");
}
}
#ifdef USE_TLS
/* Adjust the address of the TLS initialization image. */
if (l->l_tls_initimage != NULL)
l->l_tls_initimage = (char *) l->l_tls_initimage + l->l_addr;
#endif
/* We are done mapping in the file. We no longer need the descriptor. */
if (__builtin_expect (__close (fd) != 0, 0))
@ -1928,10 +1939,11 @@ open_path (const char *name, size_t namelen, int preloaded,
must not be freed using the general free() in libc. */
if (sps->malloced)
free (sps->dirs);
#ifdef HAVE_Z_RELRO
/* rtld_search_dirs is attribute_relro, therefore avoid writing
into it. */
if (sps != &rtld_search_dirs)
#endif
sps->dirs = (void *) -1;
}

View File

@ -200,17 +200,14 @@ add_dependency (struct link_map *undef_map, struct link_map *map)
static void
internal_function
_dl_debug_bindings (const char *undef_name, struct link_map *undef_map,
const ElfW(Sym) **ref, struct sym_val *value,
const ElfW(Sym) **ref, struct r_scope_elem *symbol_scope[],
struct sym_val *value,
const struct r_found_version *version, int type_class,
int protected);
/* Search loaded objects' symbol tables for a definition of the symbol
UNDEF_NAME, perhaps with a requested version for the symbol.
We must never have calls to the audit functions inside this function
or in any function which gets called. If this would happen the audit
code might create a thread which can throw off all the scope locking. */
UNDEF_NAME, perhaps with a requested version for the symbol. */
lookup_t
internal_function
_dl_lookup_symbol_x (const char *undef_name, struct link_map *undef_map,
@ -350,7 +347,7 @@ _dl_lookup_symbol_x (const char *undef_name, struct link_map *undef_map,
if (__builtin_expect (GLRO(dl_debug_mask)
& (DL_DEBUG_BINDINGS|DL_DEBUG_PRELINK), 0))
_dl_debug_bindings (undef_name, undef_map, ref,
_dl_debug_bindings (undef_name, undef_map, ref, symbol_scope,
&current_value, version, type_class, protected);
*ref = current_value.s;
@ -407,7 +404,8 @@ _dl_setup_hash (struct link_map *map)
static void
internal_function
_dl_debug_bindings (const char *undef_name, struct link_map *undef_map,
const ElfW(Sym) **ref, struct sym_val *value,
const ElfW(Sym) **ref, struct r_scope_elem *symbol_scope[],
struct sym_val *value,
const struct r_found_version *version, int type_class,
int protected)
{
@ -449,10 +447,12 @@ _dl_debug_bindings (const char *undef_name, struct link_map *undef_map,
conflict = 1;
}
# ifdef USE_TLS
if (value->s
&& (__builtin_expect (ELFW(ST_TYPE) (value->s->st_info)
== STT_TLS, 0)))
type_class = 4;
# endif
if (conflict
|| GLRO(dl_trace_prelink_map) == undef_map

View File

@ -1,6 +1,5 @@
/* Minimal replacements for basic facilities used in the dynamic linker.
Copyright (C) 1995-1998,2000-2002,2004,2005,2006
Free Software Foundation, Inc.
Copyright (C) 1995-1998,2000-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
@ -129,13 +128,14 @@ free (void *ptr)
void * weak_function
realloc (void *ptr, size_t n)
{
void *new;
if (ptr == NULL)
return malloc (n);
assert (ptr == alloc_last_block);
size_t old_size = alloc_ptr - alloc_last_block;
alloc_ptr = alloc_last_block;
void *new = malloc (n);
return new != ptr ? memcpy (new, ptr, old_size) : new;
new = malloc (n);
assert (new == ptr);
return new;
}
/* Avoid signal frobnication in setjmp/longjmp. Keeps things smaller. */

View File

@ -1,5 +1,5 @@
/* Storage management for the chain of loaded shared objects.
Copyright (C) 1995-2002, 2004, 2006 Free Software Foundation, Inc.
Copyright (C) 1995-2002, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -64,7 +64,7 @@ _dl_new_object (char *realname, const char *libname, int type,
new->l_name = realname;
new->l_type = type;
new->l_loader = loader;
#if NO_TLS_OFFSET != 0
#if defined USE_TLS && NO_TLS_OFFSET != 0
new->l_tls_offset = NO_TLS_OFFSET;
#endif
new->l_ns = nsid;
@ -85,11 +85,6 @@ _dl_new_object (char *realname, const char *libname, int type,
new->l_scope = new->l_scope_mem;
new->l_scope_max = sizeof (new->l_scope_mem) / sizeof (new->l_scope_mem[0]);
/* No need to initialize the scope lock if the initializer is zero. */
#if _RTLD_MRLOCK_INITIALIZER != 0
__rtld_mrlock_initialize (new->l_scope_lock);
#endif
/* Counter for the scopes we have to handle. */
idx = 0;

View File

@ -31,7 +31,6 @@
#include <ldsodefs.h>
#include <bp-sym.h>
#include <caller.h>
#include <sysdep-cancel.h>
#include <dl-dst.h>
@ -164,7 +163,9 @@ dl_open_worker (void *a)
struct link_map *new, *l;
int lazy;
unsigned int i;
#ifdef USE_TLS
bool any_tls = false;
#endif
struct link_map *call_map = NULL;
/* Check whether _dl_open() has been called from a valid DSO. */
@ -378,8 +379,6 @@ dl_open_worker (void *a)
while (*runp != NULL)
{
if (*runp == &new->l_searchlist)
break;
++cnt;
++runp;
}
@ -392,53 +391,37 @@ dl_open_worker (void *a)
{
/* The 'r_scope' array is too small. Allocate a new one
dynamically. */
size_t new_size;
struct r_scope_elem **newp;
size_t new_size = imap->l_scope_max * 2;
#define SCOPE_ELEMS(imap) \
(sizeof (imap->l_scope_mem) / sizeof (imap->l_scope_mem[0]))
if (imap->l_scope != imap->l_scope_mem
&& imap->l_scope_max < SCOPE_ELEMS (imap))
if (imap->l_scope == imap->l_scope_mem)
{
new_size = SCOPE_ELEMS (imap);
newp = imap->l_scope_mem;
}
else
{
new_size = imap->l_scope_max * 2;
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]));
}
memcpy (newp, imap->l_scope, cnt * sizeof (imap->l_scope[0]));
struct r_scope_elem **old = imap->l_scope;
if (RTLD_SINGLE_THREAD_P)
imap->l_scope = newp;
else
{
__rtld_mrlock_change (imap->l_scope_lock);
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;
__rtld_mrlock_done (imap->l_scope_lock);
}
if (old != imap->l_scope_mem)
free (old);
imap->l_scope_max = new_size;
}
/* First terminate the extended list. Otherwise a thread
might use the new last element and then use the garbage
at offset IDX+1. */
imap->l_scope[cnt + 1] = NULL;
atomic_write_barrier ();
imap->l_scope[cnt] = &new->l_searchlist;
imap->l_scope[cnt++] = &new->l_searchlist;
imap->l_scope[cnt] = NULL;
}
#if USE_TLS
/* Only add TLS memory if this object is loaded now and
therefore is not yet initialized. */
else if (! imap->l_init_called
@ -453,11 +436,11 @@ dl_open_worker (void *a)
if (imap->l_need_tls_init)
{
imap->l_need_tls_init = 0;
#ifdef SHARED
# ifdef SHARED
/* 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
# endif
GL(dl_init_static_tls) (imap);
assert (imap->l_need_tls_init == 0);
@ -466,12 +449,15 @@ dl_open_worker (void *a)
/* We have to bump the generation counter. */
any_tls = true;
}
#endif
}
#if USE_TLS
/* Bump the generation number if necessary. */
if (any_tls && __builtin_expect (++GL(dl_tls_generation) == 0, 0))
_dl_fatal_printf (N_("\
TLS generation counter wrapped! Please report this."));
#endif
/* Run the initializer functions of new objects. */
_dl_init (new, args->argc, args->argv, args->env);
@ -561,13 +547,20 @@ no more namespaces available for dlmopen()"));
_dl_unload_cache ();
#endif
/* See if an error occurred during loading. */
/* Release the lock. */
__rtld_lock_unlock_recursive (GL(dl_load_lock));
if (__builtin_expect (errstring != NULL, 0))
{
/* Some error occurred during loading. */
char *local_errstring;
size_t len_errstring;
/* Remove the object from memory. It may be in an inconsistent
state if relocation failed, for example. */
if (args.map)
{
#ifdef USE_TLS
/* Maybe some of the modules which were loaded use TLS.
Since it will be removed in the following _dl_close call
we have to mark the dtv array as having gaps to fill the
@ -577,19 +570,14 @@ no more namespaces available for dlmopen()"));
up. */
if ((mode & __RTLD_AUDIT) == 0)
GL(dl_tls_dtv_gaps) = true;
#endif
_dl_close_worker (args.map);
_dl_close (args.map);
}
assert (_dl_debug_initialize (0, args.nsid)->r_state == RT_CONSISTENT);
/* Release the lock. */
__rtld_lock_unlock_recursive (GL(dl_load_lock));
/* Make a local copy of the error string so that we can release the
memory allocated for it. */
size_t len_errstring = strlen (errstring) + 1;
char *local_errstring;
len_errstring = strlen (errstring) + 1;
if (objname == errstring + len_errstring)
{
size_t total_len = len_errstring + strlen (objname) + 1;
@ -606,15 +594,14 @@ no more namespaces available for dlmopen()"));
if (malloced)
free ((char *) errstring);
assert (_dl_debug_initialize (0, args.nsid)->r_state == RT_CONSISTENT);
/* Reraise the error. */
_dl_signal_error (errcode, objname, NULL, local_errstring);
}
assert (_dl_debug_initialize (0, args.nsid)->r_state == RT_CONSISTENT);
/* Release the lock. */
__rtld_lock_unlock_recursive (GL(dl_load_lock));
#ifndef SHARED
DL_STATIC_INIT (args.map);
#endif

View File

@ -1,5 +1,5 @@
/* Profiling of shared libraries.
Copyright (C) 1997-2002, 2003, 2004, 2006 Free Software Foundation, Inc.
Copyright (C) 1997-2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
Based on the BSD mcount implementation.
@ -509,24 +509,24 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
size_t newfromidx;
to_index = (data[narcs].self_pc
/ (HASHFRACTION * sizeof (*tos)));
newfromidx = catomic_exchange_and_add (&fromidx, 1) + 1;
newfromidx = atomic_exchange_and_add (&fromidx, 1) + 1;
froms[newfromidx].here = &data[narcs];
froms[newfromidx].link = tos[to_index];
tos[to_index] = newfromidx;
catomic_increment (&narcs);
atomic_increment (&narcs);
}
/* If we still have no entry stop searching and insert. */
if (*topcindex == 0)
{
uint_fast32_t newarc = catomic_exchange_and_add (narcsp, 1);
uint_fast32_t newarc = atomic_exchange_and_add (narcsp, 1);
/* In rare cases it could happen that all entries in FROMS are
occupied. So we cannot count this anymore. */
if (newarc >= fromlimit)
goto done;
*topcindex = catomic_exchange_and_add (&fromidx, 1) + 1;
*topcindex = atomic_exchange_and_add (&fromidx, 1) + 1;
fromp = &froms[*topcindex];
fromp->here = &data[newarc];
@ -534,7 +534,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
data[newarc].self_pc = selfpc;
data[newarc].count = 0;
fromp->link = 0;
catomic_increment (&narcs);
atomic_increment (&narcs);
break;
}
@ -547,7 +547,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
}
/* Increment the counter. */
catomic_increment (&fromp->here->count);
atomic_increment (&fromp->here->count);
done:
;

View File

@ -1,5 +1,5 @@
/* Relocate a shared object and resolve its references to other loaded objects.
Copyright (C) 1995-2004, 2005, 2006 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
@ -35,6 +35,7 @@
#endif
#ifdef USE_TLS
/* We are trying to perform a static TLS relocation in MAP, but it was
dynamically loaded. This can only work if there is enough surplus in
the static TLS area already allocated for each running thread. If this
@ -55,7 +56,7 @@ _dl_allocate_static_tls (struct link_map *map)
cannot allocate memory in static TLS block"));
}
#if TLS_TCB_AT_TP
# if TLS_TCB_AT_TP
size_t freebytes;
size_t n;
size_t blsize;
@ -72,7 +73,7 @@ cannot allocate memory in static TLS block"));
- map->l_tls_firstbyte_offset);
map->l_tls_offset = GL(dl_tls_static_used) = offset;
#elif TLS_DTV_AT_TP
# elif TLS_DTV_AT_TP
size_t used;
size_t check;
@ -86,9 +87,9 @@ cannot allocate memory in static TLS block"));
map->l_tls_offset = offset;
GL(dl_tls_static_used) = used;
#else
# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
#endif
# else
# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
# endif
/* If the object is not yet relocated we cannot initialize the
static TLS region. Delay it. */
@ -114,13 +115,13 @@ cannot allocate memory in static TLS block"));
void
_dl_nothread_init_static_tls (struct link_map *map)
{
#if TLS_TCB_AT_TP
# if TLS_TCB_AT_TP
void *dest = (char *) THREAD_SELF - map->l_tls_offset;
#elif TLS_DTV_AT_TP
# elif TLS_DTV_AT_TP
void *dest = (char *) THREAD_SELF + map->l_tls_offset + TLS_PRE_TCB_SIZE;
#else
# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
#endif
# else
# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
# endif
/* Fill in the DTV slot so that a later LD/GD access will find it. */
dtv_t *dtv = THREAD_DTV ();
@ -132,6 +133,7 @@ _dl_nothread_init_static_tls (struct link_map *map)
memset (__mempcpy (dest, map->l_tls_initimage, map->l_tls_initimage_size),
'\0', map->l_tls_blocksize - map->l_tls_initimage_size);
}
#endif
void

View File

@ -1,5 +1,5 @@
/* On-demand PLT fixup for shared objects.
Copyright (C) 1995-2002,2003,2004,2005,2006 Free Software Foundation, Inc.
Copyright (C) 1995-2002,2003,2004,2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -24,7 +24,6 @@
#include <unistd.h>
#include <sys/param.h>
#include <ldsodefs.h>
#include <sysdep-cancel.h>
#include "dynamic-link.h"
#if (!defined ELF_MACHINE_NO_RELA && !defined ELF_MACHINE_PLT_REL) \
@ -93,22 +92,16 @@ _dl_fixup (
version = NULL;
}
if (l->l_type == lt_loaded && !RTLD_SINGLE_THREAD_P)
__rtld_mrlock_lock (l->l_scope_lock);
result = _dl_lookup_symbol_x (strtab + sym->st_name, l, &sym,
l->l_scope, version, ELF_RTYPE_CLASS_PLT,
DL_LOOKUP_ADD_DEPENDENCY, NULL);
if (l->l_type == lt_loaded && !RTLD_SINGLE_THREAD_P)
__rtld_mrlock_unlock (l->l_scope_lock);
/* Currently result contains the base load address (or link map)
of the object that defines sym. Now add in the symbol
offset. */
value = DL_FIXUP_MAKE_VALUE (result,
sym ? (LOOKUP_VALUE_ADDRESS (result)
+ sym->st_value) : 0);
sym ? LOOKUP_VALUE_ADDRESS (result)
+ sym->st_value : 0);
}
else
{
@ -181,17 +174,11 @@ _dl_profile_fixup (
version = NULL;
}
if (l->l_type == lt_loaded && !RTLD_SINGLE_THREAD_P)
__rtld_mrlock_lock (l->l_scope_lock);
result = _dl_lookup_symbol_x (strtab + refsym->st_name, l, &defsym,
l->l_scope, version,
ELF_RTYPE_CLASS_PLT,
DL_LOOKUP_ADD_DEPENDENCY, NULL);
if (l->l_type == lt_loaded && !RTLD_SINGLE_THREAD_P)
__rtld_mrlock_unlock (l->l_scope_lock);
/* Currently result contains the base load address (or link map)
of the object that defines sym. Now add in the symbol
offset. */

View File

@ -1,5 +1,5 @@
/* Support for dynamic linking code in static libc.
Copyright (C) 1996-2005, 2006 Free Software Foundation, Inc.
Copyright (C) 1996-2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -29,7 +29,6 @@
#include <bits/libc-lock.h>
#include <dl-cache.h>
#include <dl-librecon.h>
#include <dl-procinfo.h>
#include <unsecvars.h>
#include <hp-timing.h>
@ -98,7 +97,9 @@ int _dl_starting_up = 1;
hp_timing_t _dl_cpuclock_offset;
#endif
#ifdef USE_TLS
void (*_dl_init_static_tls) (struct link_map *) = &_dl_nothread_init_static_tls;
#endif
size_t _dl_pagesize;

View File

@ -17,7 +17,6 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <assert.h>
#include <stddef.h>
#include <setjmp.h>
#include <libintl.h>
@ -25,11 +24,12 @@
#include <dlfcn.h>
#include <ldsodefs.h>
#include <dl-hash.h>
#include <sysdep-cancel.h>
#include <dl-tls.h>
#ifdef USE_TLS
# include <dl-tls.h>
#endif
#ifdef SHARED
#if defined USE_TLS && defined SHARED
/* Systems which do not have tls_index also probably have to define
DONT_USE_TLS_INDEX. */
@ -58,29 +58,6 @@ _dl_tls_symaddr (struct link_map *map, const ElfW(Sym) *ref)
#endif
struct call_dl_lookup_args
{
/* Arguments to do_dlsym. */
struct link_map *map;
const char *name;
struct r_found_version *vers;
int flags;
/* Return values of do_dlsym. */
lookup_t loadbase;
const ElfW(Sym) **refp;
};
static void
call_dl_lookup (void *ptr)
{
struct call_dl_lookup_args *args = (struct call_dl_lookup_args *) ptr;
args->map = GLRO(dl_lookup_symbol_x) (args->name, args->map, args->refp,
args->map->l_scope, args->vers, 0,
args->flags, NULL);
}
static void *
internal_function
do_sym (void *handle, const char *name, void *who,
@ -107,51 +84,10 @@ do_sym (void *handle, const char *name, void *who,
}
if (handle == RTLD_DEFAULT)
{
/* Search the global scope. We have the simple case where
we look up in the scope of an object which was part of
the initial binary. And then the more complex part
where the object is dynamically loaded and the scope
array can change. */
if (match->l_type != lt_loaded || RTLD_SINGLE_THREAD_P)
result = GLRO(dl_lookup_symbol_x) (name, match, &ref,
match->l_scope, vers, 0,
flags | DL_LOOKUP_ADD_DEPENDENCY,
NULL);
else
{
__rtld_mrlock_lock (match->l_scope_lock);
struct call_dl_lookup_args args;
args.name = name;
args.map = match;
args.vers = vers;
args.flags = flags | DL_LOOKUP_ADD_DEPENDENCY;
args.refp = &ref;
const char *objname;
const char *errstring = NULL;
bool malloced;
int err = GLRO(dl_catch_error) (&objname, &errstring, &malloced,
call_dl_lookup, &args);
__rtld_mrlock_unlock (match->l_scope_lock);
if (__builtin_expect (errstring != NULL, 0))
{
/* The lookup was unsuccessful. Rethrow the error. */
char *errstring_dup = strdupa (errstring);
char *objname_dup = strdupa (objname);
if (malloced)
free ((char *) errstring);
GLRO(dl_signal_error) (err, objname_dup, NULL, errstring_dup);
/* NOTREACHED */
}
result = args.map;
}
}
/* Search the global scope. */
result = GLRO(dl_lookup_symbol_x) (name, match, &ref, match->l_scope,
vers, 0, flags|DL_LOOKUP_ADD_DEPENDENCY,
NULL);
else if (handle == RTLD_NEXT)
{
if (__builtin_expect (match == GL(dl_ns)[LM_ID_BASE]._ns_loaded, 0))
@ -182,7 +118,7 @@ RTLD_NEXT used in code not dynamically loaded"));
{
void *value;
#ifdef SHARED
#if defined USE_TLS && defined SHARED
if (ELFW(ST_TYPE) (ref->st_info) == STT_TLS)
/* The found symbol is a thread-local storage variable.
Return the address for to the current thread. */

View File

@ -1,5 +1,5 @@
/* Operating system support for run-time dynamic linker. Generic Unix version.
Copyright (C) 1995-1998, 2000-2005, 2006 Free Software Foundation, Inc.
Copyright (C) 1995-1998, 2000-2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -405,8 +405,25 @@ _dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz,
}
#endif
#ifdef USE_TLS
/* For TLS enabled builds always add 'tls'. */
++cnt;
#else
if (cnt == 0)
{
/* If we no have platform name and no important capability we only
have the base directory to search. */
result = (struct r_strlenpair *) malloc (sizeof (*result));
if (result == NULL)
goto no_memory;
result[0].str = (char *) result; /* Does not really matter. */
result[0].len = 0;
*sz = 1;
return result;
}
#endif
/* Create temporary data structure to generate result table. */
temp = (struct r_strlenpair *) alloca (cnt * sizeof (*temp));
@ -448,11 +465,11 @@ _dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz,
temp[m].len = platform_len;
++m;
}
#ifdef USE_TLS
temp[m].str = "tls";
temp[m].len = 3;
++m;
#endif
assert (m == cnt);
/* Determine the total size of all strings together. */
@ -470,8 +487,13 @@ _dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz,
*sz = 1 << cnt;
result = (struct r_strlenpair *) malloc (*sz * sizeof (*result) + total);
if (result == NULL)
_dl_signal_error (ENOMEM, NULL, NULL,
N_("cannot create capability list"));
{
#ifndef USE_TLS
no_memory:
#endif
_dl_signal_error (ENOMEM, NULL, NULL,
N_("cannot create capability list"));
}
if (cnt == 1)
{

View File

@ -26,26 +26,30 @@
#include <sys/param.h>
#include <tls.h>
#include <dl-tls.h>
#include <ldsodefs.h>
/* We don't need any of this if TLS is not supported. */
#ifdef USE_TLS
# include <dl-tls.h>
# include <ldsodefs.h>
/* Amount of excess space to allocate in the static TLS area
to allow dynamic loading of modules defining IE-model TLS data. */
#define TLS_STATIC_SURPLUS 64 + DL_NNS * 100
# define TLS_STATIC_SURPLUS 64 + DL_NNS * 100
/* Value used for dtv entries for which the allocation is delayed. */
#define TLS_DTV_UNALLOCATED ((void *) -1l)
# define TLS_DTV_UNALLOCATED ((void *) -1l)
/* Out-of-memory handler. */
#ifdef SHARED
# ifdef SHARED
static void
__attribute__ ((__noreturn__))
oom (void)
{
_dl_fatal_printf ("cannot allocate memory for thread-local data: ABORT\n");
}
#endif
# endif
size_t
@ -109,7 +113,7 @@ _dl_next_tls_modid (void)
}
#ifdef SHARED
# ifdef SHARED
void
internal_function
_dl_determine_tlsoffset (void)
@ -154,7 +158,7 @@ _dl_determine_tlsoffset (void)
memory requirement for the next TLS block is smaller than the
gap. */
#if TLS_TCB_AT_TP
# if TLS_TCB_AT_TP
/* We simply start with zero. */
size_t offset = 0;
@ -201,7 +205,7 @@ _dl_determine_tlsoffset (void)
GL(dl_tls_static_used) = offset;
GL(dl_tls_static_size) = (roundup (offset + TLS_STATIC_SURPLUS, max_align)
+ TLS_TCB_SIZE);
#elif TLS_DTV_AT_TP
# elif TLS_DTV_AT_TP
/* The TLS blocks start right after the TCB. */
size_t offset = TLS_TCB_SIZE;
@ -245,9 +249,9 @@ _dl_determine_tlsoffset (void)
GL(dl_tls_static_used) = offset;
GL(dl_tls_static_size) = roundup (offset + TLS_STATIC_SURPLUS,
TLS_TCB_ALIGN);
#else
# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
#endif
# else
# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
# endif
/* The alignment requirement for the static TLS block. */
GL(dl_tls_static_align) = max_align;
@ -284,7 +288,7 @@ _dl_tls_setup (void)
return 0;
}
rtld_hidden_def (_dl_tls_setup)
#endif
# endif
static void *
internal_function
@ -333,13 +337,13 @@ _dl_allocate_tls_storage (void)
void *result;
size_t size = GL(dl_tls_static_size);
#if TLS_DTV_AT_TP
# if TLS_DTV_AT_TP
/* Memory layout is:
[ TLS_PRE_TCB_SIZE ] [ TLS_TCB_SIZE ] [ TLS blocks ]
^ This should be returned. */
size += (TLS_PRE_TCB_SIZE + GL(dl_tls_static_align) - 1)
& ~(GL(dl_tls_static_align) - 1);
#endif
# endif
/* Allocate a correctly aligned chunk of memory. */
result = __libc_memalign (GL(dl_tls_static_align), size);
@ -348,14 +352,14 @@ _dl_allocate_tls_storage (void)
/* Allocate the DTV. */
void *allocated = result;
#if TLS_TCB_AT_TP
# if TLS_TCB_AT_TP
/* The TCB follows the TLS blocks. */
result = (char *) result + size - TLS_TCB_SIZE;
/* Clear the TCB data structure. We can't ask the caller (i.e.
libpthread) to do it, because we will initialize the DTV et al. */
memset (result, '\0', TLS_TCB_SIZE);
#elif TLS_DTV_AT_TP
# elif TLS_DTV_AT_TP
result = (char *) result + size - GL(dl_tls_static_size);
/* Clear the TCB data structure and TLS_PRE_TCB_SIZE bytes before it.
@ -363,7 +367,7 @@ _dl_allocate_tls_storage (void)
initialize the DTV et al. */
memset ((char *) result - TLS_PRE_TCB_SIZE, '\0',
TLS_PRE_TCB_SIZE + TLS_TCB_SIZE);
#endif
# endif
result = allocate_dtv (result);
if (result == NULL)
@ -424,14 +428,14 @@ _dl_allocate_tls_init (void *result)
assert (map->l_tls_modid == cnt);
assert (map->l_tls_blocksize >= map->l_tls_initimage_size);
#if TLS_TCB_AT_TP
# if TLS_TCB_AT_TP
assert ((size_t) map->l_tls_offset >= map->l_tls_blocksize);
dest = (char *) result - map->l_tls_offset;
#elif TLS_DTV_AT_TP
# elif TLS_DTV_AT_TP
dest = (char *) result + map->l_tls_offset;
#else
# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
#endif
# else
# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
# endif
/* Copy the initialization image and clear the BSS part. */
dtv[map->l_tls_modid].pointer.val = dest;
@ -487,21 +491,21 @@ _dl_deallocate_tls (void *tcb, bool dealloc_tcb)
if (dealloc_tcb)
{
#if TLS_TCB_AT_TP
# if TLS_TCB_AT_TP
/* The TCB follows the TLS blocks. Back up to free the whole block. */
tcb -= GL(dl_tls_static_size) - TLS_TCB_SIZE;
#elif TLS_DTV_AT_TP
# elif TLS_DTV_AT_TP
/* Back up the TLS_PRE_TCB_SIZE bytes. */
tcb -= (TLS_PRE_TCB_SIZE + GL(dl_tls_static_align) - 1)
& ~(GL(dl_tls_static_align) - 1);
#endif
# endif
free (tcb);
}
}
rtld_hidden_def (_dl_deallocate_tls)
#ifdef SHARED
# ifdef SHARED
/* The __tls_get_addr function has two basic forms which differ in the
arguments. The IA-64 form takes two parameters, the module ID and
offset. The form used, among others, on IA-32 takes a reference to
@ -509,15 +513,15 @@ rtld_hidden_def (_dl_deallocate_tls)
form seems to be more often used (in the moment) so we default to
it. Users of the IA-64 form have to provide adequate definitions
of the following macros. */
# ifndef GET_ADDR_ARGS
# define GET_ADDR_ARGS tls_index *ti
# endif
# ifndef GET_ADDR_MODULE
# define GET_ADDR_MODULE ti->ti_module
# endif
# ifndef GET_ADDR_OFFSET
# define GET_ADDR_OFFSET ti->ti_offset
# endif
# ifndef GET_ADDR_ARGS
# define GET_ADDR_ARGS tls_index *ti
# endif
# ifndef GET_ADDR_MODULE
# define GET_ADDR_MODULE ti->ti_module
# endif
# ifndef GET_ADDR_OFFSET
# define GET_ADDR_OFFSET ti->ti_offset
# endif
static void *
@ -728,7 +732,7 @@ __tls_get_addr (GET_ADDR_ARGS)
return (char *) p + GET_ADDR_OFFSET;
}
#endif
# endif
/* Look up the module's TLS block as for __tls_get_addr,
@ -836,3 +840,4 @@ cannot create TLS data structures"));
listp->slotinfo[idx].map = l;
listp->slotinfo[idx].gen = GL(dl_tls_generation) + 1;
}
#endif /* use TLS */

View File

@ -1,5 +1,5 @@
/* This file defines standard ELF types, structures, and macros.
Copyright (C) 1995-2003,2004,2005,2006,2007 Free Software Foundation, Inc.
Copyright (C) 1995-2003,2004,2005,2006 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
@ -1511,9 +1511,8 @@ typedef struct
#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 */
#define R_MIPS_GLOB_DAT 51
/* Keep this the last entry. */
#define R_MIPS_NUM 52
#define R_MIPS_NUM 51
/* Legal values for p_type field of Elf32_Phdr. */

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1999-2004, 2005, 2006, 2007 Free Software Foundation, Inc.
/* Copyright (C) 1999-2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@suse.de>, 1999.
@ -24,7 +24,6 @@
#include <errno.h>
#include <inttypes.h>
#include <libintl.h>
#include <locale.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdio_ext.h>
@ -287,7 +286,7 @@ print_version (FILE *stream, struct argp_state *state)
Copyright (C) %s Free Software Foundation, Inc.\n\
This is free software; see the source for copying conditions. There is NO\n\
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
"), "2007");
"), "2006");
fprintf (stream, gettext ("Written by %s.\n"),
"Andreas Jaeger");
}
@ -559,7 +558,7 @@ manual_link (char *library)
/* Do some sanity checks first. */
if (lstat64 (real_library, &stat_buf))
{
error (0, errno, _("Cannot lstat %s"), library);
error (0, errno, _("Can't lstat %s"), library);
free (path);
return;
}
@ -1167,14 +1166,9 @@ set_hwcap (void)
int
main (int argc, char **argv)
{
/* Set locale via LC_ALL. */
setlocale (LC_ALL, "");
/* Set the text message domain. */
textdomain (_libc_intl_domainname);
int remaining;
/* Parse and process arguments. */
int remaining;
argp_parse (&argp, argc, argv, 0, &remaining, NULL);
/* Remaining arguments are additional directories if opt_manual_link
@ -1191,7 +1185,9 @@ main (int argc, char **argv)
add_dir (argv[i]);
}
#ifdef USE_TLS
hwcap_extra[63 - _DL_FIRST_EXTRA] = "tls";
#endif
set_hwcap ();

View File

@ -1,5 +1,5 @@
#! @BASH@
# Copyright (C) 1996-2004, 2005, 2006, 2007 Free Software Foundation, Inc.
# Copyright (C) 1996-2004, 2005, 2006 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
@ -39,7 +39,7 @@ while test $# -gt 0; do
printf $"Copyright (C) %s Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
" "2007"
" "2006"
printf $"Written by %s and %s.
" "Roland McGrath" "Ulrich Drepper"
exit 0

View File

@ -1,5 +1,5 @@
/* Run time dynamic linker.
Copyright (C) 1995-2002,2003,2004,2005,2006 Free Software Foundation, Inc.
Copyright (C) 1995-2002, 2003, 2004, 2005, 2006 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
@ -207,7 +207,8 @@ DL_SYSINFO_IMPLEMENTATION
is fine, too. The latter is important here. We can avoid setting
up a temporary link map for ld.so if we can mark _rtld_global as
hidden. */
#ifdef PI_STATIC_AND_HIDDEN
#if defined PI_STATIC_AND_HIDDEN && defined HAVE_HIDDEN \
&& defined HAVE_VISIBILITY_ATTRIBUTE
# define DONT_USE_BOOTSTRAP_MAP 1
#endif
@ -291,7 +292,7 @@ _dl_start_final (void *arg, struct dl_start_final_info *info)
GL(dl_rtld_map).l_map_end = (ElfW(Addr)) _end;
GL(dl_rtld_map).l_text_end = (ElfW(Addr)) _etext;
/* Copy the TLS related data if necessary. */
#ifndef DONT_USE_BOOTSTRAP_MAP
#if USE_TLS && !defined DONT_USE_BOOTSTRAP_MAP
# if USE___THREAD
assert (info->l.l_tls_modid != 0);
GL(dl_rtld_map).l_tls_blocksize = info->l.l_tls_blocksize;
@ -399,7 +400,7 @@ _dl_start (void *arg)
bootstrap_map.l_ld = (void *) bootstrap_map.l_addr + elf_machine_dynamic ();
elf_get_dynamic_info (&bootstrap_map, NULL);
#if NO_TLS_OFFSET != 0
#if defined USE_TLS && NO_TLS_OFFSET != 0
bootstrap_map.l_tls_offset = NO_TLS_OFFSET;
#endif
@ -700,6 +701,7 @@ match_version (const char *string, struct link_map *map)
return 0;
}
#ifdef USE_TLS
static bool tls_init_tp_called;
static void *
@ -771,6 +773,7 @@ cannot allocate TLS data structures for initial thread");
return tcbp;
}
#endif
#ifdef _LIBC_REENTRANT
/* _dl_error_catch_tsd points to this for the single-threaded case.
@ -858,14 +861,18 @@ dl_main (const ElfW(Phdr) *phdr,
hp_timing_t stop;
hp_timing_t diff;
#endif
#ifdef USE_TLS
void *tcbp = NULL;
#endif
#ifdef _LIBC_REENTRANT
/* Explicit initialization since the reloc would just be more work. */
GL(dl_error_catch_tsd) = &_dl_initial_error_catch_tsd;
#endif
#ifdef USE_TLS
GL(dl_init_static_tls) = &_dl_nothread_init_static_tls;
#endif
#if defined SHARED && defined _LIBC_REENTRANT \
&& defined __rtld_lock_default_lock_recursive
@ -1150,6 +1157,7 @@ of this helper program; chances are you did not intend to run this program.\n\
break;
case PT_TLS:
#ifdef USE_TLS
if (ph->p_memsz > 0)
{
/* Note that in the case the dynamic linker we duplicate work
@ -1169,6 +1177,10 @@ of this helper program; chances are you did not intend to run this program.\n\
/* This image gets the ID one. */
GL(dl_tls_max_dtv_idx) = main_map->l_tls_modid = 1;
}
#else
_dl_fatal_printf ("\
ld.so does not support TLS, but program uses it!\n");
#endif
break;
case PT_GNU_STACK:
@ -1180,12 +1192,13 @@ of this helper program; chances are you did not intend to run this program.\n\
main_map->l_relro_size = ph->p_memsz;
break;
}
/* Adjust the address of the TLS initialization image in case
the executable is actually an ET_DYN object. */
if (main_map->l_tls_initimage != NULL)
main_map->l_tls_initimage
= (char *) main_map->l_tls_initimage + main_map->l_addr;
#ifdef USE_TLS
/* Adjust the address of the TLS initialization image in case
the executable is actually an ET_DYN object. */
if (main_map->l_tls_initimage != NULL)
main_map->l_tls_initimage
= (char *) main_map->l_tls_initimage + main_map->l_addr;
#endif
if (! main_map->l_map_end)
main_map->l_map_end = ~0;
if (! main_map->l_text_end)
@ -1388,10 +1401,12 @@ of this helper program; chances are you did not intend to run this program.\n\
break;
}
#ifdef USE_TLS
/* Add the dynamic linker to the TLS list if it also uses TLS. */
if (GL(dl_rtld_map).l_tls_blocksize != 0)
/* Assign a module ID. Do this before loading any audit modules. */
GL(dl_rtld_map).l_tls_modid = _dl_next_tls_modid ();
#endif
/* If we have auditing DSOs to load, do it now. */
if (__builtin_expect (audit_list != NULL, 0))
@ -1401,6 +1416,7 @@ of this helper program; chances are you did not intend to run this program.\n\
struct audit_list *al = audit_list->next;
do
{
#ifdef USE_TLS
int tls_idx = GL(dl_tls_max_dtv_idx);
/* Now it is time to determine the layout of the static TLS
@ -1412,7 +1428,7 @@ of this helper program; chances are you did not intend to run this program.\n\
/* Since we start using the auditing DSOs right away we need to
initialize the data structures now. */
tcbp = init_tls ();
#endif
struct dlmopen_args dlmargs;
dlmargs.fname = al->name;
dlmargs.map = NULL;
@ -1527,7 +1543,9 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
assert (GL(dl_ns)[ns]._ns_loaded == NULL);
assert (GL(dl_ns)[ns]._ns_nloaded == 0);
#ifdef USE_TLS
GL(dl_tls_max_dtv_idx) = tls_idx;
#endif
goto not_loaded;
}
}
@ -1803,6 +1821,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
_dl_receive_error (print_missing_version, version_check_doit, &args);
}
#ifdef USE_TLS
/* We do not initialize any of the TLS functionality unless any of the
initial modules uses TLS. This makes dynamic loading of modules with
TLS impossible, but to support it requires either eagerly doing setup
@ -1813,6 +1832,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
bool was_tls_init_tp_called = tls_init_tp_called;
if (tcbp == NULL)
tcbp = init_tls ();
#endif
/* Set up the stack checker's canary. */
uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard ();
@ -1869,12 +1889,13 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
(size_t) l->l_map_start,
(int) sizeof l->l_addr * 2,
(size_t) l->l_addr);
#ifdef USE_TLS
if (l->l_tls_modid)
_dl_printf (" TLS(0x%Zx, 0x%0*Zx)\n", l->l_tls_modid,
(int) sizeof l->l_tls_offset * 2,
(size_t) l->l_tls_offset);
else
#endif
_dl_printf ("\n");
}
}
@ -1942,8 +1963,8 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
lookup_t result;
result = _dl_lookup_symbol_x (INTUSE(_dl_argv)[i], main_map,
&ref, main_map->l_scope,
NULL, ELF_RTYPE_CLASS_PLT,
&ref, main_map->l_scope, NULL,
ELF_RTYPE_CLASS_PLT,
DL_LOOKUP_ADD_DEPENDENCY, NULL);
loadbase = LOOKUP_VALUE_ADDRESS (result);
@ -1985,8 +2006,8 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
{
/* Mark the link map as not yet relocated again. */
GL(dl_rtld_map).l_relocated = 0;
_dl_relocate_object (&GL(dl_rtld_map),
main_map->l_scope, 0, 0);
_dl_relocate_object (&GL(dl_rtld_map), main_map->l_scope,
0, 0);
}
}
#define VERNEEDTAG (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGIDX (DT_VERNEED))
@ -2122,6 +2143,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
/* Now set up the variable which helps the assembler startup code. */
GL(dl_ns)[LM_ID_BASE]._ns_main_searchlist = &main_map->l_searchlist;
GL(dl_ns)[LM_ID_BASE]._ns_global_scope[0] = &main_map->l_searchlist;
/* Save the information about the original global scope list since
we need it in the memory handling later. */
@ -2157,9 +2179,11 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
if (l->l_relro_size)
_dl_protect_relro (l);
#ifdef USE_TLS
/* Add object to slot information data if necessasy. */
if (l->l_tls_blocksize != 0 && tls_init_tp_called)
_dl_add_to_slotinfo (l);
#endif
}
_dl_sysdep_start_cleanup ();
@ -2206,9 +2230,11 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
_dl_relocate_object (l, l->l_scope, GLRO(dl_lazy),
consider_profiling);
#ifdef USE_TLS
/* Add object to slot information data if necessasy. */
if (l->l_tls_blocksize != 0 && tls_init_tp_called)
_dl_add_to_slotinfo (l);
#endif
l = l->l_prev;
}
@ -2237,6 +2263,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
# define NONTLS_INIT_TP do { } while (0)
#endif
#ifdef USE_TLS
if (!was_tls_init_tp_called && GL(dl_tls_max_dtv_idx) > 0)
++GL(dl_tls_generation);
@ -2254,6 +2281,9 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
_dl_fatal_printf ("cannot set up thread-local storage: %s\n",
lossage);
}
#else
NONTLS_INIT_TP;
#endif
if (! prelinked && rtld_multiple_ref)
{

View File

@ -1,5 +1,5 @@
/* Read and display shared object profiling data.
Copyright (C) 1997-2004, 2005, 2006, 2007 Free Software Foundation, Inc.
Copyright (C) 1997-2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@ -357,7 +357,7 @@ Copyright (C) %s Free Software Foundation, Inc.\n\
This is free software; see the source for copying conditions. There is NO\n\
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
"),
"2007");
"2006");
fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper");
}

View File

@ -9,6 +9,7 @@
static int
do_test (void)
{
#ifdef USE_TLS
static const char modname[] = "tst-tlsmod2.so";
int result = 0;
int *foop;
@ -82,6 +83,9 @@ do_test (void)
dlclose (h);
return result;
#else
return 0;
#endif
}

View File

@ -3,18 +3,21 @@
#include <tls.h>
#include "tls-macros.h"
#ifdef USE_TLS
# include "tls-macros.h"
/* Two common 'int' variables in TLS. */
COMMON_INT_DEF(foo);
COMMON_INT_DEF(bar);
#endif
#define TEST_FUNCTION do_test ()
static int
do_test (void)
{
#ifdef USE_TLS
int result = 0;
int *ap, *bp;
@ -79,6 +82,9 @@ do_test (void)
}
return result;
#else
return 0;
#endif
}

View File

@ -1,7 +1,8 @@
#include <tls.h>
#include <stdlib.h>
#if defined HAVE___THREAD && defined HAVE_TLS_MODEL_ATTRIBUTE
#if defined USE_TLS && defined HAVE___THREAD \
&& defined HAVE_TLS_MODEL_ATTRIBUTE
# define USE_TLS__THREAD
struct A

View File

@ -6,9 +6,9 @@
#include <tls.h>
#if HAVE___THREAD
#if USE_TLS && HAVE___THREAD
# define AL 4096
#define AL 4096
struct foo
{
int i;
@ -55,11 +55,11 @@ do_test (void)
return result;
}
# define TEST_FUNCTION do_test ()
#define TEST_FUNCTION do_test ()
#else
# define TEST_FUNCTION 0
#define TEST_FUNCTION 0
#endif

View File

@ -3,18 +3,21 @@
#include <tls.h>
#include "tls-macros.h"
#ifdef USE_TLS
# include "tls-macros.h"
/* Two 'int' variables in TLS. */
VAR_INT_DEF(foo);
VAR_INT_DEF(bar);
#endif
#define TEST_FUNCTION do_test ()
static int
do_test (void)
{
#ifdef USE_TLS
int result = 0;
int *ap, *bp;
@ -79,6 +82,9 @@ do_test (void)
}
return result;
#else
return 0;
#endif
}

View File

@ -3,13 +3,15 @@
#include <tls.h>
#include "tls-macros.h"
#ifdef USE_TLS
# include "tls-macros.h"
/* One define int variable, two externs. */
COMMON_INT_DECL(foo);
VAR_INT_DECL(bar);
VAR_INT_DEF(baz);
#endif
extern int in_dso (void);
@ -19,6 +21,7 @@ extern int in_dso (void);
static int
do_test (void)
{
#ifdef USE_TLS
int result = 0;
int *ap, *bp, *cp;
@ -64,6 +67,9 @@ do_test (void)
result |= in_dso ();
return result;
#else
return 0;
#endif
}

View File

@ -9,6 +9,7 @@
static int
do_test (void)
{
#ifdef USE_TLS
static const char modname[] = "tst-tlsmod2.so";
int result = 0;
int *foop;
@ -46,6 +47,9 @@ do_test (void)
dlclose (h);
return result;
#else
return 0;
#endif
}

View File

@ -9,6 +9,7 @@
static int
do_test (void)
{
#ifdef USE_TLS
static const char modname[] = "tst-tlsmod2.so";
int result = 0;
int *foop;
@ -62,6 +63,9 @@ do_test (void)
dlclose (h);
return result;
#else
return 0;
#endif
}

View File

@ -10,6 +10,7 @@
static int
do_test (void)
{
#ifdef USE_TLS
static const char modname[] = "tst-tlsmod2.so";
int result = 0;
int *foop;
@ -80,6 +81,9 @@ do_test (void)
}
return result;
#else
return 0;
#endif
}

View File

@ -10,6 +10,7 @@
static int
do_test (void)
{
#ifdef USE_TLS
static const char modname[] = "tst-tlsmod3.so";
int result = 0;
int (*fp) (void);
@ -51,6 +52,9 @@ do_test (void)
}
return result;
#else
return 0;
#endif
}

View File

@ -10,6 +10,7 @@
static int
do_test (void)
{
#ifdef USE_TLS
static const char modname1[] = "$ORIGIN/tst-tlsmod3.so";
static const char modname2[] = "$ORIGIN/tst-tlsmod4.so";
int result = 0;
@ -164,6 +165,9 @@ do_test (void)
}
return result;
#else
return 0;
#endif
}

View File

@ -9,6 +9,7 @@
static int
do_test (void)
{
#ifdef USE_TLS
static const char modname1[] = "tst-tlsmod5.so";
static const char modname2[] = "tst-tlsmod6.so";
int result = 0;
@ -32,6 +33,9 @@ do_test (void)
dlclose (h2);
return result;
#else
return 0;
#endif
}

View File

@ -2,6 +2,7 @@
#include <tls.h>
#ifdef USE_TLS
#include "tls-macros.h"
@ -9,6 +10,7 @@
COMMON_INT_DEF(foo);
VAR_INT_DEF(bar);
VAR_INT_DECL(baz);
#endif
extern int in_dso (void);
@ -16,6 +18,7 @@ int
in_dso (void)
{
int result = 0;
#ifdef USE_TLS
int *ap, *bp, *cp;
/* Get variables using initial exec model. */
@ -59,6 +62,7 @@ in_dso (void)
printf ("baz = %d\n", *cp);
result = 1;
}
#endif
return result;
}

View File

@ -1,6 +1,7 @@
#include <tls.h>
#if defined HAVE___THREAD && defined HAVE_TLS_MODEL_ATTRIBUTE
#if defined USE_TLS && defined HAVE___THREAD \
&& defined HAVE_TLS_MODEL_ATTRIBUTE
__thread int a[2] __attribute__ ((tls_model ("initial-exec")));
#else
int a[2];

View File

@ -1,6 +1,7 @@
#include <tls.h>
#if defined HAVE___THREAD && defined HAVE_TLS_MODEL_ATTRIBUTE
#if defined USE_TLS && defined HAVE___THREAD \
&& defined HAVE_TLS_MODEL_ATTRIBUTE
__thread int b[2] __attribute__ ((tls_model ("initial-exec")));
#else
int b[2];

View File

@ -3,9 +3,9 @@
#include <tls.h>
#if HAVE___THREAD
#if USE_TLS && HAVE___THREAD
# define AL 4096
#define AL 4096
struct foo
{
int i;
@ -15,9 +15,9 @@ static __thread struct foo f;
static struct foo g;
# ifndef FCT
# define FCT in_dso1
# endif
#ifndef FCT
# define FCT in_dso1
#endif
int

View File

@ -2,6 +2,7 @@
#include <tls.h>
#ifdef USE_TLS
#include "tls-macros.h"
@ -34,3 +35,4 @@ in_dso (int n, int *caller_foop)
return result;
}
#endif

View File

@ -2,7 +2,8 @@
#include <tls.h>
#include "tls-macros.h"
#ifdef USE_TLS
# include "tls-macros.h"
extern int in_dso (int n, int *caller_foop);
@ -37,3 +38,4 @@ in_dso2 (void)
return result;
}
#endif

View File

@ -2,7 +2,8 @@
#include <tls.h>
#include "tls-macros.h"
#ifdef USE_TLS
# include "tls-macros.h"
COMMON_INT_DEF(baz);
@ -34,3 +35,4 @@ in_dso (int n, int *caller_bazp)
return result;
}
#endif

View File

@ -1,5 +1,7 @@
#include <tls.h>
#ifdef USE_TLS
#include "tls-macros.h"
COMMON_INT_DEF(foo);
#endif

View File

@ -1,5 +1,7 @@
#include <tls.h>
#ifdef USE_TLS
#include "tls-macros.h"
COMMON_INT_DEF(bar);
#endif

View File

@ -69,8 +69,8 @@ _MCOUNT_DECL(frompc, selfpc) /* _mcount; may be static, inline, etc */
* check that we are profiling
* and that we aren't recursively invoked.
*/
if (catomic_compare_and_exchange_bool_acq (&p->state, GMON_PROF_BUSY,
GMON_PROF_ON))
if (atomic_compare_and_exchange_bool_acq (&p->state, GMON_PROF_BUSY,
GMON_PROF_ON))
return;
/*

View File

@ -1,5 +1,5 @@
/* Convert text in given files from the specified from-set to the to-set.
Copyright (C) 1998-2004, 2005, 2006, 2007 Free Software Foundation, Inc.
Copyright (C) 1998-2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@ -426,7 +426,7 @@ print_version (FILE *stream, struct argp_state *state)
Copyright (C) %s Free Software Foundation, Inc.\n\
This is free software; see the source for copying conditions. There is NO\n\
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
"), "2007");
"), "2006");
fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper");
}

View File

@ -1,5 +1,5 @@
/* Generate fastloading iconv module configuration files.
Copyright (C) 2000-2004, 2005, 2006, 2007 Free Software Foundation, Inc.
Copyright (C) 2000-2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2000.
@ -395,7 +395,7 @@ print_version (FILE *stream, struct argp_state *state)
Copyright (C) %s Free Software Foundation, Inc.\n\
This is free software; see the source for copying conditions. There is NO\n\
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
"), "2007");
"), "2006");
fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper");
}

View File

@ -21,31 +21,6 @@
#ifndef _ATOMIC_H
#define _ATOMIC_H 1
/* This header defines three types of macros:
- atomic arithmetic and logic operation on memory. They all
have the prefix "atomic_".
- conditionally atomic operations of the same kinds. These
always behave identical but can be faster when atomicity
is not really needed since only one thread has access to
the memory location. In that case the code is slower in
the multi-thread case. The interfaces have the prefix
"catomic_".
- support functions like barriers. They also have the preifx
"atomic_".
Architectures must provide a few lowlevel macros (the compare
and exchange definitions). All others are optional. They
should only be provided if the architecture has specific
support for the operation.
As <atomic.h> macros are usually heavily nested and often use local
variables to make sure side-effects are evaluated properly, use for
macro local variables a per-macro unique prefix. This file uses
__atgN_ prefix where N is different in each macro. */
#include <stdlib.h>
#include <bits/atomic.h>
@ -55,33 +30,33 @@
and following args. */
#define __atomic_val_bysize(pre, post, mem, ...) \
({ \
__typeof (*mem) __atg1_result; \
__typeof (*mem) __result; \
if (sizeof (*mem) == 1) \
__atg1_result = pre##_8_##post (mem, __VA_ARGS__); \
__result = pre##_8_##post (mem, __VA_ARGS__); \
else if (sizeof (*mem) == 2) \
__atg1_result = pre##_16_##post (mem, __VA_ARGS__); \
__result = pre##_16_##post (mem, __VA_ARGS__); \
else if (sizeof (*mem) == 4) \
__atg1_result = pre##_32_##post (mem, __VA_ARGS__); \
__result = pre##_32_##post (mem, __VA_ARGS__); \
else if (sizeof (*mem) == 8) \
__atg1_result = pre##_64_##post (mem, __VA_ARGS__); \
__result = pre##_64_##post (mem, __VA_ARGS__); \
else \
abort (); \
__atg1_result; \
__result; \
})
#define __atomic_bool_bysize(pre, post, mem, ...) \
({ \
int __atg2_result; \
int __result; \
if (sizeof (*mem) == 1) \
__atg2_result = pre##_8_##post (mem, __VA_ARGS__); \
__result = pre##_8_##post (mem, __VA_ARGS__); \
else if (sizeof (*mem) == 2) \
__atg2_result = pre##_16_##post (mem, __VA_ARGS__); \
__result = pre##_16_##post (mem, __VA_ARGS__); \
else if (sizeof (*mem) == 4) \
__atg2_result = pre##_32_##post (mem, __VA_ARGS__); \
__result = pre##_32_##post (mem, __VA_ARGS__); \
else if (sizeof (*mem) == 8) \
__atg2_result = pre##_64_##post (mem, __VA_ARGS__); \
__result = pre##_64_##post (mem, __VA_ARGS__); \
else \
abort (); \
__atg2_result; \
__result; \
})
@ -95,29 +70,12 @@
#endif
#if !defined catomic_compare_and_exchange_val_acq \
&& defined __arch_c_compare_and_exchange_val_32_acq
# define catomic_compare_and_exchange_val_acq(mem, newval, oldval) \
__atomic_val_bysize (__arch_c_compare_and_exchange_val,acq, \
mem, newval, oldval)
#else
# define catomic_compare_and_exchange_val_acq(mem, newval, oldval) \
atomic_compare_and_exchange_val_acq (mem, newval, oldval)
#endif
#ifndef atomic_compare_and_exchange_val_rel
# define atomic_compare_and_exchange_val_rel(mem, newval, oldval) \
atomic_compare_and_exchange_val_acq (mem, newval, oldval)
#endif
#ifndef catomic_compare_and_exchange_val_rel
# define catomic_compare_and_exchange_val_rel(mem, newval, oldval) \
atomic_compare_and_exchange_val_acq (mem, newval, oldval)
#endif
/* Atomically store NEWVAL in *MEM if *MEM is equal to OLDVAL.
Return zero if *MEM was changed or non-zero if no exchange happened. */
#ifndef atomic_compare_and_exchange_bool_acq
@ -129,26 +87,8 @@
# define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \
({ /* Cannot use __oldval here, because macros later in this file might \
call this macro with __oldval argument. */ \
__typeof (oldval) __atg3_old = (oldval); \
atomic_compare_and_exchange_val_acq (mem, newval, __atg3_old) \
!= __atg3_old; \
})
# endif
#endif
#ifndef catomic_compare_and_exchange_bool_acq
# ifdef __arch_c_compare_and_exchange_bool_32_acq
# define catomic_compare_and_exchange_bool_acq(mem, newval, oldval) \
__atomic_bool_bysize (__arch_c_compare_and_exchange_bool,acq, \
mem, newval, oldval)
# else
# define catomic_compare_and_exchange_bool_acq(mem, newval, oldval) \
({ /* Cannot use __oldval here, because macros later in this file might \
call this macro with __oldval argument. */ \
__typeof (oldval) __atg4_old = (oldval); \
catomic_compare_and_exchange_val_acq (mem, newval, __atg4_old) \
!= __atg4_old; \
__typeof (oldval) __old = (oldval); \
atomic_compare_and_exchange_val_acq (mem, newval, __old) != __old; \
})
# endif
#endif
@ -160,26 +100,21 @@
#endif
#ifndef catomic_compare_and_exchange_bool_rel
# define catomic_compare_and_exchange_bool_rel(mem, newval, oldval) \
catomic_compare_and_exchange_bool_acq (mem, newval, oldval)
#endif
/* Store NEWVALUE in *MEM and return the old value. */
#ifndef atomic_exchange_acq
# define atomic_exchange_acq(mem, newvalue) \
({ __typeof (*(mem)) __atg5_oldval; \
__typeof (mem) __atg5_memp = (mem); \
__typeof (*(mem)) __atg5_value = (newvalue); \
({ __typeof (*(mem)) __oldval; \
__typeof (mem) __memp = (mem); \
__typeof (*(mem)) __value = (newvalue); \
\
do \
__atg5_oldval = *__atg5_memp; \
while (__builtin_expect \
(atomic_compare_and_exchange_bool_acq (__atg5_memp, __atg5_value, \
__atg5_oldval), 0)); \
__oldval = *__memp; \
while (__builtin_expect (atomic_compare_and_exchange_bool_acq (__memp, \
__value, \
__oldval),\
0)); \
\
__atg5_oldval; })
__oldval; })
#endif
#ifndef atomic_exchange_rel
@ -190,124 +125,72 @@
/* Add VALUE to *MEM and return the old value of *MEM. */
#ifndef atomic_exchange_and_add
# define atomic_exchange_and_add(mem, value) \
({ __typeof (*(mem)) __atg6_oldval; \
__typeof (mem) __atg6_memp = (mem); \
__typeof (*(mem)) __atg6_value = (value); \
({ __typeof (*(mem)) __oldval; \
__typeof (mem) __memp = (mem); \
__typeof (*(mem)) __value = (value); \
\
do \
__atg6_oldval = *__atg6_memp; \
while (__builtin_expect \
(atomic_compare_and_exchange_bool_acq (__atg6_memp, \
__atg6_oldval \
+ __atg6_value, \
__atg6_oldval), 0)); \
__oldval = *__memp; \
while (__builtin_expect (atomic_compare_and_exchange_bool_acq (__memp, \
__oldval \
+ __value,\
__oldval),\
0)); \
\
__atg6_oldval; })
__oldval; })
#endif
#ifndef catomic_exchange_and_add
# define catomic_exchange_and_add(mem, value) \
({ __typeof (*(mem)) __atg7_oldv; \
__typeof (mem) __atg7_memp = (mem); \
__typeof (*(mem)) __atg7_value = (value); \
\
do \
__atg7_oldv = *__atg7_memp; \
while (__builtin_expect \
(catomic_compare_and_exchange_bool_acq (__atg7_memp, \
__atg7_oldv \
+ __atg7_value, \
__atg7_oldv), 0)); \
\
__atg7_oldv; })
#endif
#ifndef atomic_max
# define atomic_max(mem, value) \
do { \
__typeof (*(mem)) __atg8_oldval; \
__typeof (mem) __atg8_memp = (mem); \
__typeof (*(mem)) __atg8_value = (value); \
__typeof (*(mem)) __oldval; \
__typeof (mem) __memp = (mem); \
__typeof (*(mem)) __value = (value); \
do { \
__atg8_oldval = *__atg8_memp; \
if (__atg8_oldval >= __atg8_value) \
__oldval = *__memp; \
if (__oldval >= __value) \
break; \
} while (__builtin_expect \
(atomic_compare_and_exchange_bool_acq (__atg8_memp, __atg8_value,\
__atg8_oldval), 0)); \
} while (__builtin_expect (atomic_compare_and_exchange_bool_acq (__memp, \
__value, \
__oldval),\
0)); \
} while (0)
#endif
#ifndef catomic_max
# define catomic_max(mem, value) \
do { \
__typeof (*(mem)) __atg9_oldv; \
__typeof (mem) __atg9_memp = (mem); \
__typeof (*(mem)) __atg9_value = (value); \
do { \
__atg9_oldv = *__atg9_memp; \
if (__atg9_oldv >= __atg9_value) \
break; \
} while (__builtin_expect \
(catomic_compare_and_exchange_bool_acq (__atg9_memp, \
__atg9_value, \
__atg9_oldv), 0)); \
} while (0)
#endif
#ifndef atomic_min
# define atomic_min(mem, value) \
do { \
__typeof (*(mem)) __atg10_oldval; \
__typeof (mem) __atg10_memp = (mem); \
__typeof (*(mem)) __atg10_value = (value); \
__typeof (*(mem)) __oldval; \
__typeof (mem) __memp = (mem); \
__typeof (*(mem)) __value = (value); \
do { \
__atg10_oldval = *__atg10_memp; \
if (__atg10_oldval <= __atg10_value) \
__oldval = *__memp; \
if (__oldval <= __value) \
break; \
} while (__builtin_expect \
(atomic_compare_and_exchange_bool_acq (__atg10_memp, \
__atg10_value, \
__atg10_oldval), 0)); \
} while (__builtin_expect (atomic_compare_and_exchange_bool_acq (__memp, \
__value, \
__oldval),\
0)); \
} while (0)
#endif
#ifndef atomic_add
# define atomic_add(mem, value) (void) atomic_exchange_and_add ((mem), (value))
#endif
#ifndef catomic_add
# define catomic_add(mem, value) \
(void) catomic_exchange_and_add ((mem), (value))
#endif
#ifndef atomic_increment
# define atomic_increment(mem) atomic_add ((mem), 1)
#endif
#ifndef catomic_increment
# define catomic_increment(mem) catomic_add ((mem), 1)
#endif
#ifndef atomic_increment_val
# define atomic_increment_val(mem) (atomic_exchange_and_add ((mem), 1) + 1)
#endif
#ifndef catomic_increment_val
# define catomic_increment_val(mem) (catomic_exchange_and_add ((mem), 1) + 1)
#endif
/* Add one to *MEM and return true iff it's now zero. */
#ifndef atomic_increment_and_test
# define atomic_increment_and_test(mem) \
@ -320,21 +203,11 @@
#endif
#ifndef catomic_decrement
# define catomic_decrement(mem) catomic_add ((mem), -1)
#endif
#ifndef atomic_decrement_val
# define atomic_decrement_val(mem) (atomic_exchange_and_add ((mem), -1) - 1)
#endif
#ifndef catomic_decrement_val
# define catomic_decrement_val(mem) (catomic_exchange_and_add ((mem), -1) - 1)
#endif
/* Subtract 1 from *MEM and return true iff it's now zero. */
#ifndef atomic_decrement_and_test
# define atomic_decrement_and_test(mem) \
@ -345,34 +218,35 @@
/* Decrement *MEM if it is > 0, and return the old value. */
#ifndef atomic_decrement_if_positive
# define atomic_decrement_if_positive(mem) \
({ __typeof (*(mem)) __atg11_oldval; \
__typeof (mem) __atg11_memp = (mem); \
({ __typeof (*(mem)) __oldval; \
__typeof (mem) __memp = (mem); \
\
do \
{ \
__atg11_oldval = *__atg11_memp; \
if (__builtin_expect (__atg11_oldval <= 0, 0)) \
__oldval = *__memp; \
if (__builtin_expect (__oldval <= 0, 0)) \
break; \
} \
while (__builtin_expect \
(atomic_compare_and_exchange_bool_acq (__atg11_memp, \
__atg11_oldval - 1, \
__atg11_oldval), 0)); \
__atg11_oldval; })
while (__builtin_expect (atomic_compare_and_exchange_bool_acq (__memp, \
__oldval \
- 1, \
__oldval),\
0));\
__oldval; })
#endif
#ifndef atomic_add_negative
# define atomic_add_negative(mem, value) \
({ __typeof (value) __atg12_value = (value); \
atomic_exchange_and_add (mem, __atg12_value) < -__atg12_value; })
({ __typeof (value) __aan_value = (value); \
atomic_exchange_and_add (mem, __aan_value) < -__aan_value; })
#endif
#ifndef atomic_add_zero
# define atomic_add_zero(mem, value) \
({ __typeof (value) __atg13_value = (value); \
atomic_exchange_and_add (mem, __atg13_value) == -__atg13_value; })
({ __typeof (value) __aaz_value = (value); \
atomic_exchange_and_add (mem, __aaz_value) == -__aaz_value; })
#endif
@ -384,102 +258,55 @@
#ifndef atomic_bit_test_set
# define atomic_bit_test_set(mem, bit) \
({ __typeof (*(mem)) __atg14_old; \
__typeof (mem) __atg14_memp = (mem); \
__typeof (*(mem)) __atg14_mask = ((__typeof (*(mem))) 1 << (bit)); \
({ __typeof (*(mem)) __oldval; \
__typeof (mem) __memp = (mem); \
__typeof (*(mem)) __mask = ((__typeof (*(mem))) 1 << (bit)); \
\
do \
__atg14_old = (*__atg14_memp); \
while (__builtin_expect \
(atomic_compare_and_exchange_bool_acq (__atg14_memp, \
__atg14_old | __atg14_mask,\
__atg14_old), 0)); \
__oldval = (*__memp); \
while (__builtin_expect (atomic_compare_and_exchange_bool_acq (__memp, \
__oldval \
| __mask, \
__oldval),\
0)); \
\
__atg14_old & __atg14_mask; })
#endif
/* Atomically *mem &= mask. */
#ifndef atomic_and
# define atomic_and(mem, mask) \
do { \
__typeof (*(mem)) __atg15_old; \
__typeof (mem) __atg15_memp = (mem); \
__typeof (*(mem)) __atg15_mask = (mask); \
\
do \
__atg15_old = (*__atg15_memp); \
while (__builtin_expect \
(atomic_compare_and_exchange_bool_acq (__atg15_memp, \
__atg15_old & __atg15_mask, \
__atg15_old), 0)); \
} while (0)
__oldval & __mask; })
#endif
/* Atomically *mem &= mask and return the old value of *mem. */
#ifndef atomic_and_val
# define atomic_and_val(mem, mask) \
({ __typeof (*(mem)) __atg16_old; \
__typeof (mem) __atg16_memp = (mem); \
__typeof (*(mem)) __atg16_mask = (mask); \
#ifndef atomic_and
# define atomic_and(mem, mask) \
({ __typeof (*(mem)) __oldval; \
__typeof (mem) __memp = (mem); \
__typeof (*(mem)) __mask = (mask); \
\
do \
__atg16_old = (*__atg16_memp); \
while (__builtin_expect \
(atomic_compare_and_exchange_bool_acq (__atg16_memp, \
__atg16_old & __atg16_mask,\
__atg16_old), 0)); \
__oldval = (*__memp); \
while (__builtin_expect (atomic_compare_and_exchange_bool_acq (__memp, \
__oldval \
& __mask, \
__oldval),\
0)); \
\
__atg16_old; })
__oldval; })
#endif
/* Atomically *mem |= mask and return the old value of *mem. */
#ifndef atomic_or
# define atomic_or(mem, mask) \
do { \
__typeof (*(mem)) __atg17_old; \
__typeof (mem) __atg17_memp = (mem); \
__typeof (*(mem)) __atg17_mask = (mask); \
\
do \
__atg17_old = (*__atg17_memp); \
while (__builtin_expect \
(atomic_compare_and_exchange_bool_acq (__atg17_memp, \
__atg17_old | __atg17_mask, \
__atg17_old), 0)); \
} while (0)
#endif
#ifndef catomic_or
# define catomic_or(mem, mask) \
do { \
__typeof (*(mem)) __atg18_old; \
__typeof (mem) __atg18_memp = (mem); \
__typeof (*(mem)) __atg18_mask = (mask); \
\
do \
__atg18_old = (*__atg18_memp); \
while (__builtin_expect \
(catomic_compare_and_exchange_bool_acq (__atg18_memp, \
__atg18_old | __atg18_mask,\
__atg18_old), 0)); \
} while (0)
#endif
/* Atomically *mem |= mask and return the old value of *mem. */
#ifndef atomic_or_val
# define atomic_or_val(mem, mask) \
({ __typeof (*(mem)) __atg19_old; \
__typeof (mem) __atg19_memp = (mem); \
__typeof (*(mem)) __atg19_mask = (mask); \
({ __typeof (*(mem)) __oldval; \
__typeof (mem) __memp = (mem); \
__typeof (*(mem)) __mask = (mask); \
\
do \
__atg19_old = (*__atg19_memp); \
while (__builtin_expect \
(atomic_compare_and_exchange_bool_acq (__atg19_memp, \
__atg19_old | __atg19_mask,\
__atg19_old), 0)); \
__oldval = (*__memp); \
while (__builtin_expect (atomic_compare_and_exchange_bool_acq (__memp, \
__oldval \
| __mask, \
__oldval),\
0)); \
\
__atg19_old; })
__oldval; })
#endif
#ifndef atomic_full_barrier
@ -497,12 +324,6 @@
#endif
#ifndef atomic_forced_read
# define atomic_forced_read(x) \
({ __typeof (x) __x; __asm ("" : "=r" (__x) : "0" (x)); __x; })
#endif
#ifndef atomic_delay
# define atomic_delay() do { /* nothing */ } while (0)
#endif

View File

@ -47,9 +47,6 @@ libc_hidden_proto (_dl_addr)
/* Close an object previously opened by _dl_open. */
extern void _dl_close (void *map) attribute_hidden;
/* Same as above, but without locking and safety checks for user
provided map arguments. */
extern void _dl_close_worker (struct link_map *map) attribute_hidden;
/* Look up NAME in shared object HANDLE (which may be RTLD_DEFAULT or
RTLD_NEXT). WHO is the calling function, for RTLD_NEXT. Returns

View File

@ -19,7 +19,7 @@ extern int rtld_errno attribute_hidden;
# else
# include <tls.h>
# include <tls.h> /* Defines USE_TLS. */
# if USE___THREAD
# undef errno

View File

@ -49,7 +49,7 @@
The `-ansi' switch to the GNU C compiler defines __STRICT_ANSI__.
If none of these are defined, the default is to have _SVID_SOURCE,
_BSD_SOURCE, and _POSIX_SOURCE set to one and _POSIX_C_SOURCE set to
200112L. If more than one of these are defined, they accumulate.
199506L. If more than one of these are defined, they accumulate.
For example __STRICT_ANSI__, _POSIX_SOURCE and _POSIX_C_SOURCE
together give you ISO C, 1003.1, and 1003.2, but nothing else.

View File

@ -114,13 +114,6 @@
# define _weak_alias(name, aliasname) \
extern __typeof (name) aliasname __attribute__ ((weak, alias (#name)));
/* Same as WEAK_ALIAS, but mark symbol as hidden. */
# define weak_hidden_alias(name, aliasname) \
_weak_hidden_alias (name, aliasname)
# define _weak_hidden_alias(name, aliasname) \
extern __typeof (name) aliasname \
__attribute__ ((weak, alias (#name), __visibility__ ("hidden")));
/* Declare SYMBOL as weak undefined symbol (resolved to 0 if not defined). */
# define weak_extern(symbol) _weak_extern (weak symbol)
# define _weak_extern(expr) _Pragma (#expr)
@ -128,7 +121,6 @@
# else
# define weak_alias(name, aliasname) strong_alias(name, aliasname)
# define weak_hidden_alias(name, aliasname) strong_alias(name, aliasname)
# define weak_extern(symbol) /* Nothing. */
# endif
@ -294,42 +286,27 @@ requires at runtime the shared libraries from the glibc version used \
for linking")
#endif
/* Declare SYMBOL to be TYPE (`function' or `object') of SIZE bytes
alias to ORIGINAL, when the assembler supports such declarations
(such as in ELF).
/* Declare SYMBOL to be TYPE (`function' or `object') and of SIZE bytes,
when the assembler supports such declarations (such as in ELF).
This is only necessary when defining something in assembly, or playing
funny alias games where the size should be other than what the compiler
thinks it is. */
#define declare_symbol_alias(symbol, original, type, size) \
declare_symbol_alias_1 (symbol, original, type, size)
#define declare_symbol(symbol, type, size) \
declare_symbol_1 (symbol, type, size)
#ifdef ASM_TYPE_DIRECTIVE_PREFIX
# ifdef __ASSEMBLER__
# define declare_symbol_alias_1(symbol, original, type, size) \
strong_alias (original, symbol); \
# define declare_symbol_1(symbol, type, size) \
.type C_SYMBOL_NAME (symbol), \
declare_symbol_alias_1_paste (ASM_TYPE_DIRECTIVE_PREFIX, type); \
.size C_SYMBOL_NAME (symbol), size
# define declare_symbol_alias_1_paste(a, b) \
declare_symbol_alias_1_paste_1 (a,b)
# define declare_symbol_alias_1_paste_1(a,b) a##b
declare_symbol_1_paste (ASM_TYPE_DIRECTIVE_PREFIX, type), size
# define declare_symbol_1_paste(a, b) declare_symbol_1_paste_1 (a,b)
# define declare_symbol_1_paste_1(a,b) a##b
# else /* Not __ASSEMBLER__. */
# define declare_symbol_alias_1(symbol, original, type, size) \
asm (declare_symbol_alias_1_stringify (ASM_GLOBAL_DIRECTIVE) \
" " __SYMBOL_PREFIX #symbol \
"\n\t" declare_symbol_alias_1_alias (symbol, original) \
"\n\t.type " __SYMBOL_PREFIX #symbol ", " \
declare_symbol_alias_1_stringify (ASM_TYPE_DIRECTIVE_PREFIX) #type \
# define declare_symbol_1(symbol, type, size) \
asm (".type " __SYMBOL_PREFIX #symbol ", " \
declare_symbol_1_stringify (ASM_TYPE_DIRECTIVE_PREFIX) #type \
"\n\t.size " __SYMBOL_PREFIX #symbol ", " #size);
# define declare_symbol_alias_1_stringify(x) \
declare_symbol_alias_1_stringify_1 (x)
# define declare_symbol_alias_1_stringify_1(x) #x
# ifdef HAVE_ASM_SET_DIRECTIVE
# define declare_symbol_alias_1_alias(symbol, original) \
".set " __SYMBOL_PREFIX #symbol ", " __SYMBOL_PREFIX #original
# else
# define declare_symbol_alias_1_alias(symbol, original) \
__SYMBOL_PREFIX #symbol " = " __SYMBOL_PREFIX #original
# endif /* HAVE_ASM_SET_DIRECTIVE */
# define declare_symbol_1_stringify(x) declare_symbol_1_stringify_1 (x)
# define declare_symbol_1_stringify_1(x) #x
# endif /* __ASSEMBLER__ */
#else
# define declare_symbol_1(symbol, type, size) /* Nothing. */
@ -454,7 +431,8 @@ for linking")
strong_alias(real, name)
#endif
#if defined SHARED || defined LIBC_NONSHARED
#if defined HAVE_VISIBILITY_ATTRIBUTE \
&& (defined SHARED || defined LIBC_NONSHARED)
# define attribute_hidden __attribute__ ((visibility ("hidden")))
#else
# define attribute_hidden
@ -466,7 +444,11 @@ for linking")
# define attribute_tls_model_ie
#endif
#define attribute_relro __attribute__ ((section (".data.rel.ro")))
#ifdef HAVE_Z_RELRO
# define attribute_relro __attribute__ ((section (".data.rel.ro")))
#else
# define attribute_relro
#endif
/* Handling on non-exported internal names. We have to do this only
for shared code. */
@ -475,9 +457,14 @@ for linking")
# define INTDEF(name) strong_alias (name, name##_internal)
# define INTVARDEF(name) \
_INTVARDEF (name, name##_internal)
# define _INTVARDEF(name, aliasname) \
# if defined HAVE_VISIBILITY_ATTRIBUTE
# define _INTVARDEF(name, aliasname) \
extern __typeof (name) aliasname __attribute__ ((alias (#name), \
visibility ("hidden")));
# else
# define _INTVARDEF(name, aliasname) \
extern __typeof (name) aliasname __attribute__ ((alias (#name)));
# endif
# define INTDEF2(name, newname) strong_alias (name, newname##_internal)
# define INTVARDEF2(name, newname) _INTVARDEF (name, newname##_internal)
#else
@ -562,10 +549,16 @@ for linking")
versioned_symbol (libc, __real_foo, foo, GLIBC_2_1);
libc_hidden_ver (__real_foo, foo) */
#if defined SHARED && defined DO_VERSIONING && !defined NO_HIDDEN
#if defined SHARED && defined DO_VERSIONING \
&& !defined HAVE_BROKEN_ALIAS_ATTRIBUTE && !defined NO_HIDDEN
# ifndef __ASSEMBLER__
# define __hidden_proto_hiddenattr(attrs...) \
# if !defined HAVE_VISIBILITY_ATTRIBUTE \
|| defined HAVE_BROKEN_VISIBILITY_ATTRIBUTE
# define __hidden_proto_hiddenattr(attrs...)
# else
# define __hidden_proto_hiddenattr(attrs...) \
__attribute__ ((visibility ("hidden"), ##attrs))
# endif
# define hidden_proto(name, attrs...) \
__hidden_proto (name, __GI_##name, ##attrs)
# define __hidden_proto(name, internal, attrs...) \

View File

@ -42,9 +42,7 @@ extern unsigned int la_objopen (struct link_map *__map, Lmid_t __lmid,
#include <stddef.h>
#include <bits/linkmap.h>
#include <dl-lookupcfg.h>
#include <tls.h>
#include <bits/libc-lock.h>
#include <rtld-lowlevel.h>
#include <tls.h> /* Defines USE_TLS. */
/* Some internal data structures of the dynamic linker used in the
@ -122,7 +120,7 @@ struct link_map
are indexed by DT_ADDRTAGIDX(tagvalue), see <elf.h>. */
ElfW(Dyn) *l_info[DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM
+ DT_EXTRANUM + DT_VALNUM + DT_ADDRNUM];
+ DT_EXTRANUM + DT_VALNUM + DT_ADDRNUM];
const ElfW(Phdr) *l_phdr; /* Pointer to program header table in core. */
ElfW(Addr) l_entry; /* Entry point location. */
ElfW(Half) l_phnum; /* Number of program header entries. */
@ -220,8 +218,6 @@ struct link_map
/* This is an array defining the lookup scope for this link map.
There are initially at most three different scope lists. */
struct r_scope_elem **l_scope;
/* We need to protect using the SCOPEREC. */
__rtld_mrlock_define (, l_scope_lock)
/* A similar array, this time only with the local scope. This is
used occasionally. */
@ -261,6 +257,7 @@ struct link_map
const ElfW(Sym) *ret;
} l_lookup_cache;
#ifdef USE_TLS
/* Thread-local storage related info. */
/* Start of the initialization image. */
@ -273,13 +270,14 @@ struct link_map
size_t l_tls_align;
/* Offset of first byte module alignment. */
size_t l_tls_firstbyte_offset;
#ifndef NO_TLS_OFFSET
# define NO_TLS_OFFSET 0
#endif
# ifndef NO_TLS_OFFSET
# define NO_TLS_OFFSET 0
# endif
/* For objects present at startup time: offset in the static TLS block. */
ptrdiff_t l_tls_offset;
/* Index of the module in the dtv array. */
size_t l_tls_modid;
#endif
/* Information used to change permission after the relocations are
done. */

View File

@ -1,5 +1,5 @@
/* Macros for managing ABI-compatibility definitions using ELF symbol versions.
Copyright (C) 2000, 2002, 2006 Free Software Foundation, Inc.
Copyright (C) 2000, 2002 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
@ -44,8 +44,6 @@
in the GLIBC_2.0 version and obsoleted in the GLIBC_2.2 version. */
# define SHLIB_COMPAT(lib, introduced, obsoleted) \
_SHLIB_COMPAT (lib, introduced, obsoleted)
# define _SHLIB_COMPAT(lib, introduced, obsoleted) \
((IS_IN_##lib - 0) \
&& (!(ABI_##lib##_##obsoleted - 0) \
|| ((ABI_##lib##_##introduced - 0) < (ABI_##lib##_##obsoleted - 0))))
@ -64,17 +62,13 @@
shlib-versions if that is newer. */
# define versioned_symbol(lib, local, symbol, version) \
versioned_symbol_1 (lib, local, symbol, version)
# define versioned_symbol_1(lib, local, symbol, version) \
versioned_symbol_2 (local, symbol, VERSION_##lib##_##version)
# define versioned_symbol_2(local, symbol, name) \
versioned_symbol_1 (local, symbol, VERSION_##lib##_##version)
# define versioned_symbol_1(local, symbol, name) \
default_symbol_version (local, symbol, name)
# define compat_symbol(lib, local, symbol, version) \
compat_symbol_1 (lib, local, symbol, version)
# define compat_symbol_1(lib, local, symbol, version) \
compat_symbol_2 (local, symbol, VERSION_##lib##_##version)
# define compat_symbol_2(local, symbol, name) \
compat_symbol_1 (local, symbol, VERSION_##lib##_##version)
# define compat_symbol_1(local, symbol, name) \
symbol_version (local, symbol, name)
#else

View File

@ -131,6 +131,7 @@ libc_hidden_proto (__vsnprintf_chk)
libc_hidden_proto (__vfprintf_chk)
# if !defined NOT_IN_libc && defined SHARED && defined DO_VERSIONING \
&& defined HAVE_VISIBILITY_ATTRIBUTE && !defined HAVE_BROKEN_ALIAS_ATTRIBUTE\
&& !defined NO_HIDDEN
/* Special gcc builtins. */
extern size_t __builtin_fwrite (const void *, size_t, size_t, void *)

View File

@ -5,7 +5,8 @@
#include_next <tls.h>
#if HAVE___THREAD && (!defined NOT_IN_libc || defined IS_IN_libpthread)
#if USE_TLS && HAVE___THREAD \
&& (!defined NOT_IN_libc || defined IS_IN_libpthread)
# define USE___THREAD 1

View File

@ -66,7 +66,7 @@ tests := test-utime test-stat test-stat2 test-lfs tst-getcwd \
tst-openat tst-unlinkat tst-fstatat tst-futimesat \
tst-renameat tst-fchownat tst-fchmodat tst-faccessat \
tst-symlinkat tst-linkat tst-readlinkat tst-mkdirat \
tst-mknodat tst-mkfifoat tst-ttyname_r
tst-mknodat tst-mkfifoat
distribute := ftwtest-sh
@ -90,6 +90,19 @@ CFLAGS-posix_fallocate64.c = -fexceptions
CFLAGS-test-stat.c = -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
CFLAGS-test-lfs.c = -D_LARGEFILE64_SOURCE
ifeq (yes,$(have-protected))
CFLAGS-stat.c = -DHAVE_DOT_HIDDEN
CFLAGS-fstat.c = -DHAVE_DOT_HIDDEN
CFLAGS-lstat.c = -DHAVE_DOT_HIDDEN
CFLAGS-mknod.c = -DHAVE_DOT_HIDDEN
CFLAGS-stat64.c = -DHAVE_DOT_HIDDEN
CFLAGS-fstat64.c = -DHAVE_DOT_HIDDEN
CFLAGS-lstat64.c = -DHAVE_DOT_HIDDEN
CFLAGS-fstatat.c = -DHAVE_DOT_HIDDEN
CFLAGS-fstatat64.c = -DHAVE_DOT_HIDDEN
CFLAGS-mknodat.c = -DHAVE_DOT_HIDDEN
endif
test-stat2-ARGS = Makefile . $(objpfx)test-stat2
tst-statvfs-ARGS = $(objpfx)tst-statvfs tst-statvfs.c /tmp

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1996, 1997, 1998, 2001, 2006 Free Software Foundation, Inc.
/* Copyright (C) 1996, 1997, 1998, 2001 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
@ -47,10 +47,16 @@
#undef fstat
#undef __fstat
int
attribute_hidden
__fstat (int fd, struct stat *buf)
{
return __fxstat (_STAT_VER, fd, buf);
}
weak_hidden_alias (__fstat, fstat)
weak_alias (__fstat, fstat)
/* Hide the symbol so that no definition but the one locally in the
executable or DSO is used. */
#ifdef HAVE_DOT_HIDDEN
asm (".hidden\tfstat");
asm (".hidden\t__fstat");
#endif

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1996, 1997, 2001, 2006 Free Software Foundation, Inc.
/* Copyright (C) 1996, 1997, 2001 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
@ -46,8 +46,13 @@
#undef fstat64
int
attribute_hidden
fstat64 (int fd, struct stat64 *buf)
{
return __fxstat64 (_STAT_VER, fd, buf);
}
/* Hide the symbol so that no definition but the one locally in the
executable or DSO is used. */
#ifdef HAVE_DOT_HIDDEN
asm (".hidden\tfstat64");
#endif

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2005, 2006 Free Software Foundation, Inc.
/* Copyright (C) 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
@ -46,8 +46,13 @@
#undef fstatat
int
attribute_hidden
fstatat (int fd, const char *file, struct stat *buf, int flag)
{
return __fxstatat (_STAT_VER, fd, file, buf, flag);
}
/* Hide the symbol so that no definition but the one locally in the
executable or DSO is used. */
#ifdef HAVE_DOT_HIDDEN
asm (".hidden\tfstatat");
#endif

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2005, 2006 Free Software Foundation, Inc.
/* Copyright (C) 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
@ -46,8 +46,13 @@
#undef fstatat64
int
attribute_hidden
fstatat64 (int fd, const char *file, struct stat64 *buf, int flag)
{
return __fxstatat64 (_STAT_VER, fd, file, buf, flag);
}
/* Hide the symbol so that no definition but the one locally in the
executable or DSO is used. */
#ifdef HAVE_DOT_HIDDEN
asm (".hidden\tfstatat64");
#endif

View File

@ -376,14 +376,12 @@ fts_read(sp)
}
p = sp->fts_child;
sp->fts_child = NULL;
sp->fts_cur = p;
goto name;
}
/* Move to the next node on this level. */
next: tmp = p;
if ((p = p->fts_link) != NULL) {
sp->fts_cur = p;
free(tmp);
/*
@ -396,7 +394,7 @@ next: tmp = p;
return (NULL);
}
fts_load(sp, p);
return p;
return (sp->fts_cur = p);
}
/*
@ -422,12 +420,11 @@ next: tmp = p;
name: t = sp->fts_path + NAPPEND(p->fts_parent);
*t++ = '/';
memmove(t, p->fts_name, p->fts_namelen + 1);
return p;
return (sp->fts_cur = p);
}
/* Move up to the parent node. */
p = tmp->fts_parent;
sp->fts_cur = p;
free(tmp);
if (p->fts_level == FTS_ROOTPARENTLEVEL) {
@ -468,7 +465,7 @@ name: t = sp->fts_path + NAPPEND(p->fts_parent);
return (NULL);
}
p->fts_info = p->fts_errno ? FTS_ERR : FTS_DP;
return p;
return (sp->fts_cur = p);
}
/*

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1996, 1997, 2001, 2006 Free Software Foundation, Inc.
/* Copyright (C) 1996, 1997, 2001 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
@ -47,10 +47,16 @@
#undef lstat
#undef __lstat
int
attribute_hidden
__lstat (const char *file, struct stat *buf)
{
return __lxstat (_STAT_VER, file, buf);
}
weak_hidden_alias (__lstat, lstat)
weak_alias (__lstat, lstat)
/* Hide the symbol so that no definition but the one locally in the
executable or DSO is used. */
#ifdef HAVE_DOT_HIDDEN
asm (".hidden\tlstat");
asm (".hidden\t__lstat");
#endif

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1996, 1997, 2001, 2006 Free Software Foundation, Inc.
/* Copyright (C) 1996, 1997, 2001 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
@ -46,8 +46,13 @@
#undef lstat64
int
attribute_hidden
lstat64 (const char *file, struct stat64 *buf)
{
return __lxstat64 (_STAT_VER, file, buf);
}
/* Hide the symbol so that no definition but the one locally in the
executable or DSO is used. */
#ifdef HAVE_DOT_HIDDEN
asm (".hidden\tlstat64");
#endif

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1995, 1996, 2001, 2006 Free Software Foundation, Inc.
/* Copyright (C) 1995, 1996, 2001 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
@ -47,10 +47,16 @@
all callers. */
int
attribute_hidden
__mknod (const char *path, mode_t mode, dev_t dev)
{
return __xmknod (_MKNOD_VER, path, mode, &dev);
}
weak_hidden_alias (__mknod, mknod)
weak_alias (__mknod, mknod)
/* Hide the symbol so that no definition but the one locally in the
executable or DSO is used. */
#ifdef HAVE_DOT_HIDDEN
asm (".hidden\tmknod");
asm (".hidden\t__mknod");
#endif

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1995, 1996, 2001, 2005, 2006 Free Software Foundation, Inc.
/* Copyright (C) 1995, 1996, 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
@ -47,8 +47,14 @@
all callers. */
int
attribute_hidden
mknodat (int fd, const char *path, mode_t mode, dev_t dev)
{
return __xmknodat (_MKNOD_VER, fd, path, mode, &dev);
}
/* Hide the symbol so that no definition but the one locally in the
executable or DSO is used. */
#ifdef HAVE_DOT_HIDDEN
asm (".hidden\tmknodat");
#endif

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1996, 1997, 2001, 2006 Free Software Foundation, Inc.
/* Copyright (C) 1996, 1997, 2001 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
@ -46,10 +46,16 @@
#undef stat
int
attribute_hidden
__stat (const char *file, struct stat *buf)
{
return __xstat (_STAT_VER, file, buf);
}
weak_hidden_alias (__stat, stat)
weak_alias (__stat, stat)
/* Hide the symbol so that no definition but the one locally in the
executable or DSO is used. */
#ifdef HAVE_DOT_HIDDEN
asm (".hidden\tstat");
asm (".hidden\t__stat");
#endif

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1996, 1997, 2001, 2006 Free Software Foundation, Inc.
/* Copyright (C) 1996, 1997, 2001 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
@ -46,8 +46,13 @@
#undef stat64
int
attribute_hidden
stat64 (const char *file, struct stat64 *buf)
{
return __xstat64 (_STAT_VER, file, buf);
}
/* Hide the symbol so that no definition but the one locally in the
executable or DSO is used. */
#ifdef HAVE_DOT_HIDDEN
asm (".hidden\tstat64");
#endif

1
libio/Banner Normal file
View File

@ -0,0 +1 @@
GNU libio by Per Bothner

View File

@ -57,8 +57,7 @@ tests = tst_swprintf tst_wprintf tst_swscanf tst_wscanf tst_getwc tst_putwc \
bug-ungetc2 bug-ftell bug-ungetc3 bug-ungetc4 tst-fopenloc2 \
tst-memstream1 tst-memstream2 \
tst-wmemstream1 tst-wmemstream2 \
bug-memstream1 bug-wmemstream1 \
tst-setvbuf1
bug-memstream1 bug-wmemstream1
test-srcs = test-freopen
all: # Make this the default target; it will be defined in Rules.

View File

@ -174,8 +174,14 @@ _IO_new_file_close_it (fp)
close_status = _IO_SYSCLOSE (fp);
/* Free buffer. */
if (fp->_mode <= 0)
{
INTUSE(_IO_setb) (fp, NULL, NULL, 0);
_IO_setg (fp, NULL, NULL, NULL);
_IO_setp (fp, NULL, NULL);
}
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
if (fp->_mode > 0)
else
{
if (_IO_have_wbackup (fp))
INTUSE(_IO_free_wbackup_area) (fp);
@ -184,9 +190,6 @@ _IO_new_file_close_it (fp)
_IO_wsetp (fp, NULL, NULL);
}
#endif
INTUSE(_IO_setb) (fp, NULL, NULL, 0);
_IO_setg (fp, NULL, NULL, NULL);
_IO_setp (fp, NULL, NULL);
INTUSE(_IO_un_link) ((struct _IO_FILE_plus *) fp);
fp->_flags = _IO_MAGIC|CLOSED_FILEBUF_FLAGS;

View File

@ -367,7 +367,7 @@ __uflow (fp)
#endif
if (fp->_mode == 0)
_IO_fwide (fp, -1);
_IO_fwide (fp, -11);
if (_IO_in_put_mode (fp))
if (INTUSE(_IO_switch_to_get_mode) (fp) == EOF)
return EOF;

View File

@ -142,7 +142,6 @@
#ifdef _LIBC
# define _IO_FLAGS2_FORTIFY 4
#endif
#define _IO_FLAGS2_USER_WBUF 8
/* These are "formatting flags" matching the iostream fmtflags enum values. */
#define _IO_SKIPWS 01

View File

@ -1,5 +1,4 @@
/* Copyright (C) 1993,1994,1996,1997,2000,2002,2006
Free Software Foundation, Inc.
/* Copyright (C) 1993,1994,1996,1997,2000,2002 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
@ -41,9 +40,14 @@ _IO_FILE *stderr = (FILE *) &_IO_2_1_stderr_;
#undef _IO_stderr
#ifdef _LIBC
# define AL(name) AL2 (name, _IO_##name)
# define AL2(name, al) \
# if defined HAVE_VISIBILITY_ATTRIBUTE
# define AL2(name, al) \
extern __typeof (name) al __attribute__ ((alias (#name), \
visibility ("hidden")))
# else
# define AL2(name, al) \
extern __typeof (name) al __attribute__ ((alias (#name)))
# endif
AL(stdin);
AL(stdout);
AL(stderr);

View File

@ -166,27 +166,27 @@ __BEGIN_NAMESPACE_STD
This function is a possible cancellation points and therefore not
marked with __THROW. */
#ifndef __USE_FILE_OFFSET64
extern FILE *tmpfile (void) __wur;
extern FILE *tmpfile (void);
#else
# ifdef __REDIRECT
extern FILE *__REDIRECT (tmpfile, (void), tmpfile64) __wur;
extern FILE *__REDIRECT (tmpfile, (void), tmpfile64);
# else
# define tmpfile tmpfile64
# endif
#endif
#ifdef __USE_LARGEFILE64
extern FILE *tmpfile64 (void) __wur;
extern FILE *tmpfile64 (void);
#endif
/* Generate a temporary filename. */
extern char *tmpnam (char *__s) __THROW __wur;
extern char *tmpnam (char *__s) __THROW;
__END_NAMESPACE_STD
#ifdef __USE_MISC
/* This is the reentrant variant of `tmpnam'. The only difference is
that it does not allow S to be NULL. */
extern char *tmpnam_r (char *__s) __THROW __wur;
extern char *tmpnam_r (char *__s) __THROW;
#endif
@ -199,7 +199,7 @@ extern char *tmpnam_r (char *__s) __THROW __wur;
P_tmpdir is tried and finally "/tmp". The storage for the filename
is allocated by `malloc'. */
extern char *tempnam (__const char *__dir, __const char *__pfx)
__THROW __attribute_malloc__ __wur;
__THROW __attribute_malloc__;
#endif
@ -244,23 +244,21 @@ __BEGIN_NAMESPACE_STD
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern FILE *fopen (__const char *__restrict __filename,
__const char *__restrict __modes) __wur;
__const char *__restrict __modes);
/* Open a file, replacing an existing stream with it.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern FILE *freopen (__const char *__restrict __filename,
__const char *__restrict __modes,
FILE *__restrict __stream) __wur;
FILE *__restrict __stream);
#else
# ifdef __REDIRECT
extern FILE *__REDIRECT (fopen, (__const char *__restrict __filename,
__const char *__restrict __modes), fopen64)
__wur;
__const char *__restrict __modes), fopen64);
extern FILE *__REDIRECT (freopen, (__const char *__restrict __filename,
__const char *__restrict __modes,
FILE *__restrict __stream), freopen64)
__wur;
FILE *__restrict __stream), freopen64);
# else
# define fopen fopen64
# define freopen freopen64
@ -269,15 +267,15 @@ extern FILE *__REDIRECT (freopen, (__const char *__restrict __filename,
__END_NAMESPACE_STD
#ifdef __USE_LARGEFILE64
extern FILE *fopen64 (__const char *__restrict __filename,
__const char *__restrict __modes) __wur;
__const char *__restrict __modes);
extern FILE *freopen64 (__const char *__restrict __filename,
__const char *__restrict __modes,
FILE *__restrict __stream) __wur;
FILE *__restrict __stream);
#endif
#ifdef __USE_POSIX
/* Create a new stream that refers to an existing system file descriptor. */
extern FILE *fdopen (int __fd, __const char *__modes) __THROW __wur;
extern FILE *fdopen (int __fd, __const char *__modes) __THROW;
#endif
#ifdef __USE_GNU
@ -285,16 +283,15 @@ extern FILE *fdopen (int __fd, __const char *__modes) __THROW __wur;
and uses the given functions for input and output. */
extern FILE *fopencookie (void *__restrict __magic_cookie,
__const char *__restrict __modes,
_IO_cookie_io_functions_t __io_funcs) __THROW __wur;
_IO_cookie_io_functions_t __io_funcs) __THROW;
/* Create a new stream that refers to a memory buffer. */
extern FILE *fmemopen (void *__s, size_t __len, __const char *__modes)
__THROW __wur;
extern FILE *fmemopen (void *__s, size_t __len, __const char *__modes) __THROW;
/* Open a stream that writes into a malloc'd buffer that is expanded as
necessary. *BUFLOC and *SIZELOC are updated with the buffer's location
and the number of characters written on fflush or fclose. */
extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __THROW __wur;
extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __THROW;
#endif
@ -370,13 +367,13 @@ __END_NAMESPACE_C99
Store the address of the string in *PTR. */
extern int vasprintf (char **__restrict __ptr, __const char *__restrict __f,
_G_va_list __arg)
__THROW __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
__THROW __attribute__ ((__format__ (__printf__, 2, 0)));
extern int __asprintf (char **__restrict __ptr,
__const char *__restrict __fmt, ...)
__THROW __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
__THROW __attribute__ ((__format__ (__printf__, 2, 3)));
extern int asprintf (char **__restrict __ptr,
__const char *__restrict __fmt, ...)
__THROW __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
__THROW __attribute__ ((__format__ (__printf__, 2, 3)));
/* Write formatted output to a file descriptor.

View File

@ -119,7 +119,7 @@ _IO_vswprintf (string, maxlen, format, args)
if (sf.f._sbf._f._wide_data->_IO_buf_base == sf.overflow_buf)
/* ISO C99 requires swprintf/vswprintf to return an error if the
output does not fit in the provided buffer. */
output does not fit int he provided buffer. */
return -1;
/* Terminate the string. */

View File

@ -1,5 +1,4 @@
/* Copyright (C) 1993, 1997, 1999, 2000, 2002, 2006
Free Software Foundation, Inc.
/* Copyright (C) 1993, 1997, 1999, 2000, 2002 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
@ -86,20 +85,35 @@ _IO_wfile_doallocate (fp)
_IO_FILE *fp;
{
_IO_size_t size;
int couldbetty;
wchar_t *p;
struct _G_stat64 st;
/* Allocate room for the external buffer. */
if (fp->_IO_buf_base == NULL)
INTUSE(_IO_file_doallocate) (fp);
/* If narrow buffer is user allocated (set by setvbuf etc.),
use that size as the size of the wide buffer, when it is
allocated by _IO_file_doallocate, multiply that by size
of the wide character. */
size = fp->_IO_buf_end - fp->_IO_buf_base;
if ((fp->_flags & _IO_USER_BUF))
size = (size + sizeof (wchar_t) - 1) / sizeof (wchar_t);
if (fp->_fileno < 0 || _IO_SYSSTAT (fp, &st) < 0)
{
couldbetty = 0;
size = _IO_BUFSIZ;
#if 0
/* do not try to optimise fseek() */
fp->_flags |= __SNPT;
#endif
}
else
{
couldbetty = S_ISCHR (st.st_mode);
#if _IO_HAVE_ST_BLKSIZE
size = st.st_blksize <= 0 ? _IO_BUFSIZ : st.st_blksize;
#else
size = _IO_BUFSIZ;
#endif
}
ALLOC_WBUF (p, size * sizeof (wchar_t), EOF);
INTUSE(_IO_wsetb) (fp, p, p + size, 1);
if (couldbetty && isatty (fp->_fileno))
fp->_flags |= _IO_LINE_BUF;
return 1;
}

Some files were not shown because too many files have changed in this diff Show More