diff options
author | Ulrich Drepper <drepper@redhat.com> | 1996-10-06 02:05:11 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1996-10-06 02:05:11 +0000 |
commit | cccda09fd700b0720f2ec3c7c516e0fedca4a6c2 (patch) | |
tree | 5315e37ded435676bc9fff5462811cb85af47994 /sysdeps | |
parent | 106b47fccffad8b701393adfe0bff6aa8abb9852 (diff) | |
download | glibc-cccda09fd700b0720f2ec3c7c516e0fedca4a6c2.zip glibc-cccda09fd700b0720f2ec3c7c516e0fedca4a6c2.tar.gz glibc-cccda09fd700b0720f2ec3c7c516e0fedca4a6c2.tar.bz2 |
update from main archive 961005cvs/libc-971228cvs/libc-971222cvs/libc-971214cvs/libc-971208cvs/libc-971207cvs/libc-971204cvs/libc-971203cvs/libc-971201cvs/libc-971125cvs/libc-971124cvs/libc-971123cvs/libc-971122cvs/libc-971118cvs/libc-971117cvs/libc-971112cvs/libc-971111cvs/libc-971106cvs/libc-971105cvs/libc-971103cvs/libc-971031cvs/libc-971029cvs/libc-971026cvs/libc-971012cvs/libc-971011cvs/libc-970930cvs/libc-970926cvs/libc-970924cvs/libc-970920cvs/libc-970916cvs/libc-970915cvs/libc-970912cvs/libc-970911cvs/libc-970904cvs/libc-970829cvs/libc-961007cvs/libc-961006
Sun Oct 6 02:05:52 1996 Ulrich Drepper <drepper@cygnus.com>
* posix/getopt.c: Add casts to prevent warnings.
* posix/regex.c: Likewise.
* math/Makefile (long-m-routines, long-m-yes): Define to correct
values to make `long double' functions available.
(distribute): Add $(long-m-yes:=.c).
* sysdeps/libm-i387/s_ceill.S: Correct loading of return value.
Use long double instruction.
* sysdeps/libm-ieee754/e_atanhl.c (huge): Correct constant.
* sysdeps/libm-ieee754/e_asinhl.c: Likewise.
* sysdeps/libm-ieee754/s_tanhl.c: Likewise.
* sysdeps/libm-ieee754/e_coshl.c: New file.
* sysdeps/libm-ieee754/s_asinh.c [!NO_LONG_DOUBLE]: Define names
for `long double' version as alias.
* sysdeps/libm-ieee754/s_atan.c: Likewise.
* sysdeps/libm-ieee754/s_cbrt.c: Likewise.
* sysdeps/libm-ieee754/s_ceil.c: Likewise.
* sysdeps/libm-ieee754/s_copysign.c: Likewise.
* sysdeps/libm-ieee754/s_cos.c: Likewise.
* sysdeps/libm-ieee754/s_erf.c: Likewise.
* sysdeps/libm-ieee754/s_expm1.c: Likewise.
* sysdeps/libm-ieee754/s_fabs.c: Likewise.
* sysdeps/libm-ieee754/s_finite.c: Likewise.
* sysdeps/libm-ieee754/s_floor.c: Likewise.
* sysdeps/libm-ieee754/s_frexp.c: Likewise.
* sysdeps/libm-ieee754/s_ilogb.c: Likewise.
* sysdeps/libm-ieee754/s_ldexp.c: Likewise.
* sysdeps/libm-ieee754/s_log1p.c: Likewise.
* sysdeps/libm-ieee754/s_logb.c: Likewise.
* sysdeps/libm-ieee754/s_modf.c: Likewise.
* sysdeps/libm-ieee754/s_nextafter.c: Likewise.
* sysdeps/libm-ieee754/s_rint.c: Likewise.
* sysdeps/libm-ieee754/s_scalbn.c: Likewise.
* sysdeps/libm-ieee754/s_significand.c: Likewise.
* sysdeps/libm-ieee754/s_sin.c: Likewise.
* sysdeps/libm-ieee754/s_tan.c: Likewise.
* sysdeps/libm-ieee754/s_tanh.c: Likewise.
* sysdeps/libm-ieee754/w_acos.c: Likewise.
* sysdeps/libm-ieee754/w_acosh.c: Likewise.
* sysdeps/libm-ieee754/w_sin.c: Likewise.
* sysdeps/libm-ieee754/w_atan2.c: Likewise.
* sysdeps/libm-ieee754/w_atanh.c: Likewise.
* sysdeps/libm-ieee754/w_cabs.c: Likewise.
* sysdeps/libm-ieee754/w_cosh.c: Likewise.
* sysdeps/libm-ieee754/w_drem.c: Likewise.
* sysdeps/libm-ieee754/w_exp.c: Likewise.
* sysdeps/libm-ieee754/w_fmod.c: Likewise.
* sysdeps/libm-ieee754/w_gamma.c: Likewise.
* sysdeps/libm-ieee754/w_gamma_r.c: Likewise.
* sysdeps/libm-ieee754/w_hypot.c: Likewise.
* sysdeps/libm-ieee754/w_j0.c: Likewise.
* sysdeps/libm-ieee754/w_j1.c: Likewise.
* sysdeps/libm-ieee754/w_jn.c: Likewise.
* sysdeps/libm-ieee754/w_lgamma.c: Likewise.
* sysdeps/libm-ieee754/w_lgamma_r.c: Likewise.
* sysdeps/libm-ieee754/w_log.c: Likewise.
* sysdeps/libm-ieee754/w_log10.c: Likewise.
* sysdeps/libm-ieee754/w_pow.c: Likewise.
* sysdeps/libm-ieee754/w_remainder.c: Likewise.
* sysdeps/libm-ieee754/w_scalb.c: Likewise.
* sysdeps/libm-ieee754/w_sinh.c: Likewise.
* sysdeps/libm-ieee754/w_sqrt.c: Likewise.
Stub files for missing long double math functions.
* sysdeps/stub/e_acoshl.c: New file.
* sysdeps/stub/e_hypotl.c: New file.
* sysdeps/stub/e_j0l.c: New file.
* sysdeps/stub/e_j1l.c: New file.
* sysdeps/stub/e_jnl.c: New file.
* sysdeps/stub/e_lgammal_r.c: New file.
* sysdeps/stub/e_powl.c: New file.
* sysdeps/stub/e_rem_pio2l.c: New file.
* sysdeps/stub/e_sinhl.c: New file.
* sysdeps/stub/k_cosl.c: New file.
* sysdeps/stub/k_rem_pio2l.c: New file.
* sysdeps/stub/k_sinl.c: New file.
* sysdeps/stub/k_tanl.c: New file.
* sysdeps/stub/s_erfl.c: New file.
* sysdeps/stub/s_expm1l.c: New file.
* sysdeps/i386/__longjmp.S: Use PSEUDO_END macro to provide
.size directive.
* sysdeps/i386/bsd-_setjmp.S: Likewise.
* sysdeps/i386/bsd-setjmp.S: Likewise.
* sysdeps/i386/memchr.S: Likewise.
* sysdeps/i386/memcmp.S: Likewise.
* sysdeps/i386/setjmp.S: Likewise.
* sysdeps/i386/stpcpy.S: Likewise.
* sysdeps/i386/stpncpy.S: Likewise.
* sysdeps/i386/strchr.S: Likewise.
* sysdeps/i386/strcspn.S: Likewise.
* sysdeps/i386/strpbrk.S: Likewise.
* sysdeps/i386/strrchr.S: Likewise.
* sysdeps/i386/strspn.S: Likewise.
* sysdeps/i386/strtok.S: Likewise.
* sysdeps/i386/i486/strcat.S: Likewise.
* sysdeps/i386/i486/strlen.S: Likewise.
* sysdeps/i386/i586/memset.S: Likewise.
* sysdeps/i386/i586/strchr.S: Likewise.
* sysdeps/i386/i586/strlen.S: Likewise.
* sysdeps/libm-i387/e_acos.S: Likewise.
* 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_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/s_tan.S: Likewise.
* sysdeps/libm-i387/s_tanf.S: Likewise.
* sysdeps/libm-i387/s_tanl.S: Likewise.
* sysdeps/unix/sysv/linux/i386/clone.S: Add .size directive.
* sysdeps/unix/sysv/linux/i386/mmap.S. Likewise.
* sysdeps/unix/sysv/linux/i386/socket.S. Likewise.
* sysdeps/unix/sysv/linux/i386/sysdep.S. More compact .size line.
* sysdeps/i386/sysdep.h (ASM_SIZE_DIRECTIVE): New macro. Used
to provide .size directive on ELF systems.
* sysdeps/unix/sysv/linux/i386/profil-counter.h: Include
<sigcontext.h> and rename parameter type to sigcontext.
* sysdeps/unix/sysv/linux/i386/sigcontext.h New file.
* sysdeps/unix/sysv/linux/i386/syscall.S: From Linux 2.1 on
negative values might occur as positive results. Test against
-125 to decide for error or not.
* sysdeps/unix/sysv/linux/i386/sysdep.h: Likewise for system calls.
Thu Oct 3 21:07:58 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* elf/dl-open.c: Use _DYNAMIC instead of _dl_start to decide
whether this is a statically linked program. The latter is now
always defined.
Fri Oct 4 02:08:10 1996 Bang Jun-Young <bangjy@nownuri.nowcom.co.kr>
* po/ko.po: Update.
Fri Oct 4 02:07:46 1996 Michel Robitaille <robitail@IRO.UMontreal.CA>
* po/fr.po: New file.
Fri Oct 4 05:04:52 1996 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/sysv/linux/i386/sigcontext.h: New file.
Add support for MD5 crypt replacement.
* Makefile (subdirs): Add crypt.
* shlib-versions: Add entry for libcrypt.
* crypt/md5-crypt.c: New file.
* crypt/md5.c: New file.
* crypt/md5.h: New file.
* sysdeps/generic/crypt-entry.c: New file.
* sysdeps/generic/crypt.h: New file.
Thu Oct 3 20:53:23 1996 Andreas Jaeger <aj@arthur.pfalz.de>
* dirent/tst-seekdir.c: Provide correct prototypes.
* io/test-utime.c: Likewise.
* malloc/mallocbug.c: Likewise.
* posix/testfnm.c: Likewise.
* stdio-common/xbug.c: Likewise.
* sysdeps/posix/cuserid.c: Likewise.
Wed Oct 2 13:33:48 1996 Richard Henderson <rth@tamu.edu>
Provide optimized string functions for Alpha processors.
* sysdeps/alpha/bzero.S: New file.
* sysdeps/alpha/memset.S: New file.
* sysdeps/alpha/stpcpy.S: New file.
* sysdeps/alpha/stpncpy.S: New file.
* sysdeps/alpha/strcat.S: New file.
* sysdeps/alpha/strchr.S: New file.
* sysdeps/alpha/strcpy.S: New file.
* sysdeps/alpha/strncat.S: New file.
* sysdeps/alpha/strncpy.S: New file.
* sysdeps/alpha/strrchr.S: New file.
* sysdeps/alpha/stxcpy.S: New file.
* sysdeps/alpha/stxncpy.S: New file.
* sysdeps/alpha/Makefile [$(sudir)==string]: Add stxcpy and
stxncpy to sysdep_routines.
Minor correction.
Wed Oct 2 13:41:48 1996 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/generic/strtok.c: Don't set stored pointer to NULL when
notheing is found. This guarantees all subsequent calls behave
the same.
* sysdeps/generic/strtok_r.c: Likewise.
Mon Sep 30 22:27:36 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/posix/tempname.c (__stdio_gen_tempname): Don't declare
`i' as const.
Mon Sep 30 22:38:29 1996 Richard Henderson <rth@tamu.edu>
* sysdeps/generic/strtok.c: When we hit EOS, don't set olds to
NULL immediately; we're going to get called one more time.
* sysdeps/generic/strtok_r.c: Likewise.
Tue Oct 1 09:12:21 1996 Ulrich Drepper <drepper@cygnus.com>
* locale/programs/ld-time.c: Always write some bytes at the end of
the file even if no `era's are specified.
* stdio-common/tmpname.c (tmpbuf): Don't define as array of
pointers.
Tue Oct 1 01:43:11 1996 Ulrich Drepper <drepper@cygnus.com>
* libio/iofclose.c: Move unlocking to right position.
Mon Sep 30 03:08:34 1996 Richard Henderson <rth@tamu.edu>
* misc/Makefile: Kill force-wrapper.
* misc/force-wrapper.c: Delete.
* elf/eval.c: Add <string.h>.
* gmon/sys/gmon_out.h: Nonsense like `char foo[sizeof(char*)]'
followed by `bcopy(&ptr, &foo, sizeof(foo))' helps portability
and binary compatibility not at all. Better to do `char *foo'
followed by `foo = ptr' as it is much cleaner.
(struct gmon_hdr): Fix version.
(struct gmon_hist_hdr): Fix low_pc, high_pc, hist_size, prof_rate.
(struct gmon_cg_arc_record): Fix from_pc, self_pc, count.
* gmon/gmon.c: De-ansidecl-ify.
(write_hist): De-bcopy-fy.
(write_call_graph): Likewise.
* gmon/mcount.c: Assume _MCOUNT_DECL does the entire declaration.
* sysdeps/alpha/machine-gmon.h: Update _MCOUNT_DECL.
* sysdeps/generic/machine-gmon.h: Likewise.
* resolv/netdb.h: Add __set_h_errno to mimic __set_errno.
* nss/getXXent_r.c: Use __set_h_errno to set h_errno in all funcs.
* nss/nss_dns/dns-network.c: Likewise.
* resolv/getunamaddr.c: Likewise. Also use __set_errno where needed.
* resolv/getnetnamadr.c: Likewise.
* resolv/res_debug.c: Likewise.
* resolv/res_mkquery.c: Likewise.
* resolv/res_query.c: Likewise.
* libio/clearerr_u.c: It's not necessary to define __ protected
function so don't do it.
* libio/feof_u.c, libio/ferror_u.c, libio/fputc_u.c,
libio/getc_u.c, libio/getchar_u.c, libio/iofflush_u.c: Likewise.
* libio/fgetc.c: Avoid a warning by casting _IO_funlockfile for
the cleanup registrar.
* libio/fputc.c, libio/freopen.c, libio/fseek.c, libio/getc.c,
libio/getchar.c, libio/iofclose.c, libio/iofflush.c,
libio/iofgetpos.c, libio/iofgets.c, libio/iofputs.c,
libio/iofread.c, libio/iofsetpos.c, libio/ioftell.c,
libio/iofwrite.c, libio/iogetdelim.c, libio/iogets.c,
libio/ioputs.c, libio/iosetbuffer.c, libio/iosetvbuf.c,
libio/ioungetc.c, libio/putc.c, libio/putchar.c, libio/rewind.c:
Likewise.
* locale/programs/ld-ctype.c: Include <alloca.h>.
* login/login_tty.c: Get login_tty prototype from <utmp.h>.
* posix/sys/types.h: Change #defines to typedefs. This is looking
forward to more comprehensive namespace cleanups for C++.
* posix/unistd.h: Likewise for ssize_t.
* pwd/getpw.c: Prototype and rename getpw -> __getpw and add a
weak alias.
* resolv/base64.c: Don't do `for (NULL; ...)' as it causes
`statement with no effect' warnings.
* resolv/inet_neta.c: Include <string.h> for strlen.
* stdio-common/getline.c: Undef ssize_t before libio redefinition.
* stdio-common/tstgetln.c: Same. De-ansidecl-ify.
* stdio-common/vfprintf.c: Same for va_list.
* stdio-common/vfscanf.c: Same.
* stdio-common/reg-printf.c: Prototype the __ function.
* stdio-common/scanf.c [USE_IN_LIBIO]: Include <libioP.h> for
_IO_vscanf declaration.
* string/tester.c: Tsk, tsk. Don't cast pointers to int,
but to unsigned long for the health of 64-bit systems.
* sunrpc/svc_udp.c: Define MAX only if we don't have it yet.
Many system's <sys/param.h> pulls this in.
* sysdeps/generic/dl-cache.c: Kill the bottom half of the
patch doubled file.
* sysdeps/generic/pty.c (forkpty): Get login_tty decl from <utmp.h>
instead of defining it locally.
* sysdeps/posix/sigvec.c: Prototype wrapper_handler and convert_mask.
* sysdeps/stub/chflags.c: Prototype chflags.
* sysdeps/stub/fchflags.c: Prototype fchflags.
* sysdeps/stub/sstk.c: Prototype sstk.
* sysdeps/unix/alpha/sysdep.S: Add strong alias from errno
variable to __errno. Update __syscall_error to store to both
the global and per-thread variables.
* sysdeps/unix/sysv/linux/init-first.c: Change include of
init-first.h from "" to <> as "" does not search the include path.
Prototype _dl_start.
Sun Sep 29 14:41:17 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/unix/Makefile ($(common-objpfx)s-proto.d): Make it a
pattern rule to get the right stem.
Sat Sep 28 01:30:06 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* Makefile ($(objpfx)version-info.h): Fix typo in previous change.
Sat Sep 28 00:44:38 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/posix/euidaccess.c (__set_errno): Fix typo.
Sat Sep 28 00:40:38 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* malloc/free.c (_free_internal): Don't call free recursively, use
the internal functions instead.
Sat Sep 28 00:23:20 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/posix/tempname.c (__stdio_gen_tempname) [USE_IN_LIBIO &&
_IO_MTSAFE_IO]: Allocate and initialize the file lock.
Fri Sep 27 23:58:17 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* catgets/gencat.c (main): Print version information on stdout,
not stderr.
* db/makedb.c: Likewise.
* locale/programs/locale.c: Likewise.
* locale/programs/localedef.c: Likewise.
Mon Sep 30 00:14:26 1996 Ulrich Drepper <drepper@cygnus.com>
Add implementation of netgroup.
* inet/Makefile (distributes): Add netgroup.h.
(routines): Add getnetgrent.c and getnetgrent_r.c.
* inet/getnetgrent.c: New file.
* inet/getnetgrent_r.c: New file.
* inet/netgroup.h: New file.
* netgroup.h: New file.
* nsswitch.h: New file.
* nss/Makefile (databases): Add getgrp.
* nss/databases.def: Add netgroup.
* nss/db-Makefile: Add rules for netgroup.
* nss/netgrp-lookup.c: New file.
* nss/nss.h: Add new status value NSS_STATUS_RETURN which will
always return without a check of the transition table.
* nss/nsswitch.h (struct service_user): Extend actions array to
five elements.
* nss/nsswitch.c (__nss_next): Allow NSS_STATUS_RETURN as legal
status value.
(nss_parse_service_list): Initialize action for NSS_STATUS_RETURN
to NSS_ACTION_RETURN.
* nss/nss_db/db-netgrp.c: New file.
* nss/nss_files/files-netgrp.c: New file.
* nss/nsswitch.conf: Add entry for netgroup.
* resolv/netdb.h: Add prototypes for netgroup functions.
* nss/nss_db/db-XXX.c: Use `enum nss_status' type when status
value is used.
Sun Sep 29 12:55:58 1996 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/sysv/linux/syscalls.list: Change funciton name for
_llseek to _llseek (not llseek).
Reported by Matthias Urlichs <smurf@smurf.noris.de>.
Sun Sep 29 05:34:32 1996 Ulrich Drepper <drepper@cygnus.com>
* inet/rcmd.c: Remove definition of MIN.
Sat Sep 28 14:22:51 1996 Ulrich Drepper <drepper@cygnus.com>
* dirent/readdir_r.c: Removed. We indeed need a real implementation.
* sysdeps/unix/readdir_r.c: New file.
* sysdeps/unix/readdir.c: Remove check for correct parameter
values. Let them simply die.
* manual/filesys.texi: Document readdir_r.
* sysdeps/gnu/errlist.awk: Define _sys_errlist as `const char* const'.
Proposed by Per Abrahamsen <abraham@dina.kvl.dk>.
Diffstat (limited to 'sysdeps')
179 files changed, 2510 insertions, 243 deletions
diff --git a/sysdeps/alpha/Makefile b/sysdeps/alpha/Makefile index 6aaedea..45babb6 100644 --- a/sysdeps/alpha/Makefile +++ b/sysdeps/alpha/Makefile @@ -21,17 +21,21 @@ sysdep_routines += _mcount endif ifeq ($(subdir),setjmp) -sysdep_routines := $(sysdep_routines) setjmp_aux +sysdep_routines += setjmp_aux endif ifeq ($(subdir),gnulib) -routines = $(divrem) -endif # gnulib +sysdep_routines += $(divrem) +endif + +ifeq ($(subdir),string) +sysdep_routines += stxcpy stxncpy +endif ifeq ($(subdir),elf) -# The ld.so code cannot use literals until it self-relocates. +# The ld.so startup code cannot use literals until it self-relocates. ifeq ($(elf),yes) -CFLAGS-rtld.c = -mbuild-constants + CFLAGS-rtld.c = -mbuild-constants endif # The rest of ld.so shouldn't use FP regs for block moves so # that the lazy link trampoline doesn't have to save them. diff --git a/sysdeps/alpha/bzero.S b/sysdeps/alpha/bzero.S new file mode 100644 index 0000000..fffa53d --- /dev/null +++ b/sysdeps/alpha/bzero.S @@ -0,0 +1,113 @@ +/* Copyright (C) 1996 Free Software Foundation, Inc. + Contributed by Richard Henderson (rth@tamu.edu) + +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. */ + +/* Fill a block of memory with zeros. Optimized for the Alpha architecture: + + - memory accessed as aligned quadwords only + - destination memory not read unless needed for good cache behaviour + - basic blocks arranged to optimize branch prediction for full-quadword + aligned memory blocks. + - partial head and tail quadwords constructed with byte-mask instructions + + This is generally scheduled for the EV5 (got to look out for my own + interests :-), but with EV4 needs in mind. There *should* be no more + stalls for the EV4 than there are for the EV5. +*/ + + +#include <sysdep.h> + + .set noat + .set noreorder + + .text + +/* There is a problem with either gdb (as of 4.16) or gas (as of 2.7) that + doesn't like putting the entry point for a procedure somewhere in the + middle of the procedure descriptor. Work around this by putting the main + loop in its own procedure descriptor. */ + + /* On entry to this basic block: + t3 == loop counter + t4 == bytes in partial final word + a0 == possibly misaligned destination pointer */ + + .ent bzero_loop + .align 3 +bzero_loop: + .frame sp, 0, ra, 0 + .prologue 0 + + beq t3, $tail # + blbc t3, 0f # skip single store if count even + + stq_u zero, 0(a0) # e0 : store one word + subq t3, 1, t3 # .. e1 : + addq a0, 8, a0 # e0 : + beq t3, $tail # .. e1 : + +0: stq_u zero, 0(a0) # e0 : store two words + subq t3, 2, t3 # .. e1 : + stq_u zero, 8(a0) # e0 : + addq a0, 16, a0 # .. e1 : + bne t3, 0b # e1 : + +$tail: bne t4, 1f # is there a tail to do? + ret # no + +1: ldq_u t0, 0(a0) # yes, load original data + mskqh t0, t4, t0 # + stq_u t0, 0(a0) # + ret # + + .end bzero_loop + +ENTRY(bzero) + .prologue 0 + + mov a0, v0 # e0 : move return value in place + beq a1, $done # .. e1 : early exit for zero-length store + and a0, 7, t1 # e0 : + addq a1, t1, a1 # e1 : add dest misalignment to count + srl a1, 3, t3 # e0 : loop = count >> 3 + and a1, 7, t4 # .. e1 : find number of bytes in tail + unop # : + beq t1, bzero_loop # e1 : aligned head, jump right in + + ldq_u t0, 0(a0) # e0 : load original data to mask into + cmpult a1, 8, t2 # .. e1 : is this a sub-word set? + bne t2, $oneq # e1 : + + mskql t0, a0, t0 # e0 : we span words. finish this partial + subq t3, 1, t3 # e0 : + addq a0, 8, a0 # .. e1 : + stq_u t0, -8(a0) # e0 : + br bzero_loop # .. e1 : + + .align 3 +$oneq: + mskql t0, a0, t2 # e0 : + mskqh t0, a1, t3 # e0 : + or t2, t3, t0 # e1 : + stq_u t0, 0(a0) # e0 : + +$done: ret + + END(bzero) diff --git a/sysdeps/alpha/memset.S b/sysdeps/alpha/memset.S new file mode 100644 index 0000000..55271f0 --- /dev/null +++ b/sysdeps/alpha/memset.S @@ -0,0 +1,130 @@ +/* Copyright (C) 1996 Free Software Foundation, Inc. + Contributed by Richard Henderson (rth@tamu.edu) + +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. */ + +/* Fill a block of memory with a character. Optimized for the Alpha + architecture: + + - memory accessed as aligned quadwords only + - destination memory not read unless needed for good cache behaviour + - basic blocks arranged to optimize branch prediction for full-quadword + aligned memory blocks. + - partial head and tail quadwords constructed with byte-mask instructions + + This is generally scheduled for the EV5 (got to look out for my own + interests :-), but with EV4 needs in mind. There *should* be no more + stalls for the EV4 than there are for the EV5. +*/ + + +#include <sysdep.h> + + .set noat + .set noreorder + + .text + +/* There is a problem with either gdb (as of 4.16) or gas (as of 2.7) that + doesn't like putting the entry point for a procedure somewhere in the + middle of the procedure descriptor. Work around this by putting the main + loop in its own procedure descriptor. */ + + /* On entry to this basic block: + t3 == loop counter + t4 == bytes in partial final word + a0 == possibly misaligned destination pointer + a1 == replicated source character */ + + .ent memset_loop + .align 3 +memset_loop: + .frame sp, 0, ra, 0 + .prologue 0 + + beq t3, $tail + blbc t3, 0f # skip single store if count even + + stq_u a1, 0(a0) # e0 : store one word + subq t3, 1, t3 # .. e1 : + addq a0, 8, a0 # e0 : + beq t3, $tail # .. e1 : + +0: stq_u a1, 0(a0) # e0 : store two words + subq t3, 2, t3 # .. e1 : + stq_u a1, 8(a0) # e0 : + addq a0, 16, a0 # .. e1 : + bne t3, 0b # e1 : + +$tail: bne t4, 1f # is there a tail to do? + ret # no + + .align 3 +1: ldq_u t0, 0(a0) # e1 : yes, load original data + mskql a1, t4, t1 # .. e0 : + mskqh t0, t4, t0 # e0 : + or t0, t1, t0 # e1 (stall) + stq_u t0, 0(a0) # e0 : + ret # .. e1 : + + .end memset_loop + +ENTRY(memset) + .prologue 0 + + zapnot a1, 1, a1 # e0 : zero extend input character + mov a0, v0 # .. e1 : move return value in place + sll a1, 8, t0 # e0 : begin replicating the char + beq a2, $done # .. e1 : early exit for zero-length store + or t0, a1, a1 # e0 : + and a0, 7, t1 # .. e1 : dest misalignment + sll a1, 16, t0 # e0 : + addq a2, t1, a2 # .. e1 : add dest misalignment to count + or t0, a1, a1 # e0 : + srl a2, 3, t3 # .. e1 : loop = count >> 3 + sll a1, 32, t0 # e0 : + and a2, 7, t4 # .. e1 : find number of bytes in tail + or t0, a1, a1 # e0 : character replication done + + beq t1, memset_loop # .. e1 : aligned head, jump right in + + ldq_u t0, 0(a0) # e1 : load original data to mask into + mskqh a1, a0, t1 # .. e0 : + + cmpult a2, 8, t2 # e0 : is this a sub-word set? + bne t2, $oneq # .. e1 (zdb) + + mskql t0, a0, t0 # e0 : we span words. finish this partial + subq t3, 1, t3 # .. e1 : + addq a0, 8, a0 # e0 : + or t0, t1, t0 # .. e1 : + stq_u t0, -8(a0) # e0 : + br memset_loop # .. e1 : + + .align 3 +$oneq: + mskql t1, a2, t1 # e0 : entire operation within one word + mskql t0, a0, t2 # e0 : + mskqh t0, a2, t3 # e0 : + or t1, t2, t0 # .. e1 : + or t0, t3, t0 # e1 : + stq_u t0, 0(a0) # e0 (stall) + +$done: ret + + END(memset) diff --git a/sysdeps/alpha/stpcpy.S b/sysdeps/alpha/stpcpy.S new file mode 100644 index 0000000..0dc44d3 --- /dev/null +++ b/sysdeps/alpha/stpcpy.S @@ -0,0 +1,49 @@ +/* Copyright (C) 1996 Free Software Foundation, Inc. + Contributed by Richard Henderson (rth@tamu.edu) + +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. */ + +/* Copy a null-terminated string from SRC to DST. Return a pointer + to the null-terminator in the source. */ + +#include <sysdep.h> + + .text + +ENTRY(__stpcpy) + ldgp gp, 0(pv) + .prologue 1 + + jsr t9, __stxcpy # do the work of the copy + + and t8, 0xf0, t2 # binary search for byte offset of the + and t8, 0xcc, t1 # last byte written. + and t8, 0xaa, t0 + andnot a0, 7, a0 + cmovne t2, 4, t2 + cmovne t1, 2, t1 + cmovne t0, 1, t0 + addq a0, t2, v0 + addq t0, t1, t0 + addq v0, t0, v0 + + ret + + END(__stpcpy) + +weak_alias (__stpcpy, stpcpy) diff --git a/sysdeps/alpha/stpncpy.S b/sysdeps/alpha/stpncpy.S new file mode 100644 index 0000000..50cda26 --- /dev/null +++ b/sysdeps/alpha/stpncpy.S @@ -0,0 +1,103 @@ +/* Copyright (C) 1996 Free Software Foundation, Inc. + Contributed by Richard Henderson (rth@tamu.edu) + +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. */ + +/* Copy no more than COUNT bytes of the null-terminated string from + SRC to DST. If SRC does not cover all of COUNT, the balance is + zeroed. Return the address of the terminating null in DEST, if + any, else DEST + COUNT. */ + +#include <sysdep.h> + + .set noat + .set noreorder + + .text + +ENTRY(__stpncpy) + ldgp gp, 0(pv) + .prologue 1 + + beq a2, $zerocount + jsr t9, __stxncpy # do the work of the copy + + and t8, 0xf0, t3 # binary search for byte offset of the + and t8, 0xcc, t2 # last byte written. + and t8, 0xaa, t1 + andnot a0, 7, v0 + cmovne t3, 4, t3 + cmovne t2, 2, t2 + cmovne t1, 1, t1 + addq v0, t3, v0 + addq t1, t2, t1 + addq v0, t1, v0 + + bne a2, $multiword # do we have full words left? + + .align 3 + zapnot t0, t8, t4 # e0 : was last byte a null? + subq t8, 1, t2 # .. e1 : + addq v0, 1, t5 # e0 : + subq t10, 1, t3 # .. e1 : + or t2, t8, t2 # e0 : clear the bits between the last + or t3, t10, t3 # .. e1 : written byte and the last byte in + andnot t3, t2, t3 # e0 : COUNT + cmovne t4, t5, v0 # .. e1 : if last written wasnt null, inc v0 + zap t0, t3, t0 # e0 : + stq_u t0, 0(a0) # e1 : + ret # .. e1 : + + .align 3 +$multiword: + subq t8, 1, t7 # e0 : clear the final bits in the prev + or t7, t8, t7 # e1 : word + zapnot t0, t7, t0 # e0 : + subq a2, 1, a2 # .. e1 : + stq_u t0, 0(a0) # e0 : + addq a0, 8, a0 # .. e1 : + + beq a2, 1f # e1 : + blbc a2, 0f # e1 : + + stq_u zero, 0(a0) # e0 : zero one word + subq a2, 1, a2 # .. e1 : + addq a0, 8, a0 # e0 : + beq a2, 1f # .. e1 : + +0: stq_u zero, 0(a0) # e0 : zero two words + subq a2, 2, a2 # .. e1 : + stq_u zero, 8(a0) # e0 : + addq a0, 16, a0 # .. e1 : + bne a2, 0b # e1 : + unop + +1: ldq_u t0, 0(a0) # e0 : clear the leading bits in the final + subq t10, 1, t7 # .. e1 : word + or t7, t10, t7 # e0 : + zap t0, t7, t0 # e1 (stall) + stq_u t0, 0(a0) # e0 : + ret # .. e1 : + +$zerocount: + mov a0, v0 + ret + + END(__stpncpy) + +weak_alias (__stpncpy, stpncpy) diff --git a/sysdeps/alpha/strcat.S b/sysdeps/alpha/strcat.S new file mode 100644 index 0000000..d3afff3 --- /dev/null +++ b/sysdeps/alpha/strcat.S @@ -0,0 +1,66 @@ +/* Copyright (C) 1996 Free Software Foundation, Inc. + Contributed by Richard Henderson (rth@tamu.edu) + +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. */ + +/* Append a null-terminated string from SRC to DST. */ + +#include <sysdep.h> + + .text + +ENTRY(strcat) + ldgp gp, 0(pv) + .prologue 1 + + mov a0, v0 # set up return value + + /* Find the end of the string. */ + + ldq_u t0, 0(a0) # load first quadword (a0 may be misaligned) + lda t1, -1(zero) + insqh t1, a0, t1 + andnot a0, 7, a0 + or t1, t0, t0 + cmpbge zero, t0, t1 # t1 <- bitmask: bit i == 1 <==> i-th byte == 0 + bne t1, $found + +$loop: ldq t0, 8(a0) + addq a0, 8, a0 # addr += 8 + cmpbge zero, t0, t1 + beq t1, $loop + +$found: negq t1, t2 # clear all but least set bit + and t1, t2, t1 + + and t1, 0xf0, t2 # binary search for that set bit + and t1, 0xcc, t3 + and t1, 0xaa, t4 + cmovne t2, 4, t2 + cmovne t3, 2, t3 + cmovne t4, 1, t4 + addq t2, t3, t2 + addq a0, t4, a0 + addq a0, t2, a0 + + /* Now do the append. */ + + jsr t9, __stxcpy + ret + + END(strcat) diff --git a/sysdeps/alpha/strchr.S b/sysdeps/alpha/strchr.S new file mode 100644 index 0000000..c26a843 --- /dev/null +++ b/sysdeps/alpha/strchr.S @@ -0,0 +1,88 @@ +/* Copyright (C) 1996 Free Software Foundation, Inc. + Contributed by Richard Henderson (rth@tamu.edu) + +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. */ + +/* Return the address of a given character within a null-terminated + string, or null if it is not found. + + This is generally scheduled for the EV5 (got to look out for my own + interests :-), but with EV4 needs in mind. There *should* be no more + stalls for the EV4 than there are for the EV5. +*/ + +#include <sysdep.h> + + .set noreorder + .set noat + +ENTRY(strchr) + .prologue 0 + + zapnot a1, 1, a1 # e0 : zero extend the search character + ldq_u t0, 0(a0) # .. e1 : load first quadword + sll a1, 8, t5 # e0 : replicate the search character + andnot a0, 7, v0 # .. e1 : align our loop pointer + or t5, a1, a1 # e0 : + lda t4, -1 # .. e1 : build garbage mask + sll a1, 16, t5 # e0 : + cmpbge zero, t0, t2 # .. e1 : bits set iff byte == zero + mskqh t4, a0, t4 # e0 : + or t5, a1, a1 # .. e1 : + sll a1, 32, t5 # e0 : + cmpbge zero, t4, t4 # .. e1 : bits set iff byte is garbage + or t5, a1, a1 # e0 : + xor t0, a1, t1 # .. e1 : make bytes == c zero + cmpbge zero, t1, t3 # e0 : bits set iff byte == c + or t2, t3, t0 # e1 : bits set iff char match or zero match + andnot t0, t4, t0 # e0 : clear garbage bits + bne t0, $found # .. e1 (zdb) + +$loop: ldq t0, 8(v0) # e0 : + addq v0, 8, v0 # .. e1 : + nop # e0 : + xor t0, a1, t1 # .. e1 (ev5 data stall) + cmpbge zero, t0, t2 # e0 : bits set iff byte == 0 + cmpbge zero, t1, t3 # .. e1 : bits set iff byte == c + or t2, t3, t0 # e0 : + beq t0, $loop # .. e1 (zdb) + +$found: negq t0, t1 # e0 : clear all but least set bit + and t0, t1, t0 # e1 (stall) + + and t0, t3, t1 # e0 : bit set iff byte was the char + beq t1, $retnull # .. e1 (zdb) + + and t0, 0xf0, t2 # e0 : binary search for that set bit + and t0, 0xcc, t3 # .. e1 : + and t0, 0xaa, t4 # e0 : + cmovne t2, 4, t2 # .. e1 : + cmovne t3, 2, t3 # e0 : + cmovne t4, 1, t4 # .. e1 : + addq t2, t3, t2 # e0 : + addq v0, t4, v0 # .. e1 : + addq v0, t2, v0 # e0 : + ret # .. e1 : + +$retnull: + mov zero, v0 # e0 : + ret # .. e1 : + + END(strchr) + +weak_alias (strchr, index) diff --git a/sysdeps/alpha/strcpy.S b/sysdeps/alpha/strcpy.S new file mode 100644 index 0000000..2975181 --- /dev/null +++ b/sysdeps/alpha/strcpy.S @@ -0,0 +1,36 @@ +/* Copyright (C) 1996 Free Software Foundation, Inc. + Contributed by Richard Henderson (rth@tamu.edu) + +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. */ + +/* Copy a null-terminated string from SRC to DST. Return a pointer + to the null-terminator in the source. */ + +#include <sysdep.h> + + .text + +ENTRY(strcpy) + ldgp gp, 0(pv) + .prologue 1 + + mov a0, v0 # set up return value + jsr t9, __stxcpy # do the copy + ret + + END(strcpy) diff --git a/sysdeps/alpha/strncat.S b/sysdeps/alpha/strncat.S new file mode 100644 index 0000000..d502037 --- /dev/null +++ b/sysdeps/alpha/strncat.S @@ -0,0 +1,90 @@ +/* Copyright (C) 1996 Free Software Foundation, Inc. + Contributed by Richard Henderson (rth@tamu.edu) + +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. */ + +/* Append no more than COUNT characters from the null-terminated string SRC + to the null-terminated string DST. Always null-terminate the new DST. */ + +#include <sysdep.h> + + .text + +ENTRY(strncat) + ldgp gp, 0(pv) + .prologue 1 + + mov a0, v0 # set up return value + beq a2, $zerocount + + /* Find the end of the string. */ + + ldq_u t0, 0(a0) # load first quadword (a0 may be misaligned) + lda t1, -1(zero) + insqh t1, a0, t1 + andnot a0, 7, a0 + or t1, t0, t0 + cmpbge zero, t0, t1 # t1 <- bitmask: bit i == 1 <==> i-th byte == 0 + bne t1, $found + +$loop: ldq t0, 8(a0) + addq a0, 8, a0 # addr += 8 + cmpbge zero, t0, t1 + beq t1, $loop + +$found: negq t1, t2 # clear all but least set bit + and t1, t2, t1 + + and t1, 0xf0, t2 # binary search for that set bit + and t1, 0xcc, t3 + and t1, 0xaa, t4 + cmovne t2, 4, t2 + cmovne t3, 2, t3 + cmovne t4, 1, t4 + addq t2, t3, t2 + addq a0, t4, a0 + addq a0, t2, a0 + + /* Now do the append. */ + + jsr t9, __stxncpy + + /* Worry about the null termination. */ + + zapnot t0, t8, t1 # was last byte a null? + bne t1, 0f + ret + +0: and t10, 0x80, t1 + bne t1, 1f + + /* Here there are bytes left in the current word. Clear one. */ + addq t10, t10, t10 # end-of-count bit <<= 1 + zap t0, t10, t0 + stq_u t0, 0(a0) + ret + +1: /* Here we must read the next DST word and clear the first byte. */ + ldq_u t0, 8(a0) + zap t0, 1, t0 + stq_u t0, 8(a0) + +$zerocount: + ret + + END(strncat) diff --git a/sysdeps/alpha/strncpy.S b/sysdeps/alpha/strncpy.S new file mode 100644 index 0000000..e13769c --- /dev/null +++ b/sysdeps/alpha/strncpy.S @@ -0,0 +1,85 @@ +/* Copyright (C) 1996 Free Software Foundation, Inc. + Contributed by Richard Henderson (rth@tamu.edu) + +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. */ + +/* Copy no more than COUNT bytes of the null-terminated string from + SRC to DST. If SRC does not cover all of COUNT, the balance is + zeroed. */ + +#include <sysdep.h> + + .set noat + .set noreorder + + .text + +ENTRY(strncpy) + ldgp gp, 0(pv) + .prologue 1 + + mov a0, v0 # set return value now + beq a2, $zerocount + jsr t9, __stxncpy # do the work of the copy + + bne a2, $multiword # do we have full words left? + + .align 3 + subq t8, 1, t2 # e0 : guess not + subq t10, 1, t3 # .. e1 : + or t2, t8, t2 # e0 : clear the bits between the last + or t3, t10, t3 # .. e1 : written byte and the last byte in + andnot t3, t2, t3 # e0 : COUNT + zap t0, t3, t0 # e1 : + stq_u t0, 0(a0) # e0 : + ret # .. e1 : + +$multiword: + + subq t8, 1, t7 # e0 : clear the final bits in the prev + or t7, t8, t7 # e1 : word + zapnot t0, t7, t0 # e0 : + subq a2, 1, a2 # .. e1 : + stq_u t0, 0(a0) # e0 : + addq a0, 8, a0 # .. e1 : + + beq a2, 1f # e1 : + blbc a2, 0f # e1 : + + stq_u zero, 0(a0) # e0 : zero one word + subq a2, 1, a2 # .. e1 : + addq a0, 8, a0 # e0 : + beq a2, 1f # .. e1 : + +0: stq_u zero, 0(a0) # e0 : zero two words + subq a2, 2, a2 # .. e1 : + stq_u zero, 8(a0) # e0 : + addq a0, 16, a0 # .. e1 : + bne a2, 0b # e1 : + unop + +1: ldq_u t0, 0(a0) # e0 : clear the leading bits in the final + subq t10, 1, t7 # .. e1 : word + or t7, t10, t7 # e0 : + zap t0, t7, t0 # e1 (stall) + stq_u t0, 0(a0) # e0 : + +$zerocount: + ret # .. e1 : + + END(strncpy) diff --git a/sysdeps/alpha/strrchr.S b/sysdeps/alpha/strrchr.S new file mode 100644 index 0000000..464f754 --- /dev/null +++ b/sysdeps/alpha/strrchr.S @@ -0,0 +1,104 @@ +/* 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 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. */ + +/* Return the address of the last occurrance of a given character + within a null-terminated string, or null if it is not found. + + This is generally scheduled for the EV5 (got to look out for my own + interests :-), but with EV4 needs in mind. There are, in fact, fewer + stalls on the EV4 than there are on the EV5. +*/ + +#include <sysdep.h> + + .set noreorder + .set noat + +ENTRY(strrchr) + .prologue 0 + + zapnot a1, 1, a1 # e0 : zero extend our test character + mov zero, t6 # .. e1 : t6 is last match aligned addr + sll a1, 8, t5 # e0 : replicate our test character + mov zero, t7 # .. e1 : t7 is last match byte compare mask + or t5, a1, a1 # e0 : + ldq_u t0, 0(a0) # .. e1 : load first quadword + sll a1, 16, t5 # e0 : + andnot a0, 7, v0 # .. e1 : align source addr + or t5, a1, a1 # e0 : + lda t4, -1 # .. e1 : build garbage mask + sll a1, 32, t5 # e0 : + cmpbge zero, t0, t1 # .. e1 : bits set iff byte == zero + mskqh t4, a0, t4 # e0 : + or t5, a1, a1 # .. e1 : character replication complete + xor t0, a1, t2 # e0 : make bytes == c zero + cmpbge zero, t4, t4 # .. e1 : bits set iff byte is garbage + cmpbge zero, t2, t3 # e0 : bits set iff byte == c + andnot t1, t4, t1 # .. e1 : clear garbage from null test + andnot t3, t4, t3 # e0 : clear garbage from char test + bne t1, $eos # .. e1 : did we already hit the terminator? + + /* Character search main loop */ +$loop: + ldq t0, 8(v0) # e0 : load next quadword + cmovne t3, v0, t6 # .. e1 : save previous comparisons match + cmovne t3, t3, t7 # e0 : + addq v0, 8, v0 # .. e1 : + xor t0, a1, t2 # e0 : + cmpbge zero, t0, t1 # .. e1 : bits set iff byte == zero + cmpbge zero, t2, t3 # e0 : bits set iff byte == c + beq t1, $loop # .. e1 : if we havnt seen a null, loop + + /* Mask out character matches after terminator */ +$eos: + negq t1, t4 # e0 : isolate first null byte match + and t1, t4, t4 # e1 : + subq t4, 1, t5 # e0 : build a mask of the bytes upto... + or t4, t5, t4 # e1 : ... and including the null + + and t3, t4, t3 # e0 : mask out char matches after null + cmovne t3, t3, t7 # .. e1 : save it, if match found + cmovne t3, v0, t6 # e0 : + + /* Locate the address of the last matched character */ + + /* Retain the early exit for the ev4 -- the ev5 mispredict penalty + is 5 cycles -- the same as just falling through. */ + beq t7, $retnull # .. e1 : + + and t7, 0xf0, t2 # e0 : binary search for the high bit set + cmovne t2, t2, t7 # .. e1 (zdb) + cmovne t2, 4, t2 # e0 : + and t7, 0xcc, t1 # .. e1 : + cmovne t1, t1, t7 # e0 : + cmovne t1, 2, t1 # .. e1 : + and t7, 0xaa, t0 # e0 : + cmovne t0, 1, t0 # .. e1 (zdb) + addq t2, t1, t1 # e0 : + addq t6, t0, v0 # .. e1 : add our aligned base ptr to the mix + addq v0, t1, v0 # e0 : + ret # .. e1 : + +$retnull: + mov zero, v0 # e0 : + ret # .. e1 : + + END(strrchr) + +weak_alias (strrchr, rindex) diff --git a/sysdeps/alpha/stxcpy.S b/sysdeps/alpha/stxcpy.S new file mode 100644 index 0000000..e381b70 --- /dev/null +++ b/sysdeps/alpha/stxcpy.S @@ -0,0 +1,307 @@ +/* Copyright (C) 1996 Free Software Foundation, Inc. + Contributed by Richard Henderson (rth@tamu.edu) + +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. */ + +/* Copy a null-terminated string from SRC to DST. + + This is an internal routine used by strcpy, stpcpy, and strcat. + As such, it uses special linkage conventions to make implementation + of these public functions more efficient. + + On input: + t9 = return address + a0 = DST + a1 = SRC + + On output: + t8 = bitmask (with one bit set) indicating the last byte written + a0 = unaligned address of the last *word* written + + Furthermore, v0, a3-a5, t11, and t12 are untouched. +*/ + +/* This is generally scheduled for the EV5, but should still be pretty + good for the EV4 too. */ + +#include <sysdep.h> + + .set noat + .set noreorder + + .text + +/* There is a problem with either gdb (as of 4.16) or gas (as of 2.7) that + doesn't like putting the entry point for a procedure somewhere in the + middle of the procedure descriptor. Work around this by putting the + aligned copy in its own procedure descriptor */ + + .ent stxcpy_aligned + .align 3 +stxcpy_aligned: + .frame sp, 0, t9 + .prologue 0 + + /* On entry to this basic block: + t0 == the first destination word for masking back in + t1 == the first source word. */ + + /* Create the 1st output word and detect 0's in the 1st input word. */ + lda t2, -1 # e1 : build a mask against false zero + mskqh t2, a1, t2 # e0 : detection in the src word + mskqh t1, a1, t3 # e0 : + ornot t1, t2, t2 # .. e1 : + mskql t0, a1, t0 # e0 : assemble the first output word + cmpbge zero, t2, t7 # .. e1 : bits set iff null found + or t0, t3, t1 # e0 : + bne t7, $a_eos # .. e1 : + + /* On entry to this basic block: + t0 == the first destination word for masking back in + t1 == a source word not containing a null. */ + +$a_loop: + stq_u t1, 0(a0) # e0 : + addq a0, 8, a0 # .. e1 : + ldq_u t1, 0(a1) # e0 : + addq a1, 8, a1 # .. e1 : + cmpbge zero, t1, t7 # e0 (stall) + beq t7, $a_loop # .. e1 (zdb) + + /* Take care of the final (partial) word store. + On entry to this basic block we have: + t1 == the source word containing the null + t7 == the cmpbge mask that found it. */ +$a_eos: + negq t7, t6 # e0 : find low bit set + and t7, t6, t8 # e1 (stall) + + /* For the sake of the cache, don't read a destination word + if we're not going to need it. */ + and t8, 0x80, t6 # e0 : + bne t6, 1f # .. e1 (zdb) + + /* We're doing a partial word store and so need to combine + our source and original destination words. */ + ldq_u t0, 0(a0) # e0 : + subq t8, 1, t6 # .. e1 : + zapnot t1, t6, t1 # e0 : clear src bytes >= null + or t8, t6, t7 # .. e1 : + zap t0, t7, t0 # e0 : clear dst bytes <= null + or t0, t1, t1 # e1 : + +1: stq_u t1, 0(a0) # e0 : + ret (t9) # .. e1 : + + .end stxcpy_aligned + + .align 3 + .ent __stxcpy + .globl __stxcpy +__stxcpy: + .frame sp, 0, t9 + .prologue 0 + + /* Are source and destination co-aligned? */ + xor a0, a1, t0 # e0 : + unop # : + and t0, 7, t0 # e0 : + bne t0, $unaligned # .. e1 : + + /* We are co-aligned; take care of a partial first word. */ + ldq_u t1, 0(a1) # e0 : load first src word + and a0, 7, t0 # .. e1 : take care not to load a word ... + addq a1, 8, a1 # e0 : + beq t0, stxcpy_aligned # .. e1 : ... if we wont need it + ldq_u t0, 0(a0) # e0 : + br stxcpy_aligned # .. e1 : + + +/* The source and destination are not co-aligned. Align the destination + and cope. We have to be very careful about not reading too much and + causing a SEGV. */ + + .align 3 +$u_head: + /* We know just enough now to be able to assemble the first + full source word. We can still find a zero at the end of it + that prevents us from outputting the whole thing. + + On entry to this basic block: + t0 == the first dest word, for masking back in, if needed else 0 + t1 == the low bits of the first source word + t6 == bytemask that is -1 in dest word bytes */ + + ldq_u t2, 8(a1) # e0 : + addq a1, 8, a1 # .. e1 : + + extql t1, a1, t1 # e0 : + extqh t2, a1, t4 # e0 : + mskql t0, a0, t0 # e0 : + or t1, t4, t1 # .. e1 : + mskqh t1, a0, t1 # e0 : + or t0, t1, t1 # e1 : + + or t1, t6, t6 # e0 : + cmpbge zero, t6, t7 # .. e1 : + lda t6, -1 # e0 : for masking just below + bne t7, $u_final # .. e1 : + + mskql t6, a1, t6 # e0 : mask out the bits we have + or t6, t2, t2 # e1 : already extracted before + cmpbge zero, t2, t7 # e0 : testing eos + bne t7, $u_late_head_exit # .. e1 (zdb) + + /* Finally, we've got all the stupid leading edge cases taken care + of and we can set up to enter the main loop. */ + + stq_u t1, 0(a0) # e0 : store first output word + addq a0, 8, a0 # .. e1 : + extql t2, a1, t0 # e0 : position ho-bits of lo word + ldq_u t2, 8(a1) # .. e1 : read next high-order source word + addq a1, 8, a1 # e0 : + cmpbge zero, t2, t7 # .. e1 : + nop # e0 : + bne t7, $u_eos # .. e1 : + + /* Unaligned copy main loop. In order to avoid reading too much, + the loop is structured to detect zeros in aligned source words. + This has, unfortunately, effectively pulled half of a loop + iteration out into the head and half into the tail, but it does + prevent nastiness from accumulating in the very thing we want + to run as fast as possible. + + On entry to this basic block: + t0 == the shifted high-order bits from the previous source word + t2 == the unshifted current source word + + We further know that t2 does not contain a null terminator. */ + + .align 3 +$u_loop: + extqh t2, a1, t1 # e0 : extract high bits for current word + addq a1, 8, a1 # .. e1 : + extql t2, a1, t3 # e0 : extract low bits for next time + addq a0, 8, a0 # .. e1 : + or t0, t1, t1 # e0 : current dst word now complete + ldq_u t2, 0(a1) # .. e1 : load high word for next time + stq_u t1, -8(a0) # e0 : save the current word + mov t3, t0 # .. e1 : + cmpbge zero, t2, t7 # e0 : test new word for eos + beq t7, $u_loop # .. e1 : + + /* We've found a zero somewhere in the source word we just read. + If it resides in the lower half, we have one (probably partial) + word to write out, and if it resides in the upper half, we + have one full and one partial word left to write out. + + On entry to this basic block: + t0 == the shifted high-order bits from the previous source word + t2 == the unshifted current source word. */ +$u_eos: + extqh t2, a1, t1 # e0 : + or t0, t1, t1 # e1 : first (partial) source word complete + + cmpbge zero, t1, t7 # e0 : is the null in this first bit? + bne t7, $u_final # .. e1 (zdb) + +$u_late_head_exit: + stq_u t1, 0(a0) # e0 : the null was in the high-order bits + addq a0, 8, a0 # .. e1 : + extql t2, a1, t1 # e0 : + cmpbge zero, t1, t7 # .. e1 : + + /* Take care of a final (probably partial) result word. + On entry to this basic block: + t1 == assembled source word + t7 == cmpbge mask that found the null. */ +$u_final: + negq t7, t6 # e0 : isolate low bit set + and t6, t7, t8 # e1 : + + and t8, 0x80, t6 # e0 : avoid dest word load if we can + bne t6, 1f # .. e1 (zdb) + + ldq_u t0, 0(a0) # e0 : + subq t8, 1, t6 # .. e1 : + or t6, t8, t7 # e0 : + zapnot t1, t6, t1 # .. e1 : kill source bytes >= null + zap t0, t7, t0 # e0 : kill dest bytes <= null + or t0, t1, t1 # e1 : + +1: stq_u t1, 0(a0) # e0 : + ret (t9) # .. e1 : + + /* Unaligned copy entry point. */ + .align 3 +$unaligned: + + ldq_u t1, 0(a1) # e0 : load first source word + + and a0, 7, t4 # .. e1 : find dest misalignment + and a1, 7, t5 # e0 : find src misalignment + + /* Conditionally load the first destination word and a bytemask + with 0xff indicating that the destination byte is sacrosanct. */ + + mov zero, t0 # .. e1 : + mov zero, t6 # e0 : + beq t4, 1f # .. e1 : + ldq_u t0, 0(a0) # e0 : + lda t6, -1 # .. e1 : + mskql t6, a0, t6 # e0 : +1: + subq a1, t4, a1 # .. e1 : sub dest misalignment from src addr + + /* If source misalignment is larger than dest misalignment, we need + extra startup checks to avoid SEGV. */ + + cmplt t4, t5, t8 # e0 : + beq t8, $u_head # .. e1 (zdb) + + lda t2, -1 # e1 : mask out leading garbage in source + mskqh t2, t5, t2 # e0 : + nop # e0 : + ornot t1, t2, t3 # .. e1 : + cmpbge zero, t3, t7 # e0 : is there a zero? + beq t7, $u_head # .. e1 (zdb) + + /* At this point we've found a zero in the first partial word of + the source. We need to isolate the valid source data and mask + it into the original destination data. (Incidentally, we know + that we'll need at least one byte of that original dest word.) */ + + ldq_u t0, 0(a0) # e0 : + + negq t7, t6 # .. e1 : build bitmask of bytes <= zero + and t6, t7, t8 # e0 : + nop # .. e1 : + subq t8, 1, t6 # e0 : + or t6, t8, t7 # e1 : + + zapnot t2, t7, t2 # e0 : prepare source word; mirror changes + and t1, t2, t1 # e1 : to source validity mask + extql t2, a1, t2 # e0 : + extql t1, a1, t1 # e0 : + + andnot t0, t2, t0 # e0 : zero place for source to reside + or t0, t1, t1 # e1 : and put it there + stq_u t1, 0(a0) # e0 : + ret (t9) # .. e1 : + + .end __stxcpy diff --git a/sysdeps/alpha/stxncpy.S b/sysdeps/alpha/stxncpy.S new file mode 100644 index 0000000..8c5fcf6 --- /dev/null +++ b/sysdeps/alpha/stxncpy.S @@ -0,0 +1,350 @@ +/* Copyright (C) 1996 Free Software Foundation, Inc. + Contributed by Richard Henderson (rth@tamu.edu) + +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. */ + +/* Copy no more than COUNT bytes of the null-terminated string from + SRC to DST. + + This is an internal routine used by strncpy, stpncpy, and strncat. + As such, it uses special linkage conventions to make implementation + of these public functions more efficient. + + On input: + t9 = return address + a0 = DST + a1 = SRC + a2 = COUNT + + Furthermore, COUNT may not be zero. + + On output: + t0 = last word written + t8 = bitmask (with one bit set) indicating the last byte written + t10 = bitmask (with one bit set) indicating the byte position of + the end of the range specified by COUNT + a0 = unaligned address of the last *word* written + a2 = the number of full words left in COUNT + + Furthermore, v0, a3-a5, t11, and t12 are untouched. +*/ + + +/* This is generally scheduled for the EV5, but should still be pretty + good for the EV4 too. */ + +#include <sysdep.h> + + .set noat + .set noreorder + + .text + +/* There is a problem with either gdb (as of 4.16) or gas (as of 2.7) that + doesn't like putting the entry point for a procedure somewhere in the + middle of the procedure descriptor. Work around this by putting the + aligned copy in its own procedure descriptor */ + + .ent stxncpy_aligned + .align 3 +stxncpy_aligned: + .frame sp, 0, t9, 0 + .prologue 0 + + /* On entry to this basic block: + t0 == the first destination word for masking back in + t1 == the first source word. */ + + /* Create the 1st output word and detect 0's in the 1st input word. */ + lda t2, -1 # e1 : build a mask against false zero + mskqh t2, a1, t2 # e0 : detection in the src word + mskqh t1, a1, t3 # e0 : + ornot t1, t2, t2 # .. e1 : + mskql t0, a1, t0 # e0 : assemble the first output word + cmpbge zero, t2, t7 # .. e1 : bits set iff null found + or t0, t3, t0 # e0 : + beq a2, $a_eoc # .. e1 : + bne t7, $a_eos # .. e1 : + + /* On entry to this basic block: + t0 == a source word not containing a null. */ + +$a_loop: + stq_u t0, 0(a0) # e0 : + addq a0, 8, a0 # .. e1 : + ldq_u t0, 0(a1) # e0 : + addq a1, 8, a1 # .. e1 : + subq a2, 1, a2 # e0 : + cmpbge zero, t0, t7 # .. e1 (stall) + beq a2, $a_eoc # e1 : + beq t7, $a_loop # e1 : + + /* Take care of the final (partial) word store. At this point + the end-of-count bit is set in t7 iff it applies. + + On entry to this basic block we have: + t0 == the source word containing the null + t7 == the cmpbge mask that found it. */ + +$a_eos: + negq t7, t8 # e0 : find low bit set + and t7, t8, t8 # e1 (stall) + + /* For the sake of the cache, don't read a destination word + if we're not going to need it. */ + and t8, 0x80, t6 # e0 : + bne t6, 1f # .. e1 (zdb) + + /* We're doing a partial word store and so need to combine + our source and original destination words. */ + ldq_u t1, 0(a0) # e0 : + subq t8, 1, t6 # .. e1 : + or t8, t6, t7 # e0 : + unop # + zapnot t0, t7, t0 # e0 : clear src bytes > null + zap t1, t7, t1 # .. e1 : clear dst bytes <= null + or t0, t1, t0 # e1 : + +1: stq_u t0, 0(a0) # e0 : + ret (t9) # e1 : + + /* Add the end-of-count bit to the eos detection bitmask. */ +$a_eoc: + or t10, t7, t7 + br $a_eos + + .end stxncpy_aligned + + .align 3 + .ent __stxncpy + .globl __stxncpy +__stxncpy: + .frame sp, 0, t9, 0 + .prologue 0 + + /* Are source and destination co-aligned? */ + xor a0, a1, t1 # e0 : + and a0, 7, t0 # .. e1 : find dest misalignment + and t1, 7, t1 # e0 : + addq a2, t0, a2 # .. e1 : bias count by dest misalignment + subq a2, 1, a2 # e0 : + and a2, 7, t2 # e1 : + srl a2, 3, a2 # e0 : a2 = loop counter = (count - 1)/8 + addq zero, 1, t10 # .. e1 : + sll t10, t2, t10 # e0 : t10 = bitmask of last count byte + bne t1, $unaligned # .. e1 : + + /* We are co-aligned; take care of a partial first word. */ + + ldq_u t1, 0(a1) # e0 : load first src word + addq a1, 8, a1 # .. e1 : + + beq t0, stxncpy_aligned # avoid loading dest word if not needed + ldq_u t0, 0(a0) # e0 : + br stxncpy_aligned # .. e1 : + + +/* The source and destination are not co-aligned. Align the destination + and cope. We have to be very careful about not reading too much and + causing a SEGV. */ + + .align 3 +$u_head: + /* We know just enough now to be able to assemble the first + full source word. We can still find a zero at the end of it + that prevents us from outputting the whole thing. + + On entry to this basic block: + t0 == the first dest word, unmasked + t1 == the shifted low bits of the first source word + t6 == bytemask that is -1 in dest word bytes */ + + ldq_u t2, 8(a1) # e0 : load second src word + addq a1, 8, a1 # .. e1 : + mskql t0, a0, t0 # e0 : mask trailing garbage in dst + extqh t2, a1, t4 # e0 : + or t1, t4, t1 # e1 : first aligned src word complete + mskqh t1, a0, t1 # e0 : mask leading garbage in src + or t0, t1, t0 # e0 : first output word complete + or t0, t6, t6 # e1 : mask original data for zero test + cmpbge zero, t6, t7 # e0 : + beq a2, $u_eocfin # .. e1 : + bne t7, $u_final # e1 : + + lda t6, -1 # e1 : mask out the bits we have + mskql t6, a1, t6 # e0 : already seen + stq_u t0, 0(a0) # e0 : store first output word + or t6, t2, t2 # .. e1 : + cmpbge zero, t2, t7 # e0 : find nulls in second partial + addq a0, 8, a0 # .. e1 : + subq a2, 1, a2 # e0 : + bne t7, $u_late_head_exit # .. e1 : + + /* Finally, we've got all the stupid leading edge cases taken care + of and we can set up to enter the main loop. */ + + extql t2, a1, t1 # e0 : position hi-bits of lo word + ldq_u t2, 8(a1) # .. e1 : read next high-order source word + addq a1, 8, a1 # e0 : + cmpbge zero, t2, t7 # e1 (stall) + beq a2, $u_eoc # e1 : + bne t7, $u_eos # e1 : + + /* Unaligned copy main loop. In order to avoid reading too much, + the loop is structured to detect zeros in aligned source words. + This has, unfortunately, effectively pulled half of a loop + iteration out into the head and half into the tail, but it does + prevent nastiness from accumulating in the very thing we want + to run as fast as possible. + + On entry to this basic block: + t1 == the shifted high-order bits from the previous source word + t2 == the unshifted current source word + + We further know that t2 does not contain a null terminator. */ + + .align 3 +$u_loop: + extqh t2, a1, t0 # e0 : extract high bits for current word + addq a1, 8, a1 # .. e1 : + extql t2, a1, t3 # e0 : extract low bits for next time + addq a0, 8, a0 # .. e1 : + or t0, t1, t0 # e0 : current dst word now complete + ldq_u t2, 0(a1) # .. e1 : load high word for next time + stq_u t0, -8(a0) # e0 : save the current word + mov t3, t1 # .. e1 : + subq a2, 1, a2 # e0 : + cmpbge zero, t2, t7 # .. e1 : test new word for eos + beq a2, $u_eoc # e1 : + beq t7, $u_loop # e1 : + + /* We've found a zero somewhere in the source word we just read. + If it resides in the lower half, we have one (probably partial) + word to write out, and if it resides in the upper half, we + have one full and one partial word left to write out. + + On entry to this basic block: + t1 == the shifted high-order bits from the previous source word + t2 == the unshifted current source word. */ +$u_eos: + extqh t2, a1, t0 # e0 : + or t0, t1, t0 # e1 : first (partial) source word complete + + cmpbge zero, t0, t7 # e0 : is the null in this first bit? + bne t7, $u_final # .. e1 (zdb) + + stq_u t0, 0(a0) # e0 : the null was in the high-order bits + addq a0, 8, a0 # .. e1 : + subq a2, 1, a2 # e1 : + +$u_late_head_exit: + extql t2, a1, t0 # .. e0 : + cmpbge zero, t0, t7 # e0 : + or t7, t10, t6 # e1 : + cmoveq a2, t6, t7 # e0 : + nop # .. e1 : + + /* Take care of a final (probably partial) result word. + On entry to this basic block: + t0 == assembled source word + t7 == cmpbge mask that found the null. */ +$u_final: + negq t7, t6 # e0 : isolate low bit set + and t6, t7, t8 # e1 : + + and t8, 0x80, t6 # e0 : avoid dest word load if we can + bne t6, 1f # .. e1 (zdb) + + ldq_u t1, 0(a0) # e0 : + subq t8, 1, t6 # .. e1 : + or t6, t8, t7 # e0 : + zapnot t0, t7, t0 # .. e1 : kill source bytes > null + zap t1, t7, t1 # e0 : kill dest bytes <= null + or t0, t1, t0 # e1 : + +1: stq_u t0, 0(a0) # e0 : + ret (t9) # .. e1 : + +$u_eoc: # end-of-count + extqh t2, a1, t0 + or t0, t1, t0 + cmpbge zero, t0, t7 + +$u_eocfin: # end-of-count, final word + or t10, t7, t7 + br $u_final + + /* Unaligned copy entry point. */ + .align 3 +$unaligned: + + ldq_u t1, 0(a1) # e0 : load first source word + + and a0, 7, t4 # .. e1 : find dest misalignment + and a1, 7, t5 # e0 : find src misalignment + + /* Conditionally load the first destination word and a bytemask + with 0xff indicating that the destination byte is sacrosanct. */ + + mov zero, t0 # .. e1 : + mov zero, t6 # e0 : + beq t4, 1f # .. e1 : + ldq_u t0, 0(a0) # e0 : + lda t6, -1 # .. e1 : + mskql t6, a0, t6 # e0 : +1: + subq a1, t4, a1 # .. e1 : sub dest misalignment from src addr + + /* If source misalignment is larger than dest misalignment, we need + extra startup checks to avoid SEGV. */ + + cmplt t4, t5, t8 # e1 : + extql t1, a1, t1 # .. e0 : shift src into place + lda t2, -1 # e0 : for creating masks later + beq t8, $u_head # e1 : + + mskqh t2, t5, t2 # e0 : begin src byte validity mask + cmpbge zero, t1, t7 # .. e1 : is there a zero? + extql t2, a1, t2 # e0 : + or t7, t10, t6 # .. e1 : test for end-of-count too + cmpbge zero, t2, t3 # e0 : + cmoveq a2, t6, t7 # .. e1 : + andnot t7, t3, t7 # e0 : + beq t7, $u_head # .. e1 (zdb) + + /* At this point we've found a zero in the first partial word of + the source. We need to isolate the valid source data and mask + it into the original destination data. (Incidentally, we know + that we'll need at least one byte of that original dest word.) */ + + ldq_u t0, 0(a0) # e0 : + negq t7, t6 # .. e1 : build bitmask of bytes <= zero + mskqh t1, t4, t1 # e0 : + and t6, t7, t8 # .. e1 : + subq t8, 1, t6 # e0 : + or t6, t8, t7 # e1 : + + zapnot t2, t7, t2 # e0 : prepare source word; mirror changes + zapnot t1, t7, t1 # .. e1 : to source validity mask + + andnot t0, t2, t0 # e0 : zero place for source to reside + or t0, t1, t0 # e1 : and put it there + stq_u t0, 0(a0) # e0 : + ret (t9) # .. e1 : + + .end __stxncpy diff --git a/sysdeps/generic/crypt-entry.c b/sysdeps/generic/crypt-entry.c new file mode 100644 index 0000000..84c6974 --- /dev/null +++ b/sysdeps/generic/crypt-entry.c @@ -0,0 +1,68 @@ +/* crypt - wrapper aroung MD5 sum replacement for crypt 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 <crypt.h> +#include <errno.h> +#include <string.h> + + +/* Define our magic string to mark salt for MD5 encryption + replacement. This is meant to be the same as for other MD5 based + encryption implenentations. */ +static const char md5_salt_prefix[] = "$1$"; + + +/* Prototypes for the MD5 encryption replacement functions. */ +extern char *md5_crypt_r (const char *key, const char *salt, char *buffer, + int buflen); +extern char *md5_crpyt (const char *key, const char *salt); + + +/* We recognize an intended call of the MD5 crypt replacement function + by the first 3 characters of the salt string. If they match the + MD5 magic string we want MD5 encryption replacement. */ +char * +crypt_r (key, salt, data) + const char *key; + const char *salt; + struct crypt_data *data; +{ + if (strncmp (md5_salt_prefix, salt, sizeof (md5_salt_prefix) - 1) == 0) + return md5_crypt_r (key, salt, (char *) data, sizeof (struct crypt_data)); + + /* We don't have DES encryption. */ + errno = ENOSYS; + return NULL; +} + + +/* The same here, only we call the non-reentrant version. */ +char * +crypt (key, salt) + const char *key; + const char *salt; +{ + if (strncmp (md5_salt_prefix, salt, sizeof (md5_salt_prefix) - 1) == 0) + return md5_crypt (key, salt); + + /* We don't have DES encryption. */ + errno = ENOSYS; + return NULL; +} diff --git a/sysdeps/generic/crypt.h b/sysdeps/generic/crypt.h new file mode 100644 index 0000000..c035e1e --- /dev/null +++ b/sysdeps/generic/crypt.h @@ -0,0 +1,58 @@ +/* + * UFC-crypt: ultra fast crypt(3) implementation + * + * Copyright (C) 1991, 1992, 1993, 1996 Free Software Foundation, Inc. + * + * This 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. + * + * This 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 this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * @(#)crypt.h 1.3 16 Sep 1996 + * + */ + +#ifndef _CRYPT_H + +#define _CRYPT_H 1 +#include <features.h> + +__BEGIN_DECLS + +struct crypt_data +{ + char keysched[(16 * 8) / sizeof (char)]; + char sb0[32768 / sizeof (char)]; + char sb1[32768 / sizeof (char)]; + char sb2[32768 / sizeof (char)]; + char sb3[32768 / sizeof (char)]; + /* end-of-aligment-critical-data */ + char crypt_3_buf[14]; + char current_salt[2]; + long current_saltbits; + int direction, initialized; +}; + +/* Encrypt at most 8 characters from KEY using salt to perturb DES. */ +extern char *crypt __P ((__const char *__key, __const char *__salt)); + + +#ifdef __USE_REENTRANT +/* Reentrant versions of the functions above. The additional argument + points to a structure where the results are placed in. */ +extern char *crypt_r __P ((__const char *__key, __const char *__salt, + struct crypt_data *__data)); +#endif /* reentrant */ + +__END_DECLS + +#endif /* crypt.h */ diff --git a/sysdeps/generic/strtok.c b/sysdeps/generic/strtok.c index 4f89efa..1e96fec 100644 --- a/sysdeps/generic/strtok.c +++ b/sysdeps/generic/strtok.c @@ -43,10 +43,7 @@ strtok (s, delim) /* Scan leading delimiters. */ s += strspn (s, delim); if (*s == '\0') - { - olds = NULL; - return NULL; - } + return NULL; /* Find the end of the token. */ token = s; diff --git a/sysdeps/generic/strtok_r.c b/sysdeps/generic/strtok_r.c index 870fb27..fb68ad8 100644 --- a/sysdeps/generic/strtok_r.c +++ b/sysdeps/generic/strtok_r.c @@ -44,10 +44,7 @@ strtok_r (s, delim, save_ptr) /* Scan leading delimiters. */ s += strspn (s, delim); if (*s == '\0') - { - *save_ptr = NULL; - return NULL; - } + return NULL; /* Find the end of the token. */ token = s; diff --git a/sysdeps/i386/__longjmp.S b/sysdeps/i386/__longjmp.S index 77916cd..fd02205 100644 --- a/sysdeps/i386/__longjmp.S +++ b/sysdeps/i386/__longjmp.S @@ -1,5 +1,5 @@ /* longjmp for i386. -Copyright (C) 1995 Free Software Foundation, Inc. +Copyright (C) 1995, 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 @@ -33,3 +33,4 @@ ENTRY (__longjmp) /* Jump to saved PC. */ movl (JB_PC*4)(%ecx), %ecx jmp *%ecx +PSEUDO_END (__longjmp) diff --git a/sysdeps/i386/bsd-_setjmp.S b/sysdeps/i386/bsd-_setjmp.S index a606550..b08a74f 100644 --- a/sysdeps/i386/bsd-_setjmp.S +++ b/sysdeps/i386/bsd-_setjmp.S @@ -1,5 +1,5 @@ /* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'. i386 version. -Copyright (C) 1994, 1995 Free Software Foundation, Inc. +Copyright (C) 1994, 1995, 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 @@ -30,4 +30,4 @@ ENTRY (_setjmp) pushl %ecx /* Push back first argument. */ pushl %eax /* Push back return PC. */ jmp JUMPTARGET (C_SYMBOL_NAME (__sigsetjmp)) - +PSEUDO_END (_setjmp) diff --git a/sysdeps/i386/bsd-setjmp.S b/sysdeps/i386/bsd-setjmp.S index d9a39b9..5c8dd67 100644 --- a/sysdeps/i386/bsd-setjmp.S +++ b/sysdeps/i386/bsd-setjmp.S @@ -1,5 +1,5 @@ /* BSD `setjmp' entry point to `sigsetjmp (..., 1)'. i386 version. -Copyright (C) 1994, 1995 Free Software Foundation, Inc. +Copyright (C) 1994, 1995, 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 @@ -30,3 +30,4 @@ ENTRY (setjmp) pushl %ecx /* Push back first argument. */ pushl %eax /* Push back return PC. */ jmp JUMPTARGET (C_SYMBOL_NAME (__sigsetjmp)) +PSEUDO_END (setjmp) diff --git a/sysdeps/i386/i486/strcat.S b/sysdeps/i386/i486/strcat.S index 081a797..e82b1c4 100644 --- a/sysdeps/i386/i486/strcat.S +++ b/sysdeps/i386/i486/strcat.S @@ -258,3 +258,4 @@ L8: movl 8(%esp), %eax /* start address of destination is result */ popl %edi /* restore saved register */ ret +PSEUDO_END (strcat) diff --git a/sysdeps/i386/i486/strlen.S b/sysdeps/i386/i486/strlen.S index 276563b..1a7ab7a 100644 --- a/sysdeps/i386/i486/strlen.S +++ b/sysdeps/i386/i486/strlen.S @@ -1,6 +1,6 @@ /* strlen(str) -- determine the length of the string STR. Optimized for Intel 80x86, x>=4. -Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. +Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>. This file is part of the GNU C Library. @@ -130,3 +130,4 @@ L3: testb %cl, %cl /* is first byte NUL? */ L2: subl 4(%esp), %eax /* compute difference to string start */ ret +PSEUDO_END (strlen) diff --git a/sysdeps/i386/i586/memset.S b/sysdeps/i386/i586/memset.S index 3a68fa1..0dabad2 100644 --- a/sysdeps/i386/i586/memset.S +++ b/sysdeps/i386/i586/memset.S @@ -99,3 +99,4 @@ L2: shrl $2, %ecx /* convert byte count to longword count */ popl %edi ret +PSEUDO_END (memset) diff --git a/sysdeps/i386/i586/strchr.S b/sysdeps/i386/i586/strchr.S index 100cbbc..bc435bf 100644 --- a/sysdeps/i386/i586/strchr.S +++ b/sysdeps/i386/i586/strchr.S @@ -325,6 +325,7 @@ L3: xorl %eax, %eax /* set return value = NULL */ popl %edi ret +PSEUDO_END (strchr) #undef index weak_alias (strchr, index) diff --git a/sysdeps/i386/i586/strlen.S b/sysdeps/i386/i586/strlen.S index 1e17131..12ea354 100644 --- a/sysdeps/i386/i586/strlen.S +++ b/sysdeps/i386/i586/strlen.S @@ -180,3 +180,4 @@ L2: subl 4(%esp), %eax /* now compute the length as difference character */ ret +PSEUDO_END (strlen) diff --git a/sysdeps/i386/memchr.S b/sysdeps/i386/memchr.S index 9931f97..7d2779b 100644 --- a/sysdeps/i386/memchr.S +++ b/sysdeps/i386/memchr.S @@ -1,7 +1,7 @@ /* memchr (str, ch, n) -- Return pointer to first occurrence of CH in STR less than N. For Intel 80x86, x>=3. -Copyright (C) 1994, 1995 Free Software Foundation, Inc. +Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu> Optimised a little by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au> This file is part of the GNU C Library. @@ -313,3 +313,4 @@ L9: popl %edi /* pop saved registers */ popl %esi ret +PSEUDO_END (memchr) diff --git a/sysdeps/i386/memcmp.S b/sysdeps/i386/memcmp.S index 3917a32..4bf9b23 100644 --- a/sysdeps/i386/memcmp.S +++ b/sysdeps/i386/memcmp.S @@ -63,6 +63,7 @@ L1: popl %esi /* Restore registers. */ movl %edx, %edi ret +PSEUDO_END (memcmp) #undef bcmp weak_alias (memcmp, bcmp) diff --git a/sysdeps/i386/setjmp.S b/sysdeps/i386/setjmp.S index 498a925..e877ae3 100644 --- a/sysdeps/i386/setjmp.S +++ b/sysdeps/i386/setjmp.S @@ -53,3 +53,4 @@ here: popl %ecx #else jmp __sigjmp_save #endif +PSEUDO_END (__sigsetjmp) diff --git a/sysdeps/i386/stpcpy.S b/sysdeps/i386/stpcpy.S index f38a908..46f64b5 100644 --- a/sysdeps/i386/stpcpy.S +++ b/sysdeps/i386/stpcpy.S @@ -1,7 +1,7 @@ /* stpcpy -- copy SRC to DEST returning the address of the terminating '\0' in DEST. For Intel 80x86, x>=3. -Copyright (C) 1994, 1995 Free Software Foundation, Inc. +Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. Contributed by Ulrich Drepper (drepper@gnu.ai.mit.edu). This file is part of the GNU C Library. @@ -83,5 +83,6 @@ L4: incl %eax L3: incl %eax L2: ret +PSEUDO_END (__stpcpy) weak_alias (__stpcpy, stpcpy) diff --git a/sysdeps/i386/stpncpy.S b/sysdeps/i386/stpncpy.S index 59192e6..7590e57 100644 --- a/sysdeps/i386/stpncpy.S +++ b/sysdeps/i386/stpncpy.S @@ -1,7 +1,7 @@ /* stpncpy -- copy no more then N bytes from SRC to DEST, returning the address of the terminating '\0' in DEST. For Intel 80x86, x>=3. -Copyright (C) 1994, 1995 Free Software Foundation, Inc. +Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu> Some bug fixes by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au> - original wrote n+1 chars in some cases. @@ -139,5 +139,6 @@ L3: decl %ecx /* all bytes written? */ L9: popl %esi /* restore saved register content */ ret +PSEUDO_END (__stpncpy) weak_alias (__stpncpy, stpncpy) diff --git a/sysdeps/i386/strchr.S b/sysdeps/i386/strchr.S index de947cd..50c3d7b 100644 --- a/sysdeps/i386/strchr.S +++ b/sysdeps/i386/strchr.S @@ -1,6 +1,6 @@ /* strchr (str, ch) -- Return pointer to first occurrence of CH in STR. For Intel 80x86, x>=3. -Copyright (C) 1994, 1995 Free Software Foundation, Inc. +Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu> Some optimisations by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au> This file is part of the GNU C Library. @@ -274,5 +274,6 @@ L7: testb %cl, %cl /* is first byte C? */ L6: popl %edi /* restore saved register content */ ret +PSEUDO_END (strchr) weak_alias (strchr, index) diff --git a/sysdeps/i386/strcspn.S b/sysdeps/i386/strcspn.S index b0e789b..1e80225 100644 --- a/sysdeps/i386/strcspn.S +++ b/sysdeps/i386/strcspn.S @@ -1,7 +1,7 @@ /* strcspn (str, ss) -- Return the length of the initial segement of STR which contains no characters from SS. For Intel 80x86, x>=3. -Copyright (C) 1994, 1995 Free Software Foundation, Inc. +Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu> Bug fixes by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au> This file is part of the GNU C Library. @@ -174,3 +174,4 @@ L4: subl %edx, %eax /* we have to return the number of valid addl $256, %esp /* remove stopset */ ret +PSEUDO_END (strcspn) diff --git a/sysdeps/i386/strpbrk.S b/sysdeps/i386/strpbrk.S index 245bf1a..41769b0 100644 --- a/sysdeps/i386/strpbrk.S +++ b/sysdeps/i386/strpbrk.S @@ -1,7 +1,7 @@ /* strcspn (str, ss) -- Return the length of the initial segement of STR which contains no characters from SS. For Intel 80x86, x>=3. -Copyright (C) 1994, 1995 Free Software Foundation, Inc. +Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu> Bug fixes by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au> This file is part of the GNU C Library. @@ -175,3 +175,4 @@ L4: addl $256, %esp /* remove stopset */ xorl %eax, %eax /* return NULL */ L7: ret +PSEUDO_END (strpbrk) diff --git a/sysdeps/i386/strrchr.S b/sysdeps/i386/strrchr.S index 58058e1..8cad7e5 100644 --- a/sysdeps/i386/strrchr.S +++ b/sysdeps/i386/strrchr.S @@ -321,5 +321,6 @@ L2: popl %esi /* restore saved register content */ popl %edi ret +PSEUDO_END (strrchr) weak_alias (strrchr, rindex) diff --git a/sysdeps/i386/strspn.S b/sysdeps/i386/strspn.S index 1a02026..fbba811c 100644 --- a/sysdeps/i386/strspn.S +++ b/sysdeps/i386/strspn.S @@ -1,7 +1,7 @@ /* strcspn (str, ss) -- Return the length of the initial segement of STR which contains only characters from SS. For Intel 80x86, x>=3. -Copyright (C) 1994, 1995 Free Software Foundation, Inc. +Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu> Bug fixes by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au> This file is part of the GNU C Library. @@ -174,3 +174,4 @@ L4: subl %edx, %eax /* we have to return the number of valid addl $256, %esp /* remove stopset */ ret +PSEUDO_END (strspn) diff --git a/sysdeps/i386/strtok.S b/sysdeps/i386/strtok.S index c38ebf9..a510e18 100644 --- a/sysdeps/i386/strtok.S +++ b/sysdeps/i386/strtok.S @@ -282,3 +282,4 @@ LreturnNULL: # endif #endif ret +PSEUDO_END (FUNCTION) diff --git a/sysdeps/i386/sysdep.h b/sysdeps/i386/sysdep.h index 9c312b0..9d21342 100644 --- a/sysdeps/i386/sysdep.h +++ b/sysdeps/i386/sysdep.h @@ -29,6 +29,7 @@ Cambridge, MA 02139, USA. */ #define ALIGNARG(log2) 1<<log2 /* For ELF we need the `.type' directive to make shared libs work right. */ #define ASM_TYPE_DIRECTIVE(name,typearg) .type name,typearg; +#define ASM_SIZE_DIRECTIVE(name) .size name,.-name /* In ELF C symbols are asm symbols. */ #undef NO_UNDERSCORES @@ -37,7 +38,8 @@ Cambridge, MA 02139, USA. */ #else #define ALIGNARG(log2) log2 -#define ASM_TYPE_DIRECTIVE(name,type) /* Nothing is specified. */ +#define ASM_TYPE_DIRECTIVE(name,type) /* Nothing is specified. */ +#define ASM_SIZE_DIRECTIVE(name) /* Nothing is specified. */ #endif @@ -76,6 +78,10 @@ lose: SYSCALL_PIC_SETUP \ DO_CALL (syscall_name, args); \ jb lose +#undef PSEUDO_END +#define PSEUDO_END(name) \ + ASM_SIZE_DIRECTIVE(name) + #ifdef PIC #define JUMPTARGET(name) name##@PLT #define SYSCALL_PIC_SETUP \ diff --git a/sysdeps/libm-i387/e_acos.S b/sysdeps/libm-i387/e_acos.S index 6ec7785..c9fa810 100644 --- a/sysdeps/libm-i387/e_acos.S +++ b/sysdeps/libm-i387/e_acos.S @@ -12,9 +12,10 @@ ENTRY(__ieee754_acos) fldl 4(%esp) /* x */ fst %st(1) fmul %st(0) /* x^2 */ - fld1 + fld1 fsubp /* 1 - x^2 */ fsqrt /* sqrt (1 - x^2) */ fxch %st(1) fpatan ret +PSEUDO_END (__ieee754_acos) diff --git a/sysdeps/libm-i387/e_acosl.S b/sysdeps/libm-i387/e_acosl.S index 3779fa7..4cc56c0 100644 --- a/sysdeps/libm-i387/e_acosl.S +++ b/sysdeps/libm-i387/e_acosl.S @@ -9,7 +9,7 @@ /* acosl = atanl (sqrtl(1 - x^2) / x) */ -ENTRY(__ieee754_acos) +ENTRY(__ieee754_acosl) fldt 4(%esp) /* x */ fst %st(1) fmul %st(0) /* x^2 */ @@ -19,3 +19,4 @@ ENTRY(__ieee754_acos) fxch %st(1) fpatan ret +PSEUDO_END (__ieee754_acosl) diff --git a/sysdeps/libm-i387/e_asin.S b/sysdeps/libm-i387/e_asin.S index dfcd7bc..cba4193 100644 --- a/sysdeps/libm-i387/e_asin.S +++ b/sysdeps/libm-i387/e_asin.S @@ -17,3 +17,4 @@ ENTRY(__ieee754_asin) fsqrt /* sqrt (1 - x^2) */ fpatan ret +PSEUDO_END (__ieee754_asin) diff --git a/sysdeps/libm-i387/e_asinl.S b/sysdeps/libm-i387/e_asinl.S index 7a90c3e..d4e2548 100644 --- a/sysdeps/libm-i387/e_asinl.S +++ b/sysdeps/libm-i387/e_asinl.S @@ -19,3 +19,4 @@ ENTRY(__ieee754_asinl) fsqrt /* sqrt (1 - x^2) */ fpatan ret +PSEUDO_END (__ieee754_asinl) diff --git a/sysdeps/libm-i387/e_atan2.S b/sysdeps/libm-i387/e_atan2.S index da2e119..6f7fc74 100644 --- a/sysdeps/libm-i387/e_atan2.S +++ b/sysdeps/libm-i387/e_atan2.S @@ -12,3 +12,4 @@ ENTRY(__ieee754_atan2) fldl 12(%esp) fpatan ret +PSEUDO_END (__ieee754_atan2) diff --git a/sysdeps/libm-i387/e_atan2f.S b/sysdeps/libm-i387/e_atan2f.S index 21fc0d9..bb6d902 100644 --- a/sysdeps/libm-i387/e_atan2f.S +++ b/sysdeps/libm-i387/e_atan2f.S @@ -12,3 +12,4 @@ ENTRY(__ieee754_atan2f) flds 8(%esp) fpatan ret +PSEUDO_END (__ieee754_atan2f) diff --git a/sysdeps/libm-i387/e_atan2l.S b/sysdeps/libm-i387/e_atan2l.S index 748571e..860885c 100644 --- a/sysdeps/libm-i387/e_atan2l.S +++ b/sysdeps/libm-i387/e_atan2l.S @@ -14,3 +14,4 @@ ENTRY(__ieee754_atan2l) fldt 16(%esp) fpatan ret +PSEUDO_END (__ieee754_atan2l) diff --git a/sysdeps/libm-i387/e_exp.S b/sysdeps/libm-i387/e_exp.S index 144748e..dad201f 100644 --- a/sysdeps/libm-i387/e_exp.S +++ b/sysdeps/libm-i387/e_exp.S @@ -12,6 +12,7 @@ ENTRY(__ieee754_exp) fldl 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 @@ -36,3 +37,4 @@ ENTRY(__ieee754_exp) jz .LpInf /* If positive, jump. */ fldz /* Set result to 0. */ .LpInf: ret +PSEUDO_END (__ieee754_exp) diff --git a/sysdeps/libm-i387/e_expl.S b/sysdeps/libm-i387/e_expl.S index d140898..2884efa 100644 --- a/sysdeps/libm-i387/e_expl.S +++ b/sysdeps/libm-i387/e_expl.S @@ -14,6 +14,7 @@ ENTRY(__ieee754_expl) fldt 4(%esp) /* I added the following ugly construct because expl(+-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 @@ -38,3 +39,4 @@ ENTRY(__ieee754_expl) jz .LpInf /* If positive, jump. */ fldz /* Set result to 0. */ .LpInf: ret +PSEUDO_END (__ieee754_expl) diff --git a/sysdeps/libm-i387/e_fmod.S b/sysdeps/libm-i387/e_fmod.S index c02df44..c4d7535 100644 --- a/sysdeps/libm-i387/e_fmod.S +++ b/sysdeps/libm-i387/e_fmod.S @@ -16,3 +16,4 @@ ENTRY(__ieee754_fmod) jp 1b fstpl %st(1) ret +PSEUDO_END (__ieee754_fmod) diff --git a/sysdeps/libm-i387/e_fmodl.S b/sysdeps/libm-i387/e_fmodl.S index 75ed17b..8c2bd06 100644 --- a/sysdeps/libm-i387/e_fmodl.S +++ b/sysdeps/libm-i387/e_fmodl.S @@ -18,3 +18,4 @@ ENTRY(__ieee754_fmodl) jp 1b fstpl %st(1) ret +PSEUDO_END (__ieee754_fmodl) diff --git a/sysdeps/libm-i387/e_log.S b/sysdeps/libm-i387/e_log.S index 98d569e..2a51d75 100644 --- a/sysdeps/libm-i387/e_log.S +++ b/sysdeps/libm-i387/e_log.S @@ -12,3 +12,4 @@ ENTRY(__ieee754_log) fldl 4(%esp) fyl2x ret +PSEUDO_END (__ieee754_log) diff --git a/sysdeps/libm-i387/e_log10.S b/sysdeps/libm-i387/e_log10.S index 612344b..17b3067 100644 --- a/sysdeps/libm-i387/e_log10.S +++ b/sysdeps/libm-i387/e_log10.S @@ -12,3 +12,4 @@ ENTRY(__ieee754_log10) fldl 4(%esp) fyl2x ret +PSEUDO_END (__ieee754_log10) diff --git a/sysdeps/libm-i387/e_log10l.S b/sysdeps/libm-i387/e_log10l.S index 0a19256..cfddb5c 100644 --- a/sysdeps/libm-i387/e_log10l.S +++ b/sysdeps/libm-i387/e_log10l.S @@ -14,3 +14,4 @@ ENTRY(__ieee754_log10l) fldt 4(%esp) fyl2x ret +PSEUDO_END(__ieee754_log10l) diff --git a/sysdeps/libm-i387/e_logl.S b/sysdeps/libm-i387/e_logl.S index 2575d6c..4c1550e 100644 --- a/sysdeps/libm-i387/e_logl.S +++ b/sysdeps/libm-i387/e_logl.S @@ -14,3 +14,4 @@ ENTRY(__ieee754_logl) fldt 4(%esp) fyl2x ret +PSEUDO_END(__ieee754_logl) diff --git a/sysdeps/libm-i387/e_remainder.S b/sysdeps/libm-i387/e_remainder.S index d14f2e8..287b616 100644 --- a/sysdeps/libm-i387/e_remainder.S +++ b/sysdeps/libm-i387/e_remainder.S @@ -16,3 +16,4 @@ ENTRY(__ieee754_remainder) jp 1b fstpl %st(1) ret +PSEUDO_END (__ieee754_remainder) diff --git a/sysdeps/libm-i387/e_remainderf.S b/sysdeps/libm-i387/e_remainderf.S index ed578ea..cdc1ac8 100644 --- a/sysdeps/libm-i387/e_remainderf.S +++ b/sysdeps/libm-i387/e_remainderf.S @@ -16,3 +16,4 @@ ENTRY(__ieee754_remainderf) jp 1b fstpl %st(1) ret +PSEUDO_END (__ieee754_remainderf) diff --git a/sysdeps/libm-i387/e_remainderl.S b/sysdeps/libm-i387/e_remainderl.S index ce98515..2c32550 100644 --- a/sysdeps/libm-i387/e_remainderl.S +++ b/sysdeps/libm-i387/e_remainderl.S @@ -17,3 +17,4 @@ ENTRY(__ieee754_remainderl) sahf jp 1b ret +PSEUDO_END (__ieee754_remainderl) diff --git a/sysdeps/libm-i387/e_scalb.S b/sysdeps/libm-i387/e_scalb.S index 7d95f8e..0aed96d 100644 --- a/sysdeps/libm-i387/e_scalb.S +++ b/sysdeps/libm-i387/e_scalb.S @@ -12,3 +12,4 @@ ENTRY(__ieee754_scalb) fldl 4(%esp) fscale ret +PSEUDO_END(__ieee754_scalb) diff --git a/sysdeps/libm-i387/e_scalbl.S b/sysdeps/libm-i387/e_scalbl.S index 8d5cd3b..40d6ff0 100644 --- a/sysdeps/libm-i387/e_scalbl.S +++ b/sysdeps/libm-i387/e_scalbl.S @@ -14,3 +14,4 @@ ENTRY(__ieee754_scalbl) fldt 4(%esp) fscale ret +PSEUDO_END(__ieee754_scalbl) diff --git a/sysdeps/libm-i387/e_sqrt.S b/sysdeps/libm-i387/e_sqrt.S index 34fe9b7..170363f 100644 --- a/sysdeps/libm-i387/e_sqrt.S +++ b/sysdeps/libm-i387/e_sqrt.S @@ -11,3 +11,4 @@ ENTRY(__ieee754_sqrt) fldl 4(%esp) fsqrt ret +PSEUDO_END (__ieee754_sqrt) diff --git a/sysdeps/libm-i387/e_sqrtf.S b/sysdeps/libm-i387/e_sqrtf.S index d20c4c1..f13c129 100644 --- a/sysdeps/libm-i387/e_sqrtf.S +++ b/sysdeps/libm-i387/e_sqrtf.S @@ -11,3 +11,4 @@ ENTRY(__ieee754_sqrtf) flds 4(%esp) fsqrt ret +PSEUDO_END (__ieee754_sqrtf) diff --git a/sysdeps/libm-i387/e_sqrtl.S b/sysdeps/libm-i387/e_sqrtl.S index 88e5f82..56947e1 100644 --- a/sysdeps/libm-i387/e_sqrtl.S +++ b/sysdeps/libm-i387/e_sqrtl.S @@ -13,3 +13,4 @@ ENTRY(__ieee754_sqrtl) fldt 4(%esp) fsqrt ret +PSEUDO_END (__ieee754_sqrtl) diff --git a/sysdeps/libm-i387/s_atan.S b/sysdeps/libm-i387/s_atan.S index 4dcd54f..f670031 100644 --- a/sysdeps/libm-i387/s_atan.S +++ b/sysdeps/libm-i387/s_atan.S @@ -12,4 +12,5 @@ ENTRY(__atan) fld1 fpatan ret +PSEUDO_END (__atan) weak_alias (__atan, atan) diff --git a/sysdeps/libm-i387/s_atanf.S b/sysdeps/libm-i387/s_atanf.S index d00593d..803b7f9 100644 --- a/sysdeps/libm-i387/s_atanf.S +++ b/sysdeps/libm-i387/s_atanf.S @@ -12,4 +12,5 @@ ENTRY(__atanf) fld1 fpatan ret +PSEUDO_END (__atanf) weak_alias (__atanf, atanf) diff --git a/sysdeps/libm-i387/s_atanl.S b/sysdeps/libm-i387/s_atanl.S index 867e60b..59f1390 100644 --- a/sysdeps/libm-i387/s_atanl.S +++ b/sysdeps/libm-i387/s_atanl.S @@ -14,4 +14,5 @@ ENTRY(__atanl) fld1 fpatan ret +PSEUDO_END (__atanl) weak_alias (__atanl, atanl) diff --git a/sysdeps/libm-i387/s_ceil.S b/sysdeps/libm-i387/s_ceil.S index eabe662..a500b07 100644 --- a/sysdeps/libm-i387/s_ceil.S +++ b/sysdeps/libm-i387/s_ceil.S @@ -13,10 +13,14 @@ ENTRY(__ceil) subl $8,%esp fstcw -4(%ebp) /* store fpu control word */ - movw -4(%ebp),%dx - orw $0x0800,%dx /* round towards +oo */ - andw $0xfbff,%dx - movw %dx,-8(%ebp) + + /* We use here %edx although only the low 1 bits are defined. + But none of the operations should care and they are faster + than the 16 bit operations. */ + movl -4(%ebp),%edx + orl $0x0800,%edx /* round towards +oo */ + andl $0xfbff,%edx + movl %edx,-8(%ebp) fldcw -8(%ebp) /* load modfied control word */ fldl 8(%ebp); /* round */ @@ -26,4 +30,5 @@ ENTRY(__ceil) leave ret +PSEUDO_END (__ceil) weak_alias (__ceil, ceil) diff --git a/sysdeps/libm-i387/s_ceilf.S b/sysdeps/libm-i387/s_ceilf.S index c2163ab..4789b01 100644 --- a/sysdeps/libm-i387/s_ceilf.S +++ b/sysdeps/libm-i387/s_ceilf.S @@ -13,10 +13,14 @@ ENTRY(__ceilf) subl $8,%esp fstcw -4(%ebp) /* store fpu control word */ - movw -4(%ebp),%dx - orw $0x0800,%dx /* round towards +oo */ - andw $0xfbff,%dx - movw %dx,-8(%ebp) + + /* We use here %edx although only the low 1 bits are defined. + But none of the operations should care and they are faster + than the 16 bit operations. */ + movl -4(%ebp),%edx + orl $0x0800,%edx /* round towards +oo */ + andl $0xfbff,%edx + movl %edx,-8(%ebp) fldcw -8(%ebp) /* load modfied control word */ flds 8(%ebp); /* round */ @@ -26,4 +30,5 @@ ENTRY(__ceilf) leave ret +PSEUDO_END (__ceilf) weak_alias (__ceilf, ceilf) diff --git a/sysdeps/libm-i387/s_ceill.S b/sysdeps/libm-i387/s_ceill.S index fd7bd38..a02a547 100644 --- a/sysdeps/libm-i387/s_ceill.S +++ b/sysdeps/libm-i387/s_ceill.S @@ -14,10 +14,14 @@ ENTRY(__ceill) subl $8,%esp fstcw -4(%ebp) /* store fpu control word */ - movw -4(%ebp),%dx - orw $0x0800,%dx /* round towards +oo */ - andw $0xfbff,%dx - movw %dx,-8(%ebp) + + /* We use here %edx although only the low 1 bits are defined. + But none of the operations should care and they are faster + than the 16 bit operations. */ + movl -4(%ebp),%edx + orl $0x0800,%edx /* round towards +oo */ + andl $0xfbff,%edx + movl %edx,-8(%ebp) fldcw -8(%ebp) /* load modfied control word */ fldt 8(%ebp); /* round */ @@ -27,4 +31,5 @@ ENTRY(__ceill) leave ret +PSEUDO_END (__ceill) weak_alias (__ceill, ceill) diff --git a/sysdeps/libm-i387/s_copysign.S b/sysdeps/libm-i387/s_copysign.S index 0de3aff..45b86f5 100644 --- a/sysdeps/libm-i387/s_copysign.S +++ b/sysdeps/libm-i387/s_copysign.S @@ -9,11 +9,12 @@ RCSID("$NetBSD: s_copysign.S,v 1.4 1995/05/08 23:53:02 jtc Exp $") ENTRY(__copysign) movl 16(%esp),%edx - andl $0x80000000,%edx movl 8(%esp),%eax + andl $0x80000000,%edx andl $0x7fffffff,%eax orl %edx,%eax movl %eax,8(%esp) fldl 4(%esp) ret +PSEUDO_END (__copysign) weak_alias (__copysign, copysign) diff --git a/sysdeps/libm-i387/s_copysignf.S b/sysdeps/libm-i387/s_copysignf.S index a55cd37..4844a2b 100644 --- a/sysdeps/libm-i387/s_copysignf.S +++ b/sysdeps/libm-i387/s_copysignf.S @@ -9,11 +9,12 @@ RCSID("$NetBSD: s_copysignf.S,v 1.3 1995/05/08 23:53:25 jtc Exp $") ENTRY(__copysignf) movl 8(%esp),%edx - andl $0x80000000,%edx movl 4(%esp),%eax + andl $0x80000000,%edx andl $0x7fffffff,%eax orl %edx,%eax movl %eax,4(%esp) flds 4(%esp) ret +PSEUDO_END (__copysignf) weak_alias (__copysignf, copysignf) diff --git a/sysdeps/libm-i387/s_copysignl.S b/sysdeps/libm-i387/s_copysignl.S index f65f684..37e34fe 100644 --- a/sysdeps/libm-i387/s_copysignl.S +++ b/sysdeps/libm-i387/s_copysignl.S @@ -15,6 +15,7 @@ ENTRY(__copysignl) andl $0x7fff,%eax orl %edx,%eax movl %eax,12(%esp) - fldl 4(%esp) + fldt 4(%esp) ret +PSEUDO_END (__copysignl) weak_alias (__copysignl, copysignl) diff --git a/sysdeps/libm-i387/s_cos.S b/sysdeps/libm-i387/s_cos.S index 0ccf8bc..6b47e80 100644 --- a/sysdeps/libm-i387/s_cos.S +++ b/sysdeps/libm-i387/s_cos.S @@ -13,7 +13,7 @@ ENTRY(__cos) fnstsw %ax andw $0x400,%ax jnz 1f - ret + ret 1: fldpi fadd %st(0) fxch %st(1) @@ -24,4 +24,5 @@ ENTRY(__cos) fstp %st(1) fcos ret +PSEUDO_END (__cos) weak_alias (__cos, cos) diff --git a/sysdeps/libm-i387/s_cosf.S b/sysdeps/libm-i387/s_cosf.S index a200e04..a2bd0e5 100644 --- a/sysdeps/libm-i387/s_cosf.S +++ b/sysdeps/libm-i387/s_cosf.S @@ -11,5 +11,6 @@ RCSID("$NetBSD: s_cosf.S,v 1.3 1995/05/08 23:55:16 jtc Exp $") ENTRY(__cosf) flds 4(%esp) fcos - ret + ret +PSEUDO_END (__cosf) weak_alias (__cosf, cosf) diff --git a/sysdeps/libm-i387/s_cosl.S b/sysdeps/libm-i387/s_cosl.S index e2c2242..2ddb549 100644 --- a/sysdeps/libm-i387/s_cosl.S +++ b/sysdeps/libm-i387/s_cosl.S @@ -26,4 +26,5 @@ ENTRY(__cosl) fstp %st(1) fcos ret +PSEUDO_END (__cosl) weak_alias (__cosl, cosl) diff --git a/sysdeps/libm-i387/s_finite.S b/sysdeps/libm-i387/s_finite.S index 233155e..538fec9 100644 --- a/sysdeps/libm-i387/s_finite.S +++ b/sysdeps/libm-i387/s_finite.S @@ -14,4 +14,5 @@ ENTRY(__finite) setne %al andl $0x000000ff, %eax ret +PSEUDO_END (__finite) weak_alias (__finite, finite) diff --git a/sysdeps/libm-i387/s_finitef.S b/sysdeps/libm-i387/s_finitef.S index 28a0a40..cb0caab 100644 --- a/sysdeps/libm-i387/s_finitef.S +++ b/sysdeps/libm-i387/s_finitef.S @@ -14,4 +14,5 @@ ENTRY(__finitef) setne %al andl $0x000000ff, %eax ret +PSEUDO_END (__finitef) weak_alias (__finitef, finitef) diff --git a/sysdeps/libm-i387/s_finitel.S b/sysdeps/libm-i387/s_finitel.S index d163965..7af8047 100644 --- a/sysdeps/libm-i387/s_finitel.S +++ b/sysdeps/libm-i387/s_finitel.S @@ -16,4 +16,5 @@ ENTRY(__finitel) setne %al andl $0x000000ff, %eax ret +PSEUDO_END (__finitel) weak_alias (__finitel, finitel) diff --git a/sysdeps/libm-i387/s_floor.S b/sysdeps/libm-i387/s_floor.S index 66e688f..7599303 100644 --- a/sysdeps/libm-i387/s_floor.S +++ b/sysdeps/libm-i387/s_floor.S @@ -26,4 +26,5 @@ ENTRY(__floor) leave ret +PSEUDO_END (__floor) weak_alias (__floor, floor) diff --git a/sysdeps/libm-i387/s_floorf.S b/sysdeps/libm-i387/s_floorf.S index 4b10f74..c45d82e 100644 --- a/sysdeps/libm-i387/s_floorf.S +++ b/sysdeps/libm-i387/s_floorf.S @@ -26,4 +26,5 @@ ENTRY(__floorf) leave ret +PSEUDO_END (__floorf) weak_alias (__floorf, floorf) diff --git a/sysdeps/libm-i387/s_floorl.S b/sysdeps/libm-i387/s_floorl.S index af52ffc..ae4ba2e 100644 --- a/sysdeps/libm-i387/s_floorl.S +++ b/sysdeps/libm-i387/s_floorl.S @@ -27,4 +27,5 @@ ENTRY(__floorl) leave ret +PSEUDO_END (__floorl) weak_alias (__floorl, floorl) diff --git a/sysdeps/libm-i387/s_ilogb.S b/sysdeps/libm-i387/s_ilogb.S index f11ed58..6fb51d9 100644 --- a/sysdeps/libm-i387/s_ilogb.S +++ b/sysdeps/libm-i387/s_ilogb.S @@ -21,4 +21,5 @@ ENTRY(__ilogb) leave ret +PSEUDO_END (__ilogb) weak_alias (__ilogb, ilogb) diff --git a/sysdeps/libm-i387/s_ilogbf.S b/sysdeps/libm-i387/s_ilogbf.S index 5a61d28..71e4f42 100644 --- a/sysdeps/libm-i387/s_ilogbf.S +++ b/sysdeps/libm-i387/s_ilogbf.S @@ -21,4 +21,5 @@ ENTRY(__ilogbf) leave ret +PSEUDO_END (__ilogbf) weak_alias (__ilogbf, ilogbf) diff --git a/sysdeps/libm-i387/s_ilogbl.S b/sysdeps/libm-i387/s_ilogbl.S index 11c8101..2b84146 100644 --- a/sysdeps/libm-i387/s_ilogbl.S +++ b/sysdeps/libm-i387/s_ilogbl.S @@ -21,4 +21,5 @@ ENTRY(__ilogbl) leave ret +PSEUDO_END (__ilogbl) weak_alias (__ilogbl, ilogbl) diff --git a/sysdeps/libm-i387/s_log1p.S b/sysdeps/libm-i387/s_log1p.S index c4aee4a..ce8665d 100644 --- a/sysdeps/libm-i387/s_log1p.S +++ b/sysdeps/libm-i387/s_log1p.S @@ -10,7 +10,7 @@ RCSID("$NetBSD: s_log1p.S,v 1.7 1995/05/09 00:10:58 jtc Exp $") /* * 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. + * it's not worth trying to use it. */ ENTRY(__log1p) @@ -20,4 +20,5 @@ ENTRY(__log1p) faddp fyl2x ret +PSEUDO_END (__log1p) weak_alias (__log1p, log1p) diff --git a/sysdeps/libm-i387/s_log1pf.S b/sysdeps/libm-i387/s_log1pf.S index e268550..7a161f2 100644 --- a/sysdeps/libm-i387/s_log1pf.S +++ b/sysdeps/libm-i387/s_log1pf.S @@ -10,7 +10,7 @@ RCSID("$NetBSD: s_log1pf.S,v 1.4 1995/05/09 00:13:05 jtc Exp $") /* * 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. + * it's not worth trying to use it. */ ENTRY(__log1pf) @@ -20,4 +20,5 @@ ENTRY(__log1pf) faddp fyl2x ret +PSEUDO_END (__log1pf) weak_alias (__log1pf, log1pf) diff --git a/sysdeps/libm-i387/s_log1pl.S b/sysdeps/libm-i387/s_log1pl.S index 4a9faf7..647e136 100644 --- a/sysdeps/libm-i387/s_log1pl.S +++ b/sysdeps/libm-i387/s_log1pl.S @@ -22,4 +22,5 @@ ENTRY(__log1pl) faddp fyl2x ret +PSEUDO_END (__log1pl) weak_alias (__log1pl, log1pl) diff --git a/sysdeps/libm-i387/s_logb.S b/sysdeps/libm-i387/s_logb.S index 4f071e0..92d8fee 100644 --- a/sysdeps/libm-i387/s_logb.S +++ b/sysdeps/libm-i387/s_logb.S @@ -12,4 +12,5 @@ ENTRY(__logb) fxtract fstpl %st ret +PSEUDO_END (__logb) weak_alias (__logb, logb) diff --git a/sysdeps/libm-i387/s_logbf.S b/sysdeps/libm-i387/s_logbf.S index ecdd0ae..b557974 100644 --- a/sysdeps/libm-i387/s_logbf.S +++ b/sysdeps/libm-i387/s_logbf.S @@ -12,4 +12,5 @@ ENTRY(__logbf) fxtract fstpl %st ret +PSEUDO_END (__logbf) weak_alias (__logbf, logbf) diff --git a/sysdeps/libm-i387/s_logbl.S b/sysdeps/libm-i387/s_logbl.S index e72b1fb..91bddb6 100644 --- a/sysdeps/libm-i387/s_logbl.S +++ b/sysdeps/libm-i387/s_logbl.S @@ -12,4 +12,5 @@ ENTRY(__logbl) fldt 4(%esp) fxtract ret +PSEUDO_END (__logbl) weak_alias (__logbl, logbl) diff --git a/sysdeps/libm-i387/s_rint.S b/sysdeps/libm-i387/s_rint.S index 2f09a47..9231fef 100644 --- a/sysdeps/libm-i387/s_rint.S +++ b/sysdeps/libm-i387/s_rint.S @@ -11,4 +11,5 @@ ENTRY(__rint) fldl 4(%esp) frndint ret +PSEUDO_END (__rint) weak_alias (__rint, rint) diff --git a/sysdeps/libm-i387/s_rintf.S b/sysdeps/libm-i387/s_rintf.S index de64d79..3e35f2c 100644 --- a/sysdeps/libm-i387/s_rintf.S +++ b/sysdeps/libm-i387/s_rintf.S @@ -11,4 +11,5 @@ ENTRY(__rintf) flds 4(%esp) frndint ret +PSEUDO_END (__rintf) weak_alias (__rintf, rintf) diff --git a/sysdeps/libm-i387/s_rintl.S b/sysdeps/libm-i387/s_rintl.S index aec09a6..a8198d3 100644 --- a/sysdeps/libm-i387/s_rintl.S +++ b/sysdeps/libm-i387/s_rintl.S @@ -12,4 +12,5 @@ ENTRY(__rintl) fldt 4(%esp) frndint ret +PSEUDO_END (__rintl) weak_alias (__rintl, rintl) diff --git a/sysdeps/libm-i387/s_scalbn.S b/sysdeps/libm-i387/s_scalbn.S index 99ecac6..4a41495 100644 --- a/sysdeps/libm-i387/s_scalbn.S +++ b/sysdeps/libm-i387/s_scalbn.S @@ -12,4 +12,5 @@ ENTRY(__scalbn) fldl 4(%esp) fscale ret +PSEUDO_END (__scalbn) weak_alias (__scalbn, scalbn) diff --git a/sysdeps/libm-i387/s_scalbnf.S b/sysdeps/libm-i387/s_scalbnf.S index 0203e91..080304d 100644 --- a/sysdeps/libm-i387/s_scalbnf.S +++ b/sysdeps/libm-i387/s_scalbnf.S @@ -12,4 +12,5 @@ ENTRY(__scalbnf) flds 4(%esp) fscale ret +PSEUDO_END (__scalbnf) weak_alias (__scalbnf, scalbnf) diff --git a/sysdeps/libm-i387/s_scalbnl.S b/sysdeps/libm-i387/s_scalbnl.S index b5fdf82..adf1dea 100644 --- a/sysdeps/libm-i387/s_scalbnl.S +++ b/sysdeps/libm-i387/s_scalbnl.S @@ -13,4 +13,5 @@ ENTRY(__scalbnl) fldt 4(%esp) fscale ret +PSEUDO_END (__scalbnl) weak_alias (__scalbnl, scalbnl) diff --git a/sysdeps/libm-i387/s_significand.S b/sysdeps/libm-i387/s_significand.S index 09f3a0a..ff72b88 100644 --- a/sysdeps/libm-i387/s_significand.S +++ b/sysdeps/libm-i387/s_significand.S @@ -12,4 +12,5 @@ ENTRY(__significand) fxtract fstpl %st(1) ret +PSEUDO_END (__significand) weak_alias (__significand, significand) diff --git a/sysdeps/libm-i387/s_significandf.S b/sysdeps/libm-i387/s_significandf.S index b678bc5..af92886 100644 --- a/sysdeps/libm-i387/s_significandf.S +++ b/sysdeps/libm-i387/s_significandf.S @@ -12,4 +12,5 @@ ENTRY(__significandf) fxtract fstpl %st(1) ret +PSEUDO_END (__significandf) weak_alias (__significandf, significandf) diff --git a/sysdeps/libm-i387/s_significandl.S b/sysdeps/libm-i387/s_significandl.S index e512f54..1483a0d 100644 --- a/sysdeps/libm-i387/s_significandl.S +++ b/sysdeps/libm-i387/s_significandl.S @@ -11,6 +11,7 @@ RCSID("$NetBSD: $") ENTRY(__significandl) fldt 4(%esp) fxtract - fstpt %st(1) + fincstp ret +PSEUDO_END (__significandl) weak_alias (__significandl, significandl) diff --git a/sysdeps/libm-i387/s_sin.S b/sysdeps/libm-i387/s_sin.S index 7928495..f06c944 100644 --- a/sysdeps/libm-i387/s_sin.S +++ b/sysdeps/libm-i387/s_sin.S @@ -24,4 +24,5 @@ ENTRY(__sin) fstp %st(1) fsin ret +PSEUDO_END (__sin) weak_alias (__sin, sin) diff --git a/sysdeps/libm-i387/s_sinf.S b/sysdeps/libm-i387/s_sinf.S index 03a42cb..464ccb2 100644 --- a/sysdeps/libm-i387/s_sinf.S +++ b/sysdeps/libm-i387/s_sinf.S @@ -12,4 +12,5 @@ ENTRY(__sinf) flds 4(%esp) fsin ret +PSEUDO_END (__sinf) weak_alias (__sinf, sinf) diff --git a/sysdeps/libm-i387/s_sinl.S b/sysdeps/libm-i387/s_sinl.S index 03c9c87..2872334 100644 --- a/sysdeps/libm-i387/s_sinl.S +++ b/sysdeps/libm-i387/s_sinl.S @@ -26,4 +26,5 @@ ENTRY(__sinl) fstp %st(1) fsin ret +PSEUDO_END (__sinl) weak_alias (__sinl, sinl) diff --git a/sysdeps/libm-i387/s_tan.S b/sysdeps/libm-i387/s_tan.S index 9474c8c..9333671 100644 --- a/sysdeps/libm-i387/s_tan.S +++ b/sysdeps/libm-i387/s_tan.S @@ -26,4 +26,5 @@ ENTRY(__tan) fptan fstp %st(0) ret +PSEUDO_END (__tan) weak_alias (__tan, tan) diff --git a/sysdeps/libm-i387/s_tanf.S b/sysdeps/libm-i387/s_tanf.S index 3296434..cbf8dd8 100644 --- a/sysdeps/libm-i387/s_tanf.S +++ b/sysdeps/libm-i387/s_tanf.S @@ -13,4 +13,5 @@ ENTRY(__tanf) fptan fstp %st(0) ret +PSEUDO_END (__tanf) weak_alias (__tanf, tanf) diff --git a/sysdeps/libm-i387/s_tanl.S b/sysdeps/libm-i387/s_tanl.S index 6b1532a..c818e96 100644 --- a/sysdeps/libm-i387/s_tanl.S +++ b/sysdeps/libm-i387/s_tanl.S @@ -28,4 +28,5 @@ ENTRY(__tanl) fptan fstp %st(0) ret +PSEUDO_END (__tanl) weak_alias (__tanl, tanl) diff --git a/sysdeps/libm-ieee754/e_atanhl.c b/sysdeps/libm-ieee754/e_atanhl.c index d74db48..0e6dadd 100644 --- a/sysdeps/libm-ieee754/e_atanhl.c +++ b/sysdeps/libm-ieee754/e_atanhl.c @@ -40,9 +40,9 @@ static char rcsid[] = "$NetBSD: $"; #include "math_private.h" #ifdef __STDC__ -static const long double one = 1.0, huge = 1e16380; +static const long double one = 1.0, huge = 1e4900L; #else -static long double one = 1.0, huge = 1e16380; +static long double one = 1.0, huge = 1e4900L; #endif #ifdef __STDC__ @@ -61,7 +61,7 @@ static double long zero = 0.0; long double t; int32_t ix; u_int32_t se,i0,i1; - EXTRACT_LDOUBLE_WORDS(se,i0,i1,x); + GET_LDOUBLE_WORDS(se,i0,i1,x); ix = se&0x7fff; if ((ix+((((i0&0x7fffffff)|i1)|(-((i0&0x7fffffff)|i1)))>>31))>0x3fff) /* |x|>1 */ diff --git a/sysdeps/libm-ieee754/e_coshl.c b/sysdeps/libm-ieee754/e_coshl.c new file mode 100644 index 0000000..6af846c --- /dev/null +++ b/sysdeps/libm-ieee754/e_coshl.c @@ -0,0 +1,94 @@ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: e_cosh.c,v 1.7 1995/05/10 20:44:58 jtc Exp $"; +#endif + +/* __ieee754_coshl(x) + * Method : + * mathematically coshl(x) if defined to be (exp(x)+exp(-x))/2 + * 1. Replace x by |x| (coshl(x) = coshl(-x)). + * 2. + * [ exp(x) - 1 ]^2 + * 0 <= x <= ln2/2 : coshl(x) := 1 + ------------------- + * 2*exp(x) + * + * exp(x) + 1/exp(x) + * ln2/2 <= x <= 22 : coshl(x) := ------------------- + * 2 + * 22 <= x <= lnovft : coshl(x) := expl(x)/2 + * lnovft <= x <= ln2ovft: coshl(x) := expl(x/2)/2 * expl(x/2) + * ln2ovft < x : coshl(x) := huge*huge (overflow) + * + * Special cases: + * coshl(x) is |x| if x is +INF, -INF, or NaN. + * only coshl(0)=1 is exact for finite x. + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const long double one = 1.0, half=0.5, huge = 1.0e4900L; +#else +static long double one = 1.0, half=0.5, huge = 1.0e4900L; +#endif + +#ifdef __STDC__ + long double __ieee754_coshl(long double x) +#else + long double __ieee754_coshl(x) + long double x; +#endif +{ + long double t,w; + int32_t ex; + u_int32_t mx,lx; + + /* High word of |x|. */ + GET_LDOUBLE_WORDS(ex,mx,lx,x); + ex &= 0x7fff; + + /* x is INF or NaN */ + if(ex==0x7fff) return x*x; + + /* |x| in [0,0.5*ln2], return 1+expm1l(|x|)^2/(2*expl(|x|)) */ + if(ex < 0x3ffd || (ex == 0x3ffd && mx < 0xb17217f7u)) { + t = __expm1l(fabsl(x)); + w = one+t; + if (ex<0x3fbc) return w; /* cosh(tiny) = 1 */ + return one+(t*t)/(w+w); + } + + /* |x| in [0.5*ln2,22], return (exp(|x|)+1/exp(|x|)/2; */ + if (ex < 0x4003 || (ex == 0x4003 && mx < 0xb0000000u)) { + t = __ieee754_expl(fabsl(x)); + return half*t+half/t; + } + + /* |x| in [22, ln(maxdouble)] return half*exp(|x|) */ + if (ex < 0x400c || (ex == 0x400c && mx < 0xb1700000u)) + return half*__ieee754_expl(fabsl(x)); + + /* |x| in [log(maxdouble), overflowthresold] */ + if (ex < 0x400d + || (ex == 0x400d && (mx < 0xb170b513u + || (mx == 0xb170b513u && lx < 0xa1dfd60cu)))) + { + w = __ieee754_expl(half*fabsl(x)); + t = half*w; + return t*w; + } + + /* |x| > overflowthresold, cosh(x) overflow */ + return huge*huge; +} diff --git a/sysdeps/libm-ieee754/s_asinh.c b/sysdeps/libm-ieee754/s_asinh.c index bb3c495..985cfe3 100644 --- a/sysdeps/libm-ieee754/s_asinh.c +++ b/sysdeps/libm-ieee754/s_asinh.c @@ -5,7 +5,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. * ==================================================== */ @@ -16,7 +16,7 @@ static char rcsid[] = "$NetBSD: s_asinh.c,v 1.9 1995/05/12 04:57:37 jtc Exp $"; /* asinh(x) * Method : - * Based + * Based on * asinh(x) = sign(x) * log [ |x| + sqrt(x*x+1) ] * we have * asinh(x) := x if 1+x*x=1, diff --git a/sysdeps/libm-ieee754/s_asinhl.c b/sysdeps/libm-ieee754/s_asinhl.c index 823288a..865bc31 100644 --- a/sysdeps/libm-ieee754/s_asinhl.c +++ b/sysdeps/libm-ieee754/s_asinhl.c @@ -39,7 +39,7 @@ static long double #endif one = 1.000000000000000000000e+00L, /* 0x3FFF, 0x00000000, 0x00000000 */ ln2 = 6.931471805599453094287e-01L, /* 0x3FFE, 0xB17217F7, 0xD1CF79AC */ -huge= 1.000000000000000000e+16380L; +huge= 1.000000000000000000e+4900L; #ifdef __STDC__ long double __asinhl(long double x) diff --git a/sysdeps/libm-ieee754/s_atan.c b/sysdeps/libm-ieee754/s_atan.c index 2f3c545..6657b15 100644 --- a/sysdeps/libm-ieee754/s_atan.c +++ b/sysdeps/libm-ieee754/s_atan.c @@ -5,7 +5,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. * ==================================================== */ @@ -28,9 +28,9 @@ static char rcsid[] = "$NetBSD: s_atan.c,v 1.8 1995/05/10 20:46:45 jtc Exp $"; * [39/16,INF] atan(x) = atan(INF) + atan( -1/t ) * * Constants: - * The hexadecimal values are the intended ones for the following - * constants. The decimal values may be used, provided that the - * compiler will convert from decimal to binary accurately enough + * The hexadecimal values are the intended ones for the following + * constants. The decimal values may be used, provided that the + * compiler will convert from decimal to binary accurately enough * to produce the hexadecimal values shown. */ @@ -78,9 +78,9 @@ static double aT[] = { }; #ifdef __STDC__ - static const double + static const double #else - static double + static double #endif one = 1.0, huge = 1.0e300; @@ -114,9 +114,9 @@ huge = 1.0e300; x = fabs(x); if (ix < 0x3ff30000) { /* |x| < 1.1875 */ if (ix < 0x3fe60000) { /* 7/16 <=|x|<11/16 */ - id = 0; x = (2.0*x-one)/(2.0+x); + id = 0; x = (2.0*x-one)/(2.0+x); } else { /* 11/16<=|x|< 19/16 */ - id = 1; x = (x-one)/(x+one); + id = 1; x = (x-one)/(x+one); } } else { if (ix < 0x40038000) { /* |x| < 2.4375 */ @@ -138,3 +138,7 @@ huge = 1.0e300; } } weak_alias (__atan, atan) +#ifdef NO_LONG_DOUBLE +strong_alias (__atan, __atanl) +weak_alias (__atan, atanl) +#endif diff --git a/sysdeps/libm-ieee754/s_cbrt.c b/sysdeps/libm-ieee754/s_cbrt.c index cf72f4c..24a9c9a 100644 --- a/sysdeps/libm-ieee754/s_cbrt.c +++ b/sysdeps/libm-ieee754/s_cbrt.c @@ -5,7 +5,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. * ==================================================== */ @@ -40,9 +40,9 @@ F = 1.60714285714285720630e+00, /* 45/28 = 0x3FF9B6DB, 0x6DB6DB6E */ G = 3.57142857142857150787e-01; /* 5/14 = 0x3FD6DB6D, 0xB6DB6DB7 */ #ifdef __STDC__ - double __cbrt(double x) + double __cbrt(double x) #else - double __cbrt(x) + double __cbrt(x) double x; #endif { @@ -56,7 +56,7 @@ G = 3.57142857142857150787e-01; /* 5/14 = 0x3FD6DB6D, 0xB6DB6DB7 */ hx ^=sign; if(hx>=0x7ff00000) return(x+x); /* cbrt(NaN,INF) is itself */ GET_LOW_WORD(low,x); - if((hx|low)==0) + if((hx|low)==0) return(x); /* cbrt(0) is itself */ SET_HIGH_WORD(x,hx); /* x <- |x| */ @@ -72,9 +72,9 @@ G = 3.57142857142857150787e-01; /* 5/14 = 0x3FD6DB6D, 0xB6DB6DB7 */ /* new cbrt to 23 bits, may be implemented in single precision */ r=t*t/x; s=C+r*t; - t*=G+F/(s+E+D/s); + t*=G+F/(s+E+D/s); - /* chopped to 20 bits and make it larger than cbrt(x) */ + /* chopped to 20 bits and make it larger than cbrt(x) */ GET_HIGH_WORD(high,t); INSERT_WORDS(t,high+0x00000001,0); @@ -92,3 +92,7 @@ G = 3.57142857142857150787e-01; /* 5/14 = 0x3FD6DB6D, 0xB6DB6DB7 */ return(t); } weak_alias (__cbrt, cbrt) +#ifdef NO_LONG_DOUBLE +strong_alias (__cbrt, __cbrtl) +weak_alias (__cbrt, cbrtl) +#endif diff --git a/sysdeps/libm-ieee754/s_ceil.c b/sysdeps/libm-ieee754/s_ceil.c index 9c878f7..1b352a6 100644 --- a/sysdeps/libm-ieee754/s_ceil.c +++ b/sysdeps/libm-ieee754/s_ceil.c @@ -5,7 +5,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. * ==================================================== */ @@ -46,7 +46,7 @@ static double huge = 1.0e300; if(j0<20) { if(j0<0) { /* raise inexact if x != 0 */ if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */ - if(i0<0) {i0=0x80000000;i1=0;} + if(i0<0) {i0=0x80000000;i1=0;} else if((i0|i1)!=0) { i0=0x3ff00000;i1=0;} } } else { @@ -65,7 +65,7 @@ static double huge = 1.0e300; if((i1&i)==0) return x; /* x is integral */ if(huge+x>0.0) { /* raise inexact flag */ if(i0>0) { - if(j0==20) i0+=1; + if(j0==20) i0+=1; else { j = i1 + (1<<(52-j0)); if(j<i1) i0+=1; /* got a carry */ @@ -79,3 +79,7 @@ static double huge = 1.0e300; return x; } weak_alias (__ceil, ceil) +#ifdef NO_LONG_DOUBLE +strong_alias (__ceil, __ceill) +weak_alias (__ceil, ceill) +#endif diff --git a/sysdeps/libm-ieee754/s_copysign.c b/sysdeps/libm-ieee754/s_copysign.c index b86ac76..5e35e69 100644 --- a/sysdeps/libm-ieee754/s_copysign.c +++ b/sysdeps/libm-ieee754/s_copysign.c @@ -5,7 +5,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. * ==================================================== */ @@ -37,3 +37,7 @@ static char rcsid[] = "$NetBSD: s_copysign.c,v 1.8 1995/05/10 20:46:57 jtc Exp $ return x; } weak_alias (__copysign, copysign) +#ifdef NO_LONG_DOUBLE +strong_alias (__copysign, __copysignl) +weak_alias (__copysign, copysignl) +#endif diff --git a/sysdeps/libm-ieee754/s_cos.c b/sysdeps/libm-ieee754/s_cos.c index 33a7316..7edb5de 100644 --- a/sysdeps/libm-ieee754/s_cos.c +++ b/sysdeps/libm-ieee754/s_cos.c @@ -5,7 +5,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. * ==================================================== */ @@ -23,8 +23,8 @@ static char rcsid[] = "$NetBSD: s_cos.c,v 1.7 1995/05/10 20:47:02 jtc Exp $"; * __ieee754_rem_pio2 ... argument reduction routine * * Method. - * Let S,C and T denote the sin, cos and tan respectively on - * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 + * Let S,C and T denote the sin, cos and tan respectively on + * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 * in [-pi/4 , +pi/4], and let n = k mod 4. * We have * @@ -42,7 +42,7 @@ static char rcsid[] = "$NetBSD: s_cos.c,v 1.7 1995/05/10 20:47:02 jtc Exp $"; * trig(NaN) is that NaN; * * Accuracy: - * TRIG(x) returns trig(x) nearly rounded + * TRIG(x) returns trig(x) nearly rounded */ #include "math.h" @@ -81,3 +81,7 @@ static char rcsid[] = "$NetBSD: s_cos.c,v 1.7 1995/05/10 20:47:02 jtc Exp $"; } } weak_alias (__cos, cos) +#ifdef NO_LONG_DOUBLE +strong_alias (__cos, __cosl) +weak_alias (__cos, cosl) +#endif diff --git a/sysdeps/libm-ieee754/s_erf.c b/sysdeps/libm-ieee754/s_erf.c index d3377a5..022cf11 100644 --- a/sysdeps/libm-ieee754/s_erf.c +++ b/sysdeps/libm-ieee754/s_erf.c @@ -5,7 +5,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. * ==================================================== */ @@ -19,11 +19,11 @@ static char rcsid[] = "$NetBSD: s_erf.c,v 1.8 1995/05/10 20:47:05 jtc Exp $"; * x * 2 |\ * erf(x) = --------- | exp(-t*t)dt - * sqrt(pi) \| + * sqrt(pi) \| * 0 * * erfc(x) = 1-erf(x) - * Note that + * Note that * erf(-x) = -erf(x) * erfc(-x) = 2 - erfc(x) * @@ -36,7 +36,7 @@ static char rcsid[] = "$NetBSD: s_erf.c,v 1.8 1995/05/10 20:47:05 jtc Exp $"; * Q is an odd poly of degree 10. * -57.90 * | R - (erf(x)-x)/x | <= 2 - * + * * * Remark. The formula is derived by noting * erf(x) = (2/sqrt(pi))*(x - x^3/3 + x^5/10 - x^7/42 + ....) @@ -59,14 +59,14 @@ static char rcsid[] = "$NetBSD: s_erf.c,v 1.8 1995/05/10 20:47:05 jtc Exp $"; * That is, we use rational approximation to approximate * erf(1+s) - (c = (single)0.84506291151) * Note that |P1/Q1|< 0.078 for x in [0.84375,1.25] - * where + * where * P1(s) = degree 6 poly in s * Q1(s) = degree 6 poly in s * - * 3. For x in [1.25,1/0.35(~2.857143)], + * 3. For x in [1.25,1/0.35(~2.857143)], * erfc(x) = (1/x)*exp(-x*x-0.5625+R1/S1) * erf(x) = 1 - erfc(x) - * where + * where * R1(z) = degree 7 poly in z, (z=1/x^2) * S1(z) = degree 8 poly in z * @@ -84,7 +84,7 @@ static char rcsid[] = "$NetBSD: s_erf.c,v 1.8 1995/05/10 20:47:05 jtc Exp $"; * To compute exp(-x*x-0.5625+R/S), let s be a single * precision number and s := x; then * -x*x = -s*s + (s-x)*(s+x) - * exp(-x*x-0.5626+R/S) = + * exp(-x*x-0.5626+R/S) = * exp(-s*s-0.5625)*exp((s-x)*(s+x)+R/S); * Note2: * Here 4 and 5 make use of the asymptotic series @@ -104,7 +104,7 @@ static char rcsid[] = "$NetBSD: s_erf.c,v 1.8 1995/05/10 20:47:05 jtc Exp $"; * * 7. Special case: * erf(0) = 0, erf(inf) = 1, erf(-inf) = -1, - * erfc(0) = 1, erfc(inf) = 0, erfc(-inf) = 2, + * erfc(0) = 1, erfc(inf) = 0, erfc(-inf) = 2, * erfc/erf(NaN) is NaN */ @@ -139,7 +139,7 @@ qq3 = 5.08130628187576562776e-03, /* 0x3F74D022, 0xC4D36B0F */ qq4 = 1.32494738004321644526e-04, /* 0x3F215DC9, 0x221C1A10 */ qq5 = -3.96022827877536812320e-06, /* 0xBED09C43, 0x42A26120 */ /* - * Coefficients for approximation to erf in [0.84375,1.25] + * Coefficients for approximation to erf in [0.84375,1.25] */ pa0 = -2.36211856075265944077e-03, /* 0xBF6359B8, 0xBEF77538 */ pa1 = 4.14856118683748331666e-01, /* 0x3FDA8D00, 0xAD92B34D */ @@ -209,7 +209,7 @@ sb7 = -2.24409524465858183362e+01; /* 0xC03670E2, 0x42712D62 */ if(ix < 0x3feb0000) { /* |x|<0.84375 */ if(ix < 0x3e300000) { /* |x|<2**-28 */ - if (ix < 0x00800000) + if (ix < 0x00800000) return 0.125*(8.0*x+efx8*x); /*avoid underflow */ return x + efx*x; } @@ -241,7 +241,7 @@ sb7 = -2.24409524465858183362e+01; /* 0xC03670E2, 0x42712D62 */ S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*( sb5+s*(sb6+s*sb7)))))); } - z = x; + z = x; SET_LOW_WORD(z,0); r = __ieee754_exp(-z*z-0.5625)*__ieee754_exp((z-x)*(z+x)+R/S); if(hx>=0) return one-r/x; else return r/x-one; @@ -284,7 +284,7 @@ weak_alias (__erf, erf) P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6))))); Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6))))); if(hx>=0) { - z = one-erx; return z - P/Q; + z = one-erx; return z - P/Q; } else { z = erx+P/Q; return one+z; } @@ -314,3 +314,7 @@ weak_alias (__erf, erf) } } weak_alias (__erfc, erfc) +#ifdef NO_LONG_DOUBLE +strong_alias (__erfc, __erfcl) +weak_alias (__erfc, erfcl) +#endif diff --git a/sysdeps/libm-ieee754/s_expm1.c b/sysdeps/libm-ieee754/s_expm1.c index a88ec29..c8354b7 100644 --- a/sysdeps/libm-ieee754/s_expm1.c +++ b/sysdeps/libm-ieee754/s_expm1.c @@ -5,7 +5,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,9 +21,9 @@ static char rcsid[] = "$NetBSD: s_expm1.c,v 1.8 1995/05/10 20:47:09 jtc Exp $"; * 1. Argument reduction: * Given x, find r and integer k such that * - * x = k*ln2 + r, |r| <= 0.5*ln2 ~ 0.34658 + * x = k*ln2 + r, |r| <= 0.5*ln2 ~ 0.34658 * - * Here a correction term c will be computed to compensate + * Here a correction term c will be computed to compensate * the error in r when rounded to a floating-point number. * * 2. Approximating expm1(r) by a special rational function on @@ -36,9 +36,9 @@ static char rcsid[] = "$NetBSD: s_expm1.c,v 1.8 1995/05/10 20:47:09 jtc Exp $"; * R1(r**2) = 6/r *((exp(r)+1)/(exp(r)-1) - 2/r) * = 6/r * ( 1 + 2.0*(1/(exp(r)-1) - 1/r)) * = 1 - r^2/60 + r^4/2520 - r^6/100800 + ... - * We use a special Reme algorithm on [0,0.347] to generate - * a polynomial of degree 5 in r*r to approximate R1. The - * maximum error of this polynomial approximation is bounded + * We use a special Reme algorithm on [0,0.347] to generate + * a polynomial of degree 5 in r*r to approximate R1. The + * maximum error of this polynomial approximation is bounded * by 2**-61. In other words, * R1(z) ~ 1.0 + Q1*z + Q2*z**2 + Q3*z**3 + Q4*z**4 + Q5*z**5 * where Q1 = -1.6666666666666567384E-2, @@ -49,28 +49,28 @@ static char rcsid[] = "$NetBSD: s_expm1.c,v 1.8 1995/05/10 20:47:09 jtc Exp $"; * (where z=r*r, and the values of Q1 to Q5 are listed below) * with error bounded by * | 5 | -61 - * | 1.0+Q1*z+...+Q5*z - R1(z) | <= 2 + * | 1.0+Q1*z+...+Q5*z - R1(z) | <= 2 * | | - * - * expm1(r) = exp(r)-1 is then computed by the following - * specific way which minimize the accumulation rounding error: + * + * expm1(r) = exp(r)-1 is then computed by the following + * specific way which minimize the accumulation rounding error: * 2 3 * r r [ 3 - (R1 + R1*r/2) ] * expm1(r) = r + --- + --- * [--------------------] * 2 2 [ 6 - r*(3 - R1*r/2) ] - * + * * To compensate the error in the argument reduction, we use - * expm1(r+c) = expm1(r) + c + expm1(r)*c - * ~ expm1(r) + c + r*c + * expm1(r+c) = expm1(r) + c + expm1(r)*c + * ~ expm1(r) + c + r*c * Thus c+r*c will be added in as the correction terms for - * expm1(r+c). Now rearrange the term to avoid optimization + * expm1(r+c). Now rearrange the term to avoid optimization * screw up: * ( 2 2 ) * ({ ( r [ R1 - (3 - R1*r/2) ] ) } r ) * expm1(r+c)~r - ({r*(--- * [--------------------]-c)-c} - --- ) * ({ ( 2 [ 6 - r*(3 - R1*r/2) ] ) } 2 ) * ( ) - * + * * = r - E * 3. Scale back to obtain expm1(x): * From step 1, we have @@ -87,7 +87,7 @@ static char rcsid[] = "$NetBSD: s_expm1.c,v 1.8 1995/05/10 20:47:09 jtc Exp $"; * else return 1.0+2.0*(r-E); * (v) if (k<-2||k>56) return 2^k(1-(E-r)) - 1 (or exp(x)-1) * (vi) if k <= 20, return 2^k((1-2^-k)-(E-r)), else - * (vii) return 2^k(1-((E+2^-k)-r)) + * (vii) return 2^k(1-((E+2^-k)-r)) * * Special cases: * expm1(INF) is INF, expm1(NaN) is NaN; @@ -99,12 +99,12 @@ static char rcsid[] = "$NetBSD: s_expm1.c,v 1.8 1995/05/10 20:47:09 jtc Exp $"; * 1 ulp (unit in the last place). * * Misc. info. - * For IEEE double + * For IEEE double * if x > 7.09782712893383973096e+02 then expm1(x) overflow * * Constants: - * The hexadecimal values are the intended ones for the following - * constants. The decimal values may be used, provided that the + * The hexadecimal values are the intended ones for the following + * constants. The decimal values may be used, provided that the * compiler will convert from decimal to binary accurately enough * to produce the hexadecimal values shown. */ @@ -153,7 +153,7 @@ Q5 = -2.01099218183624371326e-07; /* BE8AFDB7 6E09C32D */ if(hx>=0x7ff00000) { u_int32_t low; GET_LOW_WORD(low,x); - if(((hx&0xfffff)|low)!=0) + if(((hx&0xfffff)|low)!=0) return x+x; /* NaN */ else return (xsb==0)? x:-1.0;/* exp(+-inf)={inf,-1} */ } @@ -166,7 +166,7 @@ Q5 = -2.01099218183624371326e-07; /* BE8AFDB7 6E09C32D */ } /* argument reduction */ - if(hx > 0x3fd62e42) { /* if |x| > 0.5 ln2 */ + if(hx > 0x3fd62e42) { /* if |x| > 0.5 ln2 */ if(hx < 0x3FF0A2B2) { /* and |x| < 1.5 ln2 */ if(xsb==0) {hi = x - ln2_hi; lo = ln2_lo; k = 1;} @@ -180,10 +180,10 @@ Q5 = -2.01099218183624371326e-07; /* BE8AFDB7 6E09C32D */ } x = hi - lo; c = (hi-x)-lo; - } + } else if(hx < 0x3c900000) { /* when |x|<2**-54, return x */ t = huge+x; /* return x with inexact flags when x!=0 */ - return x - (t-(huge+x)); + return x - (t-(huge+x)); } else k = 0; @@ -198,7 +198,7 @@ Q5 = -2.01099218183624371326e-07; /* BE8AFDB7 6E09C32D */ e = (x*(e-c)-c); e -= hxs; if(k== -1) return 0.5*(x-e)-0.5; - if(k==1) + if(k==1) if(x < -0.25) return -2.0*(e-(x+0.5)); else return one+2.0*(x-e); if (k <= -2 || k>56) { /* suffice to return exp(x)-1 */ @@ -227,3 +227,7 @@ Q5 = -2.01099218183624371326e-07; /* BE8AFDB7 6E09C32D */ return y; } weak_alias (__expm1, expm1) +#ifdef NO_LONG_DOUBLE +strong_alias (__expm1, __expm1l) +weak_alias (__expm1, expm1l) +#endif diff --git a/sysdeps/libm-ieee754/s_fabs.c b/sysdeps/libm-ieee754/s_fabs.c index 1b9437c..1abe943 100644 --- a/sysdeps/libm-ieee754/s_fabs.c +++ b/sysdeps/libm-ieee754/s_fabs.c @@ -5,7 +5,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. * ==================================================== */ @@ -34,3 +34,7 @@ static char rcsid[] = "$NetBSD: s_fabs.c,v 1.7 1995/05/10 20:47:13 jtc Exp $"; return x; } weak_alias (__fabs, fabs) +#ifdef NO_LONG_DOUBLE +strong_alias (__fabs, __fabsl) +weak_alias (__fabs, fabsl) +#endif diff --git a/sysdeps/libm-ieee754/s_finite.c b/sysdeps/libm-ieee754/s_finite.c index c2c4285..b12ff42 100644 --- a/sysdeps/libm-ieee754/s_finite.c +++ b/sysdeps/libm-ieee754/s_finite.c @@ -5,7 +5,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. * ==================================================== */ @@ -34,3 +34,7 @@ static char rcsid[] = "$NetBSD: s_finite.c,v 1.8 1995/05/10 20:47:17 jtc Exp $"; return (int)((u_int32_t)((hx&0x7fffffff)-0x7ff00000)>>31); } weak_alias (__finite, finite) +#ifdef NO_LONG_DOUBLE +strong_alias (__finite, __finitel) +weak_alias (__finite, finitel) +#endif diff --git a/sysdeps/libm-ieee754/s_floor.c b/sysdeps/libm-ieee754/s_floor.c index 4dabc77..77db9ef 100644 --- a/sysdeps/libm-ieee754/s_floor.c +++ b/sysdeps/libm-ieee754/s_floor.c @@ -5,7 +5,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. * ==================================================== */ @@ -46,7 +46,7 @@ static double huge = 1.0e300; if(j0<20) { if(j0<0) { /* raise inexact if x != 0 */ if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */ - if(i0>=0) {i0=i1=0;} + if(i0>=0) {i0=i1=0;} else if(((i0&0x7fffffff)|i1)!=0) { i0=0xbff00000;i1=0;} } @@ -66,7 +66,7 @@ static double huge = 1.0e300; if((i1&i)==0) return x; /* x is integral */ if(huge+x>0.0) { /* raise inexact flag */ if(i0<0) { - if(j0==20) i0+=1; + if(j0==20) i0+=1; else { j = i1+(1<<(52-j0)); if(j<i1) i0 +=1 ; /* got a carry */ @@ -80,3 +80,7 @@ static double huge = 1.0e300; return x; } weak_alias (__floor, floor) +#ifdef NO_LONG_DOUBLE +strong_alias (__floor, __floorl) +weak_alias (__floor, floorl) +#endif diff --git a/sysdeps/libm-ieee754/s_frexp.c b/sysdeps/libm-ieee754/s_frexp.c index 1f3bfce..7dbddfd 100644 --- a/sysdeps/libm-ieee754/s_frexp.c +++ b/sysdeps/libm-ieee754/s_frexp.c @@ -5,7 +5,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. * ==================================================== */ @@ -15,13 +15,13 @@ static char rcsid[] = "$NetBSD: s_frexp.c,v 1.9 1995/05/10 20:47:24 jtc Exp $"; #endif /* - * for non-zero x + * for non-zero x * x = frexp(arg,&exp); * return a double fp quantity x such that 0.5 <= |x| <1.0 * and the corresponding binary exponent "exp". That is * arg = x*2^exp. - * If arg is inf, 0.0, or NaN, then frexp(arg,&exp) returns arg - * with *exp=0. + * If arg is inf, 0.0, or NaN, then frexp(arg,&exp) returns arg + * with *exp=0. */ #include "math.h" @@ -58,3 +58,7 @@ two54 = 1.80143985094819840000e+16; /* 0x43500000, 0x00000000 */ return x; } weak_alias (__frexp, frexp) +#ifdef NO_LONG_DOUBLE +strong_alias (__frexp, __frexpl) +weak_alias (__frexp, frexpl) +#endif diff --git a/sysdeps/libm-ieee754/s_ilogb.c b/sysdeps/libm-ieee754/s_ilogb.c index 9cdcdb7..0c28b68 100644 --- a/sysdeps/libm-ieee754/s_ilogb.c +++ b/sysdeps/libm-ieee754/s_ilogb.c @@ -5,7 +5,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. * ==================================================== */ @@ -36,7 +36,7 @@ static char rcsid[] = "$NetBSD: s_ilogb.c,v 1.9 1995/05/10 20:47:28 jtc Exp $"; hx &= 0x7fffffff; if(hx<0x00100000) { GET_LOW_WORD(lx,x); - if((hx|lx)==0) + if((hx|lx)==0) return 0x80000001; /* ilogb(0) = 0x80000001 */ else /* subnormal x */ if(hx==0) { @@ -50,3 +50,7 @@ static char rcsid[] = "$NetBSD: s_ilogb.c,v 1.9 1995/05/10 20:47:28 jtc Exp $"; else return 0x7fffffff; } weak_alias (__ilogb, ilogb) +#ifdef NO_LONG_DOUBLE +strong_alias (__ilogb, __ilogbl) +weak_alias (__ilogb, ilogbl) +#endif diff --git a/sysdeps/libm-ieee754/s_ldexp.c b/sysdeps/libm-ieee754/s_ldexp.c index 94a93fc..12c336f 100644 --- a/sysdeps/libm-ieee754/s_ldexp.c +++ b/sysdeps/libm-ieee754/s_ldexp.c @@ -31,3 +31,7 @@ static char rcsid[] = "$NetBSD: s_ldexp.c,v 1.6 1995/05/10 20:47:40 jtc Exp $"; return value; } weak_alias (__ldexp, ldexp) +#ifdef NO_LONG_DOUBLE +strong_alias (__ldexp, __ldexpl) +weak_alias (__ldexp, ldexpl) +#endif diff --git a/sysdeps/libm-ieee754/s_log1p.c b/sysdeps/libm-ieee754/s_log1p.c index 1e58ccb..cc380a1 100644 --- a/sysdeps/libm-ieee754/s_log1p.c +++ b/sysdeps/libm-ieee754/s_log1p.c @@ -5,7 +5,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. * ==================================================== */ @@ -16,9 +16,9 @@ static char rcsid[] = "$NetBSD: s_log1p.c,v 1.8 1995/05/10 20:47:46 jtc Exp $"; /* double log1p(double x) * - * Method : - * 1. Argument Reduction: find k and f such that - * 1+x = 2^k * (1+f), + * Method : + * 1. Argument Reduction: find k and f such that + * 1+x = 2^k * (1+f), * where sqrt(2)/2 < 1+f < sqrt(2) . * * Note. If k=0, then f=x is exact. However, if k!=0, then f @@ -32,8 +32,8 @@ static char rcsid[] = "$NetBSD: s_log1p.c,v 1.8 1995/05/10 20:47:46 jtc Exp $"; * Let s = f/(2+f) ; based on log(1+f) = log(1+s) - log(1-s) * = 2s + 2/3 s**3 + 2/5 s**5 + ....., * = 2s + s*R - * We use a special Reme algorithm on [0,0.1716] to generate - * a polynomial of degree 14 to approximate R The maximum error + * We use a special Reme algorithm on [0,0.1716] to generate + * a polynomial of degree 14 to approximate R The maximum error * of this polynomial approximation is bounded by 2**-58.45. In * other words, * 2 4 6 8 10 12 14 @@ -41,21 +41,21 @@ static char rcsid[] = "$NetBSD: s_log1p.c,v 1.8 1995/05/10 20:47:46 jtc Exp $"; * (the values of Lp1 to Lp7 are listed in the program) * and * | 2 14 | -58.45 - * | Lp1*s +...+Lp7*s - R(z) | <= 2 + * | Lp1*s +...+Lp7*s - R(z) | <= 2 * | | * Note that 2s = f - s*f = f - hfsq + s*hfsq, where hfsq = f*f/2. * In order to guarantee error in log below 1ulp, we compute log * by * log1p(f) = f - (hfsq - s*(hfsq+R)). - * - * 3. Finally, log1p(x) = k*ln2 + log1p(f). + * + * 3. Finally, log1p(x) = k*ln2 + log1p(f). * = k*ln2_hi+(f-(hfsq-(s*(hfsq+R)+k*ln2_lo))) - * Here ln2 is split into two floating point number: + * Here ln2 is split into two floating point number: * ln2_hi + ln2_lo, * where n*ln2_hi is always exact for |n| < 2000. * * Special cases: - * log1p(x) is NaN with signal if x < -1 (including -INF) ; + * log1p(x) is NaN with signal if x < -1 (including -INF) ; * log1p(+INF) is +INF; log1p(-1) is -INF with signal; * log1p(NaN) is that NaN with no signal. * @@ -64,14 +64,14 @@ static char rcsid[] = "$NetBSD: s_log1p.c,v 1.8 1995/05/10 20:47:46 jtc Exp $"; * 1 ulp (unit in the last place). * * Constants: - * The hexadecimal values are the intended ones for the following - * constants. The decimal values may be used, provided that the - * compiler will convert from decimal to binary accurately enough + * The hexadecimal values are the intended ones for the following + * constants. The decimal values may be used, provided that the + * compiler will convert from decimal to binary accurately enough * to produce the hexadecimal values shown. * * Note: Assuming log() return accurate answer, the following * algorithm can be used to compute log1p(x) to within a few ULP: - * + * * u = 1+x; * if(u==1.0) return x ; else * return log(u)*(x/(u-1.0)); @@ -132,11 +132,11 @@ static double zero = 0.0; } if(hx>0||hx<=((int32_t)0xbfd2bec3)) { k=0;f=x;hu=1;} /* -0.2929<x<0.41422 */ - } + } if (hx >= 0x7ff00000) return x+x; if(k!=0) { if(hx<0x43400000) { - u = 1.0+x; + u = 1.0+x; GET_HIGH_WORD(hu,u); k = (hu>>20)-1023; c = (k>0)? 1.0-(u-x):x-(u-1.0);/* correction term */ @@ -151,7 +151,7 @@ static double zero = 0.0; if(hu<0x6a09e) { SET_HIGH_WORD(u,hu|0x3ff00000); /* normalize u */ } else { - k += 1; + k += 1; SET_HIGH_WORD(u,hu|0x3fe00000); /* normalize u/2 */ hu = (0x00100000-hu)>>2; } @@ -159,16 +159,20 @@ static double zero = 0.0; } hfsq=0.5*f*f; if(hu==0) { /* |f| < 2**-20 */ - if(f==zero) if(k==0) return zero; + if(f==zero) if(k==0) return zero; else {c += k*ln2_lo; return k*ln2_hi+c;} R = hfsq*(1.0-0.66666666666666666*f); if(k==0) return f-R; else return k*ln2_hi-((R-(k*ln2_lo+c))-f); } - s = f/(2.0+f); + s = f/(2.0+f); z = s*s; R = z*(Lp1+z*(Lp2+z*(Lp3+z*(Lp4+z*(Lp5+z*(Lp6+z*Lp7)))))); if(k==0) return f-(hfsq-s*(hfsq+R)); else return k*ln2_hi-((hfsq-(s*(hfsq+R)+(k*ln2_lo+c)))-f); } weak_alias (__log1p, log1p) +#ifdef NO_LONG_DOUBLE +strong_alias (__log1p, __log1pl) +weak_alias (__log1p, log1pl) +#endif diff --git a/sysdeps/libm-ieee754/s_logb.c b/sysdeps/libm-ieee754/s_logb.c index 4fd43fc..4668cf7 100644 --- a/sysdeps/libm-ieee754/s_logb.c +++ b/sysdeps/libm-ieee754/s_logb.c @@ -5,7 +5,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. * ==================================================== */ @@ -36,8 +36,12 @@ static char rcsid[] = "$NetBSD: s_logb.c,v 1.8 1995/05/10 20:47:50 jtc Exp $"; if((ix|lx)==0) return -1.0/fabs(x); if(ix>=0x7ff00000) return x*x; if((ix>>=20)==0) /* IEEE 754 logb */ - return -1022.0; + return -1022.0; else - return (double) (ix-1023); + return (double) (ix-1023); } weak_alias (__logb, logb) +#ifdef NO_LONG_DOUBLE +strong_alias (__logb, __logbl) +weak_alias (__logb, logbl) +#endif diff --git a/sysdeps/libm-ieee754/s_modf.c b/sysdeps/libm-ieee754/s_modf.c index 8e09128..8075c5f 100644 --- a/sysdeps/libm-ieee754/s_modf.c +++ b/sysdeps/libm-ieee754/s_modf.c @@ -5,7 +5,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. * ==================================================== */ @@ -15,7 +15,7 @@ static char rcsid[] = "$NetBSD: s_modf.c,v 1.8 1995/05/10 20:47:55 jtc Exp $"; #endif /* - * modf(double x, double *iptr) + * modf(double x, double *iptr) * return fraction part of x, and return x's integral part in *iptr. * Method: * Bit twiddling. @@ -82,3 +82,7 @@ static double one = 1.0; } } weak_alias (__modf, modf) +#ifdef NO_LONG_DOUBLE +strong_alias (__modf, __modfl) +weak_alias (__modf, modfl) +#endif diff --git a/sysdeps/libm-ieee754/s_nextafter.c b/sysdeps/libm-ieee754/s_nextafter.c index 359ed8c..ee973bc 100644 --- a/sysdeps/libm-ieee754/s_nextafter.c +++ b/sysdeps/libm-ieee754/s_nextafter.c @@ -5,7 +5,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. * ==================================================== */ @@ -39,15 +39,15 @@ static char rcsid[] = "$NetBSD: s_nextafter.c,v 1.8 1995/05/10 20:47:58 jtc Exp ix = hx&0x7fffffff; /* |x| */ iy = hy&0x7fffffff; /* |y| */ - if(((ix>=0x7ff00000)&&((ix-0x7ff00000)|lx)!=0) || /* x is nan */ - ((iy>=0x7ff00000)&&((iy-0x7ff00000)|ly)!=0)) /* y is nan */ - return x+y; + if(((ix>=0x7ff00000)&&((ix-0x7ff00000)|lx)!=0) || /* x is nan */ + ((iy>=0x7ff00000)&&((iy-0x7ff00000)|ly)!=0)) /* y is nan */ + return x+y; if(x==y) return x; /* x=y, return x */ if((ix|lx)==0) { /* x == 0 */ INSERT_WORDS(x,hy&0x80000000,1); /* return +-minsubnormal */ y = x*x; if(y==x) return y; else return x; /* raise underflow flag */ - } + } if(hx>=0) { /* x > 0 */ if(hx>hy||((hx==hy)&&(lx>ly))) { /* x > y, x -= ulp */ if(lx==0) hx -= 1; @@ -78,3 +78,7 @@ static char rcsid[] = "$NetBSD: s_nextafter.c,v 1.8 1995/05/10 20:47:58 jtc Exp return x; } weak_alias (__nextafter, nextafter) +#ifdef NO_LONG_DOUBLE +strong_alias (__nextafter, __nextafterl) +weak_alias (__nextafter, nextafterl) +#endif diff --git a/sysdeps/libm-ieee754/s_rint.c b/sysdeps/libm-ieee754/s_rint.c index e24feaf..e5f2412 100644 --- a/sysdeps/libm-ieee754/s_rint.c +++ b/sysdeps/libm-ieee754/s_rint.c @@ -5,7 +5,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. * ==================================================== */ @@ -30,7 +30,7 @@ static char rcsid[] = "$NetBSD: s_rint.c,v 1.8 1995/05/10 20:48:04 jtc Exp $"; #ifdef __STDC__ static const double #else -static double +static double #endif TWO52[2]={ 4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */ @@ -51,7 +51,7 @@ TWO52[2]={ sx = (i0>>31)&1; j0 = ((i0>>20)&0x7ff)-0x3ff; if(j0<20) { - if(j0<0) { + if(j0<0) { if(((i0&0x7fffffff)|i1)==0) return x; i1 |= (i0&0x0fffff); i0 &= 0xfffe0000; @@ -85,3 +85,7 @@ TWO52[2]={ return w-TWO52[sx]; } weak_alias (__rint, rint) +#ifdef NO_LONG_DOUBLE +strong_alias (__rint, __rintl) +weak_alias (__rint, rintl) +#endif diff --git a/sysdeps/libm-ieee754/s_scalbn.c b/sysdeps/libm-ieee754/s_scalbn.c index 6efaec0..439b966 100644 --- a/sysdeps/libm-ieee754/s_scalbn.c +++ b/sysdeps/libm-ieee754/s_scalbn.c @@ -65,3 +65,7 @@ tiny = 1.0e-300; return x*twom54; } weak_alias (__scalbn, scalbn) +#ifdef NO_LONG_DOUBLE +strong_alias (__scalbn, __scalbnl) +weak_alias (__scalbn, scalbnl) +#endif diff --git a/sysdeps/libm-ieee754/s_significand.c b/sysdeps/libm-ieee754/s_significand.c index 72265d3..4ab078c 100644 --- a/sysdeps/libm-ieee754/s_significand.c +++ b/sysdeps/libm-ieee754/s_significand.c @@ -5,7 +5,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. * ==================================================== */ @@ -33,3 +33,7 @@ static char rcsid[] = "$NetBSD: s_significand.c,v 1.6 1995/05/10 20:48:11 jtc Ex return __ieee754_scalb(x,(double) -ilogb(x)); } weak_alias (__significand, significand) +#ifdef NO_LONG_DOUBLE +strong_alias (__significand, __significandl) +weak_alias (__significand, significandl) +#endif diff --git a/sysdeps/libm-ieee754/s_sin.c b/sysdeps/libm-ieee754/s_sin.c index efcf774..376c69e 100644 --- a/sysdeps/libm-ieee754/s_sin.c +++ b/sysdeps/libm-ieee754/s_sin.c @@ -5,7 +5,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. * ==================================================== */ @@ -23,8 +23,8 @@ static char rcsid[] = "$NetBSD: s_sin.c,v 1.7 1995/05/10 20:48:15 jtc Exp $"; * __ieee754_rem_pio2 ... argument reduction routine * * Method. - * Let S,C and T denote the sin, cos and tan respectively on - * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 + * Let S,C and T denote the sin, cos and tan respectively on + * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 * in [-pi/4 , +pi/4], and let n = k mod 4. * We have * @@ -42,7 +42,7 @@ static char rcsid[] = "$NetBSD: s_sin.c,v 1.7 1995/05/10 20:48:15 jtc Exp $"; * trig(NaN) is that NaN; * * Accuracy: - * TRIG(x) returns trig(x) nearly rounded + * TRIG(x) returns trig(x) nearly rounded */ #include "math.h" @@ -81,3 +81,7 @@ static char rcsid[] = "$NetBSD: s_sin.c,v 1.7 1995/05/10 20:48:15 jtc Exp $"; } } weak_alias (__sin, sin) +#ifdef NO_LONG_DOUBLE +strong_alias (__sin, __sinl) +weak_alias (__sin, sinl) +#endif diff --git a/sysdeps/libm-ieee754/s_tan.c b/sysdeps/libm-ieee754/s_tan.c index dcd9d50..714cf27 100644 --- a/sysdeps/libm-ieee754/s_tan.c +++ b/sysdeps/libm-ieee754/s_tan.c @@ -5,7 +5,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. * ==================================================== */ @@ -22,8 +22,8 @@ static char rcsid[] = "$NetBSD: s_tan.c,v 1.7 1995/05/10 20:48:18 jtc Exp $"; * __ieee754_rem_pio2 ... argument reduction routine * * Method. - * Let S,C and T denote the sin, cos and tan respectively on - * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 + * Let S,C and T denote the sin, cos and tan respectively on + * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 * in [-pi/4 , +pi/4], and let n = k mod 4. * We have * @@ -41,7 +41,7 @@ static char rcsid[] = "$NetBSD: s_tan.c,v 1.7 1995/05/10 20:48:18 jtc Exp $"; * trig(NaN) is that NaN; * * Accuracy: - * TRIG(x) returns trig(x) nearly rounded + * TRIG(x) returns trig(x) nearly rounded */ #include "math.h" @@ -75,3 +75,7 @@ static char rcsid[] = "$NetBSD: s_tan.c,v 1.7 1995/05/10 20:48:18 jtc Exp $"; } } weak_alias (__tan, tan) +#ifdef NO_LONG_DOUBLE +strong_alias (__tan, __tanl) +weak_alias (__tan, tanl) +#endif diff --git a/sysdeps/libm-ieee754/s_tanh.c b/sysdeps/libm-ieee754/s_tanh.c index 22d064b..208b459 100644 --- a/sysdeps/libm-ieee754/s_tanh.c +++ b/sysdeps/libm-ieee754/s_tanh.c @@ -5,7 +5,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. * ==================================================== */ @@ -62,7 +62,7 @@ static double one=1.0, two=2.0, tiny = 1.0e-300; ix = jx&0x7fffffff; /* x is INF or NaN */ - if(ix>=0x7ff00000) { + if(ix>=0x7ff00000) { if (jx>=0) return one/x+one; /* tanh(+-inf)=+-1 */ else return one/x-one; /* tanh(NaN) = NaN */ } @@ -85,3 +85,7 @@ static double one=1.0, two=2.0, tiny = 1.0e-300; return (jx>=0)? z: -z; } weak_alias (__tanh, tanh) +#ifdef NO_LONG_DOUBLE +strong_alias (__tanh, __tanhl) +weak_alias (__tanh, tanhl) +#endif diff --git a/sysdeps/libm-ieee754/s_tanhl.c b/sysdeps/libm-ieee754/s_tanhl.c index 984f671..9863af6 100644 --- a/sysdeps/libm-ieee754/s_tanhl.c +++ b/sysdeps/libm-ieee754/s_tanhl.c @@ -46,9 +46,9 @@ static char rcsid[] = "$NetBSD: $"; #include "math_private.h" #ifdef __STDC__ -static const long double one=1.0, two=2.0, tiny = 1.0e-16380L; +static const long double one=1.0, two=2.0, tiny = 1.0e-4900L; #else -static long double one=1.0, two=2.0, tiny = 1.0e-16380L; +static long double one=1.0, two=2.0, tiny = 1.0e-4900L; #endif #ifdef __STDC__ @@ -59,7 +59,8 @@ static long double one=1.0, two=2.0, tiny = 1.0e-16380L; #endif { long double t,z; - int32_t se,j0,j1,ix; + int32_t se; + u_int32_t j0,j1,ix; /* High word of |x|. */ GET_LDOUBLE_WORDS(se,j0,j1,x); @@ -72,7 +73,7 @@ static long double one=1.0, two=2.0, tiny = 1.0e-16380L; } /* |x| < 23 */ - if (ix < 0x4003 || (ix == 0x4003 && j0 < 0xb8000000)) { /* |x|<23 */ + if (ix < 0x4003 || (ix == 0x4003 && j0 < 0xb8000000u)) {/* |x|<23 */ if (ix<0x3fc8) /* |x|<2**-55 */ return x*(one+x); /* tanh(small) = small */ if (ix>=0x3fff) { /* |x|>=1 */ diff --git a/sysdeps/libm-ieee754/w_acos.c b/sysdeps/libm-ieee754/w_acos.c index d60d1c3..5a1158e 100644 --- a/sysdeps/libm-ieee754/w_acos.c +++ b/sysdeps/libm-ieee754/w_acos.c @@ -5,7 +5,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. * ==================================================== */ @@ -42,3 +42,7 @@ static char rcsid[] = "$NetBSD: w_acos.c,v 1.6 1995/05/10 20:48:26 jtc Exp $"; #endif } weak_alias (__acos, acos) +#ifdef NO_LONG_DOUBLE +strong_alias (__acos, __acosl) +weak_alias (__acos, acosl) +#endif diff --git a/sysdeps/libm-ieee754/w_acosh.c b/sysdeps/libm-ieee754/w_acosh.c index 46f9cf9..2b5d60f 100644 --- a/sysdeps/libm-ieee754/w_acosh.c +++ b/sysdeps/libm-ieee754/w_acosh.c @@ -5,7 +5,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. * ==================================================== */ @@ -14,7 +14,7 @@ static char rcsid[] = "$NetBSD: w_acosh.c,v 1.6 1995/05/10 20:48:31 jtc Exp $"; #endif -/* +/* * wrapper acosh(x) */ @@ -41,3 +41,7 @@ static char rcsid[] = "$NetBSD: w_acosh.c,v 1.6 1995/05/10 20:48:31 jtc Exp $"; #endif } weak_alias (__acosh, acosh) +#ifdef NO_LONG_DOUBLE +strong_alias (__acosh, __acoshl) +weak_alias (__acosh, acoshl) +#endif diff --git a/sysdeps/libm-ieee754/w_asin.c b/sysdeps/libm-ieee754/w_asin.c index 529dd59..a7ca4ef 100644 --- a/sysdeps/libm-ieee754/w_asin.c +++ b/sysdeps/libm-ieee754/w_asin.c @@ -5,7 +5,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. * ==================================================== */ @@ -14,7 +14,7 @@ static char rcsid[] = "$NetBSD: w_asin.c,v 1.6 1995/05/10 20:48:35 jtc Exp $"; #endif -/* +/* * wrapper asin(x) */ @@ -43,3 +43,7 @@ static char rcsid[] = "$NetBSD: w_asin.c,v 1.6 1995/05/10 20:48:35 jtc Exp $"; #endif } weak_alias (__asin, asin) +#ifdef NO_LONG_DOUBLE +strong_alias (__asin, __asinl) +weak_alias (__asin, asinl) +#endif diff --git a/sysdeps/libm-ieee754/w_atan2.c b/sysdeps/libm-ieee754/w_atan2.c index abfe64a..ec29d55 100644 --- a/sysdeps/libm-ieee754/w_atan2.c +++ b/sysdeps/libm-ieee754/w_atan2.c @@ -5,7 +5,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. * ==================================================== */ @@ -14,7 +14,7 @@ static char rcsid[] = "$NetBSD: w_atan2.c,v 1.6 1995/05/10 20:48:39 jtc Exp $"; #endif -/* +/* * wrapper atan2(y,x) */ @@ -42,3 +42,7 @@ static char rcsid[] = "$NetBSD: w_atan2.c,v 1.6 1995/05/10 20:48:39 jtc Exp $"; #endif } weak_alias (__atan2, atan2) +#ifdef NO_LONG_DOUBLE +strong_alias (__atan2, __atan2l) +weak_alias (__atan2, atan2l) +#endif diff --git a/sysdeps/libm-ieee754/w_atanh.c b/sysdeps/libm-ieee754/w_atanh.c index 43f5ff7..e7995b1 100644 --- a/sysdeps/libm-ieee754/w_atanh.c +++ b/sysdeps/libm-ieee754/w_atanh.c @@ -5,7 +5,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. * ==================================================== */ @@ -14,7 +14,7 @@ static char rcsid[] = "$NetBSD: w_atanh.c,v 1.6 1995/05/10 20:48:43 jtc Exp $"; #endif -/* +/* * wrapper atanh(x) */ @@ -39,10 +39,14 @@ static char rcsid[] = "$NetBSD: w_atanh.c,v 1.6 1995/05/10 20:48:43 jtc Exp $"; if(y>=1.0) { if(y>1.0) return __kernel_standard(x,x,30); /* atanh(|x|>1) */ - else + else return __kernel_standard(x,x,31); /* atanh(|x|==1) */ } else return z; #endif } weak_alias (__atanh, atanh) +#ifdef NO_LONG_DOUBLE +strong_alias (__atanh, __atanhl) +weak_alias (__atanh, atanhl) +#endif diff --git a/sysdeps/libm-ieee754/w_cabs.c b/sysdeps/libm-ieee754/w_cabs.c index ccacf67..6c67436 100644 --- a/sysdeps/libm-ieee754/w_cabs.c +++ b/sysdeps/libm-ieee754/w_cabs.c @@ -1,6 +1,6 @@ /* * cabs() wrapper for hypot(). - * + * * Written by J.T. Conklin, <jtc@wimsey.com> * Placed into the Public Domain, 1994. */ @@ -14,3 +14,7 @@ __cabs(z) return __hypot(z.x, z.y); } weak_alias (__cabs, cabs) +#ifdef NO_LONG_DOUBLE +strong_alias (__cabs, __cabsl) +weak_alias (__cabs, cabsl) +#endif diff --git a/sysdeps/libm-ieee754/w_cosh.c b/sysdeps/libm-ieee754/w_cosh.c index 651dee1..8db25c8 100644 --- a/sysdeps/libm-ieee754/w_cosh.c +++ b/sysdeps/libm-ieee754/w_cosh.c @@ -5,7 +5,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. * ==================================================== */ @@ -14,7 +14,7 @@ static char rcsid[] = "$NetBSD: w_cosh.c,v 1.6 1995/05/10 20:48:47 jtc Exp $"; #endif -/* +/* * wrapper cosh(x) */ @@ -34,10 +34,14 @@ static char rcsid[] = "$NetBSD: w_cosh.c,v 1.6 1995/05/10 20:48:47 jtc Exp $"; double z; z = __ieee754_cosh(x); if(_LIB_VERSION == _IEEE_ || __isnan(x)) return z; - if(fabs(x)>7.10475860073943863426e+02) { + if(fabs(x)>7.10475860073943863426e+02) { return __kernel_standard(x,x,5); /* cosh overflow */ } else return z; #endif } weak_alias (__cosh, cosh) +#ifdef NO_LONG_DOUBLE +strong_alias (__cosh, __coshl) +weak_alias (__cosh, coshl) +#endif diff --git a/sysdeps/libm-ieee754/w_drem.c b/sysdeps/libm-ieee754/w_drem.c index 203a7d1..9e2b1e7 100644 --- a/sysdeps/libm-ieee754/w_drem.c +++ b/sysdeps/libm-ieee754/w_drem.c @@ -1,6 +1,6 @@ /* * drem() wrapper for remainder(). - * + * * Written by J.T. Conklin, <jtc@wimsey.com> * Placed into the Public Domain, 1994. */ @@ -14,3 +14,7 @@ __drem(x, y) return __remainder(x, y); } weak_alias (__drem, drem) +#ifdef NO_LONG_DOUBLE +strong_alias (__drem, __dreml) +weak_alias (__drem, dreml) +#endif diff --git a/sysdeps/libm-ieee754/w_exp.c b/sysdeps/libm-ieee754/w_exp.c index cc39b90..445c578 100644 --- a/sysdeps/libm-ieee754/w_exp.c +++ b/sysdeps/libm-ieee754/w_exp.c @@ -5,7 +5,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. * ==================================================== */ @@ -14,7 +14,7 @@ static char rcsid[] = "$NetBSD: w_exp.c,v 1.6 1995/05/10 20:48:51 jtc Exp $"; #endif -/* +/* * wrapper exp(x) */ @@ -47,8 +47,12 @@ u_threshold= -7.45133219101941108420e+02; /* 0xc0874910, 0xD52D3051 */ return __kernel_standard(x,x,6); /* exp overflow */ else if(x<u_threshold) return __kernel_standard(x,x,7); /* exp underflow */ - } + } return z; #endif } weak_alias (__exp, exp) +#ifdef NO_LONG_DOUBLE +strong_alias (__exp, __expl) +weak_alias (__exp, expl) +#endif diff --git a/sysdeps/libm-ieee754/w_fmod.c b/sysdeps/libm-ieee754/w_fmod.c index 2102ba2..0ceeb98 100644 --- a/sysdeps/libm-ieee754/w_fmod.c +++ b/sysdeps/libm-ieee754/w_fmod.c @@ -5,7 +5,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. * ==================================================== */ @@ -14,7 +14,7 @@ static char rcsid[] = "$NetBSD: w_fmod.c,v 1.6 1995/05/10 20:48:55 jtc Exp $"; #endif -/* +/* * wrapper fmod(x,y) */ @@ -42,3 +42,7 @@ static char rcsid[] = "$NetBSD: w_fmod.c,v 1.6 1995/05/10 20:48:55 jtc Exp $"; #endif } weak_alias (__fmod, fmod) +#ifdef NO_LONG_DOUBLE +strong_alias (__fmod, __fmodl) +weak_alias (__fmod, fmodl) +#endif diff --git a/sysdeps/libm-ieee754/w_gamma.c b/sysdeps/libm-ieee754/w_gamma.c index 8a0a180..49e4bcf 100644 --- a/sysdeps/libm-ieee754/w_gamma.c +++ b/sysdeps/libm-ieee754/w_gamma.c @@ -48,3 +48,7 @@ extern int signgam; #endif } weak_alias (__gamma, gamma) +#ifdef NO_LONG_DOUBLE +strong_alias (__gamma, __gammal) +weak_alias (__gamma, gammal) +#endif diff --git a/sysdeps/libm-ieee754/w_gamma_r.c b/sysdeps/libm-ieee754/w_gamma_r.c index 103dbab..f9efc8c 100644 --- a/sysdeps/libm-ieee754/w_gamma_r.c +++ b/sysdeps/libm-ieee754/w_gamma_r.c @@ -5,7 +5,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. * ==================================================== */ @@ -14,7 +14,7 @@ static char rcsid[] = "$NetBSD: w_gamma_r.c,v 1.7 1995/11/20 22:06:45 jtc Exp $"; #endif -/* +/* * wrapper double gamma_r(double x, int *signgamp) */ @@ -43,5 +43,9 @@ static char rcsid[] = "$NetBSD: w_gamma_r.c,v 1.7 1995/11/20 22:06:45 jtc Exp $" } else return y; #endif -} +} weak_alias (__gamma_r, gamma_r) +#ifdef NO_LONG_DOUBLE +strong_alias (__gamma_r, __gammal_r) +weak_alias (__gamma_r, gammal_r) +#endif diff --git a/sysdeps/libm-ieee754/w_hypot.c b/sysdeps/libm-ieee754/w_hypot.c index 1fd8f12..e91db17 100644 --- a/sysdeps/libm-ieee754/w_hypot.c +++ b/sysdeps/libm-ieee754/w_hypot.c @@ -5,7 +5,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. * ==================================================== */ @@ -42,3 +42,7 @@ static char rcsid[] = "$NetBSD: w_hypot.c,v 1.6 1995/05/10 20:49:07 jtc Exp $"; #endif } weak_alias (__hypot, hypot) +#ifdef NO_LONG_DOUBLE +strong_alias (__hypot, __hypotl) +weak_alias (__hypot, hypotl) +#endif diff --git a/sysdeps/libm-ieee754/w_j0.c b/sysdeps/libm-ieee754/w_j0.c index 1486c14..c327e1c 100644 --- a/sysdeps/libm-ieee754/w_j0.c +++ b/sysdeps/libm-ieee754/w_j0.c @@ -5,7 +5,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. * ==================================================== */ @@ -40,6 +40,11 @@ static char rcsid[] = "$NetBSD: w_j0.c,v 1.6 1995/05/10 20:49:11 jtc Exp $"; #endif } weak_alias (__j0, j0) +#ifdef NO_LONG_DOUBLE +strong_alias (__j0, __j0l) +weak_alias (__j0, j0l) +#endif + #ifdef __STDC__ double __y0(double x) /* wrapper y0 */ @@ -69,3 +74,7 @@ weak_alias (__j0, j0) #endif } weak_alias (__y0, y0) +#ifdef NO_LONG_DOUBLE +strong_alias (__y0, __y0l) +weak_alias (__y0, y0l) +#endif diff --git a/sysdeps/libm-ieee754/w_j1.c b/sysdeps/libm-ieee754/w_j1.c index 9d09f0d..ae6e9b5 100644 --- a/sysdeps/libm-ieee754/w_j1.c +++ b/sysdeps/libm-ieee754/w_j1.c @@ -5,7 +5,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. * ==================================================== */ @@ -14,8 +14,8 @@ static char rcsid[] = "$NetBSD: w_j1.c,v 1.6 1995/05/10 20:49:15 jtc Exp $"; #endif -/* - * wrapper of j1,y1 +/* + * wrapper of j1,y1 */ #include "math.h" @@ -41,6 +41,11 @@ static char rcsid[] = "$NetBSD: w_j1.c,v 1.6 1995/05/10 20:49:15 jtc Exp $"; #endif } weak_alias (__j1, j1) +#ifdef NO_LONG_DOUBLE +strong_alias (__j1, __j1l) +weak_alias (__j1, j1l) +#endif + #ifdef __STDC__ double __y1(double x) /* wrapper y1 */ @@ -70,3 +75,7 @@ weak_alias (__j1, j1) #endif } weak_alias (__y1, y1) +#ifdef NO_LONG_DOUBLE +strong_alias (__y1, __y1l) +weak_alias (__y1, y1l) +#endif diff --git a/sysdeps/libm-ieee754/w_jn.c b/sysdeps/libm-ieee754/w_jn.c index 9f5506b..ecd86c0 100644 --- a/sysdeps/libm-ieee754/w_jn.c +++ b/sysdeps/libm-ieee754/w_jn.c @@ -5,7 +5,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. * ==================================================== */ @@ -18,7 +18,7 @@ static char rcsid[] = "$NetBSD: w_jn.c,v 1.6 1995/05/10 20:49:19 jtc Exp $"; * wrapper jn(int n, double x), yn(int n, double x) * floating point Bessel's function of the 1st and 2nd kind * of order n - * + * * Special cases: * y0(0)=y1(0)=yn(n,0) = -inf with division by zero signal; * y0(-ve)=y1(-ve)=yn(n,-ve) are NaN with invalid signal. @@ -37,7 +37,7 @@ static char rcsid[] = "$NetBSD: w_jn.c,v 1.6 1995/05/10 20:49:19 jtc Exp $"; * yn(n,x) is similar in all respects, except * that forward recursion is used for all * values of n>1. - * + * */ #include "math.h" @@ -63,6 +63,11 @@ static char rcsid[] = "$NetBSD: w_jn.c,v 1.6 1995/05/10 20:49:19 jtc Exp $"; #endif } weak_alias (__jn, jn) +#ifdef NO_LONG_DOUBLE +strong_alias (__jn, __jnl) +weak_alias (__jn, jnl) +#endif + #ifdef __STDC__ double __yn(int n, double x) /* wrapper yn */ @@ -92,3 +97,7 @@ weak_alias (__jn, jn) #endif } weak_alias (__yn, yn) +#ifdef NO_LONG_DOUBLE +strong_alias (__yn, __ynl) +weak_alias (__yn, ynl) +#endif diff --git a/sysdeps/libm-ieee754/w_lgamma.c b/sysdeps/libm-ieee754/w_lgamma.c index 2563d28..be8a174 100644 --- a/sysdeps/libm-ieee754/w_lgamma.c +++ b/sysdeps/libm-ieee754/w_lgamma.c @@ -5,7 +5,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. * ==================================================== */ @@ -46,5 +46,9 @@ extern int signgam; } else return y; #endif -} +} weak_alias (__lgamma, lgamma) +#ifdef NO_LONG_DOUBLE +strong_alias (__lgamma, __lgammal) +weak_alias (__lgamma, lgammal) +#endif diff --git a/sysdeps/libm-ieee754/w_lgamma_r.c b/sysdeps/libm-ieee754/w_lgamma_r.c index c5c5edc..f3e7d82 100644 --- a/sysdeps/libm-ieee754/w_lgamma_r.c +++ b/sysdeps/libm-ieee754/w_lgamma_r.c @@ -5,7 +5,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. * ==================================================== */ @@ -14,7 +14,7 @@ static char rcsid[] = "$NetBSD: w_lgamma_r.c,v 1.6 1995/05/10 20:49:27 jtc Exp $"; #endif -/* +/* * wrapper double lgamma_r(double x, int *signgamp) */ @@ -43,5 +43,9 @@ static char rcsid[] = "$NetBSD: w_lgamma_r.c,v 1.6 1995/05/10 20:49:27 jtc Exp $ } else return y; #endif -} +} weak_alias (__lgamma_r, lgamma_r) +#ifdef NO_LONG_DOUBLE +strong_alias (__lgamma_r, __lgammal_r) +weak_alias (__lgamma_r, lgammal_r) +#endif diff --git a/sysdeps/libm-ieee754/w_log.c b/sysdeps/libm-ieee754/w_log.c index d1713eb..5f0af79 100644 --- a/sysdeps/libm-ieee754/w_log.c +++ b/sysdeps/libm-ieee754/w_log.c @@ -5,7 +5,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. * ==================================================== */ @@ -37,8 +37,12 @@ static char rcsid[] = "$NetBSD: w_log.c,v 1.6 1995/05/10 20:49:33 jtc Exp $"; if(_LIB_VERSION == _IEEE_ || __isnan(x) || x > 0.0) return z; if(x==0.0) return __kernel_standard(x,x,16); /* log(0) */ - else + else return __kernel_standard(x,x,17); /* log(x<0) */ #endif } weak_alias (__log, log) +#ifdef NO_LONG_DOUBLE +strong_alias (__log, __logl) +weak_alias (__log, logl) +#endif diff --git a/sysdeps/libm-ieee754/w_log10.c b/sysdeps/libm-ieee754/w_log10.c index 46334ce..fc35607 100644 --- a/sysdeps/libm-ieee754/w_log10.c +++ b/sysdeps/libm-ieee754/w_log10.c @@ -5,7 +5,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. * ==================================================== */ @@ -14,7 +14,7 @@ static char rcsid[] = "$NetBSD: w_log10.c,v 1.6 1995/05/10 20:49:35 jtc Exp $"; #endif -/* +/* * wrapper log10(X) */ @@ -38,10 +38,14 @@ static char rcsid[] = "$NetBSD: w_log10.c,v 1.6 1995/05/10 20:49:35 jtc Exp $"; if(x<=0.0) { if(x==0.0) return __kernel_standard(x,x,18); /* log10(0) */ - else + else return __kernel_standard(x,x,19); /* log10(x<0) */ } else return z; #endif } weak_alias (__log10, log10) +#ifdef NO_LONG_DOUBLE +strong_alias (__log10, __log10l) +weak_alias (__log10, log10) +#endif diff --git a/sysdeps/libm-ieee754/w_pow.c b/sysdeps/libm-ieee754/w_pow.c index adc1b2b..ea19e1f 100644 --- a/sysdeps/libm-ieee754/w_pow.c +++ b/sysdeps/libm-ieee754/w_pow.c @@ -7,12 +7,12 @@ * * 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. * ==================================================== */ -/* +/* * wrapper pow(x,y) return x**y */ @@ -34,12 +34,12 @@ z=__ieee754_pow(x,y); if(_LIB_VERSION == _IEEE_|| __isnan(y)) return z; if(__isnan(x)) { - if(y==0.0) + if(y==0.0) return __kernel_standard(x,y,42); /* pow(NaN,0.0) */ - else + else return z; } - if(x==0.0){ + if(x==0.0){ if(y==0.0) return __kernel_standard(x,y,20); /* pow(0.0,0.0) */ if(__finite(y)&&y<0.0) @@ -50,13 +50,17 @@ if(__finite(x)&&__finite(y)) { if(__isnan(z)) return __kernel_standard(x,y,24); /* pow neg**non-int */ - else + else return __kernel_standard(x,y,21); /* pow overflow */ } - } + } if(z==0.0&&__finite(x)&&__finite(y)) return __kernel_standard(x,y,22); /* pow underflow */ return z; #endif } weak_alias (__pow, pow) +#ifdef NO_LONG_DOUBLE +strong_alias (__pow, __powl) +weak_alias (__pow, powl) +#endif diff --git a/sysdeps/libm-ieee754/w_remainder.c b/sysdeps/libm-ieee754/w_remainder.c index 9fd2952..d85a3fe 100644 --- a/sysdeps/libm-ieee754/w_remainder.c +++ b/sysdeps/libm-ieee754/w_remainder.c @@ -5,7 +5,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. * ==================================================== */ @@ -14,7 +14,7 @@ static char rcsid[] = "$NetBSD: w_remainder.c,v 1.6 1995/05/10 20:49:44 jtc Exp $"; #endif -/* +/* * wrapper remainder(x,p) */ @@ -34,10 +34,14 @@ static char rcsid[] = "$NetBSD: w_remainder.c,v 1.6 1995/05/10 20:49:44 jtc Exp double z; z = __ieee754_remainder(x,y); if(_LIB_VERSION == _IEEE_ || __isnan(y)) return z; - if(y==0.0) + if(y==0.0) return __kernel_standard(x,y,28); /* remainder(x,0) */ else return z; #endif } weak_alias (__remainder, remainder) +#ifdef NO_LONG_DOUBLE +strong_alias (__remainder, __remainderl) +weak_alias (__remainder, remainderl) +#endif diff --git a/sysdeps/libm-ieee754/w_scalb.c b/sysdeps/libm-ieee754/w_scalb.c index 53d4114..e5c407a 100644 --- a/sysdeps/libm-ieee754/w_scalb.c +++ b/sysdeps/libm-ieee754/w_scalb.c @@ -59,3 +59,7 @@ static char rcsid[] = "$NetBSD: w_scalb.c,v 1.6 1995/05/10 20:49:48 jtc Exp $"; #endif } weak_alias (__scalb, scalb) +#ifdef NO_LONG_DOUBLE +strong_alias (__scalb, __scalbl) +weak_alias (__scalb, scalbl) +#endif diff --git a/sysdeps/libm-ieee754/w_sinh.c b/sysdeps/libm-ieee754/w_sinh.c index 9ecc4c5..9b34cd1 100644 --- a/sysdeps/libm-ieee754/w_sinh.c +++ b/sysdeps/libm-ieee754/w_sinh.c @@ -5,7 +5,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. * ==================================================== */ @@ -14,7 +14,7 @@ static char rcsid[] = "$NetBSD: w_sinh.c,v 1.6 1995/05/10 20:49:51 jtc Exp $"; #endif -/* +/* * wrapper sinh(x) */ @@ -31,7 +31,7 @@ static char rcsid[] = "$NetBSD: w_sinh.c,v 1.6 1995/05/10 20:49:51 jtc Exp $"; #ifdef _IEEE_LIBM return __ieee754_sinh(x); #else - double z; + double z; z = __ieee754_sinh(x); if(_LIB_VERSION == _IEEE_) return z; if(!__finite(z)&&__finite(x)) { @@ -41,3 +41,7 @@ static char rcsid[] = "$NetBSD: w_sinh.c,v 1.6 1995/05/10 20:49:51 jtc Exp $"; #endif } weak_alias (__sinh, sinh) +#ifdef NO_LONG_DOUBLE +strong_alias (__sinh, __sinhl) +weak_alias (__sinh, sinhl) +#endif diff --git a/sysdeps/libm-ieee754/w_sqrt.c b/sysdeps/libm-ieee754/w_sqrt.c index 6351732..be15d95 100644 --- a/sysdeps/libm-ieee754/w_sqrt.c +++ b/sysdeps/libm-ieee754/w_sqrt.c @@ -5,7 +5,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. * ==================================================== */ @@ -14,7 +14,7 @@ static char rcsid[] = "$NetBSD: w_sqrt.c,v 1.6 1995/05/10 20:49:55 jtc Exp $"; #endif -/* +/* * wrapper sqrt(x) */ @@ -41,3 +41,7 @@ static char rcsid[] = "$NetBSD: w_sqrt.c,v 1.6 1995/05/10 20:49:55 jtc Exp $"; #endif } weak_alias (__sqrt, sqrt) +#ifdef NO_LONG_DOUBLE +strong_alias (__sqrt, __sqrtl) +weak_alias (__sqrt, sqrtl) +#endif diff --git a/sysdeps/posix/cuserid.c b/sysdeps/posix/cuserid.c index 2fe535e..140442f 100644 --- a/sysdeps/posix/cuserid.c +++ b/sysdeps/posix/cuserid.c @@ -16,9 +16,11 @@ 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 <pwd.h> #include <stdio.h> #include <string.h> -#include <pwd.h> +#include <unistd.h> +#include <sys/types.h> /* Return the username of the caller. If S is not NULL, it points to a buffer of at least L_cuserid bytes diff --git a/sysdeps/stub/e_acoshl.c b/sysdeps/stub/e_acoshl.c new file mode 100644 index 0000000..6ec9a15 --- /dev/null +++ b/sysdeps/stub/e_acoshl.c @@ -0,0 +1,11 @@ +#include <math.h> +#include <stdio.h> + +long double +__ieee754_acoshl (long double x) +{ + fputs ("__ieee754_acoshl not implemented\n", stderr); + return 0.0; +} + +stub_warning (__ieee754_acoshl) diff --git a/sysdeps/stub/e_hypotl.c b/sysdeps/stub/e_hypotl.c new file mode 100644 index 0000000..a7a6e12 --- /dev/null +++ b/sysdeps/stub/e_hypotl.c @@ -0,0 +1,11 @@ +#include <math.h> +#include <stdio.h> + +long double +__ieee754_hypotl (long double x, long double y) +{ + fputs ("__ieee754_hypotl not implemented\n", stderr); + return 0.0; +} + +stub_warning (__ieee754_hypotl) diff --git a/sysdeps/stub/e_j0l.c b/sysdeps/stub/e_j0l.c new file mode 100644 index 0000000..90fa2c6 --- /dev/null +++ b/sysdeps/stub/e_j0l.c @@ -0,0 +1,11 @@ +#include <math.h> +#include <stdio.h> + +long double +__ieee754_j0l (long double x) +{ + fputs ("__ieee754_j0l not implemented\n", stderr); + return 0.0; +} + +stub_warning (__ieee754_j0l) diff --git a/sysdeps/stub/e_j1l.c b/sysdeps/stub/e_j1l.c new file mode 100644 index 0000000..d84e3cd --- /dev/null +++ b/sysdeps/stub/e_j1l.c @@ -0,0 +1,11 @@ +#include <math.h> +#include <stdio.h> + +long double +__ieee754_j1l (long double x) +{ + fputs ("__ieee754_j1l not implemented\n", stderr); + return 0.0; +} + +stub_warning (__ieee754_j1l) diff --git a/sysdeps/stub/e_jnl.c b/sysdeps/stub/e_jnl.c new file mode 100644 index 0000000..b9f5900 --- /dev/null +++ b/sysdeps/stub/e_jnl.c @@ -0,0 +1,11 @@ +#include <math.h> +#include <stdio.h> + +long double +__ieee754_jnl (long double x) +{ + fputs ("__ieee754_jnl not implemented\n", stderr); + return 0.0; +} + +stub_warning (__ieee754_jnl) diff --git a/sysdeps/stub/e_lgammal_r.c b/sysdeps/stub/e_lgammal_r.c new file mode 100644 index 0000000..0155118 --- /dev/null +++ b/sysdeps/stub/e_lgammal_r.c @@ -0,0 +1,11 @@ +#include <math.h> +#include <stdio.h> + +long double +__ieee754_lgammal_r (long double x, int *signgamp) +{ + fputs ("__ieee754_lgammal_r not implemented\n", stderr); + return 0.0; +} + +stub_warning (__ieee754_lgammal_r) diff --git a/sysdeps/stub/e_powl.c b/sysdeps/stub/e_powl.c new file mode 100644 index 0000000..2fa7862 --- /dev/null +++ b/sysdeps/stub/e_powl.c @@ -0,0 +1,11 @@ +#include <math.h> +#include <stdio.h> + +long double +__ieee754_powl (long double x, long double y) +{ + fputs ("__ieee754_powl not implemented\n", stderr); + return 0.0; +} + +stub_warning (__ieee754_powl) diff --git a/sysdeps/stub/e_rem_pio2l.c b/sysdeps/stub/e_rem_pio2l.c new file mode 100644 index 0000000..0a9ac79 --- /dev/null +++ b/sysdeps/stub/e_rem_pio2l.c @@ -0,0 +1,11 @@ +#include <math.h> +#include <stdio.h> + +long double +__ieee754_rem_pio2l (long double x, long double *y) +{ + fputs ("__ieee754_rem_pio2l not implemented\n", stderr); + return 0.0; +} + +stub_warning (__ieee754_rem_pio2l) diff --git a/sysdeps/stub/e_sinhl.c b/sysdeps/stub/e_sinhl.c new file mode 100644 index 0000000..8fe11d4 --- /dev/null +++ b/sysdeps/stub/e_sinhl.c @@ -0,0 +1,11 @@ +#include <math.h> +#include <stdio.h> + +long double +__ieee754_sinhl (long double x) +{ + fputs ("__ieee754_sinhl not implemented\n", stderr); + return 0.0; +} + +stub_warning (__ieee754_sinhl) diff --git a/sysdeps/stub/k_cosl.c b/sysdeps/stub/k_cosl.c new file mode 100644 index 0000000..3e6c968 --- /dev/null +++ b/sysdeps/stub/k_cosl.c @@ -0,0 +1,11 @@ +#include <math.h> +#include <stdio.h> + +long double +__kernel_cosl (long double x, long double y) +{ + fputs ("__kernel_cosl not implemented\n", stderr); + return 0.0; +} + +stub_warning (__kernel_cosl) diff --git a/sysdeps/stub/k_rem_pio2l.c b/sysdeps/stub/k_rem_pio2l.c new file mode 100644 index 0000000..a51c445 --- /dev/null +++ b/sysdeps/stub/k_rem_pio2l.c @@ -0,0 +1,13 @@ +#include <math.h> +#include <math_private.h> +#include <stdio.h> + +int +__kernel_rem_pio2l (long double *x, long double *y, int e0, int nx, int prec, + const int *ipio2) +{ + fputs ("__kernel_rem_pio2l not implemented\n", stderr); + return 0.0; +} + +stub_warning (__kernel_rem_pio2l) diff --git a/sysdeps/stub/k_sinl.c b/sysdeps/stub/k_sinl.c new file mode 100644 index 0000000..2057bf8 --- /dev/null +++ b/sysdeps/stub/k_sinl.c @@ -0,0 +1,11 @@ +#include <math.h> +#include <stdio.h> + +long double +__kernel_sinl (long double x, long double y) +{ + fputs ("__kernel_sinl not implemented\n", stderr); + return 0.0; +} + +stub_warning (__kernel_sinl) diff --git a/sysdeps/stub/k_tanl.c b/sysdeps/stub/k_tanl.c new file mode 100644 index 0000000..713c8cd --- /dev/null +++ b/sysdeps/stub/k_tanl.c @@ -0,0 +1,11 @@ +#include <math.h> +#include <stdio.h> + +long double +__kernel_tanl (long double x, long double y, int iy) +{ + fputs ("__kernel_tanl not implemented\n", stderr); + return 0.0; +} + +stub_warning (__kernel_tanl) diff --git a/sysdeps/stub/s_erfl.c b/sysdeps/stub/s_erfl.c new file mode 100644 index 0000000..e01bad2 --- /dev/null +++ b/sysdeps/stub/s_erfl.c @@ -0,0 +1,12 @@ +#include <math.h> +#include <stdio.h> + +long double +__erfl (long double x) +{ + fputs ("__erfl not implemented\n", stderr); + return 0.0; +} +weak_alias (__erfl, erfl) + +stub_warning (erfl) diff --git a/sysdeps/stub/s_expm1l.c b/sysdeps/stub/s_expm1l.c new file mode 100644 index 0000000..fb8bda5 --- /dev/null +++ b/sysdeps/stub/s_expm1l.c @@ -0,0 +1,12 @@ +#include <math.h> +#include <stdio.h> + +long double +__expm1l (long double x) +{ + fputs ("__expm1l not implemented\n", stderr); + return 0.0; +} +weak_alias (__expm1l, expm1l) + +stub_warning (expm1l) diff --git a/sysdeps/unix/sysv/linux/i386/clone.S b/sysdeps/unix/sysv/linux/i386/clone.S index b60bc8e..0afbf87 100644 --- a/sysdeps/unix/sysv/linux/i386/clone.S +++ b/sysdeps/unix/sysv/linux/i386/clone.S @@ -65,6 +65,7 @@ ENTRY(__clone) jz thread_start ret + .size __clone,.-__clone SYSCALL_ERROR_HANDLER diff --git a/sysdeps/unix/sysv/linux/i386/mmap.S b/sysdeps/unix/sysv/linux/i386/mmap.S index 638d548..30b0f76 100644 --- a/sysdeps/unix/sysv/linux/i386/mmap.S +++ b/sysdeps/unix/sysv/linux/i386/mmap.S @@ -42,5 +42,6 @@ ENTRY (__mmap) /* Successful; return the syscall's value. */ ret + .size __mmap,.-__mmap weak_alias (__mmap, mmap) diff --git a/sysdeps/unix/sysv/linux/i386/profil-counter.h b/sysdeps/unix/sysv/linux/i386/profil-counter.h index 7de3fae..96b38e2 100644 --- a/sysdeps/unix/sysv/linux/i386/profil-counter.h +++ b/sysdeps/unix/sysv/linux/i386/profil-counter.h @@ -17,10 +17,10 @@ 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 <asm/sigcontext.h> +#include <sigcontext.h> void -profil_counter (int signo, struct sigcontext_struct sc) +profil_counter (int signo, struct sigcontext sc) { profil_count ((void *) sc.eip); } diff --git a/sysdeps/unix/sysv/linux/i386/sigcontext.h b/sysdeps/unix/sysv/linux/i386/sigcontext.h new file mode 100644 index 0000000..92733ab --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/sigcontext.h @@ -0,0 +1,29 @@ +/* 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 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. */ + +#ifndef _SIGCONTEXT_H +#define _SIGCONTEXT_H 1 + +/* Kernel headers before 2.1.1 define a struct sigcontext_struct, but + we need sigcontext. */ +#define sigcontext_struct sigcontext + +#include <asm/sigcontext.h> + + +#endif /* sigcontext.h */ diff --git a/sysdeps/unix/sysv/linux/i386/socket.S b/sysdeps/unix/sysv/linux/i386/socket.S index 39db6aa..0cf4bfd 100644 --- a/sysdeps/unix/sysv/linux/i386/socket.S +++ b/sysdeps/unix/sysv/linux/i386/socket.S @@ -57,5 +57,6 @@ ENTRY (P(__,socket)) /* Successful; return the syscall's value. */ ret + .size P(__,socket),.-P(__,socket) weak_alias (P(__,socket), socket) diff --git a/sysdeps/unix/sysv/linux/i386/syscall.S b/sysdeps/unix/sysv/linux/i386/syscall.S index b7b44e7..e7839cd 100644 --- a/sysdeps/unix/sysv/linux/i386/syscall.S +++ b/sysdeps/unix/sysv/linux/i386/syscall.S @@ -1,4 +1,4 @@ -/* Copyright (C) 1995 Free Software Foundation, Inc. +/* Copyright (C) 1995, 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 @@ -18,6 +18,9 @@ Cambridge, MA 02139, USA. */ #include <sysdep.h> +/* Please consult the file sysdeps/unix/sysv/linux/i386/sysdep.h for + more information about the value -125 used below.*/ + .text SYSCALL_ERROR_HANDLER /* Define error handler for PIC. */ ENTRY (syscall) @@ -26,6 +29,7 @@ ENTRY (syscall) movl 16(%esp), %eax /* Load syscall number into %eax. */ int $0x80 /* Do the system call. */ POPARGS_5 /* Restore register contents. */ - testl %eax, %eax /* Check %eax for error. */ - jl syscall_error /* Jump to error handler if negative. */ + cmpl $-125, %eax /* Check %eax for error. */ + jae syscall_error /* Jump to error handler if error. */ ret /* Return to caller. */ + .size syscall,.-syscall diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.S b/sysdeps/unix/sysv/linux/i386/sysdep.S index 213af51..9727f89 100644 --- a/sysdeps/unix/sysv/linux/i386/sysdep.S +++ b/sysdeps/unix/sysv/linux/i386/sysdep.S @@ -67,5 +67,4 @@ ENTRY (__errno_location) movl $errno, %eax #endif ret -.Lfe1: - .size __errno_location, .Lfe1-__errno_location + .size __errno_location, .-__errno_location diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h index 1bf20bd..b00c976 100644 --- a/sysdeps/unix/sysv/linux/i386/sysdep.h +++ b/sysdeps/unix/sysv/linux/i386/sysdep.h @@ -37,16 +37,25 @@ Cambridge, MA 02139, USA. */ #ifdef ASSEMBLER -/* Linux uses a negative return value to indicate syscall errors, unlike - most Unices, which use the condition codes' carry flag. */ +/* Linux uses a negative return value to indicate syscall errors, + unlike most Unices, which use the condition codes' carry flag. + + Since version 2.1 the return value of a system call might be + negative even if the call succeeded. E.g., the `lseek' system call + might return a large offset. Therefore we must not anymore test + for < 0, but test for a real error by making sure the value in %eax + is a real error number. For now (as of 2.1.1) 122 is the largest + defined error number. Given a bit room for development, Linus + chose in <asm/unistd.h> to use the values -125 to -1 for error + values. We follow him here. */ #undef PSEUDO #define PSEUDO(name, syscall_name, args) \ .text; \ SYSCALL_ERROR_HANDLER \ ENTRY (name) \ DO_CALL (args, syscall_name); \ - testl %eax, %eax; \ - jl syscall_error; + cmpl $-125, %eax; \ + jae syscall_error; #ifndef PIC #define SYSCALL_ERROR_HANDLER /* Nothing here; code in sysdep.S is used. */ @@ -70,9 +79,10 @@ syscall_error: \ popl %ebx; \ movl %ecx, (%eax); \ movl $-1, %eax; \ - ret; + ret; \ + .size syscall_error,.-syscall-error; /* A quick note: it is assumed that the call to `__errno_location' does - not modify the parameter value! */ + not modify the stack! */ #else #define SYSCALL_ERROR_HANDLER \ .type syscall_error,@function; \ @@ -85,7 +95,8 @@ syscall_error: \ movl errno@GOT(%ecx), %ecx; \ movl %edx, (%ecx); \ movl $-1, %eax; \ - ret; + ret; \ + .size syscall_error,.-syscall-error; #endif /* _LIBC_REENTRANT */ #endif /* PIC */ |