diff options
author | Ulrich Drepper <drepper@redhat.com> | 1996-12-30 01:47:46 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1996-12-30 01:47:46 +0000 |
commit | d38cd08ca397c59fc98dba8c4d0b4bd96c899c9e (patch) | |
tree | 46ffb93f070ec805f4288ef6cdb379ba0e6ae621 | |
parent | 01c901a56b165e57a17db349cc110f84f1b839c7 (diff) | |
download | glibc-d38cd08ca397c59fc98dba8c4d0b4bd96c899c9e.zip glibc-d38cd08ca397c59fc98dba8c4d0b4bd96c899c9e.tar.gz glibc-d38cd08ca397c59fc98dba8c4d0b4bd96c899c9e.tar.bz2 |
update from main archive 961229cvs/libc20x-970306cvs/libc-961231cvs/libc-961230
Mon Dec 30 01:32:59 1996 Ulrich Drepper <drepper@cygnus.com>
* tme/localtime.c: Rewrite so that localtime_r does not call tzset,
but localtime does.
* features.h: Rename ANSI C to ISO C.
Mention __GLIBC__ and __GLIBC_MINOR__ macros.
* gnu-versions.h: Add _GNU_GETOPT_INTERFACE_VERSION.
* posix/getopt.c: Use _GNU_GETOPT_INTERFACE_VERSION to check
whether we can elide the code.
* posix/getopt1.c: Likewise.
* posix/Makefile: Correct copyright.
* elf/dl-error.c (_dl_catch_error): Clear `catch' also when error
occurred.
* elf/dl-support.c (_dl_sysdep_open_zero_fill): Don't define if
MAP_ANON is defined.
* elf/eval.c: Use __getline instead of getline.
* elf/rtld.c (dl_main): Check return value of _dl_new_object
function for NULL.
* sysdeps/generic/dl-cache.c: Update copyright.
* signal/Makefile: Correct copyright.
(routines): Remove gsignal and ssignal. Add bsd_signal.
* signal/gsignal.c: Removed. Now is made an alias.
* signal/ssignal.c: Likewise.
* sysdeps/posix/raise.c: Add alias gsignal.
* sysdeps/stub/raise.c: Likewise.
* sysdeps/posix/signal.c: Add alias ssignal.
* sysdeps/stub/signal.c: Likewise.
* signal/signal.h: Declare bsd_signal. Define signal as bsd_signal
if __FAVOR_BSD.
* sysdeps/posix/bsd_signal.c: New file. Implementation of XPG
function.
* sysdeps/unix/sysv/linux/signal.c: Add explanation.
* socket/sys/un.h: Define SUN_LEN according to POSIX.1g.
* stdio-common/Makefile (tests): Add scanf10.
* stdio-common/scanf10.c: New file.
* stdio-common/vfscanf.c: Decrement counter if EOF is read while
reading string.
* sysdeps/libm-i387/e_acos.S: Use END, not PSEUDO_END.
* sysdeps/libm-i387/e_acosl.S: Likewise.
* sysdeps/libm-i387/e_asin.S: Likewise.
* sysdeps/libm-i387/e_asinl.S: Likewise.
* sysdeps/libm-i387/e_atan2.S: Likewise.
* sysdeps/libm-i387/e_atan2f.S: Likewise.
* sysdeps/libm-i387/e_atan2l.S: Likewise.
* sysdeps/libm-i387/e_exp.S: Likewise.
* sysdeps/libm-i387/e_expl.S: Likewise.
* sysdeps/libm-i387/e_fmod.S: Likewise.
* sysdeps/libm-i387/e_fmodl.S: Likewise.
* sysdeps/libm-i387/e_log.S: Likewise.
* sysdeps/libm-i387/e_log10.S: Likewise.
* sysdeps/libm-i387/e_log10l.S: Likewise.
* sysdeps/libm-i387/e_logl.S: Likewise.
* sysdeps/libm-i387/e_remainder.S: Likewise.
* sysdeps/libm-i387/e_remainderf.S: Likewise.
* sysdeps/libm-i387/e_remainderl.S: Likewise.
* sysdeps/libm-i387/e_scalb.S: Likewise.
* sysdeps/libm-i387/e_scalbl.S: Likewise.
* sysdeps/libm-i387/e_sqrt.S: Likewise.
* sysdeps/libm-i387/e_sqrtf.S: Likewise.
* sysdeps/libm-i387/e_sqrtl.S: Likewise.
* sysdeps/libm-i387/s_atan.S: Likewise.
* sysdeps/libm-i387/s_atanf.S: Likewise.
* sysdeps/libm-i387/s_atanl.S: Likewise.
* sysdeps/libm-i387/s_ceil.S: Likewise.
* sysdeps/libm-i387/s_ceilf.S: Likewise.
* sysdeps/libm-i387/s_ceill.S: Likewise.
* sysdeps/libm-i387/s_copysign.S: Likewise.
* sysdeps/libm-i387/s_copysignf.S: Likewise.
* sysdeps/libm-i387/s_copysignl.S: Likewise.
* sysdeps/libm-i387/s_cos.S: Likewise.
* sysdeps/libm-i387/s_cosf.S: Likewise.
* sysdeps/libm-i387/s_cosl.S: Likewise.
* sysdeps/libm-i387/s_finite.S: Likewise.
* sysdeps/libm-i387/s_finitef.S: Likewise.
* sysdeps/libm-i387/s_finitel.S: Likewise.
* sysdeps/libm-i387/s_floor.S: Likewise.
* sysdeps/libm-i387/s_floorf.S: Likewise.
* sysdeps/libm-i387/s_floorl.S: Likewise.
* sysdeps/libm-i387/s_ilogb.S: Likewise.
* sysdeps/libm-i387/s_ilogbf.S: Likewise.
* sysdeps/libm-i387/s_ilogbl.S: Likewise.
* sysdeps/libm-i387/s_log1p.S: Likewise.
* sysdeps/libm-i387/s_log1pf.S: Likewise.
* sysdeps/libm-i387/s_log1pl.S: Likewise.
* sysdeps/libm-i387/s_logb.S: Likewise.
* sysdeps/libm-i387/s_logbf.S: Likewise.
* sysdeps/libm-i387/s_logbl.S: Likewise.
* sysdeps/libm-i387/s_rint.S: Likewise.
* sysdeps/libm-i387/s_rintf.S: Likewise.
* sysdeps/libm-i387/s_rintl.S: Likewise.
* sysdeps/libm-i387/s_scalbn.S: Likewise.
* sysdeps/libm-i387/s_scalbnf.S: Likewise.
* sysdeps/libm-i387/s_scalbnl.S: Likewise.
* sysdeps/libm-i387/s_significand.S: Likewise.
* sysdeps/libm-i387/s_significandf.S: Likewise.
* sysdeps/libm-i387/s_significandl.S: Likewise.
* sysdeps/libm-i387/s_sin.S: Likewise.
* sysdeps/libm-i387/s_sinf.S: Likewise.
* sysdeps/libm-i387/s_sinl.S: Likewise.
* sysdeps/libm-i387/e_log.S: Use fyl2xp1 instruction for values
near 1 to increase precision.
* sysdeps/libm-i387/e_log10.S: Likewise.
* sysdeps/libm-i387/e_log10l.S: Likewise.
* sysdeps/libm-i387/e_logl.S: Likewise.
* sysdeps/libm-i387/s_cos.S: Use testl instead of andw.
* sysdeps/libm-i387/s_cosl.S: Likewise.
* sysdeps/libm-i387/s_sin.S: Likewise.
* sysdeps/libm-i387/s_sinl.S: Likewise.
* sysdeps/libm-i387/s_tan.S: Likewise.
* sysdeps/libm-i387/s_tanl.S: Likewise.
* sysdeps/libm-i387/e_acosf.S: New file. Add float versions.
* sysdeps/libm-i387/e_asinf.S: Likewise.
* sysdeps/libm-i387/e_expf.S: Likewise.
* sysdeps/libm-i387/e_fmodf.S: Likewise.
* sysdeps/libm-i387/e_log10f.S: Likewise.
* sysdeps/libm-i387/e_logf.S: Likewise.
* sysdeps/libm-i387/e_scalbf.S: Likewise.
* sysdeps/libm-i387/e_acosh.S: New file. Highly optimized versions.
* sysdeps/libm-i387/e_acoshf.S: Likewise.
* sysdeps/libm-i387/e_acoshl.S: Likewise.
* sysdeps/libm-i387/e_atanh.S: Likewise.
* sysdeps/libm-i387/e_atanhf.S: Likewise.
* sysdeps/libm-i387/e_atanhl.S: Likewise.
* sysdeps/libm-i387/e_asinh.S: Likewise.
* sysdeps/libm-i387/e_asinhf.S: Likewise.
* sysdeps/libm-i387/e_asinhl.S: Likewise.
* sysdeps/libm-ieee754/s_asinhf.c: Tweak a bit. Use lower levels
for simplified handling.
* sysdeps/unix/sysv/linux/syscalls.list: Add query_module.
Sun Dec 22 01:39:29 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* inet/rcmd.c (rcmd): Set h_errno before calling herror.
* inet/rexec.c (rexec): Likewise.
Sat Dec 21 21:47:08 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/unix/sysv/linux/m68k/setjmp.c (__setjmp): Make it really
compatible.
Sun Dec 22 03:23:33 1996 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/libm-i387/s_log1p.S: Use fyl2xp1 for numbers in range
-0.29 <= x <= 0.29, otherwise the old method.
* sysdeps/libm-i387/s_log1pf.S: Likewise.
* sysdeps/libm-i387/s_log1pl.S: Likewise.
113 files changed, 2188 insertions, 350 deletions
@@ -1,3 +1,164 @@ +Mon Dec 30 01:32:59 1996 Ulrich Drepper <drepper@cygnus.com> + + * tme/localtime.c: Rewrite so that localtime_r does not call tzset, + but localtime does. + + * features.h: Rename ANSI C to ISO C. + Mention __GLIBC__ and __GLIBC_MINOR__ macros. + + * gnu-versions.h: Add _GNU_GETOPT_INTERFACE_VERSION. + * posix/getopt.c: Use _GNU_GETOPT_INTERFACE_VERSION to check + whether we can elide the code. + * posix/getopt1.c: Likewise. + * posix/Makefile: Correct copyright. + + * elf/dl-error.c (_dl_catch_error): Clear `catch' also when error + occurred. + * elf/dl-support.c (_dl_sysdep_open_zero_fill): Don't define if + MAP_ANON is defined. + * elf/eval.c: Use __getline instead of getline. + * elf/rtld.c (dl_main): Check return value of _dl_new_object + function for NULL. + * sysdeps/generic/dl-cache.c: Update copyright. + + * signal/Makefile: Correct copyright. + (routines): Remove gsignal and ssignal. Add bsd_signal. + * signal/gsignal.c: Removed. Now is made an alias. + * signal/ssignal.c: Likewise. + * sysdeps/posix/raise.c: Add alias gsignal. + * sysdeps/stub/raise.c: Likewise. + * sysdeps/posix/signal.c: Add alias ssignal. + * sysdeps/stub/signal.c: Likewise. + * signal/signal.h: Declare bsd_signal. Define signal as bsd_signal + if __FAVOR_BSD. + * sysdeps/posix/bsd_signal.c: New file. Implementation of XPG + function. + + * sysdeps/unix/sysv/linux/signal.c: Add explanation. + + * socket/sys/un.h: Define SUN_LEN according to POSIX.1g. + + * stdio-common/Makefile (tests): Add scanf10. + * stdio-common/scanf10.c: New file. + * stdio-common/vfscanf.c: Decrement counter if EOF is read while + reading string. + + * sysdeps/libm-i387/e_acos.S: Use END, not PSEUDO_END. + * sysdeps/libm-i387/e_acosl.S: Likewise. + * sysdeps/libm-i387/e_asin.S: Likewise. + * sysdeps/libm-i387/e_asinl.S: Likewise. + * sysdeps/libm-i387/e_atan2.S: Likewise. + * sysdeps/libm-i387/e_atan2f.S: Likewise. + * sysdeps/libm-i387/e_atan2l.S: Likewise. + * sysdeps/libm-i387/e_exp.S: Likewise. + * sysdeps/libm-i387/e_expl.S: Likewise. + * sysdeps/libm-i387/e_fmod.S: Likewise. + * sysdeps/libm-i387/e_fmodl.S: Likewise. + * sysdeps/libm-i387/e_log.S: Likewise. + * sysdeps/libm-i387/e_log10.S: Likewise. + * sysdeps/libm-i387/e_log10l.S: Likewise. + * sysdeps/libm-i387/e_logl.S: Likewise. + * sysdeps/libm-i387/e_remainder.S: Likewise. + * sysdeps/libm-i387/e_remainderf.S: Likewise. + * sysdeps/libm-i387/e_remainderl.S: Likewise. + * sysdeps/libm-i387/e_scalb.S: Likewise. + * sysdeps/libm-i387/e_scalbl.S: Likewise. + * sysdeps/libm-i387/e_sqrt.S: Likewise. + * sysdeps/libm-i387/e_sqrtf.S: Likewise. + * sysdeps/libm-i387/e_sqrtl.S: Likewise. + * sysdeps/libm-i387/s_atan.S: Likewise. + * sysdeps/libm-i387/s_atanf.S: Likewise. + * sysdeps/libm-i387/s_atanl.S: Likewise. + * sysdeps/libm-i387/s_ceil.S: Likewise. + * sysdeps/libm-i387/s_ceilf.S: Likewise. + * sysdeps/libm-i387/s_ceill.S: Likewise. + * sysdeps/libm-i387/s_copysign.S: Likewise. + * sysdeps/libm-i387/s_copysignf.S: Likewise. + * sysdeps/libm-i387/s_copysignl.S: Likewise. + * sysdeps/libm-i387/s_cos.S: Likewise. + * sysdeps/libm-i387/s_cosf.S: Likewise. + * sysdeps/libm-i387/s_cosl.S: Likewise. + * sysdeps/libm-i387/s_finite.S: Likewise. + * sysdeps/libm-i387/s_finitef.S: Likewise. + * sysdeps/libm-i387/s_finitel.S: Likewise. + * sysdeps/libm-i387/s_floor.S: Likewise. + * sysdeps/libm-i387/s_floorf.S: Likewise. + * sysdeps/libm-i387/s_floorl.S: Likewise. + * sysdeps/libm-i387/s_ilogb.S: Likewise. + * sysdeps/libm-i387/s_ilogbf.S: Likewise. + * sysdeps/libm-i387/s_ilogbl.S: Likewise. + * sysdeps/libm-i387/s_log1p.S: Likewise. + * sysdeps/libm-i387/s_log1pf.S: Likewise. + * sysdeps/libm-i387/s_log1pl.S: Likewise. + * sysdeps/libm-i387/s_logb.S: Likewise. + * sysdeps/libm-i387/s_logbf.S: Likewise. + * sysdeps/libm-i387/s_logbl.S: Likewise. + * sysdeps/libm-i387/s_rint.S: Likewise. + * sysdeps/libm-i387/s_rintf.S: Likewise. + * sysdeps/libm-i387/s_rintl.S: Likewise. + * sysdeps/libm-i387/s_scalbn.S: Likewise. + * sysdeps/libm-i387/s_scalbnf.S: Likewise. + * sysdeps/libm-i387/s_scalbnl.S: Likewise. + * sysdeps/libm-i387/s_significand.S: Likewise. + * sysdeps/libm-i387/s_significandf.S: Likewise. + * sysdeps/libm-i387/s_significandl.S: Likewise. + * sysdeps/libm-i387/s_sin.S: Likewise. + * sysdeps/libm-i387/s_sinf.S: Likewise. + * sysdeps/libm-i387/s_sinl.S: Likewise. + + * sysdeps/libm-i387/e_log.S: Use fyl2xp1 instruction for values + near 1 to increase precision. + * sysdeps/libm-i387/e_log10.S: Likewise. + * sysdeps/libm-i387/e_log10l.S: Likewise. + * sysdeps/libm-i387/e_logl.S: Likewise. + + * sysdeps/libm-i387/s_cos.S: Use testl instead of andw. + * sysdeps/libm-i387/s_cosl.S: Likewise. + * sysdeps/libm-i387/s_sin.S: Likewise. + * sysdeps/libm-i387/s_sinl.S: Likewise. + * sysdeps/libm-i387/s_tan.S: Likewise. + * sysdeps/libm-i387/s_tanl.S: Likewise. + + * sysdeps/libm-i387/e_acosf.S: New file. Add float versions. + * sysdeps/libm-i387/e_asinf.S: Likewise. + * sysdeps/libm-i387/e_expf.S: Likewise. + * sysdeps/libm-i387/e_fmodf.S: Likewise. + * sysdeps/libm-i387/e_log10f.S: Likewise. + * sysdeps/libm-i387/e_logf.S: Likewise. + * sysdeps/libm-i387/e_scalbf.S: Likewise. + + * sysdeps/libm-i387/e_acosh.S: New file. Highly optimized versions. + * sysdeps/libm-i387/e_acoshf.S: Likewise. + * sysdeps/libm-i387/e_acoshl.S: Likewise. + * sysdeps/libm-i387/e_atanh.S: Likewise. + * sysdeps/libm-i387/e_atanhf.S: Likewise. + * sysdeps/libm-i387/e_atanhl.S: Likewise. + * sysdeps/libm-i387/e_asinh.S: Likewise. + * sysdeps/libm-i387/e_asinhf.S: Likewise. + * sysdeps/libm-i387/e_asinhl.S: Likewise. + + * sysdeps/libm-ieee754/s_asinhf.c: Tweak a bit. Use lower levels + for simplified handling. + + * sysdeps/unix/sysv/linux/syscalls.list: Add query_module. + +Sun Dec 22 01:39:29 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * inet/rcmd.c (rcmd): Set h_errno before calling herror. + * inet/rexec.c (rexec): Likewise. + +Sat Dec 21 21:47:08 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * sysdeps/unix/sysv/linux/m68k/setjmp.c (__setjmp): Make it really + compatible. + +Sun Dec 22 03:23:33 1996 Ulrich Drepper <drepper@cygnus.com> + + * sysdeps/libm-i387/s_log1p.S: Use fyl2xp1 for numbers in range + -0.29 <= x <= 0.29, otherwise the old method. + * sysdeps/libm-i387/s_log1pf.S: Likewise. + * sysdeps/libm-i387/s_log1pl.S: Likewise. + Sun Dec 22 00:01:27 1996 Ulrich Drepper <drepper@cygnus.com> * inet/getnetgrent.c: Reformat copyright. diff --git a/elf/dl-error.c b/elf/dl-error.c index e0a7347..55d9c2f 100644 --- a/elf/dl-error.c +++ b/elf/dl-error.c @@ -90,6 +90,7 @@ _dl_catch_error (char **errstring, } /* We get here only if we longjmp'd out of OPERATE. */ + catch = NULL; *errstring = c.errstring; *objname = c.objname; return errcode == -1 ? 0 : errcode; diff --git a/elf/dl-support.c b/elf/dl-support.c index 35710a0..593f967 100644 --- a/elf/dl-support.c +++ b/elf/dl-support.c @@ -33,6 +33,7 @@ char **_dl_argv = &__progname; /* This is checked for some error messages. */ For the dynamic linker it is set by -rpath when linking. */ const char *_dl_rpath = DEFAULT_RPATH; +#ifndef MAP_ANON /* This is the only dl-sysdep.c function that is actually needed at run-time by _dl_map_object. */ @@ -41,6 +42,7 @@ _dl_sysdep_open_zero_fill (void) { return __open ("/dev/zero", O_RDONLY); } +#endif /* This should never be called. */ void @@ -128,7 +128,7 @@ _start (void) char *buf = NULL; size_t bufsz = 0; - while (getline (&buf, &bufsz, stdin) > 0) + while (__getline (&buf, &bufsz, stdin) > 0) { char *p = buf; eval (&p); @@ -236,6 +236,8 @@ of this helper program; chances are you did not intend to run this program.\n", /* Create a link_map for the executable itself. This will be what dlopen on "" returns. */ l = _dl_new_object ((char *) "", "", lt_executable); + if (l == NULL) + _dl_sysdep_fatal ("cannot allocate memory for link map", NULL); l->l_phdr = phdr; l->l_phnum = phent; l->l_entry = *user_entry; @@ -23,14 +23,14 @@ /* These are defined by the user (or the compiler) to specify the desired environment: - __STRICT_ANSI__ ANSI Standard C. + __STRICT_ANSI__ ISO Standard C. _POSIX_SOURCE IEEE Std 1003.1. _POSIX_C_SOURCE If ==1, like _POSIX_SOURCE; if >=2 add IEEE Std 1003.2; if >=199309L, add IEEE Std 1003.1b-1993 _XOPEN_SOURCE Includes POSIX and XPG things. _XOPEN_SOURCE_EXTENDED XPG things and X/Open Unix extensions. - _BSD_SOURCE ANSI, POSIX, and 4.3BSD things. - _SVID_SOURCE ANSI, POSIX, and SVID things. + _BSD_SOURCE ISO C, POSIX, and 4.3BSD things. + _SVID_SOURCE ISO C, POSIX, and SVID things. _GNU_SOURCE All of the above, plus GNU extensions. _REENTRANT Select additionally reentrant object. _THREAD_SAFE Same as _REENTRANT, often used by other systems. @@ -39,7 +39,7 @@ If none of these are defined, the default is all but _GNU_SOURCE. If more than one of these are defined, they accumulate. For example __STRICT_ANSI__, _POSIX_SOURCE and _POSIX_C_SOURCE - together give you ANSI C, 1003.1, and 1003.2, but nothing else. + together give you ISO C, 1003.1, and 1003.2, but nothing else. These are defined by this file and are used by the header files to decide what to declare or define: @@ -56,7 +56,10 @@ __USE_REENTRANT Define reentrant/thread-safe *_r functions. __FAVOR_BSD Favor 4.3BSD things in cases of conflict. - The macro `__GNU_LIBRARY__' is defined by this file unconditionally. + The macros `__GNU_LIBRARY__', `__GLIBC__', and `__GLIBC_MINOR__' are + defined by this file unconditionally. `__GNU_LIBRARY__' is provided + only for compatibility. All new code should use the other symbols + to test for features. All macros listed above as possibly being defined by this file are explicitly undefined if they are not explicitly defined. @@ -85,15 +88,15 @@ # define __KERNEL_STRICT_NAMES #endif -/* Always use ANSI things. */ +/* Always use ISO C things. */ #define __USE_ANSI 1 /* If _BSD_SOURCE was defined by the user, favor BSD over POSIX. */ -#if defined (_BSD_SOURCE) && \ - !(defined (_POSIX_SOURCE) || defined (_POSIX_C_SOURCE) || \ - defined (_XOPEN_SOURCE) || defined (_XOPEN_SOURCE_DEFINED) || \ - defined (_GNU_SOURCE) || defined (_SVID_SOURCE)) +#if defined _BSD_SOURCE && \ + !(defined _POSIX_SOURCE || defined _POSIX_C_SOURCE || \ + defined _XOPEN_SOURCE || defined _XOPEN_SOURCE_DEFINED || \ + defined _GNU_SOURCE || defined _SVID_SOURCE) # define __FAVOR_BSD 1 #endif @@ -115,37 +118,35 @@ /* If nothing (other than _GNU_SOURCE) is defined, define _BSD_SOURCE and _SVID_SOURCE. */ -#if (!defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE) && \ - !defined (_POSIX_C_SOURCE) && !defined (_XOPEN_SOURCE) && \ - !defined (_XOPEN_SOURCE_EXTENDED) && !defined (_BSD_SOURCE) && \ - !defined (_SVID_SOURCE)) +#if (!defined __STRICT_ANSI__ && !defined _POSIX_SOURCE && \ + !defined _POSIX_C_SOURCE && !defined _XOPEN_SOURCE && \ + !defined _XOPEN_SOURCE_EXTENDED && !defined _BSD_SOURCE && \ + !defined _SVID_SOURCE) #define _BSD_SOURCE 1 #define _SVID_SOURCE 1 #endif /* If none of the ANSI/POSIX macros are defined, use POSIX.1 and POSIX.2 (and IEEE Std 1003.1b-1993 unless _XOPEN_SOURCE is defined). */ -#if (!defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE) && \ - !defined (_POSIX_C_SOURCE)) +#if (!defined __STRICT_ANSI__ && !defined _POSIX_SOURCE && \ + !defined _POSIX_C_SOURCE) #define _POSIX_SOURCE 1 -#if defined(_XOPEN_SOURCE) +#ifdef _XOPEN_SOURCE #define _POSIX_C_SOURCE 2 #else #define _POSIX_C_SOURCE 199309L #endif #endif -#if (defined (_POSIX_SOURCE) || _POSIX_C_SOURCE >= 1 || \ - defined (_XOPEN_SOURCE)) +#if defined _POSIX_SOURCE || _POSIX_C_SOURCE >= 1 || defined _XOPEN_SOURCE #define __USE_POSIX 1 #endif -#if (defined (_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 2 || \ - defined (_XOPEN_SOURCE)) +#if defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 2 || defined _XOPEN_SOURCE #define __USE_POSIX2 1 #endif -#if (defined (_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309L) +#if defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 199309L #define __USE_POSIX199309 1 #endif @@ -156,7 +157,7 @@ #endif #endif -#if defined (_BSD_SOURCE) || defined (_SVID_SOURCE) +#if defined _BSD_SOURCE || defined _SVID_SOURCE #define __USE_MISC 1 #endif @@ -172,7 +173,7 @@ #define __USE_GNU 1 #endif -#if defined (_REENTRANT) || defined (_THREAD_SAFE) +#if defined _REENTRANT || defined _THREAD_SAFE #define __USE_REENTRANT 1 #endif @@ -192,7 +193,7 @@ #define __GLIBC_MINOR__ 0 -#if !defined (__GNUC__) || __GNUC__ < 2 +#if !defined __GNUC__ || __GNUC__ < 2 /* In GCC version 2, (__extension__ EXPR) will not complain about GCC extensions used in EXPR under -ansi or -pedantic. */ #define __extension__ diff --git a/gnu-versions.h b/gnu-versions.h index 15b0799..68545bd 100644 --- a/gnu-versions.h +++ b/gnu-versions.h @@ -47,5 +47,7 @@ #define _GNU_OBSTACK_INTERFACE_VERSION 1 /* vs malloc/obstack.c */ #define _GNU_REGEX_INTERFACE_VERSION 1 /* vs posix/regex.c */ #define _GNU_GLOB_INTERFACE_VERSION 1 /* vs posix/glob.c */ +#define _GNU_GETOPT_INTERFACE_VERSION 1 /* vs posix/getopt.c and + posix/getopt1.c */ #endif /* gnu-versions.h */ diff --git a/inet/rcmd.c b/inet/rcmd.c index c9c3a2f..f13a2e6 100644 --- a/inet/rcmd.c +++ b/inet/rcmd.c @@ -83,6 +83,7 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p) &hp, &herr) < 0) if (herr != NETDB_INTERNAL || errno != ERANGE) { + __set_h_errno (herr); herror(*ahost); return -1; } @@ -322,7 +323,7 @@ again: char *pbuf; size_t dirlen; size_t buflen = __sysconf (_SC_GETPW_R_SIZE_MAX); - char buffer = __alloca (buflen); + char *buffer = __alloca (buflen); first = 0; if (getpwnam_r (luser, &pwdbuf, buffer, buflen, &pwd) < 0) diff --git a/inet/rexec.c b/inet/rexec.c index d91949d..611ff57 100644 --- a/inet/rexec.c +++ b/inet/rexec.c @@ -71,6 +71,7 @@ rexec(ahost, rport, name, pass, cmd, fd2p) &hp, &herr) < 0) if (herr != NETDB_INTERNAL || errno != ERANGE) { + __set_h_errno (herr); herror(*ahost); return -1; } diff --git a/libio/iovsprintf.c b/libio/iovsprintf.c index 11904e3..099863c 100644 --- a/libio/iovsprintf.c +++ b/libio/iovsprintf.c @@ -43,7 +43,6 @@ _IO_vsprintf (string, format, args) _IO_init (&sf._sbf._f, 0); _IO_JUMPS (&sf._sbf._f) = &_IO_str_jumps; _IO_str_init_static (&sf._sbf._f, string, -1, string); - _IO_str_init_static ((_IO_FILE *) &sf, string, -1, string); _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, &sf); _IO_flockfile (&sf._sbf._f); ret = _IO_vfprintf (&sf._sbf._f, format, args); diff --git a/posix/Makefile b/posix/Makefile index fcf7cba..1a2f6ae 100644 --- a/posix/Makefile +++ b/posix/Makefile @@ -12,9 +12,9 @@ # Library General Public License for more details. # You should have received a copy of the GNU Library General Public -# License along with the GNU C Library; see the file COPYING.LIB. If -# not, write to the Free Software Foundation, Inc., 675 Mass Ave, -# Cambridge, MA 02139, USA. +# License along with the GNU C Library; see the file COPYING.LIB. If not, +# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. # # Sub-makefile for POSIX portion of the library. diff --git a/posix/getopt.c b/posix/getopt.c index 01adee0..a5fb992 100644 --- a/posix/getopt.c +++ b/posix/getopt.c @@ -52,7 +52,15 @@ program understand `configure --with-gnu-libc' and omit the object files, it is simpler to just do this in the source for each such file. */ -#if defined (_LIBC) || !defined (__GNU_LIBRARY__) +#define GETOPT_INTERFACE_VERSION 1 +#if !defined (_LIBC) && defined (__GLIBC__) && __GLIBC__ >= 2 +#include <gnu-versions.h> +#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION +#define ELIDE_CODE +#endif +#endif + +#ifndef ELIDE_CODE /* This needs to come after some library #include @@ -124,8 +132,14 @@ char *optarg = NULL; Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ -/* XXX 1003.2 says this must be 1 before any call. */ -int optind = 0; +/* 1003.2 says this must be 1 before any call. */ +int optind = 1; + +/* Formerly, initialization of getopt depended on optind==0, which + causes problems with re-calling getopt as programs generally don't + know that. */ + +int __getopt_initialized = 0; /* The next char to be scanned in the option-element in which the last option character we returned was found. @@ -431,10 +445,11 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) { optarg = NULL; - if (optind == 0) + if (!__getopt_initialized) { optstring = _getopt_initialize (optstring); optind = 1; /* Don't scan ARGV[0], the program name. */ + __getopt_initialized = 1; } /* Test whether ARGV[optind] points to a non-option argument. @@ -500,6 +515,11 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) that we previously skipped, so the caller will digest them. */ if (first_nonopt != last_nonopt) optind = first_nonopt; + + /* Before we can be provide the next result we must be + reinitialized. */ + __getopt_initialized = 0; + return EOF; } @@ -509,7 +529,12 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) if (NONOPTION_P) { if (ordering == REQUIRE_ORDER) - return EOF; + { + /* Before we can be provide the next result we must be + reinitialized. */ + __getopt_initialized = 0; + return EOF; + } optarg = argv[optind++]; return 1; } @@ -880,7 +905,7 @@ getopt (argc, argv, optstring) 0); } -#endif /* _LIBC or not __GNU_LIBRARY__. */ +#endif /* Not ELIDE_CODE. */ #ifdef TEST diff --git a/posix/getopt1.c b/posix/getopt1.c index de8e2ad..358935d 100644 --- a/posix/getopt1.c +++ b/posix/getopt1.c @@ -1,24 +1,24 @@ /* getopt_long and getopt_long_only entry points for GNU getopt. - Copyright (C) 1987, 88, 89, 90, 91, 92, 1993, 1994 + Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. Its master source is NOT part of -the C library, however. The master source lives in /gd/gnu/lib. + This file is part of the GNU C Library. Its master source is NOT part of + the C library, however. The master source lives in /gd/gnu/lib. -The GNU C Library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. -The GNU C Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H #include <config.h> @@ -44,15 +44,21 @@ Cambridge, MA 02139, USA. */ program understand `configure --with-gnu-libc' and omit the object files, it is simpler to just do this in the source for each such file. */ -#if defined (_LIBC) || !defined (__GNU_LIBRARY__) +#define GETOPT_INTERFACE_VERSION 1 +#if !defined (_LIBC) && defined (__GLIBC__) && __GLIBC__ >= 2 +#include <gnu-versions.h> +#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION +#define ELIDE_CODE +#endif +#endif + +#ifndef ELIDE_CODE /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ #include <stdlib.h> -#else -char *getenv (); #endif #ifndef NULL @@ -87,7 +93,7 @@ getopt_long_only (argc, argv, options, long_options, opt_index) } -#endif /* _LIBC or not __GNU_LIBRARY__. */ +#endif /* Not ELIDE_CODE. */ #ifdef TEST diff --git a/signal/Makefile b/signal/Makefile index d333738..eac9576 100644 --- a/signal/Makefile +++ b/signal/Makefile @@ -12,9 +12,9 @@ # Library General Public License for more details. # You should have received a copy of the GNU Library General Public -# License along with the GNU C Library; see the file COPYING.LIB. If -# not, write to the Free Software Foundation, Inc., 675 Mass Ave, -# Cambridge, MA 02139, USA. +# License along with the GNU C Library; see the file COPYING.LIB. If not, +# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. # # Makefile for signal routines. @@ -30,7 +30,7 @@ routines := signal raise killpg \ sigstack sigaltstack sigintr \ sigsetops sigempty sigfillset sigaddset sigdelset sigismem \ sigreturn \ - gsignal ssignal siggetmask + siggetmask bsd_signal tests := tst-signal diff --git a/signal/gsignal.c b/signal/gsignal.c deleted file mode 100644 index f5b79a9..0000000 --- a/signal/gsignal.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright (C) 1991, 1995 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 -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. - -The GNU C Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - -#include <signal.h> - -#undef gsignal - -int -gsignal (sig) - int sig; -{ - return raise (sig); -} diff --git a/signal/signal.h b/signal/signal.h index 7b3c260..66ab3dd 100644 --- a/signal/signal.h +++ b/signal/signal.h @@ -22,7 +22,7 @@ #ifndef _SIGNAL_H -#if !defined(__need_sig_atomic_t) && !defined(__need_sigset_t) +#if !defined __need_sig_atomic_t && !defined __need_sigset_t #define _SIGNAL_H 1 #include <features.h> #endif @@ -32,15 +32,15 @@ __BEGIN_DECLS #include <gnu/types.h> #include <sigset.h> /* __sigset_t, __sig_atomic_t. */ -#if !defined(__sig_atomic_t_defined) && \ - (defined(_SIGNAL_H) || defined(__need_sig_atomic_t)) +#if !defined __sig_atomic_t_defined \ + && (defined _SIGNAL_H || defined __need_sig_atomic_t) /* An integral type that can be modified atomically, without the possibility of a signal arriving in the middle of the operation. */ typedef __sig_atomic_t sig_atomic_t; #endif /* `sig_atomic_t' undefined and <signal.h> or need `sig_atomic_t'. */ -#undef __need_sig_atomic_t +#undef __need_sig_atomic_t -#ifdef _SIGNAL_H +#ifdef _SIGNAL_H #include <signum.h> @@ -51,15 +51,27 @@ typedef void (*__sighandler_t) __P ((int)); returning the old handler, or SIG_ERR on error. */ extern __sighandler_t signal __P ((int __sig, __sighandler_t __handler)); +#if defined __FAVOR_BSD || defined __USE_XOPEN +/* The X/Open definition of `signal' conflicts with the BSD version. + So they defined another function `bsd_signal'. We will use this + implementation as the official `signal' function if the BSD + interface is preferred. */ +extern __sighandler_t bsd_signal __P ((int __sig, __sighandler_t __handler)); + +#ifdef __FAVOR_BSD +#define signal(sig, handler) bsd_signal ((sig), (handler)) +#endif +#endif + /* Send signal SIG to process number PID. If PID is zero, send SIG to all processes in the current process's process group. If PID is < -1, send SIG to all processes in process group - PID. */ extern int __kill __P ((__pid_t __pid, int __sig)); -#ifdef __USE_POSIX +#ifdef __USE_POSIX extern int kill __P ((__pid_t __pid, int __sig)); #endif /* Use POSIX. */ -#if defined(__USE_BSD) || defined(__USE_XOPEN_EXTENDED) +#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED /* Send SIG to all processes in process group PGRP. If PGRP is zero, send SIG to all processes in the current process's process group. */ @@ -69,13 +81,13 @@ extern int killpg __P ((__pid_t __pgrp, int __sig)); /* Raise signal SIG, i.e., send SIG to yourself. */ extern int raise __P ((int __sig)); -#ifdef __USE_SVID +#ifdef __USE_SVID /* SVID names for the same things. */ extern __sighandler_t ssignal __P ((int __sig, __sighandler_t __handler)); extern int gsignal __P ((int __sig)); #endif /* Use SVID. */ -#ifdef __USE_MISC +#ifdef __USE_MISC /* Print a message describing the meaning of the given signal number. */ extern void psignal __P ((int __sig, __const char *__s)); #endif /* Use misc. */ @@ -95,7 +107,7 @@ extern int __sigsetmask __P ((int __mask)); explitcly selects the BSD version. */ extern int __sigpause __P ((int __sig_or_mask, int __is_sig)); -#if defined(__USE_BSD) && !defined(__USE_XOPEN) +#if defined __USE_BSD && !defined __USE_XOPEN /* Set the mask of blocked signals to MASK, wait for a signal to arrive, and then restore the mask. */ #define sigpause(mask) __sigpause ((mask), 0) @@ -107,7 +119,7 @@ extern int __sigpause __P ((int __sig_or_mask, int __is_sig)); #endif -#ifdef __USE_BSD +#ifdef __USE_BSD #define sigmask(sig) __sigmask(sig) extern int sigblock __P ((int __mask)); @@ -119,32 +131,32 @@ extern int siggetmask __P ((void)); #endif /* Use BSD. */ -#ifdef __USE_MISC +#ifdef __USE_MISC #define NSIG _NSIG #endif -#ifdef __USE_GNU +#ifdef __USE_GNU typedef __sighandler_t sighandler_t; #endif /* 4.4 BSD uses the name `sig_t' for this. */ -#ifdef __USE_BSD +#ifdef __USE_BSD typedef __sighandler_t sig_t; #endif #endif /* <signal.h> included. */ -#ifdef __USE_POSIX +#ifdef __USE_POSIX -#if !defined(__sigset_t_defined) && \ - (defined(_SIGNAL_H) || defined(__need_sigset_t)) +#if !defined __sigset_t_defined \ + && (defined _SIGNAL_H || defined __need_sigset_t) typedef __sigset_t sigset_t; #define __sigset_t_defined 1 #endif /* `sigset_t' not defined and <signal.h> or need `sigset_t'. */ -#undef __need_sigset_t +#undef __need_sigset_t -#ifdef _SIGNAL_H +#ifdef _SIGNAL_H /* Clear all signals from SET. */ extern int sigemptyset __P ((sigset_t *__set)); @@ -194,7 +206,7 @@ extern int sigwait __P ((__const sigset_t *__set, int *__sig)); #endif /* Use POSIX. */ -#if defined(_SIGNAL_H) && defined(__USE_BSD) +#if defined _SIGNAL_H && defined __USE_BSD /* Names of the signals. This variable exists only for compatibility. Use `strsignal' instead (see <string.h>). */ @@ -238,7 +250,7 @@ extern int sigreturn __P ((struct sigcontext *__scp)); #endif /* signal.h included and use BSD. */ -#if defined(_SIGNAL_H) && (defined(__USE_BSD) || defined(__USE_XOPEN_EXTENDED)) +#if defined _SIGNAL_H && (defined __USE_BSD || defined __USE_XOPEN_EXTENDED) #define __need_size_t #include <stddef.h> diff --git a/signal/ssignal.c b/signal/ssignal.c deleted file mode 100644 index 54ab7f0..0000000 --- a/signal/ssignal.c +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright (C) 1991, 1992, 1995 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 -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. - -The GNU C Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - -#include <signal.h> - -#undef ssignal - -__sighandler_t -ssignal (sig, func) - int sig; - __sighandler_t func; -{ - return signal (sig, func); -} diff --git a/socket/sys/un.h b/socket/sys/un.h index d88fa47..02fc775 100644 --- a/socket/sys/un.h +++ b/socket/sys/un.h @@ -21,6 +21,8 @@ #define _SYS_UN_H 1 #include <sys/cdefs.h> +#include <string.h> /* For prototype of `strlen'. */ + /* Get the definition of the macro to define the common sockaddr members. */ #include <sockaddrcom.h> @@ -33,6 +35,11 @@ struct sockaddr_un char sun_path[108]; /* Path name. */ }; + +/* Evaluate to actual length of the `sockaddr_un' structure. */ +#define SUN_LEN(ptr) (((struct sockaddr_un *) 0)->sun_path \ + + strlen ((ptr)->sun_path)) + __END_DECLS #endif /* sys/un.h */ diff --git a/stdio-common/Makefile b/stdio-common/Makefile index 5189dd7..f4e49e6 100644 --- a/stdio-common/Makefile +++ b/stdio-common/Makefile @@ -43,7 +43,7 @@ tests := tst-printf tstscanf test_rdwr test-popen tstgetln test-fseek \ xbug errnobug \ bug1 bug2 bug3 bug4 bug5 bug6 bug7 bug8 bug9 bug10 bug11 \ tfformat tiformat tstdiomisc \ - scanf1 scanf2 scanf3 scanf4 scanf5 scanf7 scanf8 scanf9 + scanf1 scanf2 scanf3 scanf4 scanf5 scanf7 scanf8 scanf9 scanf10 include ../Rules diff --git a/stdio-common/scanf10.c b/stdio-common/scanf10.c new file mode 100644 index 0000000..f896137 --- /dev/null +++ b/stdio-common/scanf10.c @@ -0,0 +1,15 @@ +#include <stdio.h> +#include <string.h> + +int +main (int argc, char *argv[]) +{ + const char teststring[] = "<tag `word'>"; + int retc, a, b; + + retc = sscanf (teststring, "<%*s `%n%*s%n'>", &a, &b); + + printf ("retc=%d a=%d b=%d\n", retc, a, b); + + return retc == -1 && a == 6 && b == 12 ? 0 : 1; +} diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c index 7a3440c..cb6d396 100644 --- a/stdio-common/vfscanf.c +++ b/stdio-common/vfscanf.c @@ -524,7 +524,10 @@ __vfscanf (FILE *s, const char *format, va_list argptr) if (First) \ input_error (); \ else \ - break; \ + { \ + --read_in; \ + break; \ + } \ val = c; \ if (val >= 0x80) \ { \ @@ -667,6 +670,9 @@ __vfscanf (FILE *s, const char *format, va_list argptr) STRING_ADD_CHAR (str, c, char); } while ((width <= 0 || --width > 0) && inchar () != EOF); + if (c == EOF) + --read_in; + if (!(flags & SUPPRESS)) { *str = '\0'; diff --git a/sysdeps/generic/dl-cache.c b/sysdeps/generic/dl-cache.c index 6cd454c..ac4ee5e 100644 --- a/sysdeps/generic/dl-cache.c +++ b/sysdeps/generic/dl-cache.c @@ -1,21 +1,21 @@ /* Support for reading /etc/ld.so.cache files written by Linux ldconfig. -Copyright (C) 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. + Copyright (C) 1996 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 -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. -The GNU C Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ #include <link.h> #include <stddef.h> diff --git a/sysdeps/libm-i387/e_acos.S b/sysdeps/libm-i387/e_acos.S index c9fa810..becae36 100644 --- a/sysdeps/libm-i387/e_acos.S +++ b/sysdeps/libm-i387/e_acos.S @@ -18,4 +18,4 @@ ENTRY(__ieee754_acos) fxch %st(1) fpatan ret -PSEUDO_END (__ieee754_acos) +END (__ieee754_acos) diff --git a/sysdeps/libm-i387/e_acosf.S b/sysdeps/libm-i387/e_acosf.S new file mode 100644 index 0000000..87ee2fb --- /dev/null +++ b/sysdeps/libm-i387/e_acosf.S @@ -0,0 +1,22 @@ +/* + * Written by J.T. Conklin <jtc@netbsd.org>. + * Public domain. + * Adapted for float type by Ulrich Drepper <drepper@cygnus.com>. + */ + +#include <machine/asm.h> + +RCSID("$NetBSD: $") + +/* acos = atan (sqrt(1 - x^2) / x) */ +ENTRY(__ieee754_acosf) + flds 4(%esp) /* x */ + fst %st(1) + fmul %st(0) /* x^2 */ + fld1 + fsubp /* 1 - x^2 */ + fsqrt /* sqrt (1 - x^2) */ + fxch %st(1) + fpatan + ret +END (__ieee754_acosf) diff --git a/sysdeps/libm-i387/e_acosh.S b/sysdeps/libm-i387/e_acosh.S new file mode 100644 index 0000000..a3397b3 --- /dev/null +++ b/sysdeps/libm-i387/e_acosh.S @@ -0,0 +1,105 @@ +/* ix87 specific implementation of arcsinh. + Copyright (C) 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <machine/asm.h> + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__ieee754_acosh) + movl 8(%esp), %ecx + cmpl $0x3ff00000, %ecx + jl 5f // < 1 => invalid + fldln2 // log(2) + fldl 4(%esp) // x : log(2) + cmpl $0x41b00000, %ecx + ja 3f // x > 2^28 +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + cmpl $0x40000000, %ecx + ja 4f // x > 2 + + // 1 <= x <= 2 => y = log1p(x-1+sqrt(2*(x-1)+(x-1)^2)) + fsubl MO(one) // x-1 : log(2) + fld %st // x-1 : x-1 : log(2) + fmul %st(1) // (x-1)^2 : x-1 : log(2) + fadd %st(1) // x-1+(x-1)^2 : x-1 : log(2) + fadd %st(1) // 2*(x-1)+(x-1)^2 : x-1 : log(2) + fsqrt // sqrt(2*(x-1)+(x-1)^2) : x-1 : log(2) + faddp // x-1+sqrt(2*(x-1)+(x-1)^2) : log(2) + fcoml MO(limit) + fnstsw + sahf + ja 2f + fyl2xp1 // log1p(x-1+sqrt(2*(x-1)+(x-1)^2)) + ret + +2: faddl MO(one) // x+sqrt(2*(x-1)+(x-1)^2) : log(2) + fyl2x // log(x+sqrt(2*(x-1)+(x-1)^2)) + ret + + // x > 2^28 => y = log(x) + log(2) + .align ALIGNARG(4) +3: fyl2x // log(x) + fldln2 // log(2) : log(x) + faddp // log(x)+log(2) + ret + + // 2^28 > x > 2 => y = log(2*x - 1/(x+sqrt(x*x-1))) + .align ALIGNARG(4) +4: fld %st // x : x : log(2) + fadd %st, %st(1) // x : 2*x : log(2) + fld %st // x : x : 2*x : log(2) + fmul %st(1) // x^2 : x : 2*x : log(2) + fsubl MO(one) // x^2-1 : x : 2*x : log(2) + fsqrt // sqrt(x^2-1) : x : 2*x : log(2) + faddp // x+sqrt(x^2-1) : 2*x : log(2) + fdivrl MO(one) // 1/(x+sqrt(x^2-1)) : 2*x : log(2) + fsubrp // 2*x+1/(x+sqrt(x^2)-1) : log(2) + fyl2x // log(2*x+1/(x+sqrt(x^2-1))) + ret + + // x < 1 => NaN + .align ALIGNARG(4) +5: fldz + fdiv %st, %st(0) + ret +END(__ieee754_acosh) diff --git a/sysdeps/libm-i387/e_acoshf.S b/sysdeps/libm-i387/e_acoshf.S new file mode 100644 index 0000000..a4f50ba --- /dev/null +++ b/sysdeps/libm-i387/e_acoshf.S @@ -0,0 +1,105 @@ +/* ix87 specific implementation of arcsinh. + Copyright (C) 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <machine/asm.h> + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__ieee754_acoshf) + movl 8(%esp), %ecx + cmpl $0x3f800000, %ecx + jl 5f // < 1 => invalid + fldln2 // log(2) + flds 4(%esp) // x : log(2) + cmpl $0x47000000, %ecx + ja 3f // x > 2^14 +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + cmpl $0x40000000, %ecx + ja 4f // x > 2 + + // 1 <= x <= 2 => y = log1p(x-1+sqrt(2*(x-1)+(x-1)^2)) + fsubl MO(one) // x-1 : log(2) + fld %st // x-1 : x-1 : log(2) + fmul %st(1) // (x-1)^2 : x-1 : log(2) + fadd %st(1) // x-1+(x-1)^2 : x-1 : log(2) + fadd %st(1) // 2*(x-1)+(x-1)^2 : x-1 : log(2) + fsqrt // sqrt(2*(x-1)+(x-1)^2) : x-1 : log(2) + faddp // x-1+sqrt(2*(x-1)+(x-1)^2) : log(2) + fcoml MO(limit) + fnstsw + sahf + ja 2f + fyl2xp1 // log1p(x-1+sqrt(2*(x-1)+(x-1)^2)) + ret + +2: faddl MO(one) // x+sqrt(2*(x-1)+(x-1)^2) : log(2) + fyl2x // log(x+sqrt(2*(x-1)+(x-1)^2)) + ret + + // x > 2^14 => y = log(x) + log(2) + .align ALIGNARG(4) +3: fyl2x // log(x) + fldln2 // log(2) : log(x) + faddp // log(x)+log(2) + ret + + // 2^28 > x > 2 => y = log(2*x - 1/(x+sqrt(x*x-1))) + .align ALIGNARG(4) +4: fld %st // x : x : log(2) + fadd %st, %st(1) // x : 2*x : log(2) + fld %st // x : x : 2*x : log(2) + fmul %st(1) // x^2 : x : 2*x : log(2) + fsubl MO(one) // x^2-1 : x : 2*x : log(2) + fsqrt // sqrt(x^2-1) : x : 2*x : log(2) + faddp // x+sqrt(x^2-1) : 2*x : log(2) + fdivrl MO(one) // 1/(x+sqrt(x^2-1)) : 2*x : log(2) + fsubrp // 2*x+1/(x+sqrt(x^2)-1) : log(2) + fyl2x // log(2*x+1/(x+sqrt(x^2-1))) + ret + + // x < 1 => NaN + .align ALIGNARG(4) +5: fldz + fdiv %st, %st(0) + ret +END(__ieee754_acoshf) diff --git a/sysdeps/libm-i387/e_acoshl.S b/sysdeps/libm-i387/e_acoshl.S new file mode 100644 index 0000000..b0fa45c --- /dev/null +++ b/sysdeps/libm-i387/e_acoshl.S @@ -0,0 +1,111 @@ +/* ix87 specific implementation of arcsinh. + Copyright (C) 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <machine/asm.h> + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + + .align ALIGNARG(4) + /* Please note that we use double value for 1.0. This number + has an exact representation and so we don't get accuracy + problems. The advantage is that the code is simpler. */ + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + /* It is not important that this constant is precise. It is only + a value which is known to be on the safe side for using the + fyl2xp1 instruction. */ + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__ieee754_acoshl) + movl 12(%esp), %ecx + cmpl $0x3fff, %ecx + jl 5f // < 1 => invalid + fldln2 // log(2) + fldt 4(%esp) // x : log(2) + cmpl $0x4020, %ecx + ja 3f // x > 2^34 +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + cmpl $0x4000, %ecx + ja 4f // x > 2 + + // 1 <= x <= 2 => y = log1p(x-1+sqrt(2*(x-1)+(x-1)^2)) + fsubl MO(one) // x-1 : log(2) + fld %st // x-1 : x-1 : log(2) + fmul %st(1) // (x-1)^2 : x-1 : log(2) + fadd %st(1) // x-1+(x-1)^2 : x-1 : log(2) + fadd %st(1) // 2*(x-1)+(x-1)^2 : x-1 : log(2) + fsqrt // sqrt(2*(x-1)+(x-1)^2) : x-1 : log(2) + faddp // x-1+sqrt(2*(x-1)+(x-1)^2) : log(2) + fcoml MO(limit) + fnstsw + sahf + ja 2f + fyl2xp1 // log1p(x-1+sqrt(2*(x-1)+(x-1)^2)) + ret + +2: faddl MO(one) // x+sqrt(2*(x-1)+(x-1)^2) : log(2) + fyl2x // log(x+sqrt(2*(x-1)+(x-1)^2)) + ret + + // x > 2^34 => y = log(x) + log(2) + .align ALIGNARG(4) +3: fyl2x // log(x) + fldln2 // log(2) : log(x) + faddp // log(x)+log(2) + ret + + // 2^34 > x > 2 => y = log(2*x - 1/(x+sqrt(x*x-1))) + .align ALIGNARG(4) +4: fld %st // x : x : log(2) + fadd %st, %st(1) // x : 2*x : log(2) + fld %st // x : x : 2*x : log(2) + fmul %st(1) // x^2 : x : 2*x : log(2) + fsubl MO(one) // x^2-1 : x : 2*x : log(2) + fsqrt // sqrt(x^2-1) : x : 2*x : log(2) + faddp // x+sqrt(x^2-1) : 2*x : log(2) + fdivrl MO(one) // 1/(x+sqrt(x^2-1)) : 2*x : log(2) + fsubrp // 2*x+1/(x+sqrt(x^2)-1) : log(2) + fyl2x // log(2*x+1/(x+sqrt(x^2-1))) + ret + + // x < 1 => NaN + .align ALIGNARG(4) +5: fldz + fdiv %st, %st(0) + ret +END(__ieee754_acoshl) diff --git a/sysdeps/libm-i387/e_acosl.S b/sysdeps/libm-i387/e_acosl.S index 4cc56c0..e8f9748 100644 --- a/sysdeps/libm-i387/e_acosl.S +++ b/sysdeps/libm-i387/e_acosl.S @@ -19,4 +19,4 @@ ENTRY(__ieee754_acosl) fxch %st(1) fpatan ret -PSEUDO_END (__ieee754_acosl) +END (__ieee754_acosl) diff --git a/sysdeps/libm-i387/e_asin.S b/sysdeps/libm-i387/e_asin.S index cba4193..1202753 100644 --- a/sysdeps/libm-i387/e_asin.S +++ b/sysdeps/libm-i387/e_asin.S @@ -17,4 +17,4 @@ ENTRY(__ieee754_asin) fsqrt /* sqrt (1 - x^2) */ fpatan ret -PSEUDO_END (__ieee754_asin) +END (__ieee754_asin) diff --git a/sysdeps/libm-i387/e_asinf.S b/sysdeps/libm-i387/e_asinf.S new file mode 100644 index 0000000..d2159ba --- /dev/null +++ b/sysdeps/libm-i387/e_asinf.S @@ -0,0 +1,21 @@ +/* + * Written by J.T. Conklin <jtc@netbsd.org>. + * Public domain. + * Adapted for float type by Ulrich Drepper <drepper@cygnus.com>. + */ + +#include <machine/asm.h> + +RCSID("$NetBSD: $") + +/* asin = atan (x / sqrt(1 - x^2)) */ +ENTRY(__ieee754_asinf) + flds 4(%esp) /* x */ + fst %st(1) + fmul %st(0) /* x^2 */ + fld1 + fsubp /* 1 - x^2 */ + fsqrt /* sqrt (1 - x^2) */ + fpatan + ret +END (__ieee754_asinf) diff --git a/sysdeps/libm-i387/e_asinl.S b/sysdeps/libm-i387/e_asinl.S index d4e2548..ab421f3 100644 --- a/sysdeps/libm-i387/e_asinl.S +++ b/sysdeps/libm-i387/e_asinl.S @@ -19,4 +19,4 @@ ENTRY(__ieee754_asinl) fsqrt /* sqrt (1 - x^2) */ fpatan ret -PSEUDO_END (__ieee754_asinl) +END (__ieee754_asinl) diff --git a/sysdeps/libm-i387/e_atan2.S b/sysdeps/libm-i387/e_atan2.S index 6f7fc74..8df04e4 100644 --- a/sysdeps/libm-i387/e_atan2.S +++ b/sysdeps/libm-i387/e_atan2.S @@ -12,4 +12,4 @@ ENTRY(__ieee754_atan2) fldl 12(%esp) fpatan ret -PSEUDO_END (__ieee754_atan2) +END (__ieee754_atan2) diff --git a/sysdeps/libm-i387/e_atan2f.S b/sysdeps/libm-i387/e_atan2f.S index bb6d902..fc6621f 100644 --- a/sysdeps/libm-i387/e_atan2f.S +++ b/sysdeps/libm-i387/e_atan2f.S @@ -12,4 +12,4 @@ ENTRY(__ieee754_atan2f) flds 8(%esp) fpatan ret -PSEUDO_END (__ieee754_atan2f) +END (__ieee754_atan2f) diff --git a/sysdeps/libm-i387/e_atan2l.S b/sysdeps/libm-i387/e_atan2l.S index 860885c..f58eaa9 100644 --- a/sysdeps/libm-i387/e_atan2l.S +++ b/sysdeps/libm-i387/e_atan2l.S @@ -14,4 +14,4 @@ ENTRY(__ieee754_atan2l) fldt 16(%esp) fpatan ret -PSEUDO_END (__ieee754_atan2l) +END (__ieee754_atan2l) diff --git a/sysdeps/libm-i387/e_atanh.S b/sysdeps/libm-i387/e_atanh.S new file mode 100644 index 0000000..231e96f --- /dev/null +++ b/sysdeps/libm-i387/e_atanh.S @@ -0,0 +1,101 @@ +/* ix87 specific implementation of arctanh function. + Copyright (C) 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <machine/asm.h> + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(half,@object) +half: .double 0.5 + ASM_SIZE_DIRECTIVE(half) + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + ASM_TYPE_DIRECTIVE(ln2_2,@object) +ln2_2: .tfloat 0.3465735902799726547086160 + ASM_SIZE_DIRECTIVE(ln2_2) + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__ieee754_atanh) + movl 8(%esp), %ecx + +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + + andl $0x80000000, %ecx // ECX == 0 iff X >= 0 + + fldt MO(ln2_2) // 0.5*ln2 + xorl %ecx, 8(%esp) + fldl 4(%esp) // |x| : 0.5*ln2 + fcoml MO(half) // |x| : 0.5*ln2 + fld %st // |x| : |x| : 0.5*ln2 + fnstsw // |x| : |x| : 0.5*ln2 + sahf + jae 2f + fadd %st, %st(1) // |x| : 2*|x| : 0.5*ln2 + fld %st // |x| : |x| : 2*|x| : 0.5*ln2 + fsubrl MO(one) // 1-|x| : |x| : 2*|x| : 0.5*ln2 + fxch // |x| : 1-|x| : 2*|x| : 0.5*ln2 + fmul %st(2) // 2*|x|^2 : 1-|x| : 2*|x| : 0.5*ln2 + fdivp // (2*|x|^2)/(1-|x|) : 2*|x| : 0.5*ln2 + faddp // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 + fcoml MO(limit) // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 + fnstsw // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 + sahf + jae 4f + fyl2xp1 // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|)) + jecxz 3f + fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x)) +3: ret + + .align ALIGNARG(4) +4: faddl MO(one) // 1+2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 + fyl2x // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|)) + jecxz 3f + fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x)) +3: ret + + .align ALIGNARG(4) +2: faddl MO(one) // 1+|x| : |x| : 0.5*ln2 + fxch // |x| : 1+|x| : 0.5*ln2 + fsubrl MO(one) // 1-|x| : 1+|x| : 0.5*ln2 + fdivrp // (1+|x|)/(1-|x|) : 0.5*ln2 + fyl2x // 0.5*ln2*ld((1+|x|)/(1-|x|)) + jecxz 3f + fchs // 0.5*ln2*ld((1+x)/(1-x)) +3: ret +END(__ieee754_atanh) diff --git a/sysdeps/libm-i387/e_atanhf.S b/sysdeps/libm-i387/e_atanhf.S new file mode 100644 index 0000000..687d4c9 --- /dev/null +++ b/sysdeps/libm-i387/e_atanhf.S @@ -0,0 +1,102 @@ +/* ix87 specific implementation of arctanh function. + Copyright (C) 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <machine/asm.h> + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(half,@object) +half: .double 0.5 + ASM_SIZE_DIRECTIVE(half) + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(ln2_2,@object) +ln2_2: .tfloat 0.3465735902799726547086160 + ASM_SIZE_DIRECTIVE(ln2_2) + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__ieee754_atanhf) + movl 4(%esp), %ecx + +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + + andl $0x80000000, %ecx // ECX == 0 iff X >= 0 + + fldt MO(ln2_2) // 0.5*ln2 + xorl %ecx, 4(%esp) + flds 4(%esp) // |x| : 0.5*ln2 + fcoml MO(half) // |x| : 0.5*ln2 + fld %st(0) // |x| : |x| : 0.5*ln2 + fnstsw // |x| : |x| : 0.5*ln2 + sahf + jae 2f + fadd %st, %st(1) // |x| : 2*|x| : 0.5*ln2 + fld %st // |x| : |x| : 2*|x| : 0.5*ln2 + fsubrl MO(one) // 1-|x| : |x| : 2*|x| : 0.5*ln2 + fxch // |x| : 1-|x| : 2*|x| : 0.5*ln2 + fmul %st(2) // 2*|x|^2 : 1-|x| : 2*|x| : 0.5*ln2 + fdivp // (2*|x|^2)/(1-|x|) : 2*|x| : 0.5*ln2 + faddp // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 + fcoml MO(limit) // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 + fnstsw // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 + sahf + jae 4f + fyl2xp1 // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|)) + jecxz 3f + fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x)) +3: ret + + .align ALIGNARG(4) +4: faddl MO(one) // 1+2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 + fyl2x // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|)) + jecxz 3f + fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x)) +3: ret + + .align ALIGNARG(4) +2: faddl MO(one) // 1+|x| : |x| : 0.5*ln2 + fxch // |x| : 1+|x| : 0.5*ln2 + fsubrl MO(one) // 1-|x| : 1+|x| : 0.5*ln2 + fdivrp // (1+|x|)/(1-|x|) : 0.5*ln2 + fyl2x // 0.5*ln2*ld((1+|x|)/(1-|x|)) + jecxz 3f + fchs // 0.5*ln2*ld((1+x)/(1-x)) +3: ret +END(__ieee754_atanhf) diff --git a/sysdeps/libm-i387/e_atanhl.S b/sysdeps/libm-i387/e_atanhl.S new file mode 100644 index 0000000..8a2bd11 --- /dev/null +++ b/sysdeps/libm-i387/e_atanhl.S @@ -0,0 +1,108 @@ +/* ix87 specific implementation of arctanh function. + Copyright (C) 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <machine/asm.h> + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + + .align ALIGNARG(4) + /* Please note that we use double values for 0.5 and 1.0. These + numbers have exact representations and so we don't get accuracy + problems. The advantage is that the code is simpler. */ + ASM_TYPE_DIRECTIVE(half,@object) +half: .double 0.5 + ASM_SIZE_DIRECTIVE(half) + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + /* It is not important that this constant is precise. It is only + a value which is known to be on the safe side for using the + fyl2xp1 instruction. */ + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(ln2_2,@object) +ln2_2: .tfloat 0.3465735902799726547086160 + ASM_SIZE_DIRECTIVE(ln2_2) + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__ieee754_atanhl) + movl 12(%esp), %ecx + +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + + andl $0x8000, %ecx // ECX == 0 iff X >= 0 + + fldt MO(ln2_2) // 0.5*ln2 + xorl %ecx, 12(%esp) + fldt 4(%esp) // |x| : 0.5*ln2 + fcoml MO(half) // |x| : 0.5*ln2 + fld %st(0) // |x| : |x| : 0.5*ln2 + fnstsw // |x| : |x| : 0.5*ln2 + sahf + jae 2f + fadd %st, %st(1) // |x| : 2*|x| : 0.5*ln2 + fld %st // |x| : |x| : 2*|x| : 0.5*ln2 + fsubrl MO(one) // 1-|x| : |x| : 2*|x| : 0.5*ln2 + fxch // |x| : 1-|x| : 2*|x| : 0.5*ln2 + fmul %st(2) // 2*|x|^2 : 1-|x| : 2*|x| : 0.5*ln2 + fdivp // (2*|x|^2)/(1-|x|) : 2*|x| : 0.5*ln2 + faddp // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 + fcoml MO(limit) // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 + fnstsw // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 + sahf + jae 4f + fyl2xp1 // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|)) + jecxz 3f + fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x)) +3: ret + + .align ALIGNARG(4) +4: faddl MO(one) // 1+2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 + fyl2x // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|)) + jecxz 3f + fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x)) +3: ret + + .align ALIGNARG(4) +2: faddl MO(one) // 1+|x| : |x| : 0.5*ln2 + fxch // |x| : 1+|x| : 0.5*ln2 + fsubrl MO(one) // 1-|x| : 1+|x| : 0.5*ln2 + fdivrp // (1+|x|)/(1-|x|) : 0.5*ln2 + fyl2x // 0.5*ln2*ld((1+|x|)/(1-|x|)) + jecxz 3f + fchs // 0.5*ln2*ld((1+x)/(1-x)) +3: ret +END(__ieee754_atanhl) diff --git a/sysdeps/libm-i387/e_exp.S b/sysdeps/libm-i387/e_exp.S index 01c254a..4505ebd 100644 --- a/sysdeps/libm-i387/e_exp.S +++ b/sysdeps/libm-i387/e_exp.S @@ -38,4 +38,4 @@ ENTRY(__ieee754_exp) jz .LpInf /* If positive, jump. */ fldz /* Set result to 0. */ .LpInf: ret -PSEUDO_END (__ieee754_exp) +END (__ieee754_exp) diff --git a/sysdeps/libm-i387/e_expf.S b/sysdeps/libm-i387/e_expf.S new file mode 100644 index 0000000..c8233eb --- /dev/null +++ b/sysdeps/libm-i387/e_expf.S @@ -0,0 +1,42 @@ +/* + * Written by J.T. Conklin <jtc@netbsd.org>. + * Public domain. + * Adapted for float type by Ulrich Drepper <drepper@cygnus.com>. + */ + +#include <machine/asm.h> + +RCSID("$NetBSD: $") + +/* e^x = 2^(x * log2(e)) */ +ENTRY(__ieee754_expf) + flds 4(%esp) +/* I added the following ugly construct because exp(+-Inf) resulted + in NaN. The ugliness results from the bright minds at Intel. + For the i686 the code can be written better. + -- drepper@cygnus.com. */ + fxam /* Is NaN or +-Inf? */ + fstsw %ax + sahf + jnc .LnoInfNaN /* No, jump. */ + jp .LisInf /* Is +-Inf, jump. */ +.LnoInfNaN: + fldl2e + fmulp /* x * log2(e) */ + fstl %st(1) + frndint /* int(x * log2(e)) */ + fstl %st(2) + fsubrp /* fract(x * log2(e)) */ + f2xm1 /* 2^(fract(x * log2(e))) - 1 */ + fld1 + faddp /* 2^(fract(x * log2(e))) */ + fscale /* e^x */ + fstp %st(1) + ret + +.LisInf: + andb $2, %ah /* Test sign. */ + jz .LpInf /* If positive, jump. */ + fldz /* Set result to 0. */ +.LpInf: ret +END (__ieee754_expf) diff --git a/sysdeps/libm-i387/e_expl.S b/sysdeps/libm-i387/e_expl.S index fc4a183..9103a92 100644 --- a/sysdeps/libm-i387/e_expl.S +++ b/sysdeps/libm-i387/e_expl.S @@ -40,4 +40,4 @@ ENTRY(__ieee754_expl) jz .LpInf /* If positive, jump. */ fldz /* Set result to 0. */ .LpInf: ret -PSEUDO_END (__ieee754_expl) +END (__ieee754_expl) diff --git a/sysdeps/libm-i387/e_fmod.S b/sysdeps/libm-i387/e_fmod.S index c4d7535..9c780b9 100644 --- a/sysdeps/libm-i387/e_fmod.S +++ b/sysdeps/libm-i387/e_fmod.S @@ -16,4 +16,4 @@ ENTRY(__ieee754_fmod) jp 1b fstpl %st(1) ret -PSEUDO_END (__ieee754_fmod) +END (__ieee754_fmod) diff --git a/sysdeps/libm-i387/e_fmodf.S b/sysdeps/libm-i387/e_fmodf.S new file mode 100644 index 0000000..fbb0c69 --- /dev/null +++ b/sysdeps/libm-i387/e_fmodf.S @@ -0,0 +1,20 @@ +/* + * Written by J.T. Conklin <jtc@netbsd.org>. + * Public domain. + * Adapted for float type by Ulrich Drepper <drepper@cygnus.com>. + */ + +#include <machine/asm.h> + +RCSID("$NetBSD: $") + +ENTRY(__ieee754_fmodf) + flds 8(%esp) + flds 4(%esp) +1: fprem + fstsw %ax + sahf + jp 1b + fstpl %st(1) + ret +END(__ieee754_fmodf) diff --git a/sysdeps/libm-i387/e_fmodl.S b/sysdeps/libm-i387/e_fmodl.S index 8c2bd06..f21082e0 100644 --- a/sysdeps/libm-i387/e_fmodl.S +++ b/sysdeps/libm-i387/e_fmodl.S @@ -18,4 +18,4 @@ ENTRY(__ieee754_fmodl) jp 1b fstpl %st(1) ret -PSEUDO_END (__ieee754_fmodl) +END (__ieee754_fmodl) diff --git a/sysdeps/libm-i387/e_log.S b/sysdeps/libm-i387/e_log.S index 2a51d75..43d4303 100644 --- a/sysdeps/libm-i387/e_log.S +++ b/sysdeps/libm-i387/e_log.S @@ -1,15 +1,59 @@ /* * Written by J.T. Conklin <jtc@netbsd.org>. * Public domain. + * + * Changed to use fyl2xp1 for values near 1, <drepper@cygnus.com>. */ #include <machine/asm.h> RCSID("$NetBSD: e_log.S,v 1.4 1995/05/08 23:48:39 jtc Exp $") +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + /* It is not important that this constant is precise. It is only + a value which is known to be on the safe side for using the + fyl2xp1 instruction. */ + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text ENTRY(__ieee754_log) - fldln2 - fldl 4(%esp) - fyl2x + fldln2 // log(2) + fldl 4(%esp) // x : log(2) +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + fld %st // x : x : log(2) + fsubl MO(one) // x-1 : x : log(2) + fld %st // x-1 : x-1 : x : log(2) + fabs // |x-1| : x-1 : x : log(2) + fcompl MO(limit) // x-1 : x : log(2) + fnstsw // x-1 : x : log(2) + sahf + ja 2f + fstp %st(1) // x-1 : log(2) + fyl2xp1 // log(x) + ret + +2: fincstp // x : log(2) + fyl2x // log(x) ret -PSEUDO_END (__ieee754_log) +END (__ieee754_log) diff --git a/sysdeps/libm-i387/e_log10.S b/sysdeps/libm-i387/e_log10.S index 17b3067..95efc8f 100644 --- a/sysdeps/libm-i387/e_log10.S +++ b/sysdeps/libm-i387/e_log10.S @@ -1,15 +1,59 @@ /* * Written by J.T. Conklin <jtc@netbsd.org>. * Public domain. + * + * Changed to use fyl2xp1 for values near 1, <drepper@cygnus.com>. */ #include <machine/asm.h> RCSID("$NetBSD: e_log10.S,v 1.4 1995/05/08 23:49:24 jtc Exp $") +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + /* It is not important that this constant is precise. It is only + a value which is known to be on the safe side for using the + fyl2xp1 instruction. */ + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text ENTRY(__ieee754_log10) - fldlg2 - fldl 4(%esp) - fyl2x + fldlg2 // log10(2) + fldl 4(%esp) // x : log10(2) +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + fld %st // x : x : log10(2) + fsubl MO(one) // x-1 : x : log10(2) + fld %st // x-1 : x-1 : x : log10(2) + fabs // |x-1| : x-1 : x : log10(2) + fcompl MO(limit) // x-1 : x : log10(2) + fnstsw // x-1 : x : log10(2) + sahf + ja 2f + fstp %st(1) // x-1 : log10(2) + fyl2xp1 // log10(x) + ret + +2: fincstp // x : log10(2) + fyl2x // log10(x) ret -PSEUDO_END (__ieee754_log10) +END (__ieee754_log10) diff --git a/sysdeps/libm-i387/e_log10f.S b/sysdeps/libm-i387/e_log10f.S new file mode 100644 index 0000000..bddb501 --- /dev/null +++ b/sysdeps/libm-i387/e_log10f.S @@ -0,0 +1,60 @@ +/* + * Written by J.T. Conklin <jtc@netbsd.org>. + * Public domain. + * Adapted for float type by Ulrich Drepper <drepper@cygnus.com>. + * + * Changed to use fyl2xp1 for values near 1, <drepper@cygnus.com>. + */ + +#include <machine/asm.h> + +RCSID("$NetBSD: $") + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + /* It is not important that this constant is precise. It is only + a value which is known to be on the safe side for using the + fyl2xp1 instruction. */ + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__ieee754_log10f) + fldlg2 // log10(2) + flds 4(%esp) // x : log10(2) +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + fld %st // x : x : log10(2) + fsubl MO(one) // x-1 : x : log10(2) + fld %st // x-1 : x-1 : x : log10(2) + fabs // |x-1| : x-1 : x : log10(2) + fcompl MO(limit) // x-1 : x : log10(2) + fnstsw // x-1 : x : log10(2) + sahf + ja 2f + fstp %st(1) // x-1 : log10(2) + fyl2xp1 // log10(x) + ret + +2: fincstp // x : log10(2) + fyl2x // log10(x) + ret +END (__ieee754_log10f) diff --git a/sysdeps/libm-i387/e_log10l.S b/sysdeps/libm-i387/e_log10l.S index cfddb5c..f0b8f32 100644 --- a/sysdeps/libm-i387/e_log10l.S +++ b/sysdeps/libm-i387/e_log10l.S @@ -3,15 +3,59 @@ * Public domain. * * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>. + * + * Changed to use fyl2xp1 for values near 1, <drepper@cygnus.com>. */ #include <machine/asm.h> RCSID("$NetBSD: $") +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + /* It is not important that this constant is precise. It is only + a value which is known to be on the safe side for using the + fyl2xp1 instruction. */ + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text ENTRY(__ieee754_log10l) - fldlg2 - fldt 4(%esp) - fyl2x + fldlg2 // log10(2) + fldt 4(%esp) // x : log10(2) +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + fld %st // x : x : log10(2) + fsubl MO(one) // x-1 : x : log10(2) + fld %st // x-1 : x-1 : x : log10(2) + fabs // |x-1| : x-1 : x : log10(2) + fcompl MO(limit) // x-1 : x : log10(2) + fnstsw // x-1 : x : log10(2) + sahf + ja 2f + fstp %st(1) // x-1 : log10(2) + fyl2xp1 // log10(x) + ret + +2: fincstp // x : log10(2) + fyl2x // log10(x) ret -PSEUDO_END(__ieee754_log10l) +END(__ieee754_log10l) diff --git a/sysdeps/libm-i387/e_logf.S b/sysdeps/libm-i387/e_logf.S new file mode 100644 index 0000000..b79f478 --- /dev/null +++ b/sysdeps/libm-i387/e_logf.S @@ -0,0 +1,60 @@ +/* + * Written by J.T. Conklin <jtc@netbsd.org>. + * Public domain. + * Adapted for float by Ulrich Drepper <drepper@cygnus.com>. + * + * Changed to use fyl2xp1 for values near 1, <drepper@cygnus.com>. + */ + +#include <machine/asm.h> + +RCSID("$NetBSD: e_log.S,v 1.4 1995/05/08 23:48:39 jtc Exp $") + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + /* It is not important that this constant is precise. It is only + a value which is known to be on the safe side for using the + fyl2xp1 instruction. */ + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__ieee754_logf) + fldln2 // log(2) + flds 4(%esp) // x : log(2) +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + fld %st // x : x : log(2) + fsubl MO(one) // x-1 : x : log(2) + fld %st // x-1 : x-1 : x : log(2) + fabs // |x-1| : x-1 : x : log(2) + fcompl MO(limit) // x-1 : x : log(2) + fnstsw // x-1 : x : log(2) + sahf + ja 2f + fstp %st(1) // x-1 : log(2) + fyl2xp1 // log(x) + ret + +2: fincstp // x : log(2) + fyl2x // log(x) + ret +END (__ieee754_logf) diff --git a/sysdeps/libm-i387/e_logl.S b/sysdeps/libm-i387/e_logl.S index 4c1550e..1657dfd 100644 --- a/sysdeps/libm-i387/e_logl.S +++ b/sysdeps/libm-i387/e_logl.S @@ -9,9 +9,52 @@ RCSID("$NetBSD: $") + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + /* It is not important that this constant is precise. It is only + a value which is known to be on the safe side for using the + fyl2xp1 instruction. */ + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text ENTRY(__ieee754_logl) - fldln2 - fldt 4(%esp) - fyl2x + fldln2 // log(2) + fldt 4(%esp) // x : log(2) +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + fld %st // x : x : log(2) + fsubl MO(one) // x-1 : x : log(2) + fld %st // x-1 : x-1 : x : log(2) + fabs // |x-1| : x-1 : x : log(2) + fcompl MO(limit) // x-1 : x : log(2) + fnstsw // x-1 : x : log(2) + sahf + ja 2f + fstp %st(1) // x-1 : log(2) + fyl2xp1 // log(x) + ret + +2: fincstp // x : log(2) + fyl2x // log(x) ret -PSEUDO_END(__ieee754_logl) +END (__ieee754_logl) diff --git a/sysdeps/libm-i387/e_remainder.S b/sysdeps/libm-i387/e_remainder.S index 287b616..06cdddc 100644 --- a/sysdeps/libm-i387/e_remainder.S +++ b/sysdeps/libm-i387/e_remainder.S @@ -16,4 +16,4 @@ ENTRY(__ieee754_remainder) jp 1b fstpl %st(1) ret -PSEUDO_END (__ieee754_remainder) +END (__ieee754_remainder) diff --git a/sysdeps/libm-i387/e_remainderf.S b/sysdeps/libm-i387/e_remainderf.S index cdc1ac8..d313a55 100644 --- a/sysdeps/libm-i387/e_remainderf.S +++ b/sysdeps/libm-i387/e_remainderf.S @@ -16,4 +16,4 @@ ENTRY(__ieee754_remainderf) jp 1b fstpl %st(1) ret -PSEUDO_END (__ieee754_remainderf) +END (__ieee754_remainderf) diff --git a/sysdeps/libm-i387/e_remainderl.S b/sysdeps/libm-i387/e_remainderl.S index 2c32550..90a8da7 100644 --- a/sysdeps/libm-i387/e_remainderl.S +++ b/sysdeps/libm-i387/e_remainderl.S @@ -17,4 +17,4 @@ ENTRY(__ieee754_remainderl) sahf jp 1b ret -PSEUDO_END (__ieee754_remainderl) +END (__ieee754_remainderl) diff --git a/sysdeps/libm-i387/e_scalb.S b/sysdeps/libm-i387/e_scalb.S index 0aed96d..db63dde 100644 --- a/sysdeps/libm-i387/e_scalb.S +++ b/sysdeps/libm-i387/e_scalb.S @@ -12,4 +12,4 @@ ENTRY(__ieee754_scalb) fldl 4(%esp) fscale ret -PSEUDO_END(__ieee754_scalb) +END(__ieee754_scalb) diff --git a/sysdeps/libm-i387/e_scalbf.S b/sysdeps/libm-i387/e_scalbf.S new file mode 100644 index 0000000..7de03db --- /dev/null +++ b/sysdeps/libm-i387/e_scalbf.S @@ -0,0 +1,16 @@ +/* + * Written by J.T. Conklin <jtc@netbsd.org>. + * Public domain. + * Adapted for float type by Ulrich Drepper <drepper@cygnus.com>. + */ + +#include <machine/asm.h> + +RCSID("$NetBSD: $") + +ENTRY(__ieee754_scalbf) + flds 8(%esp) + flds 4(%esp) + fscale + ret +END(__ieee754_scalbf) diff --git a/sysdeps/libm-i387/e_scalbl.S b/sysdeps/libm-i387/e_scalbl.S index 40d6ff0..7b20cc6 100644 --- a/sysdeps/libm-i387/e_scalbl.S +++ b/sysdeps/libm-i387/e_scalbl.S @@ -14,4 +14,4 @@ ENTRY(__ieee754_scalbl) fldt 4(%esp) fscale ret -PSEUDO_END(__ieee754_scalbl) +END(__ieee754_scalbl) diff --git a/sysdeps/libm-i387/e_sqrt.S b/sysdeps/libm-i387/e_sqrt.S index 170363f..6f253d5 100644 --- a/sysdeps/libm-i387/e_sqrt.S +++ b/sysdeps/libm-i387/e_sqrt.S @@ -11,4 +11,4 @@ ENTRY(__ieee754_sqrt) fldl 4(%esp) fsqrt ret -PSEUDO_END (__ieee754_sqrt) +END (__ieee754_sqrt) diff --git a/sysdeps/libm-i387/e_sqrtf.S b/sysdeps/libm-i387/e_sqrtf.S index f13c129..5ce1ad0 100644 --- a/sysdeps/libm-i387/e_sqrtf.S +++ b/sysdeps/libm-i387/e_sqrtf.S @@ -11,4 +11,4 @@ ENTRY(__ieee754_sqrtf) flds 4(%esp) fsqrt ret -PSEUDO_END (__ieee754_sqrtf) +END (__ieee754_sqrtf) diff --git a/sysdeps/libm-i387/e_sqrtl.S b/sysdeps/libm-i387/e_sqrtl.S index 56947e1..d47aae5 100644 --- a/sysdeps/libm-i387/e_sqrtl.S +++ b/sysdeps/libm-i387/e_sqrtl.S @@ -13,4 +13,4 @@ ENTRY(__ieee754_sqrtl) fldt 4(%esp) fsqrt ret -PSEUDO_END (__ieee754_sqrtl) +END (__ieee754_sqrtl) diff --git a/sysdeps/libm-i387/s_asinh.S b/sysdeps/libm-i387/s_asinh.S new file mode 100644 index 0000000..9b58eaa --- /dev/null +++ b/sysdeps/libm-i387/s_asinh.S @@ -0,0 +1,132 @@ +/* ix87 specific implementation of arcsinh. + Copyright (C) 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <machine/asm.h> + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(huge,@object) +huge: .double 1e+300 + ASM_SIZE_DIRECTIVE(huge) + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__asinh) + movl 8(%esp), %ecx + movl $0x7fffffff, %eax + andl %ecx, %eax + andl $0x80000000, %ecx + xorl %ecx, 8(%esp) + fldl 4(%esp) // |x| + cmpl $0x3e300000, %eax + jb 2f // |x| < 2^-28 + fldln2 // log(2) : |x| + cmpl $0x41b00000, %eax + fxch // |x| : log(2) + ja 3f // |x| > 2^28 +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + cmpl $0x40000000, %eax + ja 5f // |x| > 2 + + // 2^-28 <= |x| <= 2 => y = sign(x)*log1p(|x|+|x|^2/(1+sqrt(1+|x|^2))) + fld %st // |x| : |x| : log(2) + fmul %st(1) // |x|^2 : |x| : log(2) + fld %st // |x|^2 : |x|^2 : |x| : log(2) + faddl MO(one) // 1+|x|^2 : |x|^2 : |x| : log(2) + fsqrt // sqrt(1+|x|^2) : |x|^2 : |x| : log(2) + faddl MO(one) // 1+sqrt(1+|x|^2) : |x|^2 : |x| : log(2) + fdivrp // |x|^2/(1+sqrt(1+|x|^2)) : |x| : log(2) + faddp // |x|+|x|^2/(1+sqrt(1+|x|^2)) : log(2) + fcoml MO(limit) + fnstsw + sahf + ja 6f + fyl2xp1 + jecxz 4f + fchs +4: ret + +6: faddl MO(one) + fyl2x + jecxz 4f + fchs +4: ret + + // |x| < 2^-28 => y = x (inexact iff |x| != 0.0) + .align ALIGNARG(4) +2: +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + jecxz 4f + fchs // x +4: fld %st // x : x + faddl MO(huge) // huge+x : x + fincstp // x + ret + + // |x| > 2^28 => y = sign(x) * (log(|x|) + log(2)) + .align ALIGNARG(4) +3: fyl2x // log(|x|) + fldln2 // log(2) : log(|x|) + faddp // log(|x|)+log(2) + jecxz 4f + fchs +4: ret + + // |x| > 2 => y = sign(x) * log(2*|x| + 1/(|x|+sqrt(x*x+1))) + .align ALIGNARG(4) +5: fld %st // |x| : |x| : log(2) + fadd %st, %st(1) // |x| : 2*|x| : log(2) + fld %st // |x| : |x| : 2*|x| : log(2) + fmul %st(1) // |x|^2 : |x| : 2*|x| : log(2) + faddl MO(one) // 1+|x|^2 : |x| : 2*|x| : log(2) + fsqrt // sqrt(1+|x|^2) : |x| : 2*|x| : log(2) + faddp // |x|+sqrt(1+|x|^2) : 2*|x| : log(2) + fdivrl MO(one) // 1/(|x|+sqrt(1+|x|^2)) : 2*|x| : log(2) + faddp // 2*|x|+1/(|x|+sqrt(1+|x|^2)) : log(2) + fyl2x // log(2*|x|+1/(|x|+sqrt(1+|x|^2))) + jecxz 4f + fchs +4: ret +END(__asinh) +weak_alias (__asinh, asinh) diff --git a/sysdeps/libm-i387/s_asinhf.S b/sysdeps/libm-i387/s_asinhf.S new file mode 100644 index 0000000..d0a99a9 --- /dev/null +++ b/sysdeps/libm-i387/s_asinhf.S @@ -0,0 +1,132 @@ +/* ix87 specific implementation of arcsinh. + Copyright (C) 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <machine/asm.h> + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(huge,@object) +huge: .double 1e+36 + ASM_SIZE_DIRECTIVE(huge) + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__asinhf) + movl 4(%esp), %ecx + movl $0x7fffffff, %eax + andl %ecx, %eax + andl $0x80000000, %ecx + xorl %ecx, 8(%esp) + flds 4(%esp) // |x| + cmpl $0x38000000, %eax + jb 2f // |x| < 2^-14 + fldln2 // log(2) : |x| + cmpl $0x47000000, %eax + fxch // |x| : log(2) + ja 3f // |x| > 2^14 +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + cmpl $0x40000000, %eax + ja 5f // |x| > 2 + + // 2^-14 <= |x| <= 2 => y = sign(x)*log1p(|x|+|x|^2/(1+sqrt(1+|x|^2))) + fld %st // |x| : |x| : log(2) + fmul %st(1) // |x|^2 : |x| : log(2) + fld %st // |x|^2 : |x|^2 : |x| : log(2) + faddl MO(one) // 1+|x|^2 : |x|^2 : |x| : log(2) + fsqrt // sqrt(1+|x|^2) : |x|^2 : |x| : log(2) + faddl MO(one) // 1+sqrt(1+|x|^2) : |x|^2 : |x| : log(2) + fdivrp // |x|^2/(1+sqrt(1+|x|^2)) : |x| : log(2) + faddp // |x|+|x|^2/(1+sqrt(1+|x|^2)) : log(2) + fcoml MO(limit) + fnstsw + sahf + ja 6f + fyl2xp1 + jecxz 4f + fchs +4: ret + +6: faddl MO(one) + fyl2x + jecxz 4f + fchs +4: ret + + // |x| < 2^-14 => y = x (inexact iff |x| != 0.0) + .align ALIGNARG(4) +2: +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + jecxz 4f + fchs // x +4: fld %st // x : x + faddl MO(huge) // huge+x : x + fincstp // x + ret + + // |x| > 2^14 => y = sign(x) * (log(|x|) + log(2)) + .align ALIGNARG(4) +3: fyl2x // log(|x|) + fldln2 // log(2) : log(|x|) + faddp // log(|x|)+log(2) + jecxz 4f + fchs +4: ret + + // |x| > 2 => y = sign(x) * log(2*|x| + 1/(|x|+sqrt(x*x+1))) + .align ALIGNARG(4) +5: fld %st // |x| : |x| : log(2) + fadd %st, %st(1) // |x| : 2*|x| : log(2) + fld %st // |x| : |x| : 2*|x| : log(2) + fmul %st(1) // |x|^2 : |x| : 2*|x| : log(2) + faddl MO(one) // 1+|x|^2 : |x| : 2*|x| : log(2) + fsqrt // sqrt(1+|x|^2) : |x| : 2*|x| : log(2) + faddp // |x|+sqrt(1+|x|^2) : 2*|x| : log(2) + fdivrl MO(one) // 1/(|x|+sqrt(1+|x|^2)) : 2*|x| : log(2) + faddp // 2*|x|+1/(|x|+sqrt(1+|x|^2)) : log(2) + fyl2x // log(2*|x|+1/(|x|+sqrt(1+|x|^2))) + jecxz 4f + fchs +4: ret +END(__asinhf) +weak_alias (__asinhf, asinhf) diff --git a/sysdeps/libm-i387/s_asinhl.S b/sysdeps/libm-i387/s_asinhl.S new file mode 100644 index 0000000..28f76c2 --- /dev/null +++ b/sysdeps/libm-i387/s_asinhl.S @@ -0,0 +1,140 @@ +/* ix87 specific implementation of arcsinh. + Copyright (C) 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <machine/asm.h> + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(huge,@object) +huge: .tfloat 1e+4930 + ASM_SIZE_DIRECTIVE(huge) + .align ALIGNARG(4) + /* Please note that we use double value for 1.0. This number + has an exact representation and so we don't get accuracy + problems. The advantage is that the code is simpler. */ + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + /* It is not important that this constant is precise. It is only + a value which is known to be on the safe side for using the + fyl2xp1 instruction. */ + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__asinhl) + movl 12(%esp), %ecx + movl $0x7fff, %eax + andl %ecx, %eax + andl $0x8000, %ecx + xorl %ecx, 12(%esp) + fldt 4(%esp) // |x| + cmpl $0x3fde, %eax + jb 2f // |x| < 2^-34 + fldln2 // log(2) : |x| + cmpl $0x4020, %eax + fxch // |x| : log(2) + ja 3f // |x| > 2^34 +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + cmpl $0x4000, %eax + ja 5f // |x| > 2 + + // 2^-34 <= |x| <= 2 => y = sign(x)*log1p(|x|+|x|^2/(1+sqrt(1+|x|^2))) + fld %st // |x| : |x| : log(2) + fmul %st(1) // |x|^2 : |x| : log(2) + fld %st // |x|^2 : |x|^2 : |x| : log(2) + faddl MO(one) // 1+|x|^2 : |x|^2 : |x| : log(2) + fsqrt // sqrt(1+|x|^2) : |x|^2 : |x| : log(2) + faddl MO(one) // 1+sqrt(1+|x|^2) : |x|^2 : |x| : log(2) + fdivrp // |x|^2/(1+sqrt(1+|x|^2)) : |x| : log(2) + faddp // |x|+|x|^2/(1+sqrt(1+|x|^2)) : log(2) + fcoml MO(limit) + fnstsw + sahf + ja 6f + fyl2xp1 + jecxz 4f + fchs +4: ret + +6: faddl MO(one) + fyl2x + jecxz 4f + fchs +4: ret + + // |x| < 2^-34 => y = x (inexact iff |x| != 0.0) + .align ALIGNARG(4) +2: +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + jecxz 4f + fchs // x +4: fld %st // x : x + fldt MO(huge) // huge : x : x + faddp // huge+x : x + fincstp // x + ret + + // |x| > 2^34 => y = sign(x) * (log(|x|) + log(2)) + .align ALIGNARG(4) +3: fyl2x // log(|x|) + fldln2 // log(2) : log(|x|) + faddp // log(|x|)+log(2) + jecxz 4f + fchs +4: ret + + // |x| > 2 => y = sign(x) * log(2*|x| + 1/(|x|+sqrt(x*x+1))) + .align ALIGNARG(4) +5: fld %st // |x| : |x| : log(2) + fadd %st, %st(1) // |x| : 2*|x| : log(2) + fld %st // |x| : |x| : 2*|x| : log(2) + fmul %st(1) // |x|^2 : |x| : 2*|x| : log(2) + faddl MO(one) // 1+|x|^2 : |x| : 2*|x| : log(2) + fsqrt // sqrt(1+|x|^2) : |x| : 2*|x| : log(2) + faddp // |x|+sqrt(1+|x|^2) : 2*|x| : log(2) + fdivrl MO(one) // 1/(|x|+sqrt(1+|x|^2)) : 2*|x| : log(2) + faddp // 2*|x|+1/(|x|+sqrt(1+|x|^2)) : log(2) + fyl2x // log(2*|x|+1/(|x|+sqrt(1+|x|^2))) + jecxz 4f + fchs +4: ret +END(__asinhl) +weak_alias (__asinhl, asinhl) diff --git a/sysdeps/libm-i387/s_atan.S b/sysdeps/libm-i387/s_atan.S index f670031..7502f6d 100644 --- a/sysdeps/libm-i387/s_atan.S +++ b/sysdeps/libm-i387/s_atan.S @@ -12,5 +12,5 @@ ENTRY(__atan) fld1 fpatan ret -PSEUDO_END (__atan) +END (__atan) weak_alias (__atan, atan) diff --git a/sysdeps/libm-i387/s_atanf.S b/sysdeps/libm-i387/s_atanf.S index 803b7f9..70232c8 100644 --- a/sysdeps/libm-i387/s_atanf.S +++ b/sysdeps/libm-i387/s_atanf.S @@ -12,5 +12,5 @@ ENTRY(__atanf) fld1 fpatan ret -PSEUDO_END (__atanf) +END (__atanf) weak_alias (__atanf, atanf) diff --git a/sysdeps/libm-i387/s_atanl.S b/sysdeps/libm-i387/s_atanl.S index 59f1390..8b07272 100644 --- a/sysdeps/libm-i387/s_atanl.S +++ b/sysdeps/libm-i387/s_atanl.S @@ -14,5 +14,5 @@ ENTRY(__atanl) fld1 fpatan ret -PSEUDO_END (__atanl) +END (__atanl) weak_alias (__atanl, atanl) diff --git a/sysdeps/libm-i387/s_ceil.S b/sysdeps/libm-i387/s_ceil.S index 5135c90..309fe88 100644 --- a/sysdeps/libm-i387/s_ceil.S +++ b/sysdeps/libm-i387/s_ceil.S @@ -30,5 +30,5 @@ ENTRY(__ceil) leave ret -PSEUDO_END (__ceil) +END (__ceil) weak_alias (__ceil, ceil) diff --git a/sysdeps/libm-i387/s_ceilf.S b/sysdeps/libm-i387/s_ceilf.S index 93cf40b..768d117 100644 --- a/sysdeps/libm-i387/s_ceilf.S +++ b/sysdeps/libm-i387/s_ceilf.S @@ -30,5 +30,5 @@ ENTRY(__ceilf) leave ret -PSEUDO_END (__ceilf) +END (__ceilf) weak_alias (__ceilf, ceilf) diff --git a/sysdeps/libm-i387/s_ceill.S b/sysdeps/libm-i387/s_ceill.S index a77e550..dcf8719 100644 --- a/sysdeps/libm-i387/s_ceill.S +++ b/sysdeps/libm-i387/s_ceill.S @@ -31,5 +31,5 @@ ENTRY(__ceill) leave ret -PSEUDO_END (__ceill) +END (__ceill) weak_alias (__ceill, ceill) diff --git a/sysdeps/libm-i387/s_copysign.S b/sysdeps/libm-i387/s_copysign.S index 45b86f5..2520a94 100644 --- a/sysdeps/libm-i387/s_copysign.S +++ b/sysdeps/libm-i387/s_copysign.S @@ -16,5 +16,5 @@ ENTRY(__copysign) movl %eax,8(%esp) fldl 4(%esp) ret -PSEUDO_END (__copysign) +END (__copysign) weak_alias (__copysign, copysign) diff --git a/sysdeps/libm-i387/s_copysignf.S b/sysdeps/libm-i387/s_copysignf.S index 4844a2b..57b1a6f 100644 --- a/sysdeps/libm-i387/s_copysignf.S +++ b/sysdeps/libm-i387/s_copysignf.S @@ -16,5 +16,5 @@ ENTRY(__copysignf) movl %eax,4(%esp) flds 4(%esp) ret -PSEUDO_END (__copysignf) +END (__copysignf) weak_alias (__copysignf, copysignf) diff --git a/sysdeps/libm-i387/s_copysignl.S b/sysdeps/libm-i387/s_copysignl.S index 37e34fe..2163e7b 100644 --- a/sysdeps/libm-i387/s_copysignl.S +++ b/sysdeps/libm-i387/s_copysignl.S @@ -17,5 +17,5 @@ ENTRY(__copysignl) movl %eax,12(%esp) fldt 4(%esp) ret -PSEUDO_END (__copysignl) +END (__copysignl) weak_alias (__copysignl, copysignl) diff --git a/sysdeps/libm-i387/s_cos.S b/sysdeps/libm-i387/s_cos.S index 6b47e80..f75e980 100644 --- a/sysdeps/libm-i387/s_cos.S +++ b/sysdeps/libm-i387/s_cos.S @@ -11,7 +11,7 @@ ENTRY(__cos) fldl 4(%esp) fcos fnstsw %ax - andw $0x400,%ax + testl $0x400,%eax jnz 1f ret 1: fldpi @@ -19,10 +19,10 @@ ENTRY(__cos) fxch %st(1) 2: fprem1 fnstsw %ax - andw $0x400,%ax + testl $0x400,%eax jnz 2b fstp %st(1) fcos ret -PSEUDO_END (__cos) +END (__cos) weak_alias (__cos, cos) diff --git a/sysdeps/libm-i387/s_cosf.S b/sysdeps/libm-i387/s_cosf.S index a2bd0e5..d8e8090 100644 --- a/sysdeps/libm-i387/s_cosf.S +++ b/sysdeps/libm-i387/s_cosf.S @@ -12,5 +12,5 @@ ENTRY(__cosf) flds 4(%esp) fcos ret -PSEUDO_END (__cosf) +END (__cosf) weak_alias (__cosf, cosf) diff --git a/sysdeps/libm-i387/s_cosl.S b/sysdeps/libm-i387/s_cosl.S index 2ddb549..f41fc19 100644 --- a/sysdeps/libm-i387/s_cosl.S +++ b/sysdeps/libm-i387/s_cosl.S @@ -13,7 +13,7 @@ ENTRY(__cosl) fldt 4(%esp) fcos fnstsw %ax - andw $0x400,%ax + testl $0x400,%eax jnz 1f ret 1: fldpi @@ -21,10 +21,10 @@ ENTRY(__cosl) fxch %st(1) 2: fprem1 fnstsw %ax - andw $0x400,%ax + testl $0x400,%eax jnz 2b fstp %st(1) fcos ret -PSEUDO_END (__cosl) +END (__cosl) weak_alias (__cosl, cosl) diff --git a/sysdeps/libm-i387/s_finite.S b/sysdeps/libm-i387/s_finite.S index 538fec9..7c67e19 100644 --- a/sysdeps/libm-i387/s_finite.S +++ b/sysdeps/libm-i387/s_finite.S @@ -14,5 +14,5 @@ ENTRY(__finite) setne %al andl $0x000000ff, %eax ret -PSEUDO_END (__finite) +END (__finite) weak_alias (__finite, finite) diff --git a/sysdeps/libm-i387/s_finitef.S b/sysdeps/libm-i387/s_finitef.S index cb0caab..ee26c87 100644 --- a/sysdeps/libm-i387/s_finitef.S +++ b/sysdeps/libm-i387/s_finitef.S @@ -14,5 +14,5 @@ ENTRY(__finitef) setne %al andl $0x000000ff, %eax ret -PSEUDO_END (__finitef) +END (__finitef) weak_alias (__finitef, finitef) diff --git a/sysdeps/libm-i387/s_finitel.S b/sysdeps/libm-i387/s_finitel.S index 7af8047..944b249 100644 --- a/sysdeps/libm-i387/s_finitel.S +++ b/sysdeps/libm-i387/s_finitel.S @@ -16,5 +16,5 @@ ENTRY(__finitel) setne %al andl $0x000000ff, %eax ret -PSEUDO_END (__finitel) +END (__finitel) weak_alias (__finitel, finitel) diff --git a/sysdeps/libm-i387/s_floor.S b/sysdeps/libm-i387/s_floor.S index ca8914e..561f83d 100644 --- a/sysdeps/libm-i387/s_floor.S +++ b/sysdeps/libm-i387/s_floor.S @@ -26,5 +26,5 @@ ENTRY(__floor) leave ret -PSEUDO_END (__floor) +END (__floor) weak_alias (__floor, floor) diff --git a/sysdeps/libm-i387/s_floorf.S b/sysdeps/libm-i387/s_floorf.S index 796db4f..059f4f3 100644 --- a/sysdeps/libm-i387/s_floorf.S +++ b/sysdeps/libm-i387/s_floorf.S @@ -26,5 +26,5 @@ ENTRY(__floorf) leave ret -PSEUDO_END (__floorf) +END (__floorf) weak_alias (__floorf, floorf) diff --git a/sysdeps/libm-i387/s_floorl.S b/sysdeps/libm-i387/s_floorl.S index 396d854..7b7cff7 100644 --- a/sysdeps/libm-i387/s_floorl.S +++ b/sysdeps/libm-i387/s_floorl.S @@ -27,5 +27,5 @@ ENTRY(__floorl) leave ret -PSEUDO_END (__floorl) +END (__floorl) weak_alias (__floorl, floorl) diff --git a/sysdeps/libm-i387/s_ilogb.S b/sysdeps/libm-i387/s_ilogb.S index 6fb51d9..01b8afa 100644 --- a/sysdeps/libm-i387/s_ilogb.S +++ b/sysdeps/libm-i387/s_ilogb.S @@ -21,5 +21,5 @@ ENTRY(__ilogb) leave ret -PSEUDO_END (__ilogb) +END (__ilogb) weak_alias (__ilogb, ilogb) diff --git a/sysdeps/libm-i387/s_ilogbf.S b/sysdeps/libm-i387/s_ilogbf.S index 71e4f42..6a94326 100644 --- a/sysdeps/libm-i387/s_ilogbf.S +++ b/sysdeps/libm-i387/s_ilogbf.S @@ -21,5 +21,5 @@ ENTRY(__ilogbf) leave ret -PSEUDO_END (__ilogbf) +END (__ilogbf) weak_alias (__ilogbf, ilogbf) diff --git a/sysdeps/libm-i387/s_ilogbl.S b/sysdeps/libm-i387/s_ilogbl.S index 2b84146..2422a41 100644 --- a/sysdeps/libm-i387/s_ilogbl.S +++ b/sysdeps/libm-i387/s_ilogbl.S @@ -21,5 +21,5 @@ ENTRY(__ilogbl) leave ret -PSEUDO_END (__ilogbl) +END (__ilogbl) weak_alias (__ilogbl, ilogbl) diff --git a/sysdeps/libm-i387/s_log1p.S b/sysdeps/libm-i387/s_log1p.S index ce8665d..10e8a36 100644 --- a/sysdeps/libm-i387/s_log1p.S +++ b/sysdeps/libm-i387/s_log1p.S @@ -7,18 +7,56 @@ RCSID("$NetBSD: s_log1p.S,v 1.7 1995/05/09 00:10:58 jtc Exp $") +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + .align ALIGNARG(4) + /* The fyl2xp1 can only be used for values in + -1 + sqrt(2) / 2 <= x <= 1 - sqrt(2) / 2 + 0.29 is a safe value. + */ +limit: .double 0.29 +one: .double 1.0 + /* - * Since the fyl2xp1 instruction has such a limited range: - * -(1 - (sqrt(2) / 2)) <= x <= sqrt(2) - 1 - * it's not worth trying to use it. + * Use the fyl2xp1 function when the argument is in the range -0.29 to 0.29, + * otherwise fyl2x with the needed extra computation. */ - + .text ENTRY(__log1p) fldln2 - fldl 4(%esp) - fld1 - faddp + + fldl 4(%esp) + +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + + fld %st + fabs +#ifdef PIC + fcompl limit@GOTOFF(%edx) +#else + fcompl limit +#endif + fnstsw + sahf + jc 2f + +#ifdef PIC + faddl one@GOTOFF(%edx) +#else + faddl one +#endif fyl2x ret -PSEUDO_END (__log1p) + +2: fyl2xp1 + ret + +END (__log1p) weak_alias (__log1p, log1p) diff --git a/sysdeps/libm-i387/s_log1pf.S b/sysdeps/libm-i387/s_log1pf.S index 7a161f2..df9fdcb 100644 --- a/sysdeps/libm-i387/s_log1pf.S +++ b/sysdeps/libm-i387/s_log1pf.S @@ -7,18 +7,56 @@ RCSID("$NetBSD: s_log1pf.S,v 1.4 1995/05/09 00:13:05 jtc Exp $") +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + .align ALIGNARG(4) + /* The fyl2xp1 can only be used for values in + -1 + sqrt(2) / 2 <= x <= 1 - sqrt(2) / 2 + 0.29 is a safe value. + */ +limit: .float 0.29 +one: .float 1.0 + /* - * Since the fyl2xp1 instruction has such a limited range: - * -(1 - (sqrt(2) / 2)) <= x <= sqrt(2) - 1 - * it's not worth trying to use it. + * Use the fyl2xp1 function when the argument is in the range -0.29 to 0.29, + * otherwise fyl2x with the needed extra computation. */ - + .text ENTRY(__log1pf) fldln2 - flds 4(%esp) - fld1 - faddp + + flds 4(%esp) + +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + + fld %st + fabs +#ifdef PIC + fcomps limit@GOTOFF(%edx) +#else + fcomps limit +#endif + fnstsw + sahf + jc 2f + +#ifdef PIC + fadds one@GOTOFF(%edx) +#else + fadds one +#endif fyl2x ret -PSEUDO_END (__log1pf) + +2: fyl2xp1 + ret + +END (__log1pf) weak_alias (__log1pf, log1pf) diff --git a/sysdeps/libm-i387/s_log1pl.S b/sysdeps/libm-i387/s_log1pl.S index 647e136..05a17b2 100644 --- a/sysdeps/libm-i387/s_log1pl.S +++ b/sysdeps/libm-i387/s_log1pl.S @@ -7,20 +7,62 @@ #include <machine/asm.h> -RCSID("$NetBSD: $") +RCSID("$NetBSD: s_log1p.S,v 1.7 1995/05/09 00:10:58 jtc Exp $") + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + .align ALIGNARG(4) + /* The fyl2xp1 can only be used for values in + -1 + sqrt(2) / 2 <= x <= 1 - sqrt(2) / 2 + 0.29 is a safe value. + */ +limit: .tfloat 0.29 + /* Please note: we use a double value here. Since 1.0 has + an exact representation this does not effect the accuracy + but it helps to optimize the code. */ +one: .double 1.0 /* - * Since the fyl2xp1 instruction has such a limited range: - * -(1 - (sqrt(2) / 2)) <= x <= sqrt(2) - 1 - * it's not worth trying to use it. + * Use the fyl2xp1 function when the argument is in the range -0.29 to 0.29, + * otherwise fyl2x with the needed extra computation. */ - + .text ENTRY(__log1pl) fldln2 - fldt 4(%esp) - fld1 - faddp + + fldt 4(%esp) + +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + + fld %st + fabs +#ifdef PIC + fldt limit@GOTOFF(%edx) +#else + fldt limit +#endif + fcompp + fnstsw + sahf + jnc 2f + +#ifdef PIC + faddl one@GOTOFF(%edx) +#else + faddl one +#endif fyl2x ret -PSEUDO_END (__log1pl) + +2: fyl2xp1 + ret + +END (__log1pl) weak_alias (__log1pl, log1pl) diff --git a/sysdeps/libm-i387/s_logb.S b/sysdeps/libm-i387/s_logb.S index 92d8fee..2f1afd4 100644 --- a/sysdeps/libm-i387/s_logb.S +++ b/sysdeps/libm-i387/s_logb.S @@ -12,5 +12,5 @@ ENTRY(__logb) fxtract fstpl %st ret -PSEUDO_END (__logb) +END (__logb) weak_alias (__logb, logb) diff --git a/sysdeps/libm-i387/s_logbf.S b/sysdeps/libm-i387/s_logbf.S index b557974..0052497 100644 --- a/sysdeps/libm-i387/s_logbf.S +++ b/sysdeps/libm-i387/s_logbf.S @@ -12,5 +12,5 @@ ENTRY(__logbf) fxtract fstpl %st ret -PSEUDO_END (__logbf) +END (__logbf) weak_alias (__logbf, logbf) diff --git a/sysdeps/libm-i387/s_logbl.S b/sysdeps/libm-i387/s_logbl.S index 91bddb6..6ce274c 100644 --- a/sysdeps/libm-i387/s_logbl.S +++ b/sysdeps/libm-i387/s_logbl.S @@ -12,5 +12,5 @@ ENTRY(__logbl) fldt 4(%esp) fxtract ret -PSEUDO_END (__logbl) +END (__logbl) weak_alias (__logbl, logbl) diff --git a/sysdeps/libm-i387/s_rint.S b/sysdeps/libm-i387/s_rint.S index 9231fef..be36c5f 100644 --- a/sysdeps/libm-i387/s_rint.S +++ b/sysdeps/libm-i387/s_rint.S @@ -11,5 +11,5 @@ ENTRY(__rint) fldl 4(%esp) frndint ret -PSEUDO_END (__rint) +END (__rint) weak_alias (__rint, rint) diff --git a/sysdeps/libm-i387/s_rintf.S b/sysdeps/libm-i387/s_rintf.S index 3e35f2c..2b358c1 100644 --- a/sysdeps/libm-i387/s_rintf.S +++ b/sysdeps/libm-i387/s_rintf.S @@ -11,5 +11,5 @@ ENTRY(__rintf) flds 4(%esp) frndint ret -PSEUDO_END (__rintf) +END (__rintf) weak_alias (__rintf, rintf) diff --git a/sysdeps/libm-i387/s_rintl.S b/sysdeps/libm-i387/s_rintl.S index a8198d3..fd1ae63 100644 --- a/sysdeps/libm-i387/s_rintl.S +++ b/sysdeps/libm-i387/s_rintl.S @@ -12,5 +12,5 @@ ENTRY(__rintl) fldt 4(%esp) frndint ret -PSEUDO_END (__rintl) +END (__rintl) weak_alias (__rintl, rintl) diff --git a/sysdeps/libm-i387/s_scalbn.S b/sysdeps/libm-i387/s_scalbn.S index 4a41495..3ec56d4 100644 --- a/sysdeps/libm-i387/s_scalbn.S +++ b/sysdeps/libm-i387/s_scalbn.S @@ -12,5 +12,5 @@ ENTRY(__scalbn) fldl 4(%esp) fscale ret -PSEUDO_END (__scalbn) +END (__scalbn) weak_alias (__scalbn, scalbn) diff --git a/sysdeps/libm-i387/s_scalbnf.S b/sysdeps/libm-i387/s_scalbnf.S index 080304d..b1a1c46 100644 --- a/sysdeps/libm-i387/s_scalbnf.S +++ b/sysdeps/libm-i387/s_scalbnf.S @@ -12,5 +12,5 @@ ENTRY(__scalbnf) flds 4(%esp) fscale ret -PSEUDO_END (__scalbnf) +END (__scalbnf) weak_alias (__scalbnf, scalbnf) diff --git a/sysdeps/libm-i387/s_scalbnl.S b/sysdeps/libm-i387/s_scalbnl.S index adf1dea..0f33238 100644 --- a/sysdeps/libm-i387/s_scalbnl.S +++ b/sysdeps/libm-i387/s_scalbnl.S @@ -13,5 +13,5 @@ ENTRY(__scalbnl) fldt 4(%esp) fscale ret -PSEUDO_END (__scalbnl) +END (__scalbnl) weak_alias (__scalbnl, scalbnl) diff --git a/sysdeps/libm-i387/s_significand.S b/sysdeps/libm-i387/s_significand.S index ff72b88..4f8d91f 100644 --- a/sysdeps/libm-i387/s_significand.S +++ b/sysdeps/libm-i387/s_significand.S @@ -12,5 +12,5 @@ ENTRY(__significand) fxtract fstpl %st(1) ret -PSEUDO_END (__significand) +END (__significand) weak_alias (__significand, significand) diff --git a/sysdeps/libm-i387/s_significandf.S b/sysdeps/libm-i387/s_significandf.S index af92886..603e9f0 100644 --- a/sysdeps/libm-i387/s_significandf.S +++ b/sysdeps/libm-i387/s_significandf.S @@ -12,5 +12,5 @@ ENTRY(__significandf) fxtract fstpl %st(1) ret -PSEUDO_END (__significandf) +END (__significandf) weak_alias (__significandf, significandf) diff --git a/sysdeps/libm-i387/s_significandl.S b/sysdeps/libm-i387/s_significandl.S index 1483a0d..1d5f4a3 100644 --- a/sysdeps/libm-i387/s_significandl.S +++ b/sysdeps/libm-i387/s_significandl.S @@ -13,5 +13,5 @@ ENTRY(__significandl) fxtract fincstp ret -PSEUDO_END (__significandl) +END (__significandl) weak_alias (__significandl, significandl) diff --git a/sysdeps/libm-i387/s_sin.S b/sysdeps/libm-i387/s_sin.S index f06c944..f048e52 100644 --- a/sysdeps/libm-i387/s_sin.S +++ b/sysdeps/libm-i387/s_sin.S @@ -11,7 +11,7 @@ ENTRY(__sin) fldl 4(%esp) fsin fnstsw %ax - andw $0x400,%ax + testl $0x400,%eax jnz 1f ret 1: fldpi @@ -19,10 +19,10 @@ ENTRY(__sin) fxch %st(1) 2: fprem1 fnstsw %ax - andw $0x400,%ax + testl $0x400,%eax jnz 2b fstp %st(1) fsin ret -PSEUDO_END (__sin) +END (__sin) weak_alias (__sin, sin) diff --git a/sysdeps/libm-i387/s_sinf.S b/sysdeps/libm-i387/s_sinf.S index 464ccb2..a010d60 100644 --- a/sysdeps/libm-i387/s_sinf.S +++ b/sysdeps/libm-i387/s_sinf.S @@ -12,5 +12,5 @@ ENTRY(__sinf) flds 4(%esp) fsin ret -PSEUDO_END (__sinf) +END (__sinf) weak_alias (__sinf, sinf) diff --git a/sysdeps/libm-i387/s_sinl.S b/sysdeps/libm-i387/s_sinl.S index 2872334..7c8c95f 100644 --- a/sysdeps/libm-i387/s_sinl.S +++ b/sysdeps/libm-i387/s_sinl.S @@ -13,7 +13,7 @@ ENTRY(__sinl) fldt 4(%esp) fsin fnstsw %ax - andw $0x400,%ax + testl $0x400,%eax jnz 1f ret 1: fldpi @@ -21,10 +21,10 @@ ENTRY(__sinl) fxch %st(1) 2: fprem1 fnstsw %ax - andw $0x400,%ax + testl $0x400,%eax jnz 2b fstp %st(1) fsin ret -PSEUDO_END (__sinl) +END (__sinl) weak_alias (__sinl, sinl) diff --git a/sysdeps/libm-i387/s_tan.S b/sysdeps/libm-i387/s_tan.S index 9333671..7b3547a 100644 --- a/sysdeps/libm-i387/s_tan.S +++ b/sysdeps/libm-i387/s_tan.S @@ -11,7 +11,7 @@ ENTRY(__tan) fldl 4(%esp) fptan fnstsw %ax - andw $0x400,%ax + testl $0x400,%eax jnz 1f fstp %st(0) ret @@ -20,11 +20,11 @@ ENTRY(__tan) fxch %st(1) 2: fprem1 fstsw %ax - andw $0x400,%ax + testl $0x400,%eax jnz 2b fstp %st(1) fptan fstp %st(0) ret -PSEUDO_END (__tan) +END (__tan) weak_alias (__tan, tan) diff --git a/sysdeps/libm-i387/s_tanf.S b/sysdeps/libm-i387/s_tanf.S index cbf8dd8..7a75091 100644 --- a/sysdeps/libm-i387/s_tanf.S +++ b/sysdeps/libm-i387/s_tanf.S @@ -13,5 +13,5 @@ ENTRY(__tanf) fptan fstp %st(0) ret -PSEUDO_END (__tanf) +END (__tanf) weak_alias (__tanf, tanf) diff --git a/sysdeps/libm-i387/s_tanl.S b/sysdeps/libm-i387/s_tanl.S index c818e96..f2bdd6a 100644 --- a/sysdeps/libm-i387/s_tanl.S +++ b/sysdeps/libm-i387/s_tanl.S @@ -13,7 +13,7 @@ ENTRY(__tanl) fldt 4(%esp) fptan fnstsw %ax - andw $0x400,%ax + testl $0x400,%eax jnz 1f fstp %st(0) ret @@ -22,11 +22,11 @@ ENTRY(__tanl) fxch %st(1) 2: fprem1 fstsw %ax - andw $0x400,%ax + testl $0x400,%eax jnz 2b fstp %st(1) fptan fstp %st(0) ret -PSEUDO_END (__tanl) +END (__tanl) weak_alias (__tanl, tanl) diff --git a/sysdeps/libm-ieee754/s_asinhf.c b/sysdeps/libm-ieee754/s_asinhf.c index d57508d..fac256d 100644 --- a/sysdeps/libm-ieee754/s_asinhf.c +++ b/sysdeps/libm-ieee754/s_asinhf.c @@ -8,7 +8,7 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -21,13 +21,13 @@ static char rcsid[] = "$NetBSD: s_asinhf.c,v 1.5 1995/05/12 04:57:39 jtc Exp $"; #include "math_private.h" #ifdef __STDC__ -static const float +static const float #else -static float +static float #endif one = 1.0000000000e+00, /* 0x3F800000 */ ln2 = 6.9314718246e-01, /* 0x3f317218 */ -huge= 1.0000000000e+30; +huge= 1.0000000000e+30; #ifdef __STDC__ float __asinhf(float x) @@ -35,21 +35,21 @@ huge= 1.0000000000e+30; float __asinhf(x) float x; #endif -{ +{ float t,w; int32_t hx,ix; GET_FLOAT_WORD(hx,x); ix = hx&0x7fffffff; if(ix>=0x7f800000) return x+x; /* x is inf or NaN */ - if(ix< 0x31800000) { /* |x|<2**-28 */ + if(ix< 0x38000000) { /* |x|<2**-14 */ if(huge+x>one) return x; /* return x inexact except 0 */ - } - if(ix>0x4d800000) { /* |x| > 2**28 */ + } + if(ix>0x47000000) { /* |x| > 2**14 */ w = __ieee754_logf(fabsf(x))+ln2; - } else if (ix>0x40000000) { /* 2**28 > |x| > 2.0 */ + } else if (ix>0x40000000) { /* 2**14 > |x| > 2.0 */ t = fabsf(x); w = __ieee754_logf((float)2.0*t+one/(__ieee754_sqrtf(x*x+one)+t)); - } else { /* 2.0 > |x| > 2**-28 */ + } else { /* 2.0 > |x| > 2**-14 */ t = x*x; w =__log1pf(fabsf(x)+t/(one+__ieee754_sqrtf(one+t))); } diff --git a/sysdeps/posix/bsd_signal.c b/sysdeps/posix/bsd_signal.c new file mode 100644 index 0000000..4941485 --- /dev/null +++ b/sysdeps/posix/bsd_signal.c @@ -0,0 +1,50 @@ +/* X/Open compatibility function. + Copyright (C) 1991, 1992, 1996 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <errno.h> +#include <signal.h> + + +sigset_t _sigintr; /* Set by siginterrupt. */ + +/* Set the handler for the signal SIG to HANDLER, + returning the old handler, or SIG_ERR on error. */ +__sighandler_t +bsd_signal (sig, handler) + int sig; + __sighandler_t handler; +{ + struct sigaction act, oact; + + /* Check signal extents to protect __sigismember. */ + if (handler == SIG_ERR || sig < 1 || sig >= NSIG) + { + __set_errno (EINVAL); + return SIG_ERR; + } + + act.sa_handler = handler; + if (__sigemptyset (&act.sa_mask) < 0) + return SIG_ERR; + act.sa_flags = __sigismember (&_sigintr, sig) ? 0 : SA_RESTART; + if (__sigaction (sig, &act, &oact) < 0) + return SIG_ERR; + + return oact.sa_handler; +} diff --git a/sysdeps/posix/raise.c b/sysdeps/posix/raise.c index 159fdd5..3a49fe5 100644 --- a/sysdeps/posix/raise.c +++ b/sysdeps/posix/raise.c @@ -1,28 +1,29 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. -This file is part of the GNU C Library. +/* Copyright (C) 1991, 1996 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 -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. -The GNU C Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ -#include <ansidecl.h> #include <signal.h> #include <unistd.h> /* Raise the signal SIG. */ int -DEFUN(raise, (sig), int sig) +raise (sig) + int sig; { - return __kill(__getpid(), sig); + return __kill (__getpid (), sig); } +weak_alias (raise, gsignal) diff --git a/sysdeps/posix/signal.c b/sysdeps/posix/signal.c index ce93116..25e7cab 100644 --- a/sysdeps/posix/signal.c +++ b/sysdeps/posix/signal.c @@ -20,8 +20,6 @@ #include <signal.h> -sigset_t _sigintr; /* Set by siginterrupt. */ - /* Set the handler for the signal SIG to HANDLER, returning the old handler, or SIG_ERR on error. */ __sighandler_t @@ -41,9 +39,12 @@ signal (sig, handler) act.sa_handler = handler; if (__sigemptyset (&act.sa_mask) < 0) return SIG_ERR; - act.sa_flags = __sigismember (&_sigintr, sig) ? 0 : SA_RESTART; + act.sa_flags = SA_ONESHOT | SA_NOMASK | SA_INTERRUPT; + act.sa_flags &= ~SA_RESTART; if (__sigaction (sig, &act, &oact) < 0) return SIG_ERR; return oact.sa_handler; } + +weak_alias (signal, ssignal) diff --git a/sysdeps/stub/raise.c b/sysdeps/stub/raise.c index cac49df..97fd5fe 100644 --- a/sysdeps/stub/raise.c +++ b/sysdeps/stub/raise.c @@ -1,20 +1,20 @@ /* Copyright (C) 1991, 1995, 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. + This file is part of the GNU C Library. -The GNU C Library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. -The GNU C Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ #include <signal.h> #include <errno.h> @@ -28,4 +28,7 @@ raise (sig) return -1; } +weak_alias (raise, gsignal) + stub_warning (raise) +stub_warning (gsignal) diff --git a/sysdeps/stub/signal.c b/sysdeps/stub/signal.c index 6ee587a..066a8cc 100644 --- a/sysdeps/stub/signal.c +++ b/sysdeps/stub/signal.c @@ -1,20 +1,20 @@ /* Copyright (C) 1991, 1995, 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. + This file is part of the GNU C Library. -The GNU C Library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. -The GNU C Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ #include <errno.h> #include <signal.h> @@ -31,5 +31,7 @@ signal (sig, handler) return SIG_ERR; } +weak_alias (signal, ssignal) stub_warning (signal) +stub_warning (ssignal) diff --git a/sysdeps/unix/sysv/linux/m68k/setjmp.c b/sysdeps/unix/sysv/linux/m68k/setjmp.c index ef609cc..477e896 100644 --- a/sysdeps/unix/sysv/linux/m68k/setjmp.c +++ b/sysdeps/unix/sysv/linux/m68k/setjmp.c @@ -76,8 +76,6 @@ __setjmp (jmp_buf env) : : "m" (env[0].__jmpbuf[0].__fpregs[0])); #endif - /* Don't save the signal mask. */ - env[0].__mask_was_saved = 0; - + /* The signal mask has already been dealt with. */ return 0; } diff --git a/sysdeps/unix/sysv/linux/signal.c b/sysdeps/unix/sysv/linux/signal.c index 55f1108..bc4e4e8 100644 --- a/sysdeps/unix/sysv/linux/signal.c +++ b/sysdeps/unix/sysv/linux/signal.c @@ -1 +1,3 @@ +/* We need this file since otherwise `signal' would be handled as a + system call. */ #include <sysdeps/posix/signal.c> diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list index 07a3c1d..38896e7 100644 --- a/sysdeps/unix/sysv/linux/syscalls.list +++ b/sysdeps/unix/sysv/linux/syscalls.list @@ -30,6 +30,7 @@ nanosleep - nanosleep 2 __libc_nanosleep __nanosleep nanosleep pause - pause 0 __libc_pause pause personality init-first personality 1 __personality personality pipe - pipe 1 __pipe pipe +query_module EXTRA query_module 5 query_module s_getpriority getpriority getpriority 2 __syscall_getpriority s_ptrace ptrace ptrace 4 __syscall_ptrace s_reboot EXTRA reboot 3 __syscall_reboot diff --git a/time/localtime.c b/time/localtime.c index 5e1dd0a..f228776 100644 --- a/time/localtime.c +++ b/time/localtime.c @@ -1,4 +1,4 @@ -/* localtime -- convert `time_t' to `struct tm' in local time zone +/* Convert `time_t' to `struct tm' in local time zone. Copyright (C) 1991, 92, 93, 95, 96 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -26,29 +26,22 @@ struct tm _tmbuf; /* Prototype for the internal function to get information based on TZ. */ extern void __tzset_internal __P ((void)); +extern int __tz_compute __P ((time_t timer, struct tm *tp)); +extern int __tzfile_compute __P ((time_t timer, + long int *leap_correct, int *leap_hit)); +extern int __use_tzfile; -/* Return the `struct tm' representation of *TIMER in the local timezone. */ -struct tm * -localtime (timer) - const time_t *timer; -{ - return __localtime_r (timer, &_tmbuf); -} +/* This lock is defined in tzset.c and locks all the data defined there + and in tzfile.c; the internal functions do no locking themselves. + This lock is only taken here and in `tzset'. */ +__libc_lock_define (extern, __tzset_lock) -struct tm * -__localtime_r (timer, tp) - const time_t *timer; - struct tm *tp; + +/* Return the `struct tm' representation of *TIMER in the local timezone. */ +static struct tm * +localtime_internal (const time_t *timer, struct tm *tp) { - /* This lock is defined in tzset.c and locks all the data defined there - and in tzfile.c; the internal functions do no locking themselves. - This lock is only taken here and in `tzset'. */ - __libc_lock_define (extern, __tzset_lock) - extern int __use_tzfile; - extern int __tz_compute __P ((time_t timer, struct tm *tp)); - extern int __tzfile_compute __P ((time_t timer, - long int *leap_correct, int *leap_hit)); long int leap_correction; int leap_extra_secs; @@ -58,11 +51,6 @@ __localtime_r (timer, tp) return NULL; } - __libc_lock_lock (__tzset_lock); - - /* Make sure the database is initialized. */ - __tzset_internal (); - if (__use_tzfile) { if (! __tzfile_compute (*timer, &leap_correction, &leap_extra_secs)) @@ -86,8 +74,46 @@ __localtime_r (timer, tp) tp->tm_zone = __tzname[__daylight]; } + return tp; +} + + +/* POSIX.1 8.3.7.2 says that localtime_r is not required to set + tzname. This is a good idea since this allows at least a bit more + parallelism. */ + +struct tm * +localtime (timer) + const time_t *timer; +{ + struct tm *result; + + __libc_lock_lock (__tzset_lock); + + /* Make sure the database is initialized. */ + __tzset_internal (); + + result = localtime_internal (timer, &_tmbuf); + __libc_lock_unlock (__tzset_lock); - return tp; + return result; +} + + +struct tm * +__localtime_r (timer, tp) + const time_t *timer; + struct tm *tp; +{ + struct tm *result; + + __libc_lock_lock (__tzset_lock); + + result = localtime_internal (timer, tp); + + __libc_lock_unlock (__tzset_lock); + + return result; } weak_alias (__localtime_r, localtime_r) |