Updated to fedora-glibc-2_3-20050216T1256

This commit is contained in:
Roland McGrath 2005-02-16 19:57:14 +00:00
parent aa29d418cf
commit 7cd2745877
236 changed files with 40674 additions and 53745 deletions

6058
ChangeLog

File diff suppressed because it is too large Load Diff

View File

@ -510,6 +510,14 @@
_IO_vfprintf_internal, _IO_putc_internal, _IO_read, _IO_write,
_IO_close): Likewise.
2004-11-26 Jakub Jelinek <jakub@redhat.com>
* posix/Makefile (generated: Add getconf.speclist.
($(inst_libexecdir)/getconf): Use getconf.speclist instead of
getconf output.
($(objpfx)getconf.speclist): New rule.
* posix/getconf.speclist.h: New file.
2004-11-26 Jakub Jelinek <jakub@redhat.com>
* posix/Makefile (install-others): Add $(inst_libexecdir)/getconf.
@ -1103,6 +1111,16 @@
* sysdeps/generic/tempname.c (__path_search): Add missing argument
TRY_TMPDIR.
2004-11-02 Jakub Jelinek <jakub@redhat.com>
* include/features.h (__USE_FORTIFY_LEVEL): Also set for Red Hat
GCC 3.4.x-RH >= 3.4.2-8.
* libio/bits/features.h (printf, fprintf, vprintf, vfprintf): For
GCC 3.4.x-RH use __builtin___{,v}{,f}printf_chk instead of
__{,v}{,f}printf_chk.
* debug/tst-chk1.c (do_test): Deal with GCC 3.4.x-RH not
being able to recognize subobjects.
2004-10-31 Mariusz Mazur <mmazur@kernel.pl>
* sysdeps/unix/sysv/linux/alpha/setregid.c: New file.
@ -1398,6 +1416,11 @@
* posix/execvp.c (execvp): Also ignore ENODEV and ETIMEDOUT errno
values.
2004-10-20 Jakub Jelinek <jakub@redhat.com>
* sysdeps/unix/sysv/linux/readonly-area.c (__readonly_area): If /proc
is not mounted, return 1.
2004-10-20 Roland McGrath <roland@redhat.com>
* Makeconfig ($(common-objpfx)shlib-versions.v.i): Check also
@ -1470,6 +1493,11 @@
* debug/catchsegv.sh: Update copyright year.
Use mktemp to create segv_output file.
2004-10-19 Jakub Jelinek <jakub@redhat.com>
* include/features.h (__USE_FORTIFY_LEVEL): Enable even with
Red Hat gcc4 4.0.0 and above.
2004-10-18 Jakub Jelinek <jakub@redhat.com>
* elf/dl-libc.c (__libc_dlsym_private, __libc_register_dl_open_hook):
@ -2453,6 +2481,22 @@
* string/string.h: Add __nonnull annotations.
* stdlib/stdlib.h: Likewise.
2004-09-20 Jakub Jelinek <jakub@redhat.com>
* sysdeps/unix/alpha/sysdep.h (inline_syscall[0-6]): Change name
argument to numbers from syscall names.
(INLINE_SYSCALL1): Pass __NR_##name to inline_syscall##nr.
(INTERNAL_SYSCALL_NCS): Renamed from...
(INTERNAL_SYSCALL_1): ... this. Use INTERNAL_SYSCALL_NCS.
* sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
(INTERNAL_SYSCALL_NCS): Define.
* sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
(INTERNAL_SYSCALL_NCS): Likewise.
* sysdeps/unix/sysv/linux/sparc/sysdep.h (inline_syscall[0-6]):
Change name argument to numbers from syscall names.
(INLINE_SYSCALL, INTERNAL_SYSCALL): Adjust.
(INTERNAL_SYSCALL_NCS): Define.
2004-09-20 H.J. Lu <hongjiu.lu@intel.com>
* sysdeps/unix/sysv/linux/ia64/sysdep.h (DO_INLINE_SYSCALL):
@ -3182,6 +3226,23 @@
before return type.
* locale/localename.c (__current_locale_name): Likewise.
2004-08-31 Jakub Jelinek <jakub@redhat.com>
* elf/ldconfig.c (parse_conf): Add prefix argument, prepend it
before arguments to add_dir and pass to parse_conf_include.
(parse_conf_include): Add prefix argument, pass it down to
parse_conf.
(main): Call arch_startup. Adjust parse_conf caller.
Call add_arch_dirs.
* sysdeps/generic/dl-cache.h (arch_startup, add_arch_dirs): Define.
* sysdeps/unix/sysv/linux/i386/dl-cache.h: New file.
* sysdeps/unix/sysv/linux/ia64/dl-cache.h (EMUL_HACK, arch_startup,
add_arch_dirs): Define.
* sysdeps/unix/sysv/linux/ia64/ldd-rewrite.sed: Prepend
/emul/ia32-linux before the 32-bit ld.so pathname.
* sysdeps/unix/sysv/linux/ia64/dl-procinfo.c: New file.
* sysdeps/unix/sysv/linux/ia64/dl-procinfo.h: New file.
2004-08-30 Roland McGrath <roland@frob.com>
* scripts/extract-abilist.awk: If `lastversion' variable defined, omit
@ -3338,6 +3399,22 @@
* resolv/nss_dns/dns-canon.c (_nss_dns_getcanonname_r): Initialize
status to NSS_STATUS_UNAVAIL.
2004-08-19 Jakub Jelinek <jakub@redhat.com>
* sysdeps/powerpc/powerpc64/configure.in: New file.
* sysdeps/powerpc/powerpc64/configure: Rebuilt.
* config.h.in (USE_PPC64_OVERLAPPING_OPD): Add.
* configure.in (HAVE_ASM_GLOBAL_DOT_NAME): Remove.
* configure: Rebuilt.
* sysdeps/powerpc/powerpc64/sysdep.h: Formatting.
(OPD_ENT, BODY_LABEL, ENTRY_1, ENTRY_2, END_2, DOT_PREFIX,
BODY_PREFIX): Define.
(ENTRY, DOT_LABEL, END, TRACEBACK, END_GEN_TB, EALIGN): Support
HAVE_ASM_GLOBAL_DOT_NAME or no dot symbols,
USE_PPC64_OVERLAPPING_OPD or never overlapping .opd entries.
* sysdeps/powerpc/powerpc64/dl-machine.h: Include sysdep.h.
(TRAMPOLINE_TEMPLATE, RTLD_START): Use the new sysdep.h macros.
2004-08-19 Ulrich Drepper <drepper@redhat.com>
* sysdeps/posix/getaddrinfo.c (gaih_inet): Use h->h_name in the
@ -3642,6 +3719,12 @@
* iconvdata/testdata/ISO-2022-JP-3: Regenerated.
2004-07-23 Jakub Jelinek <jakub@redhat.com>
[BZ #284]
* include/features.h (_POSIX_SOURCE, _POSIX_C_SOURCE): Define
if _XOPEN_SOURCE >= 500 even if __STRICT_ANSI__ is defined.
2004-08-10 Alfred M. Szmidt <ams@kemisten.nu>
* sysdeps/generic/bits/in.h (struct ip_mreq): Remove definition.

View File

@ -480,32 +480,21 @@ default-rpath = $(libdir)
endif
ifndef link-extra-libs
ifeq (yes,$(build-shared))
ifneq ($(common-objpfx),$(objpfx))
link-extra-libs = $(foreach lib,$(LDLIBS-$(@F)),\
$(wildcard $(common-objpfx)$(lib).so$($(notdir $(lib)).so-version) \
$(objpfx)$(lib).so$($(notdir $(lib)).so-version)))
else
link-extra-libs = $(foreach lib,$(LDLIBS-$(@F)),$(common-objpfx)$(lib).so$($(notdir $(lib)).so-version))
endif
else
link-extra-libs = $(foreach lib,$(LDLIBS-$(@F)),$(common-objpfx)$(lib).a)
endif
link-extra-libs = $(LDLIBS-$(@F))
link-extra-libs-static = $(link-extra-libs)
link-extra-libs-bounded = $(link-extra-libs)
endif
# The static libraries.
ifeq (yes,$(build-static))
link-libc-static = $(common-objpfx)libc.a $(static-gnulib) $(common-objpfx)libc.a
link-extra-libs-static = $(foreach lib,$(LDLIBS-$(@F)),$(common-objpfx)$(lib).a)
else
ifeq (yes,$(build-shared))
# We can try to link the programs with lib*_pic.a...
link-libc-static = $(static-gnulib) $(common-objpfx)libc_pic.a
link-extra-libs-static = $(link-extra-libs)
endif
endif
link-libc-bounded = $(common-objpfx)libc_b.a $(gnulib) $(common-objpfx)libc_b.a
link-extra-libs-bounded = $(foreach lib,$(LDLIBS-$(@F:%-bp=%)),$(common-objpfx)$(lib)_b.a)
ifndef gnulib
ifneq ($(have-cc-with-libunwind),yes)

View File

@ -248,7 +248,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\
"), "2004");
"), "2005");
fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper");
}

View File

@ -54,11 +54,13 @@ include ../Makeconfig
ifeq (yes,$(build-shared))
extra-objs += S$(start-installed-name)
install-lib += S$(start-installed-name)
generated += start.os
endif
ifeq (yes,$(build-bounded))
extra-objs += b$(start-installed-name)
install-lib += b$(start-installed-name)
generated += start.ob
endif
ifneq ($(start-installed-name),$(static-start-installed-name))

View File

@ -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) 2004 Free Software Foundation, Inc.\n\
Copyright (C) 2005 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\

View File

@ -39,7 +39,7 @@ if test $# -eq 0; then
;;
--v | --ve | --ver | --vers | --versi | --versio | --version)
echo 'catchsegv (GNU libc) @VERSION@'
echo 'Copyright (C) 2004 Free Software Foundation, Inc.
echo 'Copyright (C) 2005 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, 2002, 2003, 2004 Free Software Foundation, Inc.
# Copyright (C) 1999, 2001-2004, 2005 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.
" "2004"
" "2005"
printf $"Written by %s.
" "Ulrich Drepper"
exit 0

View File

@ -11,8 +11,23 @@ main (int argc, char *argv[])
int i = 0;
int result = 0;
struct dirent *dp;
long int save0;
long int rewind;
dirp = opendir (".");
if (dirp == NULL)
{
printf ("opendir failed: %m\n");
return 1;
}
save0 = telldir (dirp);
if (save0 == -1)
{
printf ("telldir failed: %m\n");
result = 1;
}
for (dp = readdir (dirp); dp != NULL; dp = readdir (dirp))
{
/* save position 3 (after fourth entry) */
@ -44,6 +59,19 @@ main (int argc, char *argv[])
for (dp = readdir (dirp); dp != NULL; dp = readdir (dirp))
printf ("%s\n", dp->d_name);
/* Check rewinddir */
rewinddir (dirp);
rewind = telldir (dirp);
if (rewind == -1)
{
printf ("telldir failed: %m\n");
result = 1;
}
else if (save0 != rewind)
{
printf ("rewinddir didn't reset directory stream\n");
result = 1;
}
closedir (dirp);
return result;

View File

@ -72,7 +72,7 @@ distribute := rtld-Rules \
tst-tlsmod1.c tst-tlsmod2.c tst-tlsmod3.c tst-tlsmod4.c \
tst-tlsmod5.c tst-tlsmod6.c tst-tlsmod7.c tst-tlsmod8.c \
tst-tlsmod9.c tst-tlsmod10.c tst-tlsmod11.c \
tst-tlsmod12.c tst-tls10.h tst-alignmod.c \
tst-tlsmod12.c tst-tls10.h tst-alignmod.c tst-alignmod2.c \
circlemod1.c circlemod1a.c circlemod2.c circlemod2a.c \
circlemod3.c circlemod3a.c nodlopenmod2.c \
tls-macros.h \
@ -153,7 +153,7 @@ tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
restest2 next dblload dblunload reldep5 reldep6 reldep7 reldep8 \
circleload1 tst-tls3 tst-tls4 tst-tls5 tst-tls6 tst-tls7 tst-tls8 \
tst-tls10 tst-tls11 tst-tls12 tst-tls13 tst-tls14 tst-align \
$(tests-execstack-$(have-z-execstack)) tst-dlmodcount \
tst-align2 $(tests-execstack-$(have-z-execstack)) tst-dlmodcount \
tst-dlopenrpath tst-deep1 tst-dlmopen1 tst-dlmopen2 tst-dlmopen3
# reldep9
test-srcs = tst-pathopt
@ -186,7 +186,8 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
circlemod3 circlemod3a \
reldep8mod1 reldep8mod2 reldep8mod3 \
reldep9mod1 reldep9mod2 reldep9mod3 \
tst-alignmod $(modules-execstack-$(have-z-execstack)) \
tst-alignmod tst-alignmod2 \
$(modules-execstack-$(have-z-execstack)) \
tst-dlopenrpathmod tst-deep1mod1 tst-deep1mod2 tst-deep1mod3 \
tst-dlmopen1mod
ifeq (yes,$(have-initfini-array))
@ -668,9 +669,12 @@ $(objpfx)tst-tls14: $(objpfx)tst-tlsmod14a.so $(libdl)
$(objpfx)tst-tls14.out:$(objpfx)tst-tlsmod14b.so
CFLAGS-tst-align.c = $(stack-align-test-flags)
CFLAGS-tst-align2.c = $(stack-align-test-flags)
CFLAGS-tst-alignmod.c = $(stack-align-test-flags)
CFLAGS-tst-alignmod2.c = $(stack-align-test-flags)
$(objpfx)tst-align: $(libdl)
$(objpfx)tst-align.out: $(objpfx)tst-alignmod.so
$(objpfx)tst-align2: $(objpfx)tst-alignmod2.so
ifdef libdl
$(objpfx)tst-tls9-static: $(common-objpfx)dlfcn/libdl.a
@ -732,6 +736,8 @@ $(objpfx)tst-pie1: $(objpfx)tst-pie1.o $(objpfx)tst-piemod1.so
-L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link) \
-o $@ $(objpfx)tst-pie1.o $(objpfx)tst-piemod1.so \
$(common-objpfx)libc_nonshared.a
generated += tst-pie1 tst-pie1.out tst-pie1.o
endif
check-textrel-CFLAGS = -O -Wall -D_XOPEN_SOURCE=600 -D_BSD_SOURCE

View File

@ -36,6 +36,7 @@
#include <dl-osinfo.h>
#include <stackinfo.h>
#include <caller.h>
#include <sysdep.h>
#include <dl-dst.h>
@ -105,13 +106,11 @@ ELF_PREFERRED_ADDRESS_DATA;
int __stack_prot attribute_hidden attribute_relro
= (PROT_READ|PROT_WRITE
#if _STACK_GROWS_DOWN && defined PROT_GROWSDOWN
|PROT_GROWSDOWN
= PROT_GROWSDOWN;
#elif _STACK_GROWS_UP && defined PROT_GROWSUP
|PROT_GROWSUP
= PROT_GROWSUP;
#endif
);
/* Type for the buffer we put the ELF header and hopefully the program
@ -1327,12 +1326,16 @@ cannot allocate TLS data structures for initial thread");
if (__builtin_expect (__check_caller (RETURN_ADDRESS (0),
allow_ldso|allow_libc) == 0,
0))
__stack_prot |= PROT_EXEC;
__stack_prot |= PROT_READ|PROT_WRITE|PROT_EXEC;
__mprotect ((void *) p, s, PROT_READ);
}
else
#endif
__stack_prot |= PROT_EXEC;
__stack_prot |= PROT_READ|PROT_WRITE|PROT_EXEC;
#ifdef check_consistency
check_consistency ();
#endif
errval = (*GL(dl_make_stack_executable_hook)) (stack_endp);
if (errval)
@ -1788,7 +1791,12 @@ 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);
sps->dirs = (void *) -1;
#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;
}
return -1;

View File

@ -279,7 +279,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\
"), "2004");
"), "2005");
fprintf (stream, gettext ("Written by %s.\n"),
"Andreas Jaeger");
}

View File

@ -1,5 +1,5 @@
#! @BASH@
# Copyright (C) 1996-2001, 2002, 2003, 2004 Free Software Foundation, Inc.
# Copyright (C) 1996-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
@ -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.
" "2004"
" "2005"
printf $"Written by %s and %s.
" "Roland McGrath" "Ulrich Drepper"
exit 0

View File

@ -1412,9 +1412,9 @@ ERROR: ld.so: object '%s' from %s cannot be preloaded: ignored.\n",
{
if (! l->l_addr)
l->l_addr = ph->p_vaddr;
else if (ph->p_vaddr + ph->p_memsz >= l->l_map_end)
if (ph->p_vaddr + ph->p_memsz >= l->l_map_end)
l->l_map_end = ph->p_vaddr + ph->p_memsz;
else if ((ph->p_flags & PF_X)
if ((ph->p_flags & PF_X)
&& ph->p_vaddr + ph->p_memsz >= l->l_text_end)
l->l_text_end = ph->p_vaddr + ph->p_memsz;
}

View File

@ -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\
"),
"2004");
"2005");
fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper");
}

View File

@ -1,5 +1,7 @@
# This file is updated automatically by Makefile.
glibc-branch := fedora
glibc-base := HEAD
fedora-sync-date := 2004-12-19 23:31 UTC
fedora-sync-tag := fedora-glibc-20041219T2331
glibc-branch := fedora-2_3
glibc-base := glibc-2_3-branch
DIST_BRANCH := FC-3
COLLECTION := dist-fc3-updates-candidate
fedora-2_3-sync-date := 2005-02-16 12:56 UTC
fedora-2_3-sync-tag := fedora-glibc-2_3-20050216T1256

View File

@ -1,4 +1,4 @@
%define glibcrelease 2
%define glibcrelease 3.fc3
%define auxarches i586 i686 athlon sparcv9 alphaev6
%define prelinkarches noarch
%define nptlarches i386 i686 athlon x86_64 ia64 s390 s390x sparcv9 ppc ppc64
@ -12,10 +12,10 @@ Version: %{glibcversion}
Release: %{glibcrelease}
Copyright: LGPL
Group: System Environment/Libraries
%define glibcsrcdir %{name}-%{glibcdate}
%define glibcsrcdir %{glibcname}-%{glibcdate}
Source0: %{glibcsrcdir}.tar.bz2
Source1: %{name}-fedora-%{glibcdate}.tar.bz2
Patch0: %{name}-fedora.patch
Source1: %{glibcname}-fedora-%{glibcdate}.tar.bz2
Patch0: %{glibcname}-fedora.patch
Patch1: %{name}-nptl-check.patch
Patch2: %{name}-ppc-assume.patch
Patch3: %{name}-ia64-lib64.patch
@ -1270,6 +1270,47 @@ rm -f *.filelist*
%endif
%changelog
* Wed Feb 16 2005 Roland McGrath <roland@redhat.com> 2.3.4-3.fc3
- update from CVS
- fix initstate{,_r} (BZ#710)
- fix segfault if chrooted app attempts to dlopen a library
and no standard library directory exists at all (#147067, #144303, BZ#738)
- fix initgroups when nscd is running, but has group caching disabled
(#146588, BZ#741)
- fix pthread_key_{create,destroy} in LinuxThreads when pthread_create
has not been called yet (#146710, BZ#739)
- fix ppc64 swapcontext and setcontext (#146736, BZ#700)
- service nscd cosmetic fixes (#146776, BZ#742)
- fix s390{,x} string.h (BZ#743)
- fix IA-32 and x86-64 stack alignment in DSO constructors (#145689, BZ#735)
- fix zdump -v segfaults on x86-64 (#146210, BZ#736)
- update IA-64 libm from Intel v2.1 (#142494, BZ#592)
- avoid calling sigaction (SIGPIPE, ...) inside syslog
(#146021, IT#56686, BZ#671)
- declare ftruncate for POSIX 2003 (BZ#640)
- fix errno values for futimes (BZ#633)
- unconditionally include <features.h> in malloc.h (BZ#650)
- change regex \B handling to match old GNU regex as well as perl/grep's dfa
(from empty string inside of word to empty string not at a word boundary,
BZ#693)
- slightly optimize i686 TLS accesses, use direct TLS %gs access in sem_*
and allow building -mno-tls-direct-seg-refs glibc that is free of
direct TLS %gs access with negative offsets (BZ#737)
- fix addseverity (BZ#731)
- fix fmemopen (BZ#730)
- fix rewinddir (BZ#734)
- increase svc{tcp,unix}_create listen backlog (BZ#733)
- fix vDSO l_map_end/l_text_end computation (BZ#729)
- fix IA-32 stack alignment for LinuxThreads thread functions
and functions passed to clone(2) directly (BZ#723)
- fix ecvt{,_r} on denormals (#143279, BZ#725)
- fix __tls_get_addr typo (BZ#726)
- fix rounding in IA-64 alarm (#143710, BZ#626)
- don't reinitialize __environ in __libc_start_main, so that
effects of setenv/putenv done in DSO initializers are preserved
(#144037, IT#57403, BZ#727)
- fix ppc/ppc64 rint and other rounding functions (#144931, BZ#602)
* Mon Dec 19 2004 Jakub Jelinek <jakub@redhat.com> 2.3.4-2
- work around rpm bug some more, this time by copying
iconvconfig to iconvconfig.%%{_target_cpu}.
@ -1574,7 +1615,7 @@ rm -f *.filelist*
- update from CVS
- fix BZ #151, #362, #381, #407
- fdim fix for +inf/+inf (BZ #376)
* Sun Sep 26 2004 Jakub Jelinek <jakub@redhat.com> 2.3.3-58
- update from CVS
- vasprintf fix (BZ #346)

View File

@ -111,7 +111,7 @@ _hurdsig_longjmp_from_handler (void *data, jmp_buf env, int val)
link = (void *) &scp[1];
assert (! link->resource.next && ! link->resource.prevp);
assert (link->thread.next == ss->active_resources);
assert (link->thread.prevp = &ss->active_resources);
assert (link->thread.prevp == &ss->active_resources);
if (link->thread.next)
link->thread.next->thread.prevp = &link->thread.next;
ss->active_resources = link;

View File

@ -78,3 +78,15 @@ $(inst_bindir)/iconv: $(objpfx)iconv_prog $(+force)
$(objpfx)iconv_prog: $(iconv_prog-modules:%=$(objpfx)%.o)
$(objpfx)iconvconfig: $(iconvconfig-modules:%=$(objpfx)%.o)
ifneq ($(cross-compiling),yes)
xtests: test-iconvconfig
endif
.PHONY: test-iconvconfig
test-iconvconfig: /dev/null $(objpfx)iconvconfig
tmp=$(objpfx)gconv-modules.cache.$$$$; \
rm -f $$tmp; \
$(make-test-out) --output=$$tmp --nostdlib $(inst_gconvdir) && \
cmp $$tmp $(inst_gconvdir)/gconv-modules.cache && \
rm -f $$tmp

View File

@ -424,7 +424,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\
"), "2004");
"), "2005");
fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper");
}

View File

@ -397,7 +397,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\
"), "2004");
"), "2005");
fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper");
}

View File

@ -326,7 +326,7 @@ strtabfinalize (struct Strtab *st, size_t *size)
copylen = 1;
copystrings (st->root, &endp, &copylen);
assert (copylen == st->total + 1);
assert (endp = retval + st->total + 1);
assert (endp == retval + st->total + 1);
*size = copylen;
return retval;

View File

@ -48,6 +48,9 @@ extern int __sigpause (int sig_or_mask, int is_sig);
extern int __default_sigpause (int mask);
extern int __xpg_sigpause (int sig);
/* Simplified sigemptyset() implementation without the parameter checking. */
#undef __sigemptyset
#define __sigemptyset(ss) (memset (ss, '\0', sizeof (sigset_t)), 0)
/* Allocate real-time signal with highest/lowest available priority. */

View File

@ -27,8 +27,6 @@
* but couldn't find it in libio. The following snippet of code is an
* attempt to implement what glibc's documentation describes.
*
* No, it isn't really tested yet. :-)
*
*
*
* I already see some potential problems:
@ -166,7 +164,7 @@ fmemopen_seek (void *cookie, _IO_off64_t *p, int w)
break;
case SEEK_END:
np = c->size - *p;
np = c->maxpos - *p;
break;
default:
@ -176,9 +174,9 @@ fmemopen_seek (void *cookie, _IO_off64_t *p, int w)
if (np < 0 || (size_t) np > c->size)
return -1;
c->pos = np;
*p = c->pos = np;
return np;
return 0;
}
@ -203,6 +201,13 @@ fmemopen (void *buf, size_t len, const char *mode)
cookie_io_functions_t iof;
fmemopen_cookie_t *c;
if (len == 0)
{
einval:
__set_errno (EINVAL);
return NULL;
}
c = (fmemopen_cookie_t *) malloc (sizeof (fmemopen_cookie_t));
if (c == NULL)
return NULL;
@ -220,7 +225,12 @@ fmemopen (void *buf, size_t len, const char *mode)
c->buffer[0] = '\0';
}
else
c->buffer = buf;
{
if ((uintptr_t) len > -(uintptr_t) buf)
goto einval;
c->buffer = buf;
}
c->size = len;

View File

@ -36,6 +36,8 @@ static _IO_ssize_t _IO_cookie_read (register _IO_FILE* fp, void* buf,
static _IO_ssize_t _IO_cookie_write (register _IO_FILE* fp,
const void* buf, _IO_ssize_t size);
static _IO_off64_t _IO_cookie_seek (_IO_FILE *fp, _IO_off64_t offset, int dir);
static _IO_off64_t _IO_cookie_seekoff (_IO_FILE *fp, _IO_off64_t offset,
int dir, int mode);
static int _IO_cookie_close (_IO_FILE* fp);
static _IO_ssize_t
@ -94,6 +96,20 @@ _IO_cookie_close (fp)
}
static _IO_off64_t
_IO_cookie_seekoff (fp, offset, dir, mode)
_IO_FILE *fp;
_IO_off64_t offset;
int dir;
int mode;
{
/* We must force the fileops code to always use seek to determine
the position. */
fp->_offset = _IO_pos_BAD;
return INTUSE(_IO_file_seekoff) (fp, offset, dir, mode);
}
static const struct _IO_jump_t _IO_cookie_jumps = {
JUMP_INIT_DUMMY,
JUMP_INIT(finish, INTUSE(_IO_file_finish)),
@ -103,7 +119,7 @@ static const struct _IO_jump_t _IO_cookie_jumps = {
JUMP_INIT(pbackfail, INTUSE(_IO_default_pbackfail)),
JUMP_INIT(xsputn, INTUSE(_IO_file_xsputn)),
JUMP_INIT(xsgetn, INTUSE(_IO_default_xsgetn)),
JUMP_INIT(seekoff, INTUSE(_IO_file_seekoff)),
JUMP_INIT(seekoff, _IO_cookie_seekoff),
JUMP_INIT(seekpos, _IO_default_seekpos),
JUMP_INIT(setbuf, INTUSE(_IO_file_setbuf)),
JUMP_INIT(sync, INTUSE(_IO_file_sync)),
@ -223,7 +239,7 @@ static const struct _IO_jump_t _IO_old_cookie_jumps = {
JUMP_INIT(pbackfail, INTUSE(_IO_default_pbackfail)),
JUMP_INIT(xsputn, INTUSE(_IO_file_xsputn)),
JUMP_INIT(xsgetn, INTUSE(_IO_default_xsgetn)),
JUMP_INIT(seekoff, INTUSE(_IO_file_seekoff)),
JUMP_INIT(seekoff, _IO_cookie_seekoff),
JUMP_INIT(seekpos, _IO_default_seekpos),
JUMP_INIT(setbuf, INTUSE(_IO_file_setbuf)),
JUMP_INIT(sync, INTUSE(_IO_file_sync)),

View File

@ -1,3 +1,25 @@
2005-02-09 Daniel Jacobowitz <dan@codesourcery.com>
[BZ #740]
* descr.h (__pthread_find_self, thread_self): Mark as pure
instead of const.
2005-02-07 Jakub Jelinek <jakub@redhat.com>
[BZ #739]
* specific.c (pthread_key_delete): If pthread_create has not been
called yet, clear p_specific for the current thread.
* Makefile (tests): Add tst-tsd1.
* tst-tsd1.c: New test.
2004-12-21 Jakub Jelinek <jakub@redhat.com>
[BZ #723]
* Makefile (tests): Add tst-align.
* tst-align.c: New test.
* sysdeps/i386/Makefile (CFLAGS-tst-align.c): Add
-mpreferred-stack-boundary=4.
2004-12-12 Ulrich Drepper <drepper@redhat.com>
* internals.h: Include <stdbool.h> to match includes used in nptl.

View File

@ -111,7 +111,7 @@ tests = ex1 ex2 ex3 ex4 ex5 ex6 ex7 ex8 ex9 $(librt-tests) ex12 ex13 joinrace \
ex17 ex18 tst-cancel tst-context bug-sleep \
tst-cancel1 tst-cancel2 tst-cancel3 tst-cancel4 tst-cancel5 \
tst-cancel6 tst-cancel7 tst-cancel8 tst-popen tst-popen2 tst-attr1 \
tst-stack1
tst-stack1 tst-align tst-tsd1
test-srcs = tst-signal
# These tests are linked with libc before libpthread
tests-reverse += tst-cancel5

View File

@ -239,9 +239,9 @@ extern int __pthread_nonstandard_stacks;
/* Recover thread descriptor for the current thread */
extern pthread_descr __pthread_find_self (void) __attribute__ ((const));
extern pthread_descr __pthread_find_self (void) __attribute__ ((pure));
static inline pthread_descr thread_self (void) __attribute__ ((const));
static inline pthread_descr thread_self (void) __attribute__ ((pure));
static inline pthread_descr thread_self (void)
{
#ifdef THREAD_SELF

View File

@ -104,15 +104,16 @@ int pthread_key_delete(pthread_key_t key)
that if the key is reallocated later by pthread_key_create, its
associated values will be NULL in all threads.
Do nothing if no threads have been created yet. */
If no threads have been created yet, clear it just in the
current thread. */
struct pthread_key_delete_helper_args args;
args.idx1st = key / PTHREAD_KEY_2NDLEVEL_SIZE;
args.idx2nd = key % PTHREAD_KEY_2NDLEVEL_SIZE;
if (__pthread_manager_request != -1)
{
struct pthread_key_delete_helper_args args;
struct pthread_request request;
args.idx1st = key / PTHREAD_KEY_2NDLEVEL_SIZE;
args.idx2nd = key % PTHREAD_KEY_2NDLEVEL_SIZE;
args.self = 0;
request.req_thread = self;
@ -124,6 +125,11 @@ int pthread_key_delete(pthread_key_t key)
(char *) &request, sizeof(request)));
suspend(self);
}
else
{
if (self->p_specific[args.idx1st] != NULL)
self->p_specific[args.idx1st][args.idx2nd] = NULL;
}
pthread_mutex_unlock(&pthread_keys_mutex);
return 0;

View File

@ -15,6 +15,7 @@ CFLAGS-pthread.c += -fno-omit-frame-pointer -mpreferred-stack-boundary=4
CFLAGS-ptlongjmp.c += -fno-omit-frame-pointer
CFLAGS-semaphore.c += -fno-omit-frame-pointer
CFLAGS-sighandler.c += -fno-omit-frame-pointer -mpreferred-stack-boundary=4
CFLAGS-tst-align.c += -mpreferred-stack-boundary=4
endif
ifeq ($(subdir),csu)

View File

@ -277,7 +277,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\
"), "2004");
"), "2005");
fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper");
}

View File

@ -389,7 +389,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\
"), "2004");
"), "2005");
fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper");
}

View File

@ -1,3 +1,7 @@
2004-12-19 Roland McGrath <roland@frob.com>
* gen-unicode-ctype.c (output_tables): Fix email address in output.
2004-10-02 Petter Reinholdtsen <pere@hungry.com>
[BZ #82]

View File

@ -638,7 +638,7 @@ output_tables (const char *filename, const char *version)
fprintf (stream, "source \"UnicodeData.txt, PropList.txt\"\n");
fprintf (stream, "address \"\"\n");
fprintf (stream, "contact \"\"\n");
fprintf (stream, "email \"bug-glibc@gnu.org\"\n");
fprintf (stream, "email \"bug-glibc-locales@gnu.org\"\n");
fprintf (stream, "tel \"\"\n");
fprintf (stream, "fax \"\"\n");
fprintf (stream, "language \"\"\n");

View File

@ -20,9 +20,7 @@
#ifndef _MALLOC_H
#define _MALLOC_H 1
#ifdef _LIBC
#include <features.h>
#endif
/*
$Id$

View File

@ -1,5 +1,5 @@
#! @BASH@
# Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc.
# Copyright (C) 1999-2004, 2005 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# Contributed by Ulrich Drepper <drepper@gnu.org>, 1999.
@ -71,7 +71,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.
" "2004"
" "2005"
printf $"Written by %s.
" "Ulrich Drepper"
exit 0

View File

@ -45,7 +45,7 @@ arglist: while (@ARGV) {
$ARGV[0] eq "--vers" || $ARGV[0] eq "--versi" ||
$ARGV[0] eq "--versio" || $ARGV[0] eq "--version") {
print "mtrace (GNU $PACKAGE) $VERSION\n";
print "Copyright (C) 2004 Free Software Foundation, Inc.\n";
print "Copyright (C) 2005 Free Software Foundation, Inc.\n";
print "This is free software; see the source for copying conditions. There is NO\n";
print "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n";
print "Written by Ulrich Drepper <drepper\@gnu.org>\n";

View File

@ -3794,6 +3794,114 @@ rint_test (void)
END (rint);
}
static void
rint_test_tonearest (void)
{
int save_round_mode;
START (rint_tonearest);
save_round_mode = fegetround();
if (!fesetround (FE_TONEAREST))
{
TEST_f_f (rint, 2.0, 2.0);
TEST_f_f (rint, 1.5, 2.0);
TEST_f_f (rint, 1.0, 1.0);
TEST_f_f (rint, 0.5, 0.0);
TEST_f_f (rint, 0.0, 0.0);
TEST_f_f (rint, minus_zero, minus_zero);
TEST_f_f (rint, -0.5, -0.0);
TEST_f_f (rint, -1.0, -1.0);
TEST_f_f (rint, -1.5, -2.0);
TEST_f_f (rint, -2.0, -2.0);
}
fesetround(save_round_mode);
END (rint_tonearest);
}
static void
rint_test_towardzero (void)
{
int save_round_mode;
START (rint_towardzero);
save_round_mode = fegetround();
if (!fesetround (FE_TOWARDZERO))
{
TEST_f_f (rint, 2.0, 2.0);
TEST_f_f (rint, 1.5, 1.0);
TEST_f_f (rint, 1.0, 1.0);
TEST_f_f (rint, 0.5, 0.0);
TEST_f_f (rint, 0.0, 0.0);
TEST_f_f (rint, minus_zero, minus_zero);
TEST_f_f (rint, -0.5, -0.0);
TEST_f_f (rint, -1.0, -1.0);
TEST_f_f (rint, -1.5, -1.0);
TEST_f_f (rint, -2.0, -2.0);
}
fesetround(save_round_mode);
END (rint_towardzero);
}
static void
rint_test_downward (void)
{
int save_round_mode;
START (rint_downward);
save_round_mode = fegetround();
if (!fesetround (FE_DOWNWARD))
{
TEST_f_f (rint, 2.0, 2.0);
TEST_f_f (rint, 1.5, 1.0);
TEST_f_f (rint, 1.0, 1.0);
TEST_f_f (rint, 0.5, 0.0);
TEST_f_f (rint, 0.0, 0.0);
TEST_f_f (rint, minus_zero, minus_zero);
TEST_f_f (rint, -0.5, -1.0);
TEST_f_f (rint, -1.0, -1.0);
TEST_f_f (rint, -1.5, -2.0);
TEST_f_f (rint, -2.0, -2.0);
}
fesetround(save_round_mode);
END (rint_downward);
}
static void
rint_test_upward (void)
{
int save_round_mode;
START (rint_upward);
save_round_mode = fegetround();
if (!fesetround (FE_UPWARD))
{
TEST_f_f (rint, 2.0, 2.0);
TEST_f_f (rint, 1.5, 2.0);
TEST_f_f (rint, 1.0, 1.0);
TEST_f_f (rint, 0.5, 1.0);
TEST_f_f (rint, 0.0, 0.0);
TEST_f_f (rint, minus_zero, minus_zero);
TEST_f_f (rint, -0.5, -0.0);
TEST_f_f (rint, -1.0, -1.0);
TEST_f_f (rint, -1.5, -1.0);
TEST_f_f (rint, -2.0, -2.0);
}
fesetround(save_round_mode);
END (rint_upward);
}
static void
round_test (void)
{
@ -4557,6 +4665,10 @@ main (int argc, char **argv)
floor_test ();
nearbyint_test ();
rint_test ();
rint_test_tonearest ();
rint_test_towardzero ();
rint_test_downward ();
rint_test_upward ();
lrint_test ();
llrint_test ();
round_test ();

View File

@ -31,6 +31,7 @@
# define FUNC_PREFIX
# define FLOAT_FMT_FLAG
# define FLOAT_NAME_EXT
# define FLOAT_MIN_10_EXP DBL_MIN_10_EXP
# if DBL_MANT_DIG == 53
# define NDIGIT_MAX 17
# elif DBL_MANT_DIG == 24
@ -43,6 +44,17 @@
# error "NDIGIT_MAX must be precomputed"
# define NDIGIT_MAX (lrint (ceil (M_LN2 / M_LN10 * DBL_MANT_DIG + 1.0)))
# endif
# if DBL_MIN_10_EXP == -37
# define FLOAT_MIN_10_NORM 1.0e-37
# elif DBL_MIN_10_EXP == -307
# define FLOAT_MIN_10_NORM 1.0e-307
# elif DBL_MIN_10_EXP == -4931
# define FLOAT_MIN_10_NORM 1.0e-4931
# else
/* libc can't depend on libm. */
# error "FLOAT_MIN_10_NORM must be precomputed"
# define FLOAT_MIN_10_NORM exp10 (DBL_MIN_10_EXP)
# endif
#endif
#define APPEND(a, b) APPEND2 (a, b)
@ -171,6 +183,17 @@ APPEND (FUNC_PREFIX, ecvt_r) (value, ndigit, decpt, sign, buf, len)
d = -value;
else
d = value;
/* For denormalized numbers the d < 1.0 case below won't work,
as f can overflow to +Inf. */
if (d < FLOAT_MIN_10_NORM)
{
value /= FLOAT_MIN_10_NORM;
if (value < 0.0)
d = -value;
else
d = value;
exponent += FLOAT_MIN_10_EXP;
}
if (d < 1.0)
{
do

View File

@ -24,6 +24,7 @@
#define FUNC_PREFIX q
#define FLOAT_FMT_FLAG "L"
#define FLOAT_NAME_EXT l
#define FLOAT_MIN_10_EXP LDBL_MIN_10_EXP
#if LDBL_MANT_DIG == 64
# define NDIGIT_MAX 21
#elif LDBL_MANT_DIG == 53
@ -40,5 +41,16 @@
# error "NDIGIT_MAX must be precomputed"
# define NDIGIT_MAX (lrint (ceil (M_LN2 / M_LN10 * LDBL_MANT_DIG + 1.0)))
#endif
#if LDBL_MIN_10_EXP == -37
# define FLOAT_MIN_10_NORM 1.0e-37L
#elif LDBL_MIN_10_EXP == -307
# define FLOAT_MIN_10_NORM 1.0e-307L
#elif LDBL_MIN_10_EXP == -4931
# define FLOAT_MIN_10_NORM 1.0e-4931L
#else
/* libc can't depend on libm. */
# error "FLOAT_MIN_10_NORM must be precomputed"
# define FLOAT_MIN_10_NORM exp10l (LDBL_MIN_10_EXP)
#endif
#include "efgcvt_r.c"

View File

@ -1,414 +0,0 @@
/*
* Copyright (c) 1983, 1988, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)syslog.c 8.4 (Berkeley) 3/18/94";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/syslog.h>
#include <sys/uio.h>
#include <netdb.h>
#include <errno.h>
#include <fcntl.h>
#include <paths.h>
#include <stdio.h>
#include <stdio_ext.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <stdlib.h>
#include <bits/libc-lock.h>
#include <signal.h>
#include <locale.h>
#if __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#endif
#include <libio/iolibio.h>
#define ftell(s) INTUSE(_IO_ftell) (s)
static int LogType = SOCK_DGRAM; /* type of socket connection */
static int LogFile = -1; /* fd for log */
static int connected; /* have done connect */
static int LogStat; /* status bits, set by openlog() */
static const char *LogTag; /* string to tag the entry with */
static int LogFacility = LOG_USER; /* default facility code */
static int LogMask = 0xff; /* mask of priorities to be logged */
extern char *__progname; /* Program name, from crt0. */
/* Define the lock. */
__libc_lock_define_initialized (static, syslog_lock)
static void openlog_internal(const char *, int, int) internal_function;
static void closelog_internal(void);
static void sigpipe_handler (int);
struct cleanup_arg
{
void *buf;
struct sigaction *oldaction;
};
static void
cancel_handler (void *ptr)
{
/* Restore the old signal handler. */
struct cleanup_arg *clarg = (struct cleanup_arg *) ptr;
if (clarg != NULL && clarg->oldaction != NULL)
__sigaction (SIGPIPE, clarg->oldaction, NULL);
/* Free the lock. */
__libc_lock_unlock (syslog_lock);
}
/*
* syslog, vsyslog --
* print message on log file; output is intended for syslogd(8).
*/
void
#if __STDC__
syslog(int pri, const char *fmt, ...)
#else
syslog(pri, fmt, va_alist)
int pri;
char *fmt;
va_dcl
#endif
{
va_list ap;
#if __STDC__
va_start(ap, fmt);
#else
va_start(ap);
#endif
vsyslog(pri, fmt, ap);
va_end(ap);
}
libc_hidden_def (syslog)
void
vsyslog(pri, fmt, ap)
int pri;
register const char *fmt;
va_list ap;
{
struct tm now_tm;
time_t now;
int fd;
FILE *f;
char *buf = 0;
size_t bufsize = 0;
size_t prioff, msgoff;
struct sigaction action, oldaction;
int sigpipe;
int saved_errno = errno;
char failbuf[3 * sizeof (pid_t) + sizeof "out of memory []"];
#define INTERNALLOG LOG_ERR|LOG_CONS|LOG_PERROR|LOG_PID
/* Check for invalid bits. */
if (pri & ~(LOG_PRIMASK|LOG_FACMASK)) {
syslog(INTERNALLOG,
"syslog: unknown facility/priority: %x", pri);
pri &= LOG_PRIMASK|LOG_FACMASK;
}
/* Check priority against setlogmask values. */
if ((LOG_MASK (LOG_PRI (pri)) & LogMask) == 0)
return;
/* Set default facility if none specified. */
if ((pri & LOG_FACMASK) == 0)
pri |= LogFacility;
/* Build the message in a memory-buffer stream. */
f = open_memstream (&buf, &bufsize);
if (f == NULL)
{
/* We cannot get a stream. There is not much we can do but
emitting an error messages. */
char numbuf[3 * sizeof (pid_t)];
char *nump;
char *endp = __stpcpy (failbuf, "out of memory [");
pid_t pid = __getpid ();
nump = numbuf + sizeof (numbuf);
/* The PID can never be zero. */
do
*--nump = '0' + pid % 10;
while ((pid /= 10) != 0);
endp = __mempcpy (endp, nump, (numbuf + sizeof (numbuf)) - nump);
*endp++ = ']';
*endp = '\0';
buf = failbuf;
bufsize = endp - failbuf;
msgoff = 0;
}
else
{
__fsetlocking (f, FSETLOCKING_BYCALLER);
prioff = fprintf (f, "<%d>", pri);
(void) time (&now);
f->_IO_write_ptr += __strftime_l (f->_IO_write_ptr,
f->_IO_write_end
- f->_IO_write_ptr,
"%h %e %T ",
__localtime_r (&now, &now_tm),
&_nl_C_locobj);
msgoff = ftell (f);
if (LogTag == NULL)
LogTag = __progname;
if (LogTag != NULL)
fputs_unlocked (LogTag, f);
if (LogStat & LOG_PID)
fprintf (f, "[%d]", (int) __getpid ());
if (LogTag != NULL)
{
putc_unlocked (':', f);
putc_unlocked (' ', f);
}
/* Restore errno for %m format. */
__set_errno (saved_errno);
/* We have the header. Print the user's format into the
buffer. */
vfprintf (f, fmt, ap);
/* Close the memory stream; this will finalize the data
into a malloc'd buffer in BUF. */
fclose (f);
}
/* Output to stderr if requested. */
if (LogStat & LOG_PERROR) {
struct iovec iov[2];
register struct iovec *v = iov;
v->iov_base = buf + msgoff;
v->iov_len = bufsize - msgoff;
/* Append a newline if necessary. */
if (buf[bufsize - 1] != '\n')
{
++v;
v->iov_base = (char *) "\n";
v->iov_len = 1;
}
__libc_cleanup_push (free, buf == failbuf ? NULL : buf);
/* writev is a cancellation point. */
(void)__writev(STDERR_FILENO, iov, v - iov + 1);
__libc_cleanup_pop (0);
}
/* Prepare for multiple users. We have to take care: open and
write are cancellation points. */
struct cleanup_arg clarg;
clarg.buf = buf;
clarg.oldaction = NULL;
__libc_cleanup_push (cancel_handler, &clarg);
__libc_lock_lock (syslog_lock);
/* Prepare for a broken connection. */
memset (&action, 0, sizeof (action));
action.sa_handler = sigpipe_handler;
sigemptyset (&action.sa_mask);
sigpipe = __sigaction (SIGPIPE, &action, &oldaction);
if (sigpipe == 0)
clarg.oldaction = &oldaction;
/* Get connected, output the message to the local logger. */
if (!connected)
openlog_internal(LogTag, LogStat | LOG_NDELAY, 0);
/* If we have a SOCK_STREAM connection, also send ASCII NUL as
a record terminator. */
if (LogType == SOCK_STREAM)
++bufsize;
if (!connected || __send(LogFile, buf, bufsize, 0) < 0)
{
if (connected)
{
/* Try to reopen the syslog connection. Maybe it went
down. */
closelog_internal ();
openlog_internal(LogTag, LogStat | LOG_NDELAY, 0);
}
if (!connected || __send(LogFile, buf, bufsize, 0) < 0)
{
closelog_internal (); /* attempt re-open next time */
/*
* Output the message to the console; don't worry
* about blocking, if console blocks everything will.
* Make sure the error reported is the one from the
* syslogd failure.
*/
if (LogStat & LOG_CONS &&
(fd = __open(_PATH_CONSOLE, O_WRONLY|O_NOCTTY, 0)) >= 0)
{
dprintf (fd, "%s\r\n", buf + msgoff);
(void)__close(fd);
}
}
}
if (sigpipe == 0)
__sigaction (SIGPIPE, &oldaction, (struct sigaction *) NULL);
/* End of critical section. */
__libc_cleanup_pop (0);
__libc_lock_unlock (syslog_lock);
if (buf != failbuf)
free (buf);
}
libc_hidden_def (vsyslog)
static struct sockaddr SyslogAddr; /* AF_UNIX address of local logger */
static void
internal_function
openlog_internal(const char *ident, int logstat, int logfac)
{
if (ident != NULL)
LogTag = ident;
LogStat = logstat;
if (logfac != 0 && (logfac &~ LOG_FACMASK) == 0)
LogFacility = logfac;
int retry = 0;
while (retry < 2) {
if (LogFile == -1) {
SyslogAddr.sa_family = AF_UNIX;
(void)strncpy(SyslogAddr.sa_data, _PATH_LOG,
sizeof(SyslogAddr.sa_data));
if (LogStat & LOG_NDELAY) {
if ((LogFile = __socket(AF_UNIX, LogType, 0))
== -1)
return;
(void)__fcntl(LogFile, F_SETFD, 1);
}
}
if (LogFile != -1 && !connected)
{
int old_errno = errno;
if (__connect(LogFile, &SyslogAddr, sizeof(SyslogAddr))
== -1)
{
int saved_errno = errno;
int fd = LogFile;
LogFile = -1;
(void)__close(fd);
__set_errno (old_errno);
if (saved_errno == EPROTOTYPE)
{
/* retry with the other type: */
LogType = (LogType == SOCK_DGRAM
? SOCK_STREAM : SOCK_DGRAM);
++retry;
continue;
}
} else
connected = 1;
}
break;
}
}
void
openlog (const char *ident, int logstat, int logfac)
{
/* Protect against multiple users and cancellation. */
__libc_cleanup_push (cancel_handler, NULL);
__libc_lock_lock (syslog_lock);
openlog_internal (ident, logstat, logfac);
__libc_cleanup_pop (1);
}
static void
sigpipe_handler (int signo)
{
closelog_internal ();
}
static void
closelog_internal()
{
if (!connected)
return;
__close (LogFile);
LogFile = -1;
connected = 0;
}
void
closelog ()
{
/* Protect against multiple users and cancellation. */
__libc_cleanup_push (cancel_handler, NULL);
__libc_lock_lock (syslog_lock);
closelog_internal ();
LogTag = NULL;
LogType = SOCK_DGRAM; /* this is the default */
/* Free the lock. */
__libc_cleanup_pop (1);
}
/* setlogmask -- set the log mask level */
int
setlogmask(pmask)
int pmask;
{
int omask;
omask = LogMask;
if (pmask != 0)
LogMask = pmask;
return (omask);
}

View File

@ -20,6 +20,7 @@
# define _GNU_SOURCE 1
#endif
#include <float.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
@ -59,6 +60,10 @@ static testcase ecvt_tests[] =
{ 123.01, -4, 3, "" },
{ 126.71, -4, 3, "" },
{ 0.0, 4, 1, "0000" },
#if DBL_MANT_DIG == 53
{ 0x1p-1074, 3, -323, "494" },
{ -0x1p-1074, 3, -323, "494" },
#endif
/* -1.0 is end marker. */
{ -1.0, 0, 0, "" }
};

View File

@ -1,3 +1,41 @@
2005-01-26 Jakub Jelinek <jakub@redhat.com>
[BZ #737]
* sysdeps/unix/sysv/linux/i386/i486/sem_trywait.S (__new_sem_trywait):
Use direct %gs segment access or, if NO_TLS_DIRECT_SEG_REFS,
at least gotntpoff relocation and addition.
* sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S (sem_timedwait):
Likewise.
* sysdeps/unix/sysv/linux/i386/i486/sem_post.S (__new_sem_post):
Likewise.
* sysdeps/unix/sysv/linux/i386/i486/sem_wait.S (__new_sem_wait):
Likewise.
2004-12-27 Ulrich Drepper <drepper@redhat.com>
[BZ #744]
* init.c (__pthread_initialize_minimal_internal): Use __sigemptyset.
2004-12-21 Jakub Jelinek <jakub@redhat.com>
[BZ #723]
* sysdeps/i386/tls.h (CALL_THREAD_FCT): Maintain 16 byte alignment of
%esp.
* Makefile (tests): Add tst-align2.
* tst-align2.c: New test.
* sysdeps/i386/Makefile (CFLAGS-tst-align{,2}.c): Add
-mpreferred-stack-boundary=4.
2004-12-21 Jakub Jelinek <jakub@redhat.com>
[BZ #723]
* sysdeps/i386/tls.h (CALL_THREAD_FCT): Maintain 16 byte alignment of
%esp.
* Makefile (tests): Add tst-align2.
* tst-align2.c: New test.
* sysdeps/i386/Makefile (CFLAGS-tst-align{,2}.c): Add
-mpreferred-stack-boundary=4.
2004-12-18 Roland McGrath <roland@redhat.com>
* sysdeps/unix/sysv/linux/powerpc/powerpc64/bits/local_lim.h:

View File

@ -205,7 +205,7 @@ tests = tst-attr1 tst-attr2 tst-attr3 \
tst-sem1 tst-sem2 tst-sem3 tst-sem4 tst-sem5 tst-sem6 tst-sem7 \
tst-sem8 tst-sem9 \
tst-barrier1 tst-barrier2 tst-barrier3 tst-barrier4 \
tst-align \
tst-align tst-align2 \
tst-basic1 tst-basic2 tst-basic3 tst-basic4 tst-basic5 tst-basic6 \
tst-kill1 tst-kill2 tst-kill3 tst-kill4 tst-kill5 tst-kill6 \
tst-raise1 \

View File

@ -262,7 +262,7 @@ __pthread_initialize_minimal_internal (void)
struct sigaction sa;
sa.sa_sigaction = sigcancel_handler;
sa.sa_flags = SA_SIGINFO;
sigemptyset (&sa.sa_mask);
__sigemptyset (&sa.sa_mask);
(void) __libc_sigaction (SIGCANCEL, &sa, NULL);

View File

@ -22,4 +22,6 @@ endif
ifeq ($(subdir),nptl)
CFLAGS-pthread_create.c += -mpreferred-stack-boundary=4
CFLAGS-tst-align.c += -mpreferred-stack-boundary=4
CFLAGS-tst-align2.c += -mpreferred-stack-boundary=4
endif

View File

@ -397,9 +397,12 @@ union user_desc_init
#define CALL_THREAD_FCT(descr) \
({ void *__res; \
int __ignore1, __ignore2; \
asm volatile ("pushl %%gs:%P4\n\t" \
asm volatile ("pushl %%eax\n\t" \
"pushl %%eax\n\t" \
"pushl %%eax\n\t" \
"pushl %%gs:%P4\n\t" \
"call *%%gs:%P3\n\t" \
"addl $4, %%esp" \
"addl $16, %%esp" \
: "=a" (__res), "=c" (__ignore1), "=d" (__ignore2) \
: "i" (offsetof (struct pthread, start_routine)), \
"i" (offsetof (struct pthread, arg))); \

View File

@ -65,9 +65,14 @@ __new_sem_post:
#endif
addl $_GLOBAL_OFFSET_TABLE_, %ebx
#if USE___THREAD
movl %gs:0, %edx
subl errno@gottpoff(%ebx), %edx
# ifdef NO_TLS_DIRECT_SEG_REFS
movl errno@gotntpoff(%ebx), %edx
addl %gs:0, %edx
movl $EINVAL, (%edx)
# else
movl errno@gotntpoff(%ebx), %edx
movl $EINVAL, %gs:(%edx)
# endif
#else
call __errno_location@plt
movl $EINVAL, (%eax)

View File

@ -158,9 +158,14 @@ sem_timedwait:
#endif
addl $_GLOBAL_OFFSET_TABLE_, %ebx
#if USE___THREAD
movl %gs:0, %edx
subl errno@gottpoff(%ebx), %edx
# ifdef NO_TLS_DIRECT_SEG_REFS
movl errno@gotntpoff(%ebx), %edx
addl %gs:0, %edx
movl %esi, (%edx)
# else
movl errno@gotntpoff(%ebx), %edx
movl %esi, %gs:(%edx)
# endif
#else
call __errno_location@plt
movl %esi, (%eax)

View File

@ -55,9 +55,14 @@ __new_sem_trywait:
#endif
addl $_GLOBAL_OFFSET_TABLE_, %ecx
#if USE___THREAD
movl %gs:0, %edx
subl errno@gottpoff(%ecx), %edx
# ifdef NO_TLS_DIRECT_SEG_REFS
movl errno@gotntpoff(%ecx), %edx
addl %gs:0, %edx
movl $EAGAIN, (%edx)
# else
movl errno@gotntpoff(%ecx), %edx
movl $EAGAIN, %gs:(%edx)
# endif
#else
call __errno_location@plt
movl $EAGAIN, (%eax)

View File

@ -102,9 +102,14 @@ __new_sem_wait:
#endif
addl $_GLOBAL_OFFSET_TABLE_, %ebx
#if USE___THREAD
movl %gs:0, %edx
subl errno@gottpoff(%ebx), %edx
# ifdef NO_TLS_DIRECT_SEG_REFS
movl errno@gotntpoff(%ebx), %edx
addl %gs:0, %edx
movl %esi, (%edx)
# else
movl errno@gotntpoff(%ebx), %edx
movl %esi, %gs:(%edx)
# endif
#else
call __errno_location@plt
movl %esi, (%eax)

View File

@ -56,6 +56,8 @@ nscd-modules += selinux
selinux-LIBS := -lselinux
endif
LDLIBS-nscd = $(selinux-LIBS)
distribute := nscd.h nscd-client.h dbg_log.h \
$(addsuffix .c, $(filter-out xmalloc, $(nscd-modules))) \
nscd_nischeck.c nscd.conf nscd.init nscd_proto.h \
@ -110,7 +112,7 @@ $(objpfx)nscd: $(addprefix $(objpfx),$(nscd-modules:=.o))
$(extra-B-$(@F:lib%.so=%).so) $(load-map-file) \
$(LDFLAGS) $(LDFLAGS-$(@F)) \
-L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link) \
-o $@ $^ $(selinux-LIBS) $(common-objpfx)libc_nonshared.a
-o $@ $^ $(LDLIBS-nscd) $(common-objpfx)libc_nonshared.a
endif
# This makes sure -DNOT_IN_libc is passed for all these modules.

View File

@ -403,7 +403,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\
"), "2004");
"), "2005");
fprintf (stream, gettext ("Written by %s.\n"),
"Thorsten Kukuk and Ulrich Drepper");
}
@ -450,6 +450,9 @@ termination_handler (int signum)
/* Synchronize memory. */
for (int cnt = 0; cnt < lastdb; ++cnt)
{
if (!dbs[cnt].enabled)
continue;
/* Make sure nobody keeps using the database. */
dbs[cnt].head->timestamp = 0;

View File

@ -88,9 +88,9 @@ case "$1" in
RETVAL=$?
;;
status)
status nscd
status nscd
RETVAL=$?
;;
;;
restart)
restart
RETVAL=$?
@ -100,9 +100,11 @@ case "$1" in
RETVAL=$?
;;
reload)
killproc /usr/sbin/nscd -HUP
echo -n $"Reloading $prog: "
killproc /usr/sbin/nscd -HUP
RETVAL=$?
;;
echo
;;
*)
echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"
RETVAL=1

View File

@ -78,7 +78,7 @@ __nscd_getai (const char *key, struct nscd_ai_result **result, int *h_errnop)
sizeof (ai_resp_mem));
if (sock == -1)
{
/* nscd not running or wrong version or hosts caching disabled. */
/* nscd not running or wrong version. */
__nss_not_use_nscd_hosts = 1;
goto out;
}
@ -151,6 +151,13 @@ __nscd_getai (const char *key, struct nscd_ai_result **result, int *h_errnop)
}
else
{
if (__builtin_expect (ai_resp->found == -1, 0))
{
/* The daemon does not cache this database. */
__nss_not_use_nscd_hosts = 1;
goto out_close;
}
/* Store the error number. */
*h_errnop = ai_resp->error;

View File

@ -75,7 +75,7 @@ __nscd_getgrouplist (const char *user, gid_t group, long int *size,
sizeof (initgr_resp_mem));
if (sock == -1)
{
/* nscd not running or wrong version or hosts caching disabled. */
/* nscd not running or wrong version. */
__nss_not_use_nscd_group = 1;
goto out;
}
@ -101,7 +101,7 @@ __nscd_getgrouplist (const char *user, gid_t group, long int *size,
(initgr_resp->ngrps + 1) * sizeof (gid_t));
if (newp == NULL)
/* We cannot increase the buffer size. */
goto out;
goto out_close;
*groupsp = newp;
*size = initgr_resp->ngrps + 1;
@ -125,6 +125,13 @@ __nscd_getgrouplist (const char *user, gid_t group, long int *size,
}
else
{
if (__builtin_expect (initgr_resp->found == -1, 0))
{
/* The daemon does not cache this database. */
__nss_not_use_nscd_group = 1;
goto out_close;
}
/* No group found yet. */
retval = 0;
@ -143,6 +150,7 @@ __nscd_getgrouplist (const char *user, gid_t group, long int *size,
(*groupsp)[retval++] = group;
}
out_close:
if (sock != -1)
close_not_cancel_no_status (sock);
out:

View File

@ -91,6 +91,6 @@ 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\
"), "2004");
"), "2005");
fprintf (stream, gettext ("Written by %s.\n"), "Thorsten Kukuk");
}

View File

@ -83,7 +83,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\
"), "2004");
"), "2005");
fprintf (stream, gettext ("Written by %s.\n"), "Thorsten Kukuk");
}

View File

@ -140,16 +140,27 @@ CFLAGS-waitid.c = -fexceptions
CFLAGS-waitpid.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-getopt.c = -fexceptions
CFLAGS-wordexp.c = -fexceptions
CFLAGS-wordexp.os = -fomit-frame-pointer
CFLAGS-sysconf.c = -fexceptions -DGETCONF_DIR='"$(libexecdir)/getconf"'
CFLAGS-pathconf.c = -fexceptions
CFLAGS-fpathconf.c = -fexceptions
CFLAGS-spawn.c = -fexceptions
CFLAGS-spawn.os = -fomit-frame-pointer
CFLAGS-spawnp.c = -fexceptions
CFLAGS-spawnp.os = -fomit-frame-pointer
CFLAGS-spawni.c = -fexceptions
CFLAGS-spawni.os = -fomit-frame-pointer
CFLAGS-pause.c = -fexceptions
CFLAGS-glob.c = $(uses-callbacks) -fexceptions
CFLAGS-glob64.c = $(uses-callbacks) -fexceptions
CFLAGS-getconf.c = -DGETCONF_DIR='"$(libexecdir)/getconf"'
CFLAGS-execve.os = -fomit-frame-pointer
CFLAGS-fexecve.os = -fomit-frame-pointer
CFLAGS-execv.os = -fomit-frame-pointer
CFLAGS-execle.os = -fomit-frame-pointer
CFLAGS-execl.os = -fomit-frame-pointer
CFLAGS-execvp.os = -fomit-frame-pointer
CFLAGS-execlp.os = -fomit-frame-pointer
tstgetopt-ARGS = -a -b -cfoobar --required foobar --optional=bazbug \
--none random --col --color --colour

View File

@ -170,22 +170,22 @@ static struct test_s
{ERE, "[^k]\\B[^k]", "kBk", 0, -1},
{ERE, "[^C]\\B[^C]", "CCCABA", 0, 3},
{ERE, "[^C]\\B[^C]", "CBC", 0, -1},
{ERE, ".(\\b|\\B).", "=~AB", 0, 1},
{ERE, ".(\\b|\\B).", "=~AB", 0, 0},
{ERE, ".(\\b|\\B).", "A=C", 0, 0},
{ERE, ".(\\b|\\B).", "ABC", 0, 0},
{ERE, ".(\\b|\\B).", "=~\\!", 0, -1},
{ERE, "[^k](\\b|\\B)[^k]", "=~AB", 0, 1},
{ERE, ".(\\b|\\B).", "=~\\!", 0, 0},
{ERE, "[^k](\\b|\\B)[^k]", "=~AB", 0, 0},
{ERE, "[^k](\\b|\\B)[^k]", "A=C", 0, 0},
{ERE, "[^k](\\b|\\B)[^k]", "ABC", 0, 0},
{ERE, "[^k](\\b|\\B)[^k]", "=~kBD", 0, 3},
{ERE, "[^k](\\b|\\B)[^k]", "=~\\!", 0, -1},
{ERE, "[^k](\\b|\\B)[^k]", "=~kB", 0, -1},
{ERE, "[^C](\\b|\\B)[^C]", "=~AB", 0, 1},
{ERE, "[^k](\\b|\\B)[^k]", "=~kBD", 0, 0},
{ERE, "[^k](\\b|\\B)[^k]", "=~\\!", 0, 0},
{ERE, "[^k](\\b|\\B)[^k]", "=~kB", 0, 0},
{ERE, "[^C](\\b|\\B)[^C]", "=~AB", 0, 0},
{ERE, "[^C](\\b|\\B)[^C]", "A=C", 0, 0},
{ERE, "[^C](\\b|\\B)[^C]", "ABC", 0, 0},
{ERE, "[^C](\\b|\\B)[^C]", "=~CBD", 0, 3},
{ERE, "[^C](\\b|\\B)[^C]", "=~\\!", 0, -1},
{ERE, "[^C](\\b|\\B)[^C]", "=~CB", 0, -1},
{ERE, "[^C](\\b|\\B)[^C]", "=~CBD", 0, 0},
{ERE, "[^C](\\b|\\B)[^C]", "=~\\!", 0, 0},
{ERE, "[^C](\\b|\\B)[^C]", "=~CB", 0, 0},
{ERE, "\\b([A]|[!]|.B)", "A=AC", 0, 0},
{ERE, "\\b([A]|[!]|.B)", "=AC", 0, 1},
{ERE, "\\b([A]|[!]|.B)", "!AC", 0, 1},

View File

@ -16,10 +16,10 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <alloca.h>
#include <unistd.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <stackinfo.h>
@ -33,46 +33,44 @@
int
execl (const char *path, const char *arg, ...)
{
size_t argv_max = 1024;
const char **argv = alloca (argv_max * sizeof (const char *));
unsigned int i;
#define INITIAL_ARGV_MAX 1024
size_t argv_max = INITIAL_ARGV_MAX;
const char *initial_argv[INITIAL_ARGV_MAX];
const char **argv = initial_argv;
va_list args;
argv[0] = arg;
va_start (args, arg);
i = 0;
unsigned int i = 0;
while (argv[i++] != NULL)
{
if (i == argv_max)
{
const char **nptr = alloca ((argv_max *= 2) * sizeof (const char *));
#ifndef _STACK_GROWS_UP
if ((char *) nptr + argv_max == (char *) argv)
argv_max *= 2;
const char **nptr = realloc (argv == initial_argv ? NULL : argv,
argv_max * sizeof (const char *));
if (nptr == NULL)
{
/* Stack grows down. */
argv = (const char **) memcpy (nptr, argv,
i * sizeof (const char *));
argv_max += i;
if (argv != initial_argv)
free (argv);
return -1;
}
else
#endif
#ifndef _STACK_GROWS_DOWN
if ((char *) argv + i == (char *) nptr)
/* Stack grows up. */
argv_max += i;
else
#endif
/* We have a hole in the stack. */
argv = (const char **) memcpy (nptr, argv,
i * sizeof (const char *));
if (argv == initial_argv)
/* We have to copy the already filled-in data ourselves. */
memcpy (nptr, argv, i * sizeof (const char *));
argv = nptr;
}
argv[i] = va_arg (args, const char *);
}
va_end (args);
return __execve (path, (char *const *) argv, __environ);
int ret = __execve (path, (char *const *) argv, __environ);
if (argv != initial_argv)
free (argv);
return ret;
}
libc_hidden_def (execl)

View File

@ -16,10 +16,10 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <alloca.h>
#include <unistd.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <stackinfo.h>
@ -29,48 +29,45 @@
int
execle (const char *path, const char *arg, ...)
{
size_t argv_max = 1024;
const char **argv = alloca (argv_max * sizeof (const char *));
const char *const *envp;
unsigned int i;
#define INITIAL_ARGV_MAX 1024
size_t argv_max = INITIAL_ARGV_MAX;
const char *initial_argv[INITIAL_ARGV_MAX];
const char **argv = initial_argv;
va_list args;
argv[0] = arg;
va_start (args, arg);
i = 0;
unsigned int i = 0;
while (argv[i++] != NULL)
{
if (i == argv_max)
{
const char **nptr = alloca ((argv_max *= 2) * sizeof (const char *));
#ifndef _STACK_GROWS_UP
if ((char *) nptr + argv_max == (char *) argv)
argv_max *= 2;
const char **nptr = realloc (argv == initial_argv ? NULL : argv,
argv_max * sizeof (const char *));
if (nptr == NULL)
{
/* Stack grows down. */
argv = (const char **) memcpy (nptr, argv,
i * sizeof (const char *));
argv_max += i;
if (argv != initial_argv)
free (argv);
return -1;
}
else
#endif
#ifndef _STACK_GROWS_DOWN
if ((char *) argv + i == (char *) nptr)
/* Stack grows up. */
argv_max += i;
else
#endif
/* We have a hole in the stack. */
argv = (const char **) memcpy (nptr, argv,
i * sizeof (const char *));
if (argv == initial_argv)
/* We have to copy the already filled-in data ourselves. */
memcpy (nptr, argv, i * sizeof (const char *));
argv = nptr;
}
argv[i] = va_arg (args, const char *);
}
envp = va_arg (args, const char *const *);
const char *const *envp = va_arg (args, const char *const *);
va_end (args);
return __execve (path, (char *const *) argv, (char *const *) envp);
int ret = __execve (path, (char *const *) argv, (char *const *) envp);
if (argv != initial_argv)
free (argv);
return ret;
}
libc_hidden_def (execle)

View File

@ -16,10 +16,10 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <alloca.h>
#include <unistd.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <stackinfo.h>
@ -30,46 +30,44 @@
int
execlp (const char *file, const char *arg, ...)
{
size_t argv_max = 1024;
const char **argv = alloca (argv_max * sizeof (const char *));
unsigned int i;
#define INITIAL_ARGV_MAX 1024
size_t argv_max = INITIAL_ARGV_MAX;
const char *initial_argv[INITIAL_ARGV_MAX];
const char **argv = initial_argv;
va_list args;
argv[0] = arg;
va_start (args, arg);
i = 0;
unsigned int i = 0;
while (argv[i++] != NULL)
{
if (i == argv_max)
{
const char **nptr = alloca ((argv_max *= 2) * sizeof (const char *));
#ifndef _STACK_GROWS_UP
if ((char *) nptr + argv_max == (char *) argv)
argv_max *= 2;
const char **nptr = realloc (argv == initial_argv ? NULL : argv,
argv_max * sizeof (const char *));
if (nptr == NULL)
{
/* Stack grows down. */
argv = (const char **) memcpy (nptr, argv,
i * sizeof (const char *));
argv_max += i;
if (argv != initial_argv)
free (argv);
return -1;
}
else
#endif
#ifndef _STACK_GROWS_DOWN
if ((char *) argv + i == (char *) nptr)
/* Stack grows up. */
argv_max += i;
else
#endif
/* We have a hole in the stack. */
argv = (const char **) memcpy (nptr, argv,
i * sizeof (const char *));
if (argv == initial_argv)
/* We have to copy the already filled-in data ourselves. */
memcpy (nptr, argv, i * sizeof (const char *));
argv = nptr;
}
argv[i] = va_arg (args, const char *);
}
va_end (args);
return execvp (file, (char *const *) argv);
int ret = execvp (file, (char *const *) argv);
if (argv != initial_argv)
free (argv);
return ret;
}
libc_hidden_def (execlp)

View File

@ -18,6 +18,7 @@
#include <unistd.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
@ -26,9 +27,9 @@
/* The file is accessible but it is not an executable file. Invoke
the shell to interpret it as a script. */
static void
static char **
internal_function
script_execute (const char *file, char *const argv[])
allocate_scripts_argv (const char *file, char *const argv[])
{
/* Count the arguments. */
int argc = 0;
@ -36,19 +37,19 @@ script_execute (const char *file, char *const argv[])
;
/* Construct an argument list for the shell. */
{
char *new_argv[argc + 1];
new_argv[0] = (char *) _PATH_BSHELL;
new_argv[1] = (char *) file;
while (argc > 1)
{
new_argv[argc] = argv[argc - 1];
--argc;
}
char **new_argv = (char **) malloc ((argc + 1) * sizeof (char *));
if (new_argv != NULL)
{
new_argv[0] = (char *) _PATH_BSHELL;
new_argv[1] = (char *) file;
while (argc > 1)
{
new_argv[argc] = argv[argc - 1];
--argc;
}
}
/* Execute the shell. */
__execve (new_argv[0], new_argv, __environ);
}
return new_argv;
}
@ -66,42 +67,58 @@ execvp (file, argv)
return -1;
}
char **script_argv = NULL;
if (strchr (file, '/') != NULL)
{
/* Don't search when it contains a slash. */
__execve (file, argv, __environ);
if (errno == ENOEXEC)
script_execute (file, argv);
{
script_argv = allocate_scripts_argv (file, argv);
if (script_argv != NULL)
{
__execve (script_argv[0], script_argv, __environ);
free (script_argv);
}
}
}
else
{
int got_eacces = 0;
char *path, *p, *name;
size_t len;
size_t pathlen;
path = getenv ("PATH");
char *path = getenv ("PATH");
bool path_malloc = false;
if (path == NULL)
{
/* There is no `PATH' in the environment.
The default search path is the current directory
followed by the path `confstr' returns for `_CS_PATH'. */
len = confstr (_CS_PATH, (char *) NULL, 0);
path = (char *) __alloca (1 + len);
size_t len = confstr (_CS_PATH, (char *) NULL, 0);
path = (char *) malloc (1 + len);
if (path == NULL)
return -1;
path[0] = ':';
(void) confstr (_CS_PATH, path + 1, len);
path_malloc = true;
}
len = strlen (file) + 1;
pathlen = strlen (path);
name = __alloca (pathlen + len + 1);
size_t len = strlen (file) + 1;
size_t pathlen = strlen (path);
char *name = malloc (pathlen + len + 1);
if (name == NULL)
{
if (path_malloc)
free (path);
return -1;
}
/* Copy the file name at the top. */
name = (char *) memcpy (name + pathlen + 1, file, len);
/* And add the slash. */
*--name = '/';
p = path;
bool got_eacces = false;
char *p = path;
do
{
char *startp;
@ -120,7 +137,21 @@ execvp (file, argv)
__execve (startp, argv, __environ);
if (errno == ENOEXEC)
script_execute (startp, argv);
{
if (script_argv == NULL)
{
script_argv = allocate_scripts_argv (file, argv);
if (script_argv == NULL)
{
/* A possible EACCES error is not as important as
the ENOMEM. */
got_eacces = false;
break;
}
}
__execve (script_argv[0], script_argv, __environ);
}
switch (errno)
{
@ -128,7 +159,7 @@ execvp (file, argv)
/* Record the we got a `Permission denied' error. If we end
up finding no executable we can use, we want to diagnose
that we did find one but were denied access. */
got_eacces = 1;
got_eacces = true;
case ENOENT:
case ESTALE:
case ENOTDIR:
@ -156,6 +187,11 @@ execvp (file, argv)
/* At least one failure was due to permissions, so report that
error. */
__set_errno (EACCES);
free (script_argv);
free (name);
if (path_malloc)
free (path);
}
/* Return the error from the last attempt (probably ENOENT). */

View File

@ -964,7 +964,7 @@ main (int argc, char *argv[])
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\
"), "2004");
"), "2005");
fprintf (stderr, gettext ("Written by %s.\n"), "Roland McGrath");
return 0;
}

View File

@ -1859,7 +1859,7 @@ peek_token (token, input, syntax)
if (!(syntax & RE_NO_GNU_OPS))
{
token->type = ANCHOR;
token->opr.ctx_type = INSIDE_WORD;
token->opr.ctx_type = NOT_WORD_DELIM;
}
break;
case 'w':
@ -2349,15 +2349,25 @@ parse_expression (regexp, preg, token, syntax, nest, err)
break;
case ANCHOR:
if ((token->opr.ctx_type
& (WORD_DELIM | INSIDE_WORD | WORD_FIRST | WORD_LAST))
& (WORD_DELIM | NOT_WORD_DELIM | WORD_FIRST | WORD_LAST))
&& dfa->word_ops_used == 0)
init_word_char (dfa);
if (token->opr.ctx_type == WORD_DELIM)
if (token->opr.ctx_type == WORD_DELIM
|| token->opr.ctx_type == NOT_WORD_DELIM)
{
bin_tree_t *tree_first, *tree_last;
token->opr.ctx_type = WORD_FIRST;
tree_first = re_dfa_add_tree_node (dfa, NULL, NULL, token);
token->opr.ctx_type = WORD_LAST;
if (token->opr.ctx_type == WORD_DELIM)
{
token->opr.ctx_type = WORD_FIRST;
tree_first = re_dfa_add_tree_node (dfa, NULL, NULL, token);
token->opr.ctx_type = WORD_LAST;
}
else
{
token->opr.ctx_type = INSIDE_WORD;
tree_first = re_dfa_add_tree_node (dfa, NULL, NULL, token);
token->opr.ctx_type = INSIDE_NOTWORD;
}
tree_last = re_dfa_add_tree_node (dfa, NULL, NULL, token);
token->type = OP_ALT;
tree = re_dfa_add_tree_node (dfa, tree_first, tree_last, token);

View File

@ -143,18 +143,21 @@ static inline void bitset_mask (bitset dest, const bitset src);
#define NEXT_NEWLINE_CONSTRAINT 0x0020
#define PREV_BEGBUF_CONSTRAINT 0x0040
#define NEXT_ENDBUF_CONSTRAINT 0x0080
#define DUMMY_CONSTRAINT 0x0100
#define WORD_DELIM_CONSTRAINT 0x0100
#define NOT_WORD_DELIM_CONSTRAINT 0x0200
typedef enum
{
INSIDE_WORD = PREV_WORD_CONSTRAINT | NEXT_WORD_CONSTRAINT,
WORD_FIRST = PREV_NOTWORD_CONSTRAINT | NEXT_WORD_CONSTRAINT,
WORD_LAST = PREV_WORD_CONSTRAINT | NEXT_NOTWORD_CONSTRAINT,
INSIDE_NOTWORD = PREV_NOTWORD_CONSTRAINT | NEXT_NOTWORD_CONSTRAINT,
LINE_FIRST = PREV_NEWLINE_CONSTRAINT,
LINE_LAST = NEXT_NEWLINE_CONSTRAINT,
BUF_FIRST = PREV_BEGBUF_CONSTRAINT,
BUF_LAST = NEXT_ENDBUF_CONSTRAINT,
WORD_DELIM = DUMMY_CONSTRAINT
WORD_DELIM = WORD_DELIM_CONSTRAINT,
NOT_WORD_DELIM = NOT_WORD_DELIM_CONSTRAINT
} re_context_type;
typedef struct

View File

@ -526,3 +526,12 @@ a((b+|((c)*)))+d - abcd abcd c,c,c,c
(((\b))){0} - x @x -,-,-
a(((.*)))b((\2)){0}c - abc abc @bc,@bc,@bc,-,-
a(((.*)))b((\1)){0}c - axbc axbc x,x,x,-,-
\b & SaT @aT
\b & aT @aT
a.*\b & abT ab
\b & STSS
\B & abc @bc
\B & aSbTc
\B & SaT @SaT
\B & aSTSb @TSb

View File

@ -127,14 +127,15 @@ mb_frob_string (const char *str, const char *letters)
}
/* Like mb_frob_string, but don't replace anything between
[: and :], [. and .] or [= and =]. */
[: and :], [. and .] or [= and =] or characters escaped
with a backslash. */
static char *
mb_frob_pattern (const char *str, const char *letters)
{
char *ret, *dst;
const char *src;
int in_class = 0;
int in_class = 0, escaped = 0;
if (str == NULL)
return NULL;
@ -144,7 +145,18 @@ mb_frob_pattern (const char *str, const char *letters)
return NULL;
for (src = str, dst = ret; *src; ++src)
if (!in_class && strchr (letters, *src))
if (*src == '\\')
{
escaped ^= 1;
*dst++ = *src;
}
else if (escaped)
{
escaped = 0;
*dst++ = *src;
continue;
}
else if (!in_class && strchr (letters, *src))
dst = mb_replace (dst, *src);
else
{

View File

@ -884,6 +884,11 @@ extern void sync (void) __THROW;
extern int getpagesize (void) __THROW __attribute__ ((__const__));
/* Return the maximum number of file descriptors
the current process could possibly have. */
extern int getdtablesize (void) __THROW;
/* Truncate FILE to LENGTH bytes. */
# ifndef __USE_FILE_OFFSET64
extern int truncate (__const char *__file, __off_t __length)
@ -902,6 +907,10 @@ extern int truncate64 (__const char *__file, __off64_t __length)
__THROW __nonnull ((1));
# endif
#endif /* Use BSD || X/Open Unix. */
#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K
/* Truncate the file FD is open on to LENGTH bytes. */
# ifndef __USE_FILE_OFFSET64
extern int ftruncate (int __fd, __off_t __length) __THROW;
@ -917,12 +926,7 @@ extern int __REDIRECT_NTH (ftruncate, (int __fd, __off64_t __length),
extern int ftruncate64 (int __fd, __off64_t __length) __THROW;
# endif
/* Return the maximum number of file descriptors
the current process could possibly have. */
extern int getdtablesize (void) __THROW;
#endif /* Use BSD || X/Open Unix. */
#endif /* Use BSD || X/Open Unix || POSIX 2003. */
#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED

View File

@ -53,7 +53,7 @@ tests := tstscanf test_rdwr test-popen tstgetln test-fseek \
scanf11 scanf12 tst-tmpnam tst-cookie tst-obprintf tst-sscanf \
tst-swprintf tst-fseek tst-fmemopen test-vfprintf tst-gets \
tst-perror tst-sprintf tst-rndseek tst-fdopen tst-fphex bug14 bug15 \
tst-popen tst-unlockedio
tst-popen tst-unlockedio tst-fmemopen2
test-srcs = tst-unbputc tst-printf

View File

@ -61,10 +61,15 @@ distribute := exit.h grouping.h abort-instr.h isomac.c tst-fmtmsg.sh \
test-srcs := tst-fmtmsg
tests := tst-strtol tst-strtod testmb testrand testsort testdiv \
test-canon test-canon2 tst-strtoll tst-environ \
tst-xpg-basename tst-random tst-bsearch tst-limits \
tst-rand48 bug-strtod tst-setcontext test-a64l tst-qsort \
tst-system testmb2
tst-xpg-basename tst-random tst-random2 tst-bsearch \
tst-limits tst-rand48 bug-strtod tst-setcontext \
test-a64l tst-qsort tst-system testmb2
include ../Makeconfig
ifeq ($(build-shared),yes)
tests += tst-putenv
endif
# Several mpn functions from GNU MP are used by the strtod function.
mpn-routines := inlines add_n addmul_1 cmp divmod_1 divrem udiv_qrnnd \
@ -75,18 +80,21 @@ routines := $(strip $(routines) $(mpn-routines)) \
dbl2mpn ldbl2mpn \
mpn2flt mpn2dbl mpn2ldbl
aux += fpioconst mp_clz_tab
distribute := $(distribute) $(mpn-headers) gen-mpn-copy fpioconst.h
distribute := $(distribute) $(mpn-headers) gen-mpn-copy fpioconst.h \
tst-putenvmod.c
generated += isomac isomac.out
tests-extras += tst-putenvmod
extra-objs += tst-putenvmod.os
generated += isomac isomac.out tst-putenvmod.so
CFLAGS-bsearch.c = $(uses-callbacks)
CFLAGS-msort.c = $(uses-callbacks)
CFLAGS-qsort.c = $(uses-callbacks)
CFLAGS-system.c = -fexceptions
CFLAGS-system.os = -fomit-frame-pointer
CFLAGS-fmtmsg.c = -fexceptions
include ../Makeconfig
ifneq (,$(filter %REENTRANT, $(defines)))
CFLAGS-strfmon.c = -D_IO_MTSAFE_IO
CFLAGS-strfmon_l.c = -D_IO_MTSAFE_IO
@ -124,3 +132,9 @@ $(objpfx)isomac: isomac.c
$(objpfx)tst-fmtmsg.out: tst-fmtmsg.sh $(objpfx)tst-fmtmsg
$(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)' $(common-objpfx)stdlib/
$(objpfx)tst-putenv: $(objpfx)tst-putenvmod.so
$(objpfx)tst-putenvmod.so: $(objpfx)tst-putenvmod.os
$(build-module)
CFLAGS-tst-putenvmod.c = -DNOT_IN_libc=1

View File

@ -316,7 +316,7 @@ internal_addseverity (int severity, const char *string)
int result = MM_OK;
/* First see if there is already a record for the severity level. */
for (runp = severity_list, lastp = NULL; runp != NULL; runp = runp-> next)
for (runp = severity_list, lastp = NULL; runp != NULL; runp = runp->next)
if (runp->severity == severity)
break;
else
@ -324,9 +324,6 @@ internal_addseverity (int severity, const char *string)
if (runp != NULL)
{
/* Release old string. */
free ((char *) runp->string);
if (string != NULL)
/* Change the string. */
runp->string = string;
@ -367,34 +364,17 @@ int
addseverity (int severity, const char *string)
{
int result;
const char *new_string;
/* Prevent illegal SEVERITY values. */
if (severity <= MM_INFO)
return MM_NOTOK;
if (string == NULL)
/* We want to remove the severity class. */
new_string = NULL;
else
{
new_string = __strdup (string);
if (new_string == NULL)
/* Allocation failed or illegal value. */
return MM_NOTOK;
}
/* Protect the global data. */
__libc_lock_lock (lock);
/* Do the real work. */
result = internal_addseverity (severity, string);
if (result != MM_OK)
/* Free the allocated string. */
free ((char *) new_string);
/* Release the lock. */
__libc_lock_unlock (lock);
@ -411,7 +391,6 @@ libc_freeres_fn (free_mem)
{
/* This is data we have to release. */
struct severity_info *here = runp;
free ((char *) runp->string);
runp = runp->next;
free (here);
}

View File

@ -240,10 +240,19 @@ __initstate_r (seed, arg_state, n, buf)
int degree;
int separation;
int32_t *state;
int old_type;
int32_t *old_state;
if (buf == NULL)
goto fail;
old_type = buf->rand_type;
old_state = buf->state;
if (old_type == TYPE_0)
old_state[-1] = TYPE_0;
else
old_state[-1] = (MAX_TYPES * (buf->rptr - old_state)) + old_type;
if (n >= BREAK_3)
type = n < BREAK_4 ? TYPE_3 : TYPE_4;
else if (n < BREAK_1)

View File

@ -1,6 +1,8 @@
#include <fmtmsg.h>
#include <mcheck.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MM_TEST 10
@ -12,11 +14,13 @@ main (void)
mtrace ();
if (addseverity (MM_TEST, "TEST") != MM_OK)
char TEST[] = "ABCD";
if (addseverity (MM_TEST, TEST) != MM_OK)
{
puts ("addseverity failed");
result = 1;
}
strcpy (TEST, "TEST");
if (fmtmsg (MM_PRINT, "GLIBC:tst-fmtmsg", MM_HALT, "halt",
"should print message for MM_HALT", "GLIBC:tst-fmtmsg:1")
@ -48,5 +52,31 @@ main (void)
!= MM_OK)
result = 1;
if (addseverity (MM_TEST, NULL) != MM_OK)
{
puts ("second addseverity failed");
result = 1;
}
if (addseverity (MM_TEST, NULL) != MM_NOTOK)
{
puts ("third addseverity unexpectedly succeeded");
result = 1;
}
char *p = strdup ("TEST2");
if (addseverity (MM_TEST, p) != MM_OK)
{
puts ("fourth addseverity failed");
result = 1;
}
if (addseverity (MM_TEST, "TEST3") != MM_OK)
{
puts ("fifth addseverity failed");
result = 1;
}
free (p);
return result;
}

View File

@ -81,7 +81,7 @@ _openchild (const char *command, FILE ** fto, FILE ** ffrom)
for (i = _rpc_dtablesize () - 1; i >= 3; i--)
__close (i);
fflush (stderr);
execlp (command, command, 0);
execlp (command, command, NULL);
perror ("exec");
_exit (~0);

View File

@ -165,7 +165,7 @@ svctcp_create (int sock, u_int sendsize, u_int recvsize)
(void) __bind (sock, (struct sockaddr *) &addr, len);
}
if ((__getsockname (sock, (struct sockaddr *) &addr, &len) != 0) ||
(__listen (sock, 2) != 0))
(__listen (sock, SOMAXCONN) != 0))
{
perror (_("svc_tcp.c - cannot getsockname or listen"));
if (madesock)

View File

@ -161,7 +161,7 @@ svcunix_create (int sock, u_int sendsize, u_int recvsize, char *path)
__bind (sock, (struct sockaddr *) &addr, len);
if (__getsockname (sock, (struct sockaddr *) &addr, &len) != 0
|| __listen (sock, 2) != 0)
|| __listen (sock, SOMAXCONN) != 0)
{
perror (_("svc_unix.c - cannot getsockname or listen"));
if (madesock)

View File

@ -65,7 +65,10 @@ _dl_next_tls_modid (void)
/* Note that this branch will never be executed during program
start since there are no gaps at that time. Therefore it
does not matter that the dl_tls_dtv_slotinfo is not allocated
yet when the function is called for the first times. */
yet when the function is called for the first times.
NB: the offset +1 is due to the fact that DTV[0] is used
for something else. */
result = GL(dl_tls_static_nelem) + 1;
/* If the following would not be true we mustn't have assumed
there is a gap. */
@ -88,11 +91,11 @@ _dl_next_tls_modid (void)
}
while ((runp = runp->next) != NULL);
if (result >= GL(dl_tls_max_dtv_idx))
if (result > GL(dl_tls_max_dtv_idx))
{
/* The new index must indeed be exactly one higher than the
previous high. */
assert (result == GL(dl_tls_max_dtv_idx));
assert (result == GL(dl_tls_max_dtv_idx) + 1);
/* There is no gap anymore. */
GL(dl_tls_dtv_gaps) = false;
@ -577,7 +580,7 @@ __tls_get_addr (GET_ADDR_ARGS)
{
size_t cnt;
for (cnt = total = 0 ? 1 : 0; cnt < listp->len; ++cnt)
for (cnt = total == 0 ? 1 : 0; cnt < listp->len; ++cnt)
{
size_t gen = listp->slotinfo[cnt].gen;
struct link_map *map;

View File

@ -106,9 +106,9 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
__libc_multiple_libcs = &_dl_starting_up && !_dl_starting_up;
#ifndef SHARED
INIT_ARGV_and_ENVIRON;
#ifndef SHARED
/* Store the lowest stack address. This is done in ld.so if this is
the code for the DSO. */
__libc_stack_end = stack_end;

View File

@ -810,7 +810,7 @@ parse_arith (char **word, size_t *word_length, size_t *max_length,
/* Function called by child process in exec_comm() */
static void
internal_function
internal_function __attribute__ ((always_inline))
exec_comm_child (char *comm, int *fildes, int showerr, int noexec)
{
const char *args[4] = { _PATH_BSHELL, "-c", comm, NULL };
@ -868,13 +868,14 @@ exec_comm (char *comm, char **word, size_t *word_length, size_t *max_length,
const char *ifs_white)
{
int fildes[2];
int bufsize = 128;
#define bufsize 128
int buflen;
int i;
int status = 0;
size_t maxnewlines = 0;
char *buffer;
char buffer[bufsize];
pid_t pid;
int noexec = 0;
/* Don't fork() unless necessary */
if (!comm || !*comm)
@ -884,32 +885,42 @@ exec_comm (char *comm, char **word, size_t *word_length, size_t *max_length,
/* Bad */
return WRDE_NOSPACE;
again:
if ((pid = __fork ()) < 0)
{
/* Bad */
__close (fildes[0]);
__close (fildes[1]);
if (fildes[0] != -1)
__close (fildes[0]);
if (fildes[1] != -1)
__close (fildes[1]);
return WRDE_NOSPACE;
}
if (pid == 0)
exec_comm_child (comm, fildes, flags & WRDE_SHOWERR, 0);
exec_comm_child (comm, fildes, noexec ? 0 : flags & WRDE_SHOWERR, noexec);
/* Parent */
/* If we are just testing the syntax, only wait. */
if (noexec)
return (TEMP_FAILURE_RETRY (__waitpid (pid, &status, 0)) == pid
&& status != 0) ? WRDE_SYNTAX : 0;
__close (fildes[1]);
buffer = __alloca (bufsize);
fildes[1] = -1;
if (!pwordexp)
/* Quoted - no field splitting */
{
while (1)
{
if ((buflen = __read (fildes[0], buffer, bufsize)) < 1)
if ((buflen = TEMP_FAILURE_RETRY (__read (fildes[0], buffer,
bufsize))) < 1)
{
if (__waitpid (pid, &status, WNOHANG) == 0)
if (TEMP_FAILURE_RETRY (__waitpid (pid, &status, WNOHANG)) == 0)
continue;
if ((buflen = __read (fildes[0], buffer, bufsize)) < 1)
if ((buflen = TEMP_FAILURE_RETRY (__read (fildes[0], buffer,
bufsize))) < 1)
break;
}
@ -933,11 +944,13 @@ exec_comm (char *comm, char **word, size_t *word_length, size_t *max_length,
while (1)
{
if ((buflen = __read (fildes[0], buffer, bufsize)) < 1)
if ((buflen = TEMP_FAILURE_RETRY (__read (fildes[0], buffer,
bufsize))) < 1)
{
if (__waitpid (pid, &status, WNOHANG) == 0)
if (TEMP_FAILURE_RETRY (__waitpid (pid, &status, WNOHANG)) == 0)
continue;
if ((buflen = __read (fildes[0], buffer, bufsize)) < 1)
if ((buflen = TEMP_FAILURE_RETRY (__read (fildes[0], buffer,
bufsize))) < 1)
break;
}
@ -1053,31 +1066,20 @@ exec_comm (char *comm, char **word, size_t *word_length, size_t *max_length,
}
__close (fildes[0]);
fildes[0] = -1;
/* Check for syntax error (re-execute but with "-n" flag) */
if (buflen < 1 && status != 0)
{
if ((pid = __fork ()) < 0)
{
/* Bad */
return WRDE_NOSPACE;
}
if (pid == 0)
{
fildes[0] = fildes[1] = -1;
exec_comm_child (comm, fildes, 0, 1);
}
if (__waitpid (pid, &status, 0) == pid && status != 0)
return WRDE_SYNTAX;
noexec = 1;
goto again;
}
return 0;
no_space:
__kill (pid, SIGKILL);
__waitpid (pid, NULL, 0);
TEMP_FAILURE_RETRY (__waitpid (pid, NULL, 0));
__close (fildes[0]);
return WRDE_NOSPACE;
}

View File

@ -61,3 +61,7 @@ CFLAGS-dlopenold.c += -mpreferred-stack-boundary=4
CFLAGS-dlclose.c += -mpreferred-stack-boundary=4
CFLAGS-dlerror.c += -mpreferred-stack-boundary=4
endif
ifneq (,$(filter -mno-tls-direct-seg-refs,$(CFLAGS)))
defines += -DNO_TLS_DIRECT_SEG_REFS
endif

View File

@ -308,11 +308,21 @@ _dl_start_user:\n\
movl _rtld_local@GOTOFF(%ebx), %eax\n\
leal 8(%esp,%edx,4), %esi\n\
leal 4(%esp), %ecx\n\
movl %esp, %ebp\n\
# Make sure _dl_init is run with 16 byte aligned stack.\n\
andl $-16, %esp\n\
pushl %eax\n\
pushl %eax\n\
pushl %ebp\n\
pushl %esi\n\
# Clear %ebp, so that even constructors have terminated backchain.\n\
xorl %ebp, %ebp\n\
# Call the function to run the initializers.\n\
call _dl_init_internal@PLT\n\
# Pass our finalizer function to the user in %edx, as per ELF ABI.\n\
leal _dl_fini@GOTOFF(%ebx), %edx\n\
# Restore %esp _start expects.\n\
movl (%esp), %esp\n\
# Jump to the user's entry point.\n\
jmp *%edi\n\
.previous\n\

View File

@ -1,8 +1,33 @@
ifeq ($(subdir),math)
libm-sysdep_routines += libm_atan2_reg s_matherrf s_matherrl libm_reduce \
libm_tan libm_error \
libm_frexp4 libm_frexp4f libm_frexp4l
#
# Some files which need to go both into libc and libm have external
# dependencies which need to be resolved differently for libc
# vs. libm. For example, inside libc, __libm_error_support needs to
# resolve to HIDDEN_JUMPTARGET(__libm_error_support) whereas within
# libm it always resolves to __libm_error_support. Such files need to
# be compiled twice. Fortunately, math/Makefile already has logic to
# support this: if a file starts with "s_", make will automatically
# generate a matching file whose name starts with "m_" which simply
# includes the corresponding "s_" file.
#
duplicated-routines = s_libm_ldexp s_libm_ldexpf s_libm_ldexpl \
s_libm_scalbn s_libm_scalbnf s_libm_scalbnl
sysdep_routines += libm_frexp4 libm_frexp4f libm_frexp4l libc_libm_error
sysdep-CPPFLAGS += -DSIZE_INT_32
libm-sysdep_routines += s_erfc s_erfcf s_erfcl \
s_matherrf s_matherrl libm_reduce \
libm_error \
libm_frexp libm_frexpf libm_frexpl \
libm_sincos libm_sincosf libm_sincosl \
libm_sincos_large \
libm_lgamma libm_lgammaf libm_lgammal \
libm_scalblnf \
$(duplicated-routines:s_%=m_%)
sysdep_routines += libc_libm_error libm_frexp libm_frexpf libm_frexpl \
$(duplicated-routines)
sysdep-CPPFLAGS += -include libm-symbols.h \
-D__POSIX__ \
-D_LIB_VERSIONIMF=_LIB_VERSION \
-DSIZE_INT_32 -DSIZE_LONG_INT_64 -DSIZE_LONG_LONG_INT_64
endif

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,10 @@
.file "acosf.s"
// Copyright (C) 2000, 2001, Intel Corporation
// Copyright (c) 2000 - 2003, Intel Corporation
// All rights reserved.
//
// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
// Contributed 2000 by the Intel Numerics Group, Intel Corporation
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@ -20,7 +20,7 @@
// * The name of Intel Corporation may not be used to endorse or promote
// products derived from this software without specific prior written
// permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@ -35,19 +35,23 @@
//
// Intel Corporation is the author of this code, and requests that all
// problem reports or change requests be submitted to it directly at
// http://developer.intel.com/opensource.
// http://www.intel.com/software/products/opensource/libraries/num.htm.
// History
//==============================================================
// 2/02/00 Initial revision
// 6/28/00 Improved speed
// 6/31/00 Changed register allocation because of some duplicate macros
// 02/02/00 Initial version
// 06/28/00 Improved speed
// 06/31/00 Changed register allocation because of some duplicate macros
// moved nan exit bundle up to gain a cycle.
// 8/15/00 Bundle added after call to __libm_error_support to properly
// 08/15/00 Bundle added after call to __libm_error_support to properly
// set [the previously overwritten] GR_Parameter_RESULT.
// 8/17/00 Changed predicate register macro-usage to direct predicate
// 08/17/00 Changed predicate register macro-usage to direct predicate
// names due to an assembler bug.
// 10/17/00 Improved speed of x=0 and x=1 paths, set D flag if x denormal.
// 03/13/01 Corrected sign of imm1 value in dep instruction.
// 05/20/02 Cleaned up namespace and sf0 syntax
// 02/06/03 Reordered header: .section, .global, .proc, .align
// 04/17/03 Moved mutex after label
// Description
@ -115,7 +119,6 @@
// answer2 = sign(x) z P(t) if x>0
// = sign(x) z P(t) + pi if x<0
#include "libm_support.h"
//
// Assembly macros
@ -222,42 +225,30 @@ acosf_poly_p1a = f90
// Data tables
//==============================================================
#ifdef _LIBC
.rodata
#else
.data
#endif
RODATA
.align 16
acosf_coeff_1_table:
ASM_TYPE_DIRECTIVE(acosf_coeff_1_table,@object)
LOCAL_OBJECT_START(acosf_coeff_1_table)
data8 0x3FC5555607DCF816 // P1
data8 0x3F9CF81AD9BAB2C6 // P4
data8 0x3FC59E0975074DF3 // P7
data8 0xBFA6F4CC2780AA1D // P6
data8 0x3FC2DD45292E93CB // P9
data8 0x3fe6a09e667f3bcd // sqrt(2)/2
ASM_SIZE_DIRECTIVE(acosf_coeff_1_table)
LOCAL_OBJECT_END(acosf_coeff_1_table)
acosf_coeff_2_table:
ASM_TYPE_DIRECTIVE(acosf_coeff_2_table,@object)
LOCAL_OBJECT_START(acosf_coeff_2_table)
data8 0x3FA6F108E31EFBA6 // P3
data8 0xBFCA31BF175D82A0 // P8
data8 0x3FA30C0337F6418B // P5
data8 0x3FB332C9266CB1F9 // P2
data8 0x3ff921fb54442d18 // pi_by_2
ASM_SIZE_DIRECTIVE(acosf_coeff_2_table)
LOCAL_OBJECT_END(acosf_coeff_2_table)
.align 32
.global acosf
ASM_TYPE_DIRECTIVE(acosf,@function)
.section .text
.proc acosf
.align 32
acosf:
GLOBAL_LIBM_ENTRY(acosf)
// Load the addresses of the two tables.
// Then, load the coefficients and other constants.
@ -342,7 +333,7 @@ acosf:
}
{ .mfb
nop.m 999
(p8) fma.s f8 = f8,f1,f0
(p8) fma.s.s0 f8 = f8,f1,f0
(p8) br.ret.spnt b0 ;; // Exit if x=nan
}
@ -350,7 +341,7 @@ acosf:
{ .mfb
nop.m 999
fcmp.eq.s1 p6,p0 = acosf_abs_x,f1
(p10) br.cond.spnt L(ACOSF_ZERO) ;; // Branch if x=0
(p10) br.cond.spnt ACOSF_ZERO ;; // Branch if x=0
}
{ .mfi
@ -367,7 +358,7 @@ acosf:
{ .mfb
nop.m 999
fma.s1 acosf_t4 = acosf_t2,acosf_t2,f0
(p6) br.cond.spnt L(ACOSF_ABS_ONE) ;; // Branch if |x|=1
(p6) br.cond.spnt ACOSF_ABS_ONE ;; // Branch if |x|=1
}
{ .mfi
@ -575,42 +566,40 @@ acosf:
.pred.rel "mutex",p8,p7 //acosf_pred_GTsqrt2by2,acosf_pred_LEsqrt2by2
{ .mfi
nop.m 999
(p8) fma.s f8 = acosf_z,acosf_Pt,acosf_sgn_x_piby2
(p8) fma.s.s0 f8 = acosf_z,acosf_Pt,acosf_sgn_x_piby2
nop.i 999
}
{ .mfb
nop.m 999
(p7) fms.s f8 = acosf_const_piby2,f1,acosf_sinf1
(p7) fms.s.s0 f8 = acosf_const_piby2,f1,acosf_sinf1
br.ret.sptk b0 ;;
}
L(ACOSF_ZERO):
ACOSF_ZERO:
// Here if x=0
{ .mfb
nop.m 999
fma.s f8 = acosf_const_piby2,f1,f0 // acosf(0)=pi/2
fma.s.s0 f8 = acosf_const_piby2,f1,f0 // acosf(0)=pi/2
br.ret.sptk b0 ;;
}
L(ACOSF_ABS_ONE):
ACOSF_ABS_ONE:
.pred.rel "mutex",p11,p12
// Here if |x|=1
{ .mfi
nop.m 999
(p11) fma.s f8 = acosf_const_piby2,f1,acosf_const_piby2 // acosf(-1)=pi
(p11) fma.s.s0 f8 = acosf_const_piby2,f1,acosf_const_piby2 // acosf(-1)=pi
nop.i 999
}
{ .mfb
nop.m 999
(p12) fma.s f8 = f1,f0,f0 // acosf(1)=0
(p12) fma.s.s0 f8 = f1,f0,f0 // acosf(1)=0
br.ret.sptk b0 ;;
}
.endp acosf
ASM_SIZE_DIRECTIVE(acosf)
GLOBAL_LIBM_END(acosf)
// Stack operations when calling error support.
// (1) (2)
@ -642,8 +631,7 @@ ASM_SIZE_DIRECTIVE(acosf)
// restore ar.pfs
.proc __libm_error_region
__libm_error_region:
LOCAL_LIBM_ENTRY(__libm_error_region)
.prologue
{ .mfi
add GR_Parameter_Y=-32,sp // Parameter 2 value
@ -699,8 +687,7 @@ __libm_error_region:
br.ret.sptk b0 // Return
};;
.endp __libm_error_region
ASM_SIZE_DIRECTIVE(__libm_error_region)
LOCAL_LIBM_END(__libm_error_region)
.type __libm_error_support#,@function
.global __libm_error_support#

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,10 @@
.file "asinf.s"
// Copyright (C) 2000, 2001, Intel Corporation
// Copyright (c) 2000 - 2003, Intel Corporation
// All rights reserved.
//
// Contributed 2/02/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
// Contributed 2000 by the Intel Numerics Group, Intel Corporation
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@ -20,7 +20,7 @@
// * The name of Intel Corporation may not be used to endorse or promote
// products derived from this software without specific prior written
// permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@ -35,21 +35,25 @@
//
// Intel Corporation is the author of this code, and requests that all
// problem reports or change requests be submitted to it directly at
// http://developer.intel.com/opensource.
// http://www.intel.com/software/products/opensource/libraries/num.htm.
// History
//==============================================================
// 2/02/00 Initial revision
// 6/28/00 Improved speed
// 6/31/00 Changed register allocation because of some duplicate macros
// 02/02/00 Initial version
// 06/28/00 Improved speed
// 06/31/00 Changed register allocation because of some duplicate macros
// moved nan exit bundle up to gain a cycle.
// 8/08/00 Improved speed by avoiding SIR flush.
// 8/15/00 Bundle added after call to __libm_error_support to properly
// 08/08/00 Improved speed by avoiding SIR flush.
// 08/15/00 Bundle added after call to __libm_error_support to properly
// set [the previously overwritten] GR_Parameter_RESULT.
// 8/17/00 Changed predicate register macro-usage to direct predicate
// 08/17/00 Changed predicate register macro-usage to direct predicate
// names due to an assembler bug.
// 10/17/00 Improved speed of x=0 and x=1 paths, set D flag if x denormal.
// 03/13/01 Corrected sign of imm1 value in dep instruction.
// 05/20/02 Cleaned up namespace and sf0 syntax
// 02/06/03 Reordered header: .section, .global, .proc, .align
// Description
//=========================================
// The asinf function computes the arc sine of x in the range [-pi,+pi].
@ -119,7 +123,6 @@
// answer2 = - sign(x) z P(t) + (sign(x) pi/2)
//
#include "libm_support.h"
// Assembly macros
//=========================================
@ -225,42 +228,30 @@ asinf_poly_p1a = f90
// Data tables
//==============================================================
#ifdef _LIBC
.rodata
#else
.data
#endif
RODATA
.align 16
asinf_coeff_1_table:
ASM_TYPE_DIRECTIVE(asinf_coeff_1_table,@object)
LOCAL_OBJECT_START(asinf_coeff_1_table)
data8 0x3FC5555607DCF816 // P1
data8 0x3F9CF81AD9BAB2C6 // P4
data8 0x3FC59E0975074DF3 // P7
data8 0xBFA6F4CC2780AA1D // P6
data8 0x3FC2DD45292E93CB // P9
data8 0x3fe6a09e667f3bcd // sqrt(2)/2
ASM_SIZE_DIRECTIVE(asinf_coeff_1_table)
LOCAL_OBJECT_END(asinf_coeff_1_table)
asinf_coeff_2_table:
ASM_TYPE_DIRECTIVE(asinf_coeff_2_table,@object)
LOCAL_OBJECT_START(asinf_coeff_2_table)
data8 0x3FA6F108E31EFBA6 // P3
data8 0xBFCA31BF175D82A0 // P8
data8 0x3FA30C0337F6418B // P5
data8 0x3FB332C9266CB1F9 // P2
data8 0x3ff921fb54442d18 // pi_by_2
ASM_SIZE_DIRECTIVE(asinf_coeff_2_table)
LOCAL_OBJECT_END(asinf_coeff_2_table)
.align 32
.global asinf
.section .text
.proc asinf
.align 32
asinf:
GLOBAL_LIBM_ENTRY(asinf)
// Load the addresses of the two tables.
// Then, load the coefficients and other constants.
@ -345,7 +336,7 @@ asinf:
}
{ .mfb
nop.m 999
(p8) fma.s f8 = f8,f1,f0
(p8) fma.s.s0 f8 = f8,f1,f0
(p8) br.ret.spnt b0 ;; // Exit if x=nan
}
@ -370,7 +361,7 @@ asinf:
{ .mfb
nop.m 999
fma.s1 asinf_t4 = asinf_t2,asinf_t2,f0
(p6) br.cond.spnt L(ASINF_ABS_ONE) ;; // Branch if |x|=1
(p6) br.cond.spnt ASINF_ABS_ONE ;; // Branch if |x|=1
}
{ .mfi
@ -572,28 +563,26 @@ asinf:
.pred.rel "mutex",p8,p7 //asinf_pred_GTsqrt2by2,asinf_pred_LEsqrt2by2
{ .mfi
nop.m 999
(p8) fnma.s f8 = asinf_z,asinf_Pt,asinf_sgn_x_piby2
(p8) fnma.s.s0 f8 = asinf_z,asinf_Pt,asinf_sgn_x_piby2
nop.i 999
}
{ .mfb
nop.m 999
(p7) fma.s f8 = asinf_x11,asinf_poly_Bx,asinf_poly_Ax
(p7) fma.s.s0 f8 = asinf_x11,asinf_poly_Bx,asinf_poly_Ax
br.ret.sptk b0 ;;
}
L(ASINF_ABS_ONE):
ASINF_ABS_ONE:
// Here for short exit if |x|=1
{ .mfb
nop.m 999
fma.s f8 = asinf_sgn_x,asinf_const_piby2,f0
fma.s.s0 f8 = asinf_sgn_x,asinf_const_piby2,f0
br.ret.sptk b0
}
;;
.endp asinf
ASM_SIZE_DIRECTIVE(asinf)
GLOBAL_LIBM_END(asinf)
// Stack operations when calling error support.
// (1) (2)
// sp -> + psp -> +
@ -623,8 +612,7 @@ ASM_SIZE_DIRECTIVE(asinf)
// restore gp
// restore ar.pfs
.proc __libm_error_region
__libm_error_region:
LOCAL_LIBM_ENTRY(__libm_error_region)
.prologue
{ .mfi
add GR_Parameter_Y=-32,sp // Parameter 2 value
@ -680,8 +668,7 @@ __libm_error_region:
br.ret.sptk b0 // Return
};;
.endp __libm_error_region
ASM_SIZE_DIRECTIVE(__libm_error_region)
LOCAL_LIBM_END(__libm_error_region)
.type __libm_error_support#,@function
.global __libm_error_support#

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,10 @@
.file "atan2f.s"
// Copyright (C) 2000, 2001, Intel Corporation
// Copyright (c) 2000 - 2003, Intel Corporation
// All rights reserved.
//
// Contributed 6/1/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
// Contributed 2000 by the Intel Numerics Group, Intel Corporation
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@ -20,7 +20,7 @@
// * The name of Intel Corporation may not be used to endorse or promote
// products derived from this software without specific prior written
// permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@ -35,18 +35,21 @@
//
// Intel Corporation is the author of this code, and requests that all
// problem reports or change requests be submitted to it directly at
// http://developer.intel.com/opensource.
// http://www.intel.com/software/products/opensource/libraries/num.htm.
// History
//==============================================================
// 6/01/00 Initial version
// 8/15/00 Bundle added after call to __libm_error_support to properly
// 06/01/00 Initial version
// 08/15/00 Bundle added after call to __libm_error_support to properly
// set [the previously overwritten] GR_Parameter_RESULT.
// 8/17/00 Changed predicate register macro-usage to direct predicate
// 08/17/00 Changed predicate register macro-usage to direct predicate
// names due to an assembler bug.
// 1/05/01 Fixed flag settings for denormal input.
// 1/19/01 Added documentation
// 1/30/01 Improved speed
// 01/05/01 Fixed flag settings for denormal input.
// 01/19/01 Added documentation
// 01/30/01 Improved speed
// 02/06/02 Corrected .section statement
// 05/20/02 Cleaned up namespace and sf0 syntax
// 02/06/03 Reordered header: .section, .global, .proc, .align
// Description
//=========================================
@ -226,7 +229,6 @@
// atan2f(+-0/+-0) sets single error tag to 38
// These are domain errors.
#include "libm_support.h"
//
// Assembly macros
@ -324,22 +326,20 @@ atan2f_poly_atan_U = f88
//atan2f_Pred_Xneg = p9 // x < 0
.data
RODATA
.align 16
atan2f_coef_table1:
ASM_TYPE_DIRECTIVE(atan2f_coef_table1,@object)
LOCAL_OBJECT_START(atan2f_coef_table1)
data8 0xBFD5555512191621 // p1
data8 0x3F522E5D33BC9BAA // p10
data8 0xBFA6E10BA401393F // p7
data8 0x3FB142A73D7C54E3 // p6
data8 0xBFC2473C5145EE38 // p3
data8 0x3FC9997E7AFBFF4E // p2
ASM_SIZE_DIRECTIVE(atan2f_coef_table1)
LOCAL_OBJECT_END(atan2f_coef_table1)
atan2f_coef_table2:
ASM_TYPE_DIRECTIVE(atan2f_coef_table2,@object)
LOCAL_OBJECT_START(atan2f_coef_table2)
data8 0xBF7DEAADAA336451 // p9
data8 0x3F97105B4160F86B // p8
data8 0xBFB68EED6A8CFA32 // p5
@ -348,29 +348,12 @@ data8 0x3ff921fb54442d18 // pi/2
data8 0x400921fb54442d18 // pi
data8 0x3fe921fb54442d18 // pi/4
data8 0x4002d97c7f3321d2 // 3pi/4
ASM_SIZE_DIRECTIVE(atan2f_coef_table2)
LOCAL_OBJECT_END(atan2f_coef_table2)
.global atan2f
#ifdef _LIBC
.global __atan2f
.global __ieee754_atan2f
#endif
.text
.align 32
atan2f:
.proc atan2f
#ifdef _LIBC
.proc __atan2f
__atan2f:
.proc __ieee754_atan2f
__ieee754_atan2f:
#endif
.section .text
GLOBAL_IEEE754_ENTRY(atan2f)
{ .mfi
alloc r32 = ar.pfs,1,5,4,0
@ -724,7 +707,7 @@ ATAN2F_XY_INF_NAN_ZERO:
}
{ .mfb
nop.m 999
(p10) fma.s f8 = f9,f8,f0 // Result quietized y if y is nan
(p10) fma.s.s0 f8 = f9,f8,f0 // Result quietized y if y is nan
(p10) br.ret.spnt b0 // Exit if y is nan
}
;;
@ -737,7 +720,7 @@ ATAN2F_XY_INF_NAN_ZERO:
}
{ .mfb
nop.m 999
(p12) fnorm.s f8 = f9 // Result quietized x if x is nan, y not nan
(p12) fnorm.s.s0 f8 = f9 // Result quietized x if x is nan, y not nan
(p12) br.ret.spnt b0 // Exit if x is nan, y not nan
}
;;
@ -757,7 +740,7 @@ ATAN2F_XY_INF_NAN_ZERO:
}
{ .mfb
nop.m 999
(p7) fma.s f8 = atan2f_sgn_Y, atan2f_const_piby4,f0 // Result +-pi/4
(p7) fma.s.s0 f8 = atan2f_sgn_Y, atan2f_const_piby4,f0 // Result +-pi/4
(p7) br.ret.spnt b0 // Exit if x +inf and y inf
}
;;
@ -790,19 +773,19 @@ ATAN2F_XY_INF_NAN_ZERO:
}
{ .mfb
nop.m 999
(p13) fma.s f8 = atan2f_sgn_Y, atan2f_const_piby2,f0 // Result +-pi/2
(p13) fma.s.s0 f8 = atan2f_sgn_Y, atan2f_const_piby2,f0 // Result +-pi/2
(p13) br.ret.spnt b0 // Exit if x not -inf and y inf
}
;;
{ .mfi
nop.m 999
(p14) fma.s f8 = atan2f_sgn_Y, atan2f_const_3piby4,f0 // Result +-3pi/4
(p14) fma.s.s0 f8 = atan2f_sgn_Y, atan2f_const_3piby4,f0 // Result +-3pi/4
nop.i 999
}
{ .mfb
nop.m 999
(p15) fma.s f8 = atan2f_sgn_Y, atan2f_const_pi,f0 // Result +-pi
(p15) fma.s.s0 f8 = atan2f_sgn_Y, atan2f_const_pi,f0 // Result +-pi
(p11) br.ret.spnt b0 // Exit if x -inf
}
;;
@ -829,31 +812,28 @@ ATAN2F_XY_INF_NAN_ZERO:
}
{ .mfb
nop.m 999
(p9) fma.s f8 = atan2f_sgn_Y, atan2f_const_pi,f0 // x < 0, y 0, result +-pi
(p9) fma.s.s0 f8 = atan2f_sgn_Y, atan2f_const_pi,f0 // x < 0, y 0, result +-pi
(p10) br.cond.spnt __libm_error_region // Branch if x zero and y zero
}
;;
{ .mfb
nop.m 999
(p11) fma.s f8 = atan2f_sgn_Y, atan2f_const_piby2,f0 // x zero, y not zero
(p11) fma.s.s0 f8 = atan2f_sgn_Y, atan2f_const_piby2,f0 // x zero, y not zero
br.ret.sptk b0 // Final special case exit
}
;;
.endp atan2f
ASM_SIZE_DIRECTIVE(atan2f)
GLOBAL_IEEE754_END(atan2f)
.proc __libm_error_region
__libm_error_region:
LOCAL_LIBM_ENTRY(__libm_error_region)
.prologue
mov GR_Parameter_TAG = 38
fclass.m p10,p11 = f9,0x5 // @zero | @pos
;;
(p10) fmerge.s f10 = f8, f0
(p11) fma.s f10 = atan2f_sgn_Y, atan2f_const_pi,f0
(p11) fma.s.s0 f10 = atan2f_sgn_Y, atan2f_const_pi,f0
;;
{ .mfi
@ -913,8 +893,7 @@ __libm_error_region:
}
;;
.endp __libm_error_region
ASM_SIZE_DIRECTIVE(__libm_error_region)
LOCAL_LIBM_END(__libm_error_region)
.type __libm_error_support#,@function
.global __libm_error_support#

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,10 @@
.file "fmod.s"
// Copyright (C) 2000, 2001, Intel Corporation
// Copyright (c) 2000 - 2003, Intel Corporation
// All rights reserved.
//
// Contributed 2/2/2000 by John Harrison, Cristina Iordache, Ted Kubaska,
// Bob Norin, Shane Story, and Ping Tak Peter Tang of the Computational
// Software Lab, Intel Corporation.
// Contributed 2000 by the Intel Numerics Group, Intel Corporation
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@ -21,7 +20,7 @@
// * The name of Intel Corporation may not be used to endorse or promote
// products derived from this software without specific prior written
// permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@ -36,38 +35,42 @@
//
// Intel Corporation is the author of this code, and requests that all
// problem reports or change requests be submitted to it directly at
// http://developer.intel.com/opensource.
// http://www.intel.com/software/products/opensource/libraries/num.htm.
//
// History
//====================================================================
// 2/02/00 Initial version
// 3/02/00 New Algorithm
// 4/04/00 Unwind support added
// 8/15/00 Bundle added after call to __libm_error_support to properly
// 02/02/00 Initial version
// 03/02/00 New Algorithm
// 04/04/00 Unwind support added
// 08/15/00 Bundle added after call to __libm_error_support to properly
// set [the previously overwritten] GR_Parameter_RESULT.
//11/28/00 Set FR_Y to f9
// 11/28/00 Set FR_Y to f9
// 03/11/02 Fixed flags for fmod(qnan,zero)
// 05/20/02 Cleaned up namespace and sf0 syntax
// 02/10/03 Reordered header: .section, .global, .proc, .align
// 04/28/03 Fix: fmod(sNaN,0) no longer sets errno
//
// API
//====================================================================
// double fmod(double,double);
// double fmod(double,double);
//
// Overview of operation
//====================================================================
// fmod(a,b)=a-i*b,
// where i is an integer such that, if b!=0,
// where i is an integer such that, if b!=0,
// |i|<|a/b| and |a/b-i|<1
//
// Algorithm
//====================================================================
// a). if |a|<|b|, return a
// b). get quotient and reciprocal overestimates accurate to
// b). get quotient and reciprocal overestimates accurate to
// 33 bits (q2,y2)
// c). if the exponent difference (exponent(a)-exponent(b))
// is less than 32, truncate quotient to integer and
// finish in one iteration
// d). if exponent(a)-exponent(b)>=32 (q2>=2^32)
// round quotient estimate to single precision (k=RN(q2)),
// calculate partial remainder (a'=a-k*b),
// calculate partial remainder (a'=a-k*b),
// get quotient estimate (a'*y2), and repeat from c).
//
// Special cases
@ -81,14 +84,9 @@
// General registers: r2,r29,r32 (ar.pfs), r33-r39
// Floating point registers: f6-f15
#include "libm_support.h"
.section .text
GR_SAVE_B0 = r33
GR_SAVE_PFS = r34
GR_SAVE_GP = r35
GR_SAVE_GP = r35
GR_SAVE_SP = r36
GR_Parameter_X = r37
@ -101,17 +99,9 @@ FR_Y = f9
FR_RESULT = f8
.proc fmod#
.align 32
.global fmod#
.align 32
.section .text
GLOBAL_IEEE754_ENTRY(fmod)
fmod:
#ifdef _LIBC
.global __ieee754_fmod
.type __ieee754_fmod,@function
__ieee754_fmod:
#endif
// inputs in f8, f9
// result in f8
@ -133,12 +123,12 @@ __ieee754_fmod:
// (1) y0
frcpa.s1 f10,p6=f6,f7
nop.i 0
}
}
// Y +-NAN, +-inf, +-0? p7
{ .mfi
nop.m 999
(p0) fclass.m.unc p7,p0 = f9, 0xe7
fclass.m.unc p7,p0 = f9, 0xe7
nop.i 999;;
}
@ -149,14 +139,14 @@ __ieee754_fmod:
{ .mfi
nop.m 999
(p0) fclass.m.unc p9,p0 = f8, 0xe3
nop.i 999
fclass.m.unc p9,p0 = f8, 0xe3
nop.i 999
}
// |x| < |y|? Return x p8
{ .mfi
nop.m 999
(p0) fcmp.lt.unc.s1 p8,p0 = f6,f7
fcmp.lt.unc.s1 p8,p0 = f6,f7
nop.i 999 ;;
}
@ -172,33 +162,33 @@ __ieee754_fmod:
// (2) q0=a*y0
(p6) fma.s1 f13=f6,f10,f0
nop.i 0
}
}
{ .mfi
nop.m 0
// (3) e0 = 1 - b * y0
(p6) fnma.s1 f12=f7,f10,f1
nop.i 0;;
}
}
{.mfi
nop.m 0
// normalize x (if |x|<|y|)
(p8) fma.d.s0 f8=f8,f1,f0
nop.i 0
}
}
{.bbb
(p9) br.cond.spnt L(FMOD_X_NAN_INF)
(p7) br.cond.spnt L(FMOD_Y_NAN_INF_ZERO)
(p9) br.cond.spnt FMOD_X_NAN_INF
(p7) br.cond.spnt FMOD_Y_NAN_INF_ZERO
// if |x|<|y|, return
(p8) br.ret.spnt b0;;
}
{.mfi
{.mfi
nop.m 0
// normalize x
fma.s0 f6=f6,f1,f0
nop.i 0
}
}
{.mfi
nop.m 0
// normalize y
@ -212,45 +202,45 @@ __ieee754_fmod:
// (4) q1=q0+e0*q0
(p6) fma.s1 f13=f12,f13,f13
nop.i 0
}
}
{ .mfi
nop.m 0
// (5) e1 = e0 * e0 + 2^-34
(p6) fma.s1 f14=f12,f12,f11
nop.i 0;;
}
}
{.mlx
nop.m 0
movl r2=0x33a00000;;
}
}
{ .mfi
nop.m 0
// (6) y1 = y0 + e0 * y0
(p6) fma.s1 f10=f12,f10,f10
nop.i 0;;
}
}
{.mfi
// set f12=1.25*2^{-24}
setf.s f12=r2
// (7) q2=q1+e1*q1
(p6) fma.s1 f13=f13,f14,f13
nop.i 0;;
}
}
{.mfi
nop.m 0
fmerge.s f9=f8,f9
nop.i 0
}
}
{ .mfi
nop.m 0
// (8) y2 = y1 + e1 * y1
(p6) fma.s1 f10=f14,f10,f10
// set p6=0, p10=0
cmp.ne.and p6,p10=r0,r0;;
}
}
.align 32
L(loop53):
loop53:
{.mfi
nop.m 0
// compare q2, 2^32
@ -280,7 +270,7 @@ L(loop53):
// normalize truncated quotient
(p8) fcvt.xf f13=f11
nop.i 0;;
}
}
{ .mfi
nop.m 0
// calculate remainder (assuming f13=RZ(Q))
@ -289,7 +279,7 @@ L(loop53):
}
{.mfi
nop.m 0
// also if exponent>32, round quotient to single precision
// also if exponent>32, round quotient to single precision
// and subtract 1 ulp: q=q-q*(1.25*2^{-24})
(p7) fnma.s.s1 f11=f13,f12,f13
nop.i 0;;
@ -332,7 +322,7 @@ L(loop53):
.pred.rel "mutex",p6,p10
{.mfb
nop.m 0
// add b to estimated remainder (to cover the case when the quotient was overestimated)
// add b to estimated remainder (to cover the case when the quotient was overestimated)
// also set correct sign by using f9=|b|*sgn(a), f12=sgn(a)
(p6) fma.d.s0 f8=f11,f12,f9
nop.b 0
@ -354,97 +344,114 @@ L(loop53):
nop.m 0
// if f14 was RZ(Q), set remainder to f14
(p9) mov f6=f14
br.cond.sptk L(loop53);;
br.cond.sptk loop53;;
}
L(FMOD_X_NAN_INF):
FMOD_X_NAN_INF:
// Y zero ?
{.mfi
{.mfi
nop.m 0
fclass.m p10,p0=f8,0xc3 // Test x=nan
nop.i 0
}
{.mfi
nop.m 0
fma.s1 f10=f9,f1,f0
nop.i 0;;
}
{.mfi
nop.m 0
fma.s0 f8=f8,f1,f0
nop.i 0
}
{.mfi
nop.m 0
(p10) fclass.m p10,p0=f9,0x07 // Test x=nan, and y=zero
nop.i 0;;
}
{.mfb
nop.m 0
fcmp.eq.unc.s1 p11,p0=f10,f0
nop.i 0;;
(p10) br.ret.spnt b0;; // Exit with result=x if x=nan and y=zero
}
{.mib
nop.m 0
nop.i 0
// if Y zero
(p11) br.cond.spnt L(FMOD_Y_ZERO);;
(p11) br.cond.spnt FMOD_Y_ZERO;;
}
// X infinity? Return QNAN indefinite
{ .mfi
nop.m 999
(p0) fclass.m.unc p8,p9 = f8, 0x23
nop.i 999;;
fclass.m.unc p8,p9 = f8, 0x23
nop.i 999;;
}
// Y NaN ?
{.mfi
nop.m 999
nop.m 999
(p8) fclass.m p9,p8=f9,0xc3
nop.i 0;;
nop.i 0;;
}
{.mfi
nop.m 999
(p8) frcpa.s0 f8,p0 = f8,f8
nop.m 999
(p8) frcpa.s0 f8,p0 = f8,f8
nop.i 0
}
}
{ .mfi
nop.m 999
// also set Denormal flag if necessary
// also set Denormal flag if necessary
(p8) fma.s0 f9=f9,f1,f0
nop.i 999 ;;
}
{ .mfb
nop.m 999
(p8) fma.d f8=f8,f1,f0
nop.b 999 ;;
(p8) fma.d.s0 f8=f8,f1,f0
nop.b 999 ;;
}
{ .mfb
nop.m 999
(p9) frcpa.s0 f8,p7=f8,f9
br.ret.sptk b0 ;;
(p9) frcpa.s0 f8,p7=f8,f9
br.ret.sptk b0 ;;
}
L(FMOD_Y_NAN_INF_ZERO):
FMOD_Y_NAN_INF_ZERO:
// Y INF
{ .mfi
nop.m 999
(p0) fclass.m.unc p7,p0 = f9, 0x23
fclass.m.unc p7,p0 = f9, 0x23
nop.i 999 ;;
}
{ .mfb
nop.m 999
(p7) fma.d f8=f8,f1,f0
(p7) br.ret.spnt b0 ;;
(p7) fma.d.s0 f8=f8,f1,f0
(p7) br.ret.spnt b0 ;;
}
// Y NAN?
{ .mfi
nop.m 999
(p0) fclass.m.unc p9,p0 = f9, 0xc3
fclass.m.unc p9,p0 = f9, 0xc3
nop.i 999 ;;
}
{ .mfb
nop.m 999
(p9) fma.d f8=f9,f1,f0
(p9) br.ret.spnt b0 ;;
(p9) fma.d.s0 f8=f9,f1,f0
(p9) br.ret.spnt b0 ;;
}
L(FMOD_Y_ZERO):
FMOD_Y_ZERO:
// Y zero? Must be zero at this point
// because it is the only choice left.
// Return QNAN indefinite
@ -452,60 +459,56 @@ L(FMOD_Y_ZERO):
{.mfi
nop.m 0
// set Invalid
frcpa f12,p0=f0,f0
frcpa.s0 f12,p0=f0,f0
nop.i 0
}
// X NAN?
{ .mfi
nop.m 999
(p0) fclass.m.unc p9,p10 = f8, 0xc3
fclass.m.unc p9,p10 = f8, 0xc3
nop.i 999 ;;
}
{ .mfi
nop.m 999
(p10) fclass.nm p9,p10 = f8, 0xff
(p10) fclass.nm p9,p10 = f8, 0xff
nop.i 999 ;;
}
{.mfi
nop.m 999
(p9) frcpa f11,p7=f8,f0
(p9) frcpa.s0 f11,p7=f8,f0
nop.i 0;;
}
{ .mfi
nop.m 999
(p10) frcpa f11,p7 = f9,f9
(p0) mov GR_Parameter_TAG = 121 ;;
(p10) frcpa.s0 f11,p7 = f9,f9
mov GR_Parameter_TAG = 121 ;;
}
{ .mfi
nop.m 999
(p0) fmerge.s f10 = f8, f8
fmerge.s f10 = f8, f8
nop.i 999
}
{ .mfb
nop.m 999
(p0) fma.d f8=f11,f1,f0
(p0) br.sptk __libm_error_region;;
fma.d.s0 f8=f11,f1,f0
br.sptk __libm_error_region;;
}
.endp fmod
ASM_SIZE_DIRECTIVE(fmod)
ASM_SIZE_DIRECTIVE(__ieee754_fmod)
.proc __libm_error_region
__libm_error_region:
GLOBAL_IEEE754_END(fmod)
LOCAL_LIBM_ENTRY(__libm_error_region)
.prologue
{ .mfi
add GR_Parameter_Y=-32,sp // Parameter 2 value
nop.f 0
.save ar.pfs,GR_SAVE_PFS
mov GR_SAVE_PFS=ar.pfs // Save ar.pfs
mov GR_SAVE_PFS=ar.pfs // Save ar.pfs
}
{ .mfi
.fframe 64
.fframe 64
add sp=-64,sp // Create new stack
nop.f 0
mov GR_SAVE_GP=gp // Save gp
@ -513,18 +516,18 @@ __libm_error_region:
{ .mmi
stfd [GR_Parameter_Y] = FR_Y,16 // Save Parameter 2 on stack
add GR_Parameter_X = 16,sp // Parameter 1 address
.save b0, GR_SAVE_B0
mov GR_SAVE_B0=b0 // Save b0
.save b0, GR_SAVE_B0
mov GR_SAVE_B0=b0 // Save b0
};;
.body
{ .mib
stfd [GR_Parameter_X] = FR_X // Store Parameter 1 on stack
add GR_Parameter_RESULT = 0,GR_Parameter_Y
nop.b 0 // Parameter 3 address
stfd [GR_Parameter_X] = FR_X // Store Parameter 1 on stack
add GR_Parameter_RESULT = 0,GR_Parameter_Y
nop.b 0 // Parameter 3 address
}
{ .mib
stfd [GR_Parameter_Y] = FR_RESULT // Store Parameter 3 on stack
add GR_Parameter_Y = -16,GR_Parameter_Y
add GR_Parameter_Y = -16,GR_Parameter_Y
br.call.sptk b0=__libm_error_support# // Call error handling function
};;
{ .mmi
@ -539,13 +542,17 @@ __libm_error_region:
mov b0 = GR_SAVE_B0 // Restore return address
};;
{ .mib
mov gp = GR_SAVE_GP // Restore gp
mov gp = GR_SAVE_GP // Restore gp
mov ar.pfs = GR_SAVE_PFS // Restore ar.pfs
br.ret.sptk b0 // Return
};;
};;
LOCAL_LIBM_END(__libm_error_region)
.endp __libm_error_region
ASM_SIZE_DIRECTIVE(__libm_error_region)
.type __libm_error_support#,@function
.global __libm_error_support#

View File

@ -1,10 +1,10 @@
.file "fmodf.s"
// Copyright (c) 2000, 2001, Intel Corporation
// Copyright (c) 2000 - 2003, Intel Corporation
// All rights reserved.
//
// Contributed 2/2/2000 by John Harrison, Cristina Iordache, Ted Kubaska,
// Bob Norin, Shane Story, and Ping Tak Peter Tang of the Computational
// Software Lab, Intel Corporation.
// Contributed 2000 by the Intel Numerics Group, Intel Corporation
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@ -20,9 +20,7 @@
// * The name of Intel Corporation may not be used to endorse or promote
// products derived from this software without specific prior written
// permission.
//
// WARRANTY DISCLAIMER
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@ -37,38 +35,42 @@
//
// Intel Corporation is the author of this code, and requests that all
// problem reports or change requests be submitted to it directly at
// http://developer.intel.com/opensource.
// http://www.intel.com/software/products/opensource/libraries/num.htm.
//
// History
//====================================================================
// 2/02/00 Initial version
// 3/02/00 New Algorithm
// 4/04/00 Unwind support added
// 8/15/00 Bundle added after call to __libm_error_support to properly
// 02/02/00 Initial version
// 03/02/00 New Algorithm
// 04/04/00 Unwind support added
// 08/15/00 Bundle added after call to __libm_error_support to properly
// set [the previously overwritten] GR_Parameter_RESULT.
//11/28/00 Set FR_Y to f9
// 11/28/00 Set FR_Y to f9
// 03/11/02 Fixed flags for fmodf(qnan,zero)
// 05/20/02 Cleaned up namespace and sf0 syntax
// 02/10/03 Reordered header: .section, .global, .proc, .align
// 04/28/03 Fix: fmod(sNaN,0) no longer sets errno
//
// API
//====================================================================
// float fmodf(float,float);
// float fmodf(float,float);
//
// Overview of operation
//====================================================================
// fmod(a,b)=a-i*b,
// where i is an integer such that, if b!=0,
// where i is an integer such that, if b!=0,
// |i|<|a/b| and |a/b-i|<1
// Algorithm
//====================================================================
// a). if |a|<|b|, return a
// b). get quotient and reciprocal overestimates accurate to
// b). get quotient and reciprocal overestimates accurate to
// 33 bits (q2,y2)
// c). if the exponent difference (exponent(a)-exponent(b))
// is less than 32, truncate quotient to integer and
// finish in one iteration
// d). if exponent(a)-exponent(b)>=32 (q2>=2^32)
// round quotient estimate to single precision (k=RN(q2)),
// calculate partial remainder (a'=a-k*b),
// calculate partial remainder (a'=a-k*b),
// get quotient estimate (a'*y2), and repeat from c).
// Special cases
@ -82,13 +84,9 @@
// General registers: r2,r29,r32 (ar.pfs), r33-r39
// Floating point registers: f6-f15
#include "libm_support.h"
.section .text
GR_SAVE_B0 = r33
GR_SAVE_PFS = r34
GR_SAVE_GP = r35
GR_SAVE_GP = r35
GR_SAVE_SP = r36
GR_Parameter_X = r37
@ -101,18 +99,9 @@ FR_Y = f9
FR_RESULT = f8
.section .text
GLOBAL_IEEE754_ENTRY(fmodf)
.proc fmodf#
.align 32
.global fmodf#
.align 32
fmodf:
#ifdef _LIBC
.global __ieee754_fmodf
.type __ieee754_fmodf,@function
__ieee754_fmodf:
#endif
// inputs in f8, f9
// result in f8
@ -134,13 +123,13 @@ __ieee754_fmodf:
// (1) y0
frcpa.s1 f10,p6=f6,f7
nop.i 0
}
}
// eliminate special cases
// Y +-NAN, +-inf, +-0? p7
{ .mfi
nop.m 999
(p0) fclass.m.unc p7,p0 = f9, 0xe7
fclass.m.unc p7,p0 = f9, 0xe7
nop.i 999;;
}
@ -151,14 +140,14 @@ __ieee754_fmodf:
{ .mfi
nop.m 999
(p0) fclass.m.unc p9,p0 = f8, 0xe3
nop.i 999
fclass.m.unc p9,p0 = f8, 0xe3
nop.i 999
}
// |x| < |y|? Return x p8
{ .mfi
nop.m 999
(p0) fcmp.lt.unc.s1 p8,p0 = f6,f7
fcmp.lt.unc.s1 p8,p0 = f6,f7
nop.i 999 ;;
}
@ -174,33 +163,33 @@ __ieee754_fmodf:
// (2) q0=a*y0
(p6) fma.s1 f13=f6,f10,f0
nop.i 0
}
}
{ .mfi
nop.m 0
// (3) e0 = 1 - b * y0
(p6) fnma.s1 f12=f7,f10,f1
nop.i 0;;
}
}
{.mfi
nop.m 0
// normalize x (if |x|<|y|)
(p8) fma.s.s0 f8=f8,f1,f0
nop.i 0
}
}
{.bbb
(p9) br.cond.spnt L(FMOD_X_NAN_INF)
(p7) br.cond.spnt L(FMOD_Y_NAN_INF_ZERO)
(p9) br.cond.spnt FMOD_X_NAN_INF
(p7) br.cond.spnt FMOD_Y_NAN_INF_ZERO
// if |x|<|y|, return
(p8) br.ret.spnt b0;;
}
{.mfi
{.mfi
nop.m 0
// normalize x
fma.s0 f6=f6,f1,f0
nop.i 0
}
}
{.mfi
nop.m 0
// normalize y
@ -215,45 +204,45 @@ __ieee754_fmodf:
// (4) q1=q0+e0*q0
(p6) fma.s1 f13=f12,f13,f13
nop.i 0
}
}
{ .mfi
nop.m 0
// (5) e1 = e0 * e0 + 2^-34
(p6) fma.s1 f14=f12,f12,f11
nop.i 0;;
}
}
{.mlx
nop.m 0
movl r2=0x33a00000;;
}
}
{ .mfi
nop.m 0
// (6) y1 = y0 + e0 * y0
(p6) fma.s1 f10=f12,f10,f10
nop.i 0;;
}
}
{.mfi
// set f12=1.25*2^{-24}
setf.s f12=r2
// (7) q2=q1+e1*q1
(p6) fma.s1 f13=f13,f14,f13
nop.i 0;;
}
}
{.mfi
nop.m 0
fmerge.s f9=f8,f9
nop.i 0
}
}
{ .mfi
nop.m 0
// (8) y2 = y1 + e1 * y1
(p6) fma.s1 f10=f14,f10,f10
// set p6=0, p10=0
cmp.ne.and p6,p10=r0,r0;;
}
}
.align 32
L(loop24):
loop24:
{.mfi
nop.m 0
// compare q2, 2^32
@ -283,7 +272,7 @@ L(loop24):
// normalize truncated quotient
(p8) fcvt.xf f13=f11
nop.i 0;;
}
}
{ .mfi
nop.m 0
// calculate remainder (assuming f13=RZ(Q))
@ -292,7 +281,7 @@ L(loop24):
}
{.mfi
nop.m 0
// also if exponent>32, round quotient to single precision
// also if exponent>32, round quotient to single precision
// and subtract 1 ulp: q=q-q*(1.25*2^{-24})
(p7) fnma.s.s1 f11=f13,f12,f13
nop.i 0;;
@ -335,7 +324,7 @@ L(loop24):
.pred.rel "mutex",p6,p10
{.mfb
nop.m 0
// add b to estimated remainder (to cover the case when the quotient was overestimated)
// add b to estimated remainder (to cover the case when the quotient was overestimated)
// also set correct sign by using f9=|b|*sgn(a), f12=sgn(a)
(p6) fma.s.s0 f8=f11,f12,f9
nop.b 0
@ -357,102 +346,118 @@ L(loop24):
nop.m 0
// if f14 was RZ(Q), set remainder to f14
(p9) mov f6=f14
br.cond.sptk L(loop24);;
br.cond.sptk loop24;;
}
{ .mmb
nop.m 0
nop.m 0
br.ret.sptk b0;;
nop.m 0
nop.m 0
br.ret.sptk b0;;
}
L(FMOD_X_NAN_INF):
FMOD_X_NAN_INF:
// Y zero ?
{.mfi
{.mfi
nop.m 0
fclass.m p10,p0=f8,0xc3 // Test x=nan
nop.i 0
}
{.mfi
nop.m 0
fma.s1 f10=f9,f1,f0
nop.i 0;;
}
{.mfi
nop.m 0
fma.s0 f8=f8,f1,f0
nop.i 0
}
{.mfi
nop.m 0
(p10) fclass.m p10,p0=f9,0x07 // Test x=nan, and y=zero
nop.i 0;;
}
{.mfb
nop.m 0
fcmp.eq.unc.s1 p11,p0=f10,f0
nop.i 0;;
(p10) br.ret.spnt b0;; // Exit with result=x if x=nan and y=zero
}
{.mib
nop.m 0
nop.i 0
// if Y zero
(p11) br.cond.spnt L(FMOD_Y_ZERO);;
(p11) br.cond.spnt FMOD_Y_ZERO;;
}
// X infinity? Return QNAN indefinite
{ .mfi
nop.m 999
(p0) fclass.m.unc p8,p9 = f8, 0x23
nop.i 999;;
fclass.m.unc p8,p9 = f8, 0x23
nop.i 999;;
}
// Y NaN ?
{.mfi
nop.m 999
nop.m 999
(p8) fclass.m p9,p8=f9,0xc3
nop.i 0;;
nop.i 0;;
}
{.mfi
nop.m 999
(p8) frcpa.s0 f8,p0 = f8,f8
nop.m 999
(p8) frcpa.s0 f8,p0 = f8,f8
nop.i 0
}
}
{ .mfi
nop.m 999
// also set Denormal flag if necessary
// also set Denormal flag if necessary
(p8) fma.s0 f9=f9,f1,f0
nop.i 999 ;;
}
{ .mfb
nop.m 999
(p8) fma.s f8=f8,f1,f0
nop.b 999 ;;
(p8) fma.s.s0 f8=f8,f1,f0
nop.b 999 ;;
}
{ .mfb
nop.m 999
(p9) frcpa.s0 f8,p7=f8,f9
br.ret.sptk b0 ;;
(p9) frcpa.s0 f8,p7=f8,f9
br.ret.sptk b0 ;;
}
L(FMOD_Y_NAN_INF_ZERO):
FMOD_Y_NAN_INF_ZERO:
// Y INF
{ .mfi
nop.m 999
(p0) fclass.m.unc p7,p0 = f9, 0x23
fclass.m.unc p7,p0 = f9, 0x23
nop.i 999 ;;
}
{ .mfb
nop.m 999
(p7) fma.s f8=f8,f1,f0
(p7) br.ret.spnt b0 ;;
(p7) fma.s.s0 f8=f8,f1,f0
(p7) br.ret.spnt b0 ;;
}
// Y NAN?
{ .mfi
nop.m 999
(p0) fclass.m.unc p9,p0 = f9, 0xc3
fclass.m.unc p9,p0 = f9, 0xc3
nop.i 999 ;;
}
{ .mfb
nop.m 999
(p9) fma.s f8=f9,f1,f0
(p9) br.ret.spnt b0 ;;
(p9) fma.s.s0 f8=f9,f1,f0
(p9) br.ret.spnt b0 ;;
}
L(FMOD_Y_ZERO):
FMOD_Y_ZERO:
// Y zero? Must be zero at this point
// because it is the only choice left.
// Return QNAN indefinite
@ -460,69 +465,65 @@ L(FMOD_Y_ZERO):
{.mfi
nop.m 0
// set Invalid
frcpa f12,p0=f0,f0
frcpa.s0 f12,p0=f0,f0
nop.i 999
}
// X NAN?
{ .mfi
nop.m 999
(p0) fclass.m.unc p9,p10 = f8, 0xc3
fclass.m.unc p9,p10 = f8, 0xc3
nop.i 999 ;;
}
{ .mfi
nop.m 999
(p10) fclass.nm p9,p10 = f8, 0xff
(p10) fclass.nm p9,p10 = f8, 0xff
nop.i 999 ;;
}
{.mfi
nop.m 999
(p9) frcpa f11,p7=f8,f0
(p9) frcpa.s0 f11,p7=f8,f0
nop.i 0;;
}
{ .mfi
nop.m 999
(p10) frcpa f11,p7 = f0,f0
(p10) frcpa.s0 f11,p7 = f0,f0
nop.i 999;;
}
{ .mfi
nop.m 999
(p0) fmerge.s f10 = f8, f8
fmerge.s f10 = f8, f8
nop.i 999
}
{ .mfi
nop.m 999
(p0) fma.s f8=f11,f1,f0
fma.s.s0 f8=f11,f1,f0
nop.i 999;;
}
L(EXP_ERROR_RETURN):
EXP_ERROR_RETURN:
{ .mib
nop.m 0
(p0) mov GR_Parameter_TAG=122
(p0) br.sptk __libm_error_region;;
mov GR_Parameter_TAG=122
br.sptk __libm_error_region;;
}
.endp fmodf
ASM_SIZE_DIRECTIVE(fmodf)
ASM_SIZE_DIRECTIVE(__ieee754_fmodf)
.proc __libm_error_region
__libm_error_region:
GLOBAL_IEEE754_END(fmodf)
LOCAL_LIBM_ENTRY(__libm_error_region)
.prologue
{ .mfi
add GR_Parameter_Y=-32,sp // Parameter 2 value
nop.f 0
.save ar.pfs,GR_SAVE_PFS
mov GR_SAVE_PFS=ar.pfs // Save ar.pfs
mov GR_SAVE_PFS=ar.pfs // Save ar.pfs
}
{ .mfi
.fframe 64
.fframe 64
add sp=-64,sp // Create new stack
nop.f 0
mov GR_SAVE_GP=gp // Save gp
@ -530,18 +531,18 @@ __libm_error_region:
{ .mmi
stfs [GR_Parameter_Y] = FR_Y,16 // Save Parameter 2 on stack
add GR_Parameter_X = 16,sp // Parameter 1 address
.save b0, GR_SAVE_B0
mov GR_SAVE_B0=b0 // Save b0
.save b0, GR_SAVE_B0
mov GR_SAVE_B0=b0 // Save b0
};;
.body
{ .mib
stfs [GR_Parameter_X] = FR_X // Store Parameter 1 on stack
add GR_Parameter_RESULT = 0,GR_Parameter_Y
nop.b 0 // Parameter 3 address
stfs [GR_Parameter_X] = FR_X // Store Parameter 1 on stack
add GR_Parameter_RESULT = 0,GR_Parameter_Y
nop.b 0 // Parameter 3 address
}
{ .mib
stfs [GR_Parameter_Y] = FR_RESULT // Store Parameter 3 on stack
add GR_Parameter_Y = -16,GR_Parameter_Y
add GR_Parameter_Y = -16,GR_Parameter_Y
br.call.sptk b0=__libm_error_support#;; // Call error handling function
}
{ .mmi
@ -556,13 +557,14 @@ __libm_error_region:
mov b0 = GR_SAVE_B0 // Restore return address
};;
{ .mib
mov gp = GR_SAVE_GP // Restore gp
mov gp = GR_SAVE_GP // Restore gp
mov ar.pfs = GR_SAVE_PFS // Restore ar.pfs
br.ret.sptk b0 // Return
};;
};;
.endp __libm_error_region
ASM_SIZE_DIRECTIVE(__libm_error_region)
LOCAL_LIBM_END(__libm_error_region)
.type __libm_error_support#,@function
.global __libm_error_support#

View File

@ -1,11 +1,10 @@
.file "fmodl.s"
// Copyright (C) 2000, 2001, Intel Corporation
// Copyright (c) 2000 - 2003, Intel Corporation
// All rights reserved.
//
// Contributed 2/2/2000 by John Harrison, Cristina Iordache, Ted Kubaska,
// Bob Norin, Shane Story, and Ping Tak Peter Tang of the Computational
// Software Lab, Intel Corporation.
// Contributed 2000 by the Intel Numerics Group, Intel Corporation
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@ -21,7 +20,7 @@
// * The name of Intel Corporation may not be used to endorse or promote
// products derived from this software without specific prior written
// permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@ -36,38 +35,42 @@
//
// Intel Corporation is the author of this code, and requests that all
// problem reports or change requests be submitted to it directly at
// http://developer.intel.com/opensource.
// http://www.intel.com/software/products/opensource/libraries/num.htm.
//
// History
//====================================================================
// 2/02/00 Initial version
// 3/02/00 New Algorithm
// 4/04/00 Unwind support added
// 8/15/00 Bundle added after call to __libm_error_support to properly
// 02/02/00 Initial version
// 03/02/00 New Algorithm
// 04/04/00 Unwind support added
// 08/15/00 Bundle added after call to __libm_error_support to properly
// set [the previously overwritten] GR_Parameter_RESULT.
//11/28/00 Set FR_Y to f9
// 11/28/00 Set FR_Y to f9
// 03/11/02 Fixed flags for fmodl(qnan,zero)
// 05/20/02 Cleaned up namespace and sf0 syntax
// 02/10/03 Reordered header: .section, .global, .proc, .align
// 04/28/03 Fix: fmod(sNaN,0) no longer sets errno
//
// API
//====================================================================
// long double fmodl(long double,long double);
// long double fmodl(long double,long double);
//
// Overview of operation
//====================================================================
// fmod(a,b)=a-i*b,
// where i is an integer such that, if b!=0,
// where i is an integer such that, if b!=0,
// |i|<|a/b| and |a/b-i|<1
//
// Algorithm
//====================================================================
// a). if |a|<|b|, return a
// b). get quotient and reciprocal overestimates accurate to
// b). get quotient and reciprocal overestimates accurate to
// 33 bits (q2,y2)
// c). if the exponent difference (exponent(a)-exponent(b))
// is less than 32, truncate quotient to integer and
// finish in one iteration
// d). if exponent(a)-exponent(b)>=32 (q2>=2^32)
// round quotient estimate to single precision (k=RN(q2)),
// calculate partial remainder (a'=a-k*b),
// calculate partial remainder (a'=a-k*b),
// get quotient estimate (a'*y2), and repeat from c).
//
// Registers used
@ -76,13 +79,9 @@
// General registers: r2,r29,r32 (ar.pfs), r33-r39
// Floating point registers: f6-f15
#include "libm_support.h"
.section .text
GR_SAVE_B0 = r33
GR_SAVE_PFS = r34
GR_SAVE_GP = r35
GR_SAVE_GP = r35
GR_SAVE_SP = r36
GR_Parameter_X = r37
@ -95,18 +94,9 @@ FR_Y = f9
FR_RESULT = f8
.section .text
GLOBAL_IEEE754_ENTRY(fmodl)
.proc fmodl#
.align 32
.global fmodl#
.align 32
fmodl:
#ifdef _LIBC
.global __ieee754_fmodl
.type __ieee754_fmodl,@function
__ieee754_fmodl:
#endif
// inputs in f8, f9
// result in f8
@ -128,7 +118,7 @@ __ieee754_fmodl:
// (1) y0
frcpa.s1 f10,p6=f6,f7
nop.i 0;;
}
}
// eliminate special cases
{.mmi
@ -141,7 +131,7 @@ cmp.eq p7,p10=r29,r0;;
// Y +-NAN, +-inf, +-0? p7
{ .mfi
nop.m 999
(p10) fclass.m p7,p10 = f9, 0xe7
(p10) fclass.m p7,p10 = f9, 0xe7
nop.i 999;;
}
@ -152,14 +142,14 @@ cmp.eq p7,p10=r29,r0;;
{ .mfi
nop.m 999
(p0) fclass.m.unc p9,p11 = f8, 0xe3
nop.i 999
fclass.m.unc p9,p11 = f8, 0xe3
nop.i 999
}
// |x| < |y|? Return x p8
{ .mfi
nop.m 999
(p10) fcmp.lt.unc.s1 p8,p0 = f6,f7
(p10) fcmp.lt.unc.s1 p8,p0 = f6,f7
nop.i 999 ;;
}
@ -173,13 +163,13 @@ cmp.eq p7,p10=r29,r0;;
// (3) e0 = 1 - b * y0
(p6) fnma.s1 f12=f7,f10,f1
nop.i 0;;
}
}
// Y +-NAN, +-inf, +-0? p7
{ .mfi
nop.m 999
// pseudo-NaN ?
(p10) fclass.nm p7,p0 = f9, 0xff
// pseudo-NaN ?
(p10) fclass.nm p7,p0 = f9, 0xff
nop.i 999
}
@ -190,7 +180,7 @@ cmp.eq p7,p10=r29,r0;;
{ .mfi
nop.m 999
(p11) fclass.nm p9,p0 = f8, 0xff
(p11) fclass.nm p9,p0 = f8, 0xff
nop.i 999;;
}
@ -209,18 +199,18 @@ cmp.eq p7,p10=r29,r0;;
nop.i 0
}
{.bbb
(p9) br.cond.spnt L(FMOD_X_NAN_INF)
(p7) br.cond.spnt L(FMOD_Y_NAN_INF_ZERO)
(p9) br.cond.spnt FMOD_X_NAN_INF
(p7) br.cond.spnt FMOD_Y_NAN_INF_ZERO
// if |x|<|y|, return
(p8) br.ret.spnt b0;;
}
{.mfi
{.mfi
nop.m 0
// x denormal ? set D flag
fnma.s0 f32=f6,f1,f6
nop.i 0
}
}
{.mfi
nop.m 0
// y denormal ? set D flag
@ -234,46 +224,46 @@ cmp.eq p7,p10=r29,r0;;
// (4) q1=q0+e0*q0
(p6) fma.s1 f13=f12,f13,f13
nop.i 0
}
}
{ .mfi
nop.m 0
// (5) e1 = e0 * e0 + 2^-34
(p6) fma.s1 f14=f12,f12,f11
nop.i 0;;
}
}
{.mlx
nop.m 0
movl r2=0x33a00000;;
}
}
{ .mfi
nop.m 0
// (6) y1 = y0 + e0 * y0
(p6) fma.s1 f10=f12,f10,f10
nop.i 0;;
}
}
{.mfi
// set f12=1.25*2^{-24}
setf.s f12=r2
// (7) q2=q1+e1*q1
(p6) fma.s1 f13=f13,f14,f13
nop.i 0;;
}
}
{.mfi
nop.m 0
fmerge.s f9=f8,f9
nop.i 0
}
}
{ .mfi
nop.m 0
// (8) y2 = y1 + e1 * y1
(p6) fma.s1 f10=f14,f10,f10
// set p6=0, p10=0
cmp.ne.and p6,p10=r0,r0;;
}
}
.align 32
L(loop64):
loop64:
{.mfi
nop.m 0
// compare q2, 2^32
@ -305,7 +295,7 @@ L(loop64):
// normalize truncated quotient
(p8) fcvt.xf f13=f11
nop.i 0;;
}
}
{ .mfi
nop.m 0
// calculate remainder (assuming f13=RZ(Q))
@ -314,7 +304,7 @@ L(loop64):
}
{.mfi
nop.m 0
// also if exponent>32, round quotient to single precision
// also if exponent>32, round quotient to single precision
// and subtract 1 ulp: q=q-q*(1.25*2^{-24})
(p7) fnma.s.s1 f11=f13,f12,f13
nop.i 0;;
@ -357,7 +347,7 @@ L(loop64):
.pred.rel "mutex",p6,p10
{.mfb
nop.m 0
// add b to estimated remainder (to cover the case when the quotient was overestimated)
// add b to estimated remainder (to cover the case when the quotient was overestimated)
// also set correct sign by using f9=|b|*sgn(a), f12=sgn(a)
(p6) fma.s0 f8=f11,f12,f9
nop.b 0
@ -378,43 +368,59 @@ L(loop64):
nop.m 0
// if f14 was RZ(Q), set remainder to f14
(p9) mov f6=f14
br.cond.sptk L(loop64);;
br.cond.sptk loop64;;
}
L(FMOD_X_NAN_INF):
FMOD_X_NAN_INF:
// Y zero ?
{.mfi
{.mfi
nop.m 0
fclass.m p10,p0=f8,0xc3 // Test x=nan
nop.i 0
}
{.mfi
nop.m 0
fma.s1 f10=f9,f1,f0
nop.i 0;;
}
{.mfi
nop.m 0
fma.s0 f8=f8,f1,f0
nop.i 0
}
{.mfi
nop.m 0
(p10) fclass.m p10,p0=f9,0x07 // Test x=nan, and y=zero
nop.i 0;;
}
{.mfb
nop.m 0
fcmp.eq.unc.s1 p11,p0=f10,f0
nop.i 0;;
(p10) br.ret.spnt b0;; // Exit with result=x if x=nan and y=zero
}
{.mib
nop.m 0
nop.i 0
// if Y zero
(p11) br.cond.spnt L(FMOD_Y_ZERO);;
(p11) br.cond.spnt FMOD_Y_ZERO;;
}
// X infinity? Return QNAN indefinite
{ .mfi
// set p7 t0 0
cmp.ne p7,p0=r0,r0
(p0) fclass.m.unc p8,p9 = f8, 0x23
nop.i 999;;
// set p7 t0 0
cmp.ne p7,p0=r0,r0
fclass.m.unc p8,p9 = f8, 0x23
nop.i 999;;
}
// Y NaN ?
{.mfi
nop.m 999
(p8) fclass.m p9,p8=f9,0xc3
nop.i 0;;
nop.i 0;;
}
// Y not pseudo-zero ? (r29 holds significand)
{.mii
@ -423,63 +429,63 @@ L(FMOD_X_NAN_INF):
nop.i 0;;
}
{.mfi
nop.m 999
(p8) frcpa.s0 f8,p0 = f8,f8
nop.m 999
(p8) frcpa.s0 f8,p0 = f8,f8
nop.i 0
}
}
{ .mfi
nop.m 999
// also set Denormal flag if necessary
// also set Denormal flag if necessary
(p7) fnma.s0 f9=f9,f1,f9
nop.i 999 ;;
}
{ .mfb
nop.m 999
(p8) fma.s0 f8=f8,f1,f0
nop.b 999 ;;
(p8) fma.s0 f8=f8,f1,f0
nop.b 999 ;;
}
{ .mfb
nop.m 999
(p9) frcpa.s0 f8,p7=f8,f9
br.ret.sptk b0 ;;
(p9) frcpa.s0 f8,p7=f8,f9
br.ret.sptk b0 ;;
}
L(FMOD_Y_NAN_INF_ZERO):
FMOD_Y_NAN_INF_ZERO:
// Y INF
{ .mfi
nop.m 999
(p0) fclass.m.unc p7,p0 = f9, 0x23
fclass.m.unc p7,p0 = f9, 0x23
nop.i 999 ;;
}
{ .mfb
nop.m 999
(p7) fma f8=f8,f1,f0
(p7) br.ret.spnt b0 ;;
(p7) fma.s0 f8=f8,f1,f0
(p7) br.ret.spnt b0 ;;
}
// Y NAN?
{ .mfi
nop.m 999
(p0) fclass.m.unc p9,p10 = f9, 0xc3
fclass.m.unc p9,p10 = f9, 0xc3
nop.i 999 ;;
}
{ .mfi
nop.m 999
(p10) fclass.nm p9,p0 = f9, 0xff
(p10) fclass.nm p9,p0 = f9, 0xff
nop.i 999 ;;
}
{ .mfb
nop.m 999
(p9) fma f8=f9,f1,f0
(p9) br.ret.spnt b0 ;;
(p9) fma.s0 f8=f9,f1,f0
(p9) br.ret.spnt b0 ;;
}
L(FMOD_Y_ZERO):
FMOD_Y_ZERO:
// Y zero? Must be zero at this point
// because it is the only choice left.
// Return QNAN indefinite
@ -487,62 +493,59 @@ L(FMOD_Y_ZERO):
{.mfi
nop.m 0
// set Invalid
frcpa f12,p0=f0,f0
frcpa.s0 f12,p0=f0,f0
nop.i 0
}
// X NAN?
{ .mfi
nop.m 999
(p0) fclass.m.unc p9,p10 = f8, 0xc3
fclass.m.unc p9,p10 = f8, 0xc3
nop.i 999 ;;
}
{ .mfi
nop.m 999
(p10) fclass.nm p9,p10 = f8, 0xff
(p10) fclass.nm p9,p10 = f8, 0xff
nop.i 999 ;;
}
{.mfi
nop.m 999
(p9) frcpa f11,p7=f8,f0
(p9) frcpa.s0 f11,p7=f8,f0
nop.i 0;;
}
{ .mfi
nop.m 999
(p10) frcpa f11,p7 = f9,f9
(p0) mov GR_Parameter_TAG = 120 ;;
(p10) frcpa.s0 f11,p7 = f9,f9
mov GR_Parameter_TAG = 120 ;;
}
{ .mfi
nop.m 999
(p0) fmerge.s f10 = f8, f8
fmerge.s f10 = f8, f8
nop.i 999
}
{ .mfb
nop.m 999
(p0) fma f8=f11,f1,f0
(p0) br.sptk __libm_error_region;;
fma.s0 f8=f11,f1,f0
br.sptk __libm_error_region;;
}
.endp fmodl
ASM_SIZE_DIRECTIVE(fmodl)
ASM_SIZE_DIRECTIVE(__ieee754_fmodl)
GLOBAL_IEEE754_END(fmodl)
.proc __libm_error_region
__libm_error_region:
LOCAL_LIBM_ENTRY(__libm_error_region)
.prologue
{ .mfi
add GR_Parameter_Y=-32,sp // Parameter 2 value
nop.f 0
.save ar.pfs,GR_SAVE_PFS
mov GR_SAVE_PFS=ar.pfs // Save ar.pfs
mov GR_SAVE_PFS=ar.pfs // Save ar.pfs
}
{ .mfi
.fframe 64
.fframe 64
add sp=-64,sp // Create new stack
nop.f 0
mov GR_SAVE_GP=gp // Save gp
@ -550,18 +553,18 @@ __libm_error_region:
{ .mmi
stfe [GR_Parameter_Y] = FR_Y,16 // Save Parameter 2 on stack
add GR_Parameter_X = 16,sp // Parameter 1 address
.save b0, GR_SAVE_B0
mov GR_SAVE_B0=b0 // Save b0
.save b0, GR_SAVE_B0
mov GR_SAVE_B0=b0 // Save b0
};;
.body
{ .mib
stfe [GR_Parameter_X] = FR_X // Store Parameter 1 on stack
add GR_Parameter_RESULT = 0,GR_Parameter_Y
nop.b 0 // Parameter 3 address
stfe [GR_Parameter_X] = FR_X // Store Parameter 1 on stack
add GR_Parameter_RESULT = 0,GR_Parameter_Y
nop.b 0 // Parameter 3 address
}
{ .mib
stfe [GR_Parameter_Y] = FR_RESULT // Store Parameter 3 on stack
add GR_Parameter_Y = -16,GR_Parameter_Y
add GR_Parameter_Y = -16,GR_Parameter_Y
br.call.sptk b0=__libm_error_support# // Call error handling function
};;
{ .mmi
@ -576,15 +579,17 @@ __libm_error_region:
mov b0 = GR_SAVE_B0 // Restore return address
};;
{ .mib
mov gp = GR_SAVE_GP // Restore gp
mov gp = GR_SAVE_GP // Restore gp
mov ar.pfs = GR_SAVE_PFS // Restore ar.pfs
br.ret.sptk b0 // Return
};;
};;
LOCAL_LIBM_END(__libm_error_region)
.endp __libm_error_region
ASM_SIZE_DIRECTIVE(__libm_error_region)
.type __libm_error_support#,@function
.global __libm_error_support#

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