summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BUGS41
-rw-r--r--ChangeLog89
-rw-r--r--Makefile2
-rw-r--r--elf/dl-lookup.c54
-rw-r--r--elf/dl-reloc.c5
-rw-r--r--elf/dl-support.c4
-rw-r--r--elf/dlsym.c3
-rw-r--r--elf/dlvsym.c2
-rw-r--r--elf/link.h21
-rw-r--r--elf/rtld.c2
-rw-r--r--math/Makefile3
-rw-r--r--math/libm-test.c267
-rw-r--r--sysdeps/generic/dl-sysdep.c2
-rw-r--r--sysdeps/i386/dl-machine.h108
-rw-r--r--sysdeps/libm-i387/s_nextafterl.c2
-rw-r--r--sysdeps/libm-i387/s_remquo.S31
-rw-r--r--sysdeps/libm-i387/s_remquof.S31
-rw-r--r--sysdeps/libm-i387/s_remquol.S31
-rw-r--r--sysdeps/libm-ieee754/s_nan.c47
-rw-r--r--sysdeps/libm-ieee754/s_nanf.c47
-rw-r--r--sysdeps/libm-ieee754/s_nanl.c48
-rw-r--r--sysdeps/libm-ieee754/s_nextafter.c2
-rw-r--r--sysdeps/libm-ieee754/s_nextafterf.c12
-rw-r--r--sysdeps/libm-ieee754/s_nextafterl.c2
-rw-r--r--sysdeps/libm-ieee754/s_remquo.c106
-rw-r--r--sysdeps/libm-ieee754/s_remquof.c105
-rw-r--r--sysdeps/libm-ieee754/s_remquol.c106
-rw-r--r--sysdeps/libm-ieee754/s_rintl.c4
-rw-r--r--sysdeps/libm-ieee754/s_trunc.c61
-rw-r--r--sysdeps/libm-ieee754/s_truncf.c52
-rw-r--r--sysdeps/libm-ieee754/s_truncl.c57
-rw-r--r--sysdeps/sparc/dl-machine.h148
-rw-r--r--sysdeps/unix/sysv/linux/alpha/termbits.h4
-rw-r--r--sysdeps/unix/sysv/linux/termbits.h4
-rw-r--r--termios/sys/ttydefaults.h4
-rw-r--r--time/sys/time.h3
36 files changed, 1282 insertions, 228 deletions
diff --git a/BUGS b/BUGS
index 5b839a0d0a..174d7ccc7e 100644
--- a/BUGS
+++ b/BUGS
@@ -1,20 +1,27 @@
List of known bugs (certainly very incomplete)
----------------------------------------------
-Time-stamp: <1997-03-20T02:33:37+0100 drepper>
+Time-stamp: <1997-03-22T04:31:41+0100 drepper>
This following list contains those bugs which I'm aware of. Please
-make sure that bugs you report are not listed here. I you can fix one
-of these bugs I'll certainly be glad to receive a patch.
+make sure that bugs you report are not listed here. If you can fix one
+of these bugs/limitations I'll certainly be glad to receive a patch.
-Severity: [ *] to [***]
+Another source of information about bugs is the problem data base of the
+GNU project. There is an easy to use WWW interface is available at
+
+ http://pogo.gnu.ai.mit.edu:8080/cgi-bin/wwwgnats.pl
+
+I would appreciate it very much if you could verify the problem was not
+reported before by looking though the database. To make the information
+in this data as useful as possible please report bugs always using the
+`glibcbug' shell script which gets installed with GNU libc.
-[***] Profiling currently does not work with programs using NSS.
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Severity: [ *] to [***]
-[***] At least on Linux/Alpha, there seem to be problems with dynamically
- loading NSS modules in certain situations.
- [PR libc/137]
[ **] For GNU libc on Linux, there is still no solution for the UTMP
problem.
@@ -23,7 +30,7 @@ Severity: [ *] to [***]
[ **] There are problems with signal handling when using LinuxThreads.
[ **] The `cbrtl' function is inaccurate. The algorithm used for `double'
- and `float' is not usable.
+ and `float' is not usable for `long double'.
[ **] Not really a bug, but it could lead to such:
The RPC code is ugly ugly ugly. It's more or less verbatim taken
@@ -37,3 +44,19 @@ Severity: [ *] to [***]
[ *] The syslog function should print to the console if the LOG_CONS
flag was given.
[PR libc/72]
+
+[ *] On Linux, the <linux/posix_types.h> is not clean enough to satisfy
+ the C++ namespace rules. Declaring `struct fd_set' also makes
+ `fd_set' available in the global namespace which conflicts with
+ the definition of `fd_set' in glibc.
+ [PR libc/79]
+
+[ *] On Linux, there should be a way to prevent defining the symbol
+ NGROUPS_MAX in the <linux/limits.h> header file. In glibc it
+ is defined in <posix1_lim.h> which must not make the other
+ symbols in <linux/limits.h> available.
+ [PR libc/140]
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Ulrich Drepper
+drepper@cygnus.com
diff --git a/ChangeLog b/ChangeLog
index 57b1588e66..ea83c11b61 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,94 @@
+1997-03-23 02:11 Ulrich Drepper <drepper@cygnus.com>
+
+ * time/sys/time.h: Make values ITIMER_* also available as macros.
+
+ * elf/dl-support.c (_dl_sysdep_read_whole_file): Don't call
+ __fstat but instead __fxstat directly to avoid dependency on
+ libc.a when inline failed.
+ * sysdeps/generic/dl-sysdep.c (_dl_sysdep_read_whole_file): Likewise.
+
+ * math/Makefile (libm-routines): Add s_remquo.
+ * sysdeps/libm-i387/s_remquo.S: New file.
+ * sysdeps/libm-i387/s_remquof.S: New file.
+ * sysdeps/libm-i387/s_remquol.S: New file.
+ * sysdeps/libm-ieee754/s_remquo.c: New file.
+ * sysdeps/libm-ieee754/s_remquof.c: New file.
+ * sysdeps/libm-ieee754/s_remquol.c: New file.
+
+ * math/libm-test.c (remquo_test): New function.
+
+ * sysdeps/libm-ieee754/s_rintl.c: Handle implicit leading one
+ correctly.
+
+1997-03-22 14:06 Ulrich Drepper <drepper@cygnus.com>
+
+ * math/Makefile (libm-calls): Add s_nan.
+ * sysdeps/libm-ieee754/s_nan.c: New file. Implement `nan' function.
+ * sysdeps/libm-ieee754/s_nanf.c: New file. Implement `nanf' function.
+ * sysdeps/libm-ieee754/s_nanl.c: New file. Implement `nanl' function.
+
+ * math/libm-test.c (basic_tests): Add tests for `nan' function.
+
+ * math/libm-test.c (copysign_test): New function.
+ (main): Call copysign_test.
+
+1997-03-22 06:28 Ulrich Drepper <drepper@cygnus.com>
+
+ * sysdeps/libm-ieee754/s_nextafter.c: Return y if x == y.
+ * sysdeps/libm-ieee754/s_nextafterf.c: Likewise.
+ * sysdeps/libm-ieee754/s_nextafterl.c: Likewise.
+ * sysdeps/libm-i387/s_nextafterl.c: Likewise.
+
+ * math/libm-test.c (fdim_test, fmin_test, fmax_test, nextafter_test):
+ New functions. Test these functions.
+ (main): Call above new functions.
+
+1997-03-22 04:53 Ulrich Drepper <drepper@cygnus.com>
+
+ * Net release 2.0.2.
+
+1997-03-22 04:37 Ulrich Drepper <drepper@cygnus.com>
+
+ * sysdeps/unix/sysv/linux/termbits.h (OXTABS): Define as alias for
+ XTABS.
+ * sysdeps/unix/sysv/linux/alpha/termbits.h (OXTABS): Likewise.
+ * termios/sys/ttydefaults.h: Partly revert patch by Andreas Schwab
+ of Sun Dec 15 16:33:44 1996.
+ Proposed by Thomas Bushnell <thomas@gnu.ai.mit.edu>.
+
+1997-03-21 13:41 Roland McGrath <roland@baalperazim.frob.com>
+
+ * sysdeps/sparc/dl-machine.h (elf_machine_rel): Rewritten as for i386.
+ Check here for non-SHN_UNDEF STB_LOCAL symbols don't do any lookup or
+ consult their values.
+ (elf_machine_lookup_noexec_p, elf_machine_lookup_noplt_p,
+ ELF_MACHINE_RELOC_NOPLT): New macros.
+
+ * elf/rtld.c (dl_main): Pass ELF_MACHINE_RELOC_NOPLT to
+ _dl_lookup_symbol in place of DL_LOOKUP_NOPLT.
+ * sysdeps/i386/dl-machine.h (ELF_MACHINE_RELOC_NOPLT): New macro.
+
+ * sysdeps/i386/dl-machine.h (elf_machine_rel): Rewritten to do the
+ symbol lookup before checking reloc type except for R_386_RELATIVE.
+ (elf_machine_lookup_noexec_p, elf_machine_lookup_noplt_p): New macros.
+
+ * elf/dl-reloc.c (RESOLVE): Remove STB_LOCAL check; let it be
+ per-machine since it supposedly can't happen on i386.
+
+ * elf/dl-lookup.c (do_lookup): Change arg FLAGS to RELOC_TYPE. Use
+ elf_machine_lookup_{noexec,noplt}_p macros on it. Remove gratuitous
+ indirection from REF arg; change callers.
+ (_dl_lookup_symbol, _dl_lookup_versioned_symbol): Change arg name.
+ (_dl_lookup_symbol_skip, _dl_lookup_versioned_symbol_skip): Remove
+ FLAGS arg altogether.
+ * elf/dlsym.c: Remove argument of FLAGS parameter.
+ * elf/dlvsym.c: Likewise.
+ * elf/link.h: Update decls.
+
1997-03-21 20:55 Ulrich Drepper <drepper@cygnus.com>
+ * Makefile (distribute): Add BUGS.
+
* sysdeps/generic/machine-gmon.h: Update copyright.
* sysdeps/i386/Makefile [$(subdir)=gmon] (sysdep_routines): Add
diff --git a/Makefile b/Makefile
index cf97c3019d..0dae836e69 100644
--- a/Makefile
+++ b/Makefile
@@ -290,7 +290,7 @@ $(objpfx)isomac: isomac.c
# Make the distribution tarfile.
-distribute := README INSTALL FAQ NOTES NEWS PROJECTS \
+distribute := README INSTALL FAQ NOTES NEWS PROJECTS BUGS \
COPYING.LIB COPYING ChangeLog ChangeLog.[0-9] \
Makefile Makeconfig Makerules Rules Make-dist MakeTAGS \
extra-lib.mk o-iterator.mk isomac.c \
diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
index 8702a85bbb..f85aa373c2 100644
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -22,7 +22,8 @@
#include <assert.h>
#include <string.h>
-#include <dl-hash.h>
+#include "dl-hash.h"
+#include <dl-machine.h>
#include "../stdio-common/_itoa.h"
#define VERSTAG(tag) (DT_NUM + DT_PROCNUM + DT_VERSIONTAGIDX (tag))
@@ -57,10 +58,10 @@ struct sym_val
something bad happened. */
static inline int
do_lookup (const char *undef_name, unsigned long int hash,
- const ElfW(Sym) **ref, struct sym_val *result,
+ const ElfW(Sym) *ref, struct sym_val *result,
struct link_map *list[], size_t i, size_t n,
const char *reference_name, const struct r_found_version *version,
- struct link_map *skip, int flags)
+ struct link_map *skip, int reloc_type)
{
struct link_map *map;
@@ -78,7 +79,8 @@ do_lookup (const char *undef_name, unsigned long int hash,
continue;
/* Don't search the executable when resolving a copy reloc. */
- if (flags & DL_LOOKUP_NOEXEC && map->l_type == lt_executable)
+ if (elf_machine_lookup_noexec_p (reloc_type) &&
+ map->l_type == lt_executable)
continue;
symtab = ((void *) map->l_addr + map->l_info[DT_SYMTAB]->d_un.d_ptr);
@@ -98,7 +100,7 @@ do_lookup (const char *undef_name, unsigned long int hash,
const ElfW(Sym) *sym = &symtab[symidx];
if (sym->st_value == 0 || /* No value. */
- ((flags & DL_LOOKUP_NOPLT) != 0 /* Reject PLT entry. */
+ (elf_machine_lookup_noplt_p (reloc_type) /* Reject PLT entry. */
&& sym->st_shndx == SHN_UNDEF))
continue;
@@ -113,7 +115,7 @@ do_lookup (const char *undef_name, unsigned long int hash,
continue;
}
- if (sym != *ref && strcmp (strtab + sym->st_name, undef_name))
+ if (sym != ref && strcmp (strtab + sym->st_name, undef_name))
/* Not the symbol we are looking for. */
continue;
@@ -188,16 +190,13 @@ do_lookup (const char *undef_name, unsigned long int hash,
}
/* Search loaded objects' symbol tables for a definition of the symbol
- UNDEF_NAME. FLAGS is a set of flags. If DL_LOOKUP_NOEXEC is set,
- then don't search the executable for a definition; this used for
- copy relocs. If DL_LOOKUP_NOPLT is set, then a PLT entry cannot
- satisfy the reference; some different binding must be found. */
+ UNDEF_NAME. */
ElfW(Addr)
_dl_lookup_symbol (const char *undef_name, const ElfW(Sym) **ref,
struct link_map *symbol_scope[],
const char *reference_name,
- int flags)
+ int reloc_type)
{
const unsigned long int hash = _dl_elf_hash (undef_name);
struct sym_val current_value = { 0, NULL };
@@ -205,9 +204,9 @@ _dl_lookup_symbol (const char *undef_name, const ElfW(Sym) **ref,
/* Search the relevant loaded objects for a definition. */
for (scope = symbol_scope; *scope; ++scope)
- if (do_lookup (undef_name, hash, ref, &current_value,
+ if (do_lookup (undef_name, hash, *ref, &current_value,
(*scope)->l_searchlist, 0, (*scope)->l_nsearchlist,
- reference_name, NULL, NULL, flags))
+ reference_name, NULL, NULL, reloc_type))
break;
if (current_value.s == NULL &&
@@ -230,8 +229,7 @@ ElfW(Addr)
_dl_lookup_symbol_skip (const char *undef_name, const ElfW(Sym) **ref,
struct link_map *symbol_scope[],
const char *reference_name,
- struct link_map *skip_map,
- int flags)
+ struct link_map *skip_map)
{
const unsigned long int hash = _dl_elf_hash (undef_name);
struct sym_val current_value = { 0, NULL };
@@ -243,13 +241,13 @@ _dl_lookup_symbol_skip (const char *undef_name, const ElfW(Sym) **ref,
for (i = 0; (*scope)->l_dupsearchlist[i] != skip_map; ++i)
assert (i < (*scope)->l_ndupsearchlist);
- if (! do_lookup (undef_name, hash, ref, &current_value,
+ if (! do_lookup (undef_name, hash, *ref, &current_value,
(*scope)->l_dupsearchlist, i, (*scope)->l_ndupsearchlist,
- reference_name, NULL, skip_map, flags))
+ reference_name, NULL, skip_map, 0))
while (*++scope)
- if (do_lookup (undef_name, hash, ref, &current_value,
+ if (do_lookup (undef_name, hash, *ref, &current_value,
(*scope)->l_dupsearchlist, 0, (*scope)->l_ndupsearchlist,
- reference_name, NULL, skip_map, flags))
+ reference_name, NULL, skip_map, 0))
break;
*ref = current_value.s;
@@ -266,7 +264,8 @@ ElfW(Addr)
_dl_lookup_versioned_symbol (const char *undef_name, const ElfW(Sym) **ref,
struct link_map *symbol_scope[],
const char *reference_name,
- const struct r_found_version *version, int flags)
+ const struct r_found_version *version,
+ int reloc_type)
{
const unsigned long int hash = _dl_elf_hash (undef_name);
struct sym_val current_value = { 0, NULL };
@@ -275,9 +274,9 @@ _dl_lookup_versioned_symbol (const char *undef_name, const ElfW(Sym) **ref,
/* Search the relevant loaded objects for a definition. */
for (scope = symbol_scope; *scope; ++scope)
{
- int res = do_lookup (undef_name, hash, ref, &current_value,
+ int res = do_lookup (undef_name, hash, *ref, &current_value,
(*scope)->l_searchlist, 0, (*scope)->l_nsearchlist,
- reference_name, version, NULL, flags);
+ reference_name, version, NULL, reloc_type);
if (res > 0)
break;
@@ -312,8 +311,7 @@ _dl_lookup_versioned_symbol_skip (const char *undef_name,
struct link_map *symbol_scope[],
const char *reference_name,
const struct r_found_version *version,
- struct link_map *skip_map,
- int flags)
+ struct link_map *skip_map)
{
const unsigned long int hash = _dl_elf_hash (undef_name);
struct sym_val current_value = { 0, NULL };
@@ -325,13 +323,13 @@ _dl_lookup_versioned_symbol_skip (const char *undef_name,
for (i = 0; (*scope)->l_dupsearchlist[i] != skip_map; ++i)
assert (i < (*scope)->l_ndupsearchlist);
- if (! do_lookup (undef_name, hash, ref, &current_value,
+ if (! do_lookup (undef_name, hash, *ref, &current_value,
(*scope)->l_dupsearchlist, i, (*scope)->l_ndupsearchlist,
- reference_name, version, skip_map, flags))
+ reference_name, version, skip_map, 0))
while (*++scope)
- if (do_lookup (undef_name, hash, ref, &current_value,
+ if (do_lookup (undef_name, hash, *ref, &current_value,
(*scope)->l_dupsearchlist, 0, (*scope)->l_ndupsearchlist,
- reference_name, version, skip_map, flags))
+ reference_name, version, skip_map, 0))
break;
*ref = current_value.s;
diff --git a/elf/dl-reloc.c b/elf/dl-reloc.c
index d2122a8bdf..f1c43ea174 100644
--- a/elf/dl-reloc.c
+++ b/elf/dl-reloc.c
@@ -58,10 +58,7 @@ _dl_relocate_object (struct link_map *l, struct link_map *scope[], int lazy)
/* This macro is used as a callback from the ELF_DYNAMIC_RELOCATE code. */
#define RESOLVE(ref, version, flags) \
- ((*ref)->st_shndx != SHN_UNDEF && \
- ELFW(ST_BIND) ((*ref)->st_info) == STB_LOCAL \
- ? l->l_addr : \
- (version) != NULL && (version)->hash != 0 \
+ ((version) != NULL && (version)->hash != 0 \
? _dl_lookup_versioned_symbol (strtab + (*ref)->st_name, (ref), scope, \
l->l_name, (version), (flags)) \
: _dl_lookup_symbol (strtab + (*ref)->st_name, (ref), scope, \
diff --git a/elf/dl-support.c b/elf/dl-support.c
index 593f96749b..5c70b4f263 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -1,5 +1,5 @@
/* Support for dynamic linking code in static libc.
- Copyright (C) 1996 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997 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
@@ -62,7 +62,7 @@ _dl_sysdep_read_whole_file (const char *file, size_t *sizep, int prot)
int fd = __open (file, O_RDONLY);
if (fd < 0)
return NULL;
- if (__fstat (fd, &st) < 0)
+ if (__fxstat (_STAT_VER, fd, &st) < 0)
result = NULL;
else
{
diff --git a/elf/dlsym.c b/elf/dlsym.c
index 73f6e86475..d05619bfb4 100644
--- a/elf/dlsym.c
+++ b/elf/dlsym.c
@@ -53,8 +53,7 @@ RTLD_NEXT used in code not dynamically loaded"));
while (l->l_loader)
l = l->l_loader;
- loadbase = _dl_lookup_symbol_skip
- (name, &ref, &_dl_loaded, NULL, l, 0);
+ loadbase = _dl_lookup_symbol_skip (name, &ref, &_dl_loaded, NULL, l);
}
else
{
diff --git a/elf/dlvsym.c b/elf/dlvsym.c
index 922a6eed1f..b3d4c1aeee 100644
--- a/elf/dlvsym.c
+++ b/elf/dlvsym.c
@@ -57,7 +57,7 @@ RTLD_NEXT used in code not dynamically loaded"));
l = l->l_loader;
loadbase = _dl_lookup_versioned_symbol_skip
- (name, &ref, &_dl_loaded, NULL, &version, l, 0);
+ (name, &ref, &_dl_loaded, NULL, &version, l);
}
else
{
diff --git a/elf/link.h b/elf/link.h
index 62bf74c23b..3934aed8e2 100644
--- a/elf/link.h
+++ b/elf/link.h
@@ -290,18 +290,15 @@ extern void _dl_close (struct link_map *map);
null-terminated list of object scopes to search; each object's
l_searchlist (i.e. the segment of the dependency tree starting at that
object) is searched in turn. REFERENCE_NAME should name the object
- containing the reference; it is used in error messages. FLAGS is a
- set of flags: */
-#define DL_LOOKUP_NOEXEC 1 /* Don't search the executable for a
- definition; this is used for copy
- relocs. */
-#define DL_LOOKUP_NOPLT 2 /* The reference must not be resolved
- to a PLT entry. */
+ containing the reference; it is used in error messages.
+ RELOC_TYPE is a machine-dependent reloc type, which is passed to
+ the `elf_machine_lookup_*_p' macros in dl-machine.h to affect which
+ symbols can be chosen. */
extern ElfW(Addr) _dl_lookup_symbol (const char *undef,
const ElfW(Sym) **sym,
struct link_map *symbol_scope[],
const char *reference_name,
- int flags);
+ int reloc_type);
/* Lookup versioned symbol. */
extern ElfW(Addr) _dl_lookup_versioned_symbol (const char *undef,
@@ -309,15 +306,14 @@ extern ElfW(Addr) _dl_lookup_versioned_symbol (const char *undef,
struct link_map *symbol_scope[],
const char *reference_name,
const struct r_found_version *version,
- int flags);
+ int reloc_type);
/* For handling RTLD_NEXT we must be able to skip shared objects. */
extern ElfW(Addr) _dl_lookup_symbol_skip (const char *undef,
const ElfW(Sym) **sym,
struct link_map *symbol_scope[],
const char *reference_name,
- struct link_map *skip_this,
- int flags);
+ struct link_map *skip_this);
/* For handling RTLD_NEXT with versioned symbols we must be able to
skip shared objects. */
@@ -326,8 +322,7 @@ extern ElfW(Addr) _dl_lookup_versioned_symbol_skip (const char *undef,
struct link_map *symbol_scope[],
const char *reference_name,
const struct r_found_version *version,
- struct link_map *skip_this,
- int flags);
+ struct link_map *skip_this);
/* Look up symbol NAME in MAP's scope and return its run-time address. */
extern ElfW(Addr) _dl_symbol_value (struct link_map *map, const char *name);
diff --git a/elf/rtld.c b/elf/rtld.c
index 84ab37942b..295a6aed7d 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -518,7 +518,7 @@ of this helper program; chances are you did not intend to run this program.\n",
ElfW(Addr) loadbase = _dl_lookup_symbol (_dl_argv[i], &ref,
&_dl_default_scope[2],
"argument",
- DL_LOOKUP_NOPLT);
+ ELF_MACHINE_RELOC_NOPLT);
char buf[20], *bp;
buf[sizeof buf - 1] = '\0';
bp = _itoa (ref->st_value, &buf[sizeof buf - 1], 16, 0);
diff --git a/math/Makefile b/math/Makefile
index 5b1f090b5f..31b3684997 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -47,7 +47,8 @@ libm-calls = e_acos e_acosh e_asin e_atan2 e_atanh e_cosh e_exp e_fmod \
w_atan2 w_atanh w_cosh w_drem w_exp w_fmod w_gamma \
w_gamma_r w_hypot w_j0 w_j1 w_jn w_lgamma w_lgamma_r \
w_log w_log10 w_pow w_remainder w_scalb w_sinh w_sqrt \
- s_signbit s_fpclassify s_fmax s_fmin s_fdim \
+ s_signbit s_fpclassify s_fmax s_fmin s_fdim s_nan s_trunc \
+ s_remquo \
conj cimag creal cabs
libm-routines = $(libm-support) $(libm-calls) \
$(patsubst %_rf,%f_r,$(libm-calls:=f)) \
diff --git a/math/libm-test.c b/math/libm-test.c
index a0482df758..8995f85475 100644
--- a/math/libm-test.c
+++ b/math/libm-test.c
@@ -102,10 +102,10 @@ static MATHTYPE plus_infty, minus_infty, nan_value;
typedef MATHTYPE (*mathfunc) (MATHTYPE);
-#define ISINF(x) \
-(sizeof (x) == sizeof (float) ? \
- isinff (x) \
- : sizeof (x) == sizeof (double) ? \
+#define ISINF(x) \
+(sizeof (x) == sizeof (float) ? \
+ isinff (x) \
+ : sizeof (x) == sizeof (double) ? \
isinf (x) : isinfl (x))
@@ -1223,6 +1223,222 @@ pow_test (void)
static void
+fdim_test (void)
+{
+ check ("fdim (+0, +0) = +0", FUNC(fdim) (0, 0), 0);
+ check ("fdim (9, 0) = 9", FUNC(fdim) (9, 0), 9);
+ check ("fdim (0, 9) = 0", FUNC(fdim) (0, 9), 0);
+ check ("fdim (-9, 0) = 9", FUNC(fdim) (-9, 0), 0);
+ check ("fdim (0, -9) = 9", FUNC(fdim) (0, -9), 9);
+
+ check_isinfp ("fdim (+inf, 9) = +inf", FUNC(fdim) (plus_infty, 9));
+ check_isinfp ("fdim (+inf, -9) = +inf", FUNC(fdim) (plus_infty, -9));
+ check ("fdim (-inf, 9) = 0", FUNC(fdim) (minus_infty, 9), 0);
+ check ("fdim (-inf, -9) = 0", FUNC(fdim) (minus_infty, -9), 0);
+ check_isinfp ("fdim (+9, -inf) = +inf", FUNC(fdim) (9, minus_infty));
+ check_isinfp ("fdim (-9, -inf) = +inf", FUNC(fdim) (-9, minus_infty));
+ check ("fdim (9, inf) = 0", FUNC(fdim) (9, plus_infty), 0);
+ check ("fdim (-9, inf) = 0", FUNC(fdim) (-9, plus_infty), 0);
+
+ check_isnan ("fdim (0, NaN) = NaN", FUNC(fdim) (0, nan_value));
+ check_isnan ("fdim (9, NaN) = NaN", FUNC(fdim) (9, nan_value));
+ check_isnan ("fdim (-9, NaN) = NaN", FUNC(fdim) (-9, nan_value));
+ check_isnan ("fdim (NaN, 9) = NaN", FUNC(fdim) (nan_value, 9));
+ check_isnan ("fdim (NaN, -9) = NaN", FUNC(fdim) (nan_value, -9));
+ check_isnan ("fdim (+inf, NaN) = NaN", FUNC(fdim) (plus_infty, nan_value));
+ check_isnan ("fdim (-inf, NaN) = NaN", FUNC(fdim) (minus_infty, nan_value));
+ check_isnan ("fdim (NaN, +inf) = NaN", FUNC(fdim) (nan_value, plus_infty));
+ check_isnan ("fdim (NaN, -inf) = NaN", FUNC(fdim) (nan_value, minus_infty));
+ check_isnan ("fdim (NaN, NaN) = NaN", FUNC(fdim) (nan_value, nan_value));
+}
+
+
+static void
+fmin_test (void)
+{
+ check ("fmin (+0, +0) = +0", FUNC(fmin) (0, 0), 0);
+ check ("fmin (9, 0) = 0", FUNC(fmin) (9, 0), 0);
+ check ("fmin (0, 9) = 0", FUNC(fmin) (0, 9), 0);
+ check ("fmin (-9, 0) = -9", FUNC(fmin) (-9, 0), -9);
+ check ("fmin (0, -9) = -9", FUNC(fmin) (0, -9), -9);
+
+ check ("fmin (+inf, 9) = 9", FUNC(fmin) (plus_infty, 9), 9);
+ check ("fmin (9, +inf) = 9", FUNC(fmin) (9, plus_infty), 9);
+ check ("fmin (+inf, -9) = -9", FUNC(fmin) (plus_infty, -9), -9);
+ check ("fmin (-9, +inf) = -9", FUNC(fmin) (-9, plus_infty), -9);
+ check_isinfn ("fmin (-inf, 9) = -inf", FUNC(fmin) (minus_infty, 9));
+ check_isinfn ("fmin (-inf, -9) = -inf", FUNC(fmin) (minus_infty, -9));
+ check_isinfn ("fmin (+9, -inf) = -inf", FUNC(fmin) (9, minus_infty));
+ check_isinfn ("fmin (-9, -inf) = -inf", FUNC(fmin) (-9, minus_infty));
+
+ check ("fmin (0, NaN) = 0", FUNC(fmin) (0, nan_value), 0);
+ check ("fmin (9, NaN) = 9", FUNC(fmin) (9, nan_value), 9);
+ check ("fmin (-9, NaN) = 9", FUNC(fmin) (-9, nan_value), -9);
+ check ("fmin (NaN, 0) = 0", FUNC(fmin) (nan_value, 0), 0);
+ check ("fmin (NaN, 9) = NaN", FUNC(fmin) (nan_value, 9), 9);
+ check ("fmin (NaN, -9) = NaN", FUNC(fmin) (nan_value, -9), -9);
+ check_isinfp ("fmin (+inf, NaN) = +inf", FUNC(fmin) (plus_infty, nan_value));
+ check_isinfn ("fmin (-inf, NaN) = -inf", FUNC(fmin) (minus_infty, nan_value));
+ check_isinfp ("fmin (NaN, +inf) = +inf", FUNC(fmin) (nan_value, plus_infty));
+ check_isinfn ("fmin (NaN, -inf) = -inf", FUNC(fmin) (nan_value, minus_infty));
+ check_isnan ("fmin (NaN, NaN) = NaN", FUNC(fmin) (nan_value, nan_value));
+}
+
+
+static void
+fmax_test (void)
+{
+ check ("fmax (+0, +0) = +0", FUNC(fmax) (0, 0), 0);
+ check ("fmax (9, 0) = 9", FUNC(fmax) (9, 0), 9);
+ check ("fmax (0, 9) = 9", FUNC(fmax) (0, 9), 9);
+ check ("fmax (-9, 0) = 0", FUNC(fmax) (-9, 0), 0);
+ check ("fmax (0, -9) = 0", FUNC(fmax) (0, -9), 0);
+
+ check_isinfp ("fmax (+inf, 9) = +inf", FUNC(fmax) (plus_infty, 9));
+ check_isinfp ("fmax (9, +inf) = +inf", FUNC(fmax) (0, plus_infty));
+ check_isinfp ("fmax (-9, +inf) = +inf", FUNC(fmax) (-9, plus_infty));
+ check_isinfp ("fmax (+inf, -9) = +inf", FUNC(fmax) (plus_infty, -9));
+ check ("fmax (-inf, 9) = 9", FUNC(fmax) (minus_infty, 9), 9);
+ check ("fmax (-inf, -9) = -9", FUNC(fmax) (minus_infty, -9), -9);
+ check ("fmax (+9, -inf) = 9", FUNC(fmax) (9, minus_infty), 9);
+ check ("fmax (-9, -inf) = -9", FUNC(fmax) (-9, minus_infty), -9);
+
+ check ("fmax (0, NaN) = 0", FUNC(fmax) (0, nan_value), 0);
+ check ("fmax (9, NaN) = 9", FUNC(fmax) (9, nan_value), 9);
+ check ("fmax (-9, NaN) = 9", FUNC(fmax) (-9, nan_value), -9);
+ check ("fmax (NaN, 0) = 0", FUNC(fmax) (nan_value, 0), 0);
+ check ("fmax (NaN, 9) = NaN", FUNC(fmax) (nan_value, 9), 9);
+ check ("fmax (NaN, -9) = NaN", FUNC(fmax) (nan_value, -9), -9);
+ check_isinfp ("fmax (+inf, NaN) = +inf", FUNC(fmax) (plus_infty, nan_value));
+ check_isinfn ("fmax (-inf, NaN) = -inf", FUNC(fmax) (minus_infty, nan_value));
+ check_isinfp ("fmax (NaN, +inf) = +inf", FUNC(fmax) (nan_value, plus_infty));
+ check_isinfn ("fmax (NaN, -inf) = -inf", FUNC(fmax) (nan_value, minus_infty));
+ check_isnan ("fmax (NaN, NaN) = NaN", FUNC(fmax) (nan_value, nan_value));
+}
+
+
+static void
+nextafter_test (void)
+{
+ MATHTYPE x;
+
+ check ("nextafter (+0, +0) = +0", FUNC(nextafter) (0, 0), 0);
+ check ("nextafter (-0, +0) = +0", FUNC(nextafter) (minus_zero, 0), 0);
+ check ("nextafter (+0, -0) = -0", FUNC(nextafter) (0, minus_zero),
+ minus_zero);
+ check ("nextafter (-0, -0) = -0", FUNC(nextafter) (minus_zero, minus_zero),
+ minus_zero);
+
+ check ("nextafter (9, 9) = 9", FUNC(nextafter) (9, 9), 9);
+ check ("nextafter (-9, -9) = -9", FUNC(nextafter) (-9, -9), -9);
+ check_isinfp ("nextafter (+inf, +inf) = +inf",
+ FUNC(nextafter) (plus_infty, plus_infty));
+ check_isinfn ("nextafter (-inf, -inf) = -inf",
+ FUNC(nextafter) (minus_infty, minus_infty));
+
+ x = rand () * 1.1;
+ check_isnan ("nextafter (NaN, x) = NaN", FUNC(nextafter) (nan_value, x));
+ check_isnan ("nextafter (x, NaN) = NaN", FUNC(nextafter) (x, nan_value));
+ check_isnan ("nextafter (NaN, NaN) = NaN", FUNC(nextafter) (nan_value,
+ nan_value));
+
+ /* XXX We need the hexadecimal FP number representation here for further
+ tests. */
+}
+
+
+static void
+copysign_test (void)
+{
+ check ("copysign (0, 4) = 0", FUNC(copysign) (0, 4), 0);
+ check ("copysign (0, -4) = -0", FUNC(copysign) (0, -4), minus_zero);
+ check ("copysign (-0, 4) = 0", FUNC(copysign) (minus_zero, 4), 0);
+ check ("copysign (-0, -4) = -0", FUNC(copysign) (minus_zero, -4),
+ minus_zero);
+
+ check_isinfp ("copysign (+inf, 0) = +inf", FUNC(copysign) (plus_infty, 0));
+ check_isinfn ("copysign (+inf, -0) = -inf", FUNC(copysign) (plus_infty,
+ minus_zero));
+ check_isinfp ("copysign (-inf, 0) = +inf", FUNC(copysign) (minus_infty, 0));
+ check_isinfn ("copysign (-inf, -0) = -inf", FUNC(copysign) (minus_infty,
+ minus_zero));
+
+ check ("copysign (0, +inf) = 0", FUNC(copysign) (0, plus_infty), 0);
+ check ("copysign (0, -inf) = -0", FUNC(copysign) (0, minus_zero),
+ minus_zero);
+ check ("copysign (-0, +inf) = 0", FUNC(copysign) (minus_zero, plus_infty),
+ 0);
+ check ("copysign (-0, -inf) = -0", FUNC(copysign) (minus_zero, minus_zero),
+ minus_zero);
+
+ /* XXX More correctly we would have to check the sign of the NaN. */
+ check_isnan ("copysign (+NaN, 0) = +inf", FUNC(copysign) (nan_value, 0));
+ check_isnan ("copysign (+NaN, -0) = -inf", FUNC(copysign) (nan_value,
+ minus_zero));
+ check_isnan ("copysign (-NaN, 0) = +inf", FUNC(copysign) (-nan_value, 0));
+ check_isnan ("copysign (-NaN, -0) = -inf", FUNC(copysign) (-nan_value,
+ minus_zero));
+}
+
+
+static void
+trunc_test (void)
+{
+ check ("trunc(0) = 0", FUNC(trunc) (0), 0);
+ check ("trunc(-0) = -0", FUNC(trunc) (minus_zero), minus_zero);
+ check ("trunc(0.625) = 0", FUNC(trunc) (0.625), 0);
+ check ("trunc(-0.625) = -0", FUNC(trunc) (-0.625), minus_zero);
+ check ("trunc(1) = 1", FUNC(trunc) (1), 1);
+ check ("trunc(-1) = -1", FUNC(trunc) (-1), -1);
+ check ("trunc(1.625) = 1", FUNC(trunc) (1.625), 1);
+ check ("trunc(-1.625) = -1", FUNC(trunc) (-1.625), -1);
+
+ check ("trunc(1048580.625) = 1048580", FUNC(trunc) (1048580.625L),
+ 1048580L);
+ check ("trunc(-1048580.625) = -1048580", FUNC(trunc) (-1048580.625L),
+ -1048580L);
+
+ check ("trunc(8388610.125) = 8388610", FUNC(trunc) (8388610.125L),
+ 8388610.0L);
+ check ("trunc(-8388610.125) = -8388610", FUNC(trunc) (-8388610.125L),
+ -8388610.0L);
+
+ check ("trunc(4294967296.625) = 4294967296", FUNC(trunc) (4294967296.625L),
+ 4294967296.0L);
+ check ("trunc(-4294967296.625) = -4294967296",
+ FUNC(trunc) (-4294967296.625L), -4294967296.0L);
+
+ check_isinfp ("trunc(+inf) = +inf", FUNC(trunc) (plus_infty));
+ check_isinfn ("trunc(-inf) = -inf", FUNC(trunc) (minus_infty));
+ check_isnan ("trunc(NaN) = NaN", FUNC(trunc) (nan_value));
+}
+
+
+static void
+remquo_test (void)
+{
+ int quo;
+ MATHTYPE result;
+
+ result = FUNC(remquo) (1.625, 1.0, &quo);
+ check ("remquo(1.625, 1.0, &x) == -0.375", result, -0.375);
+ check ("remquo(1.625, 1.0, &x) puts 1 in x", quo, 1);
+
+ result = FUNC(remquo) (-1.625, 1.0, &quo);
+ check ("remquo(-1.625, 1.0, &x) == 0.375", result, 0.375);
+ check ("remquo(-1.625, 1.0, &x) puts 1 in x", quo, -1);
+
+ result = FUNC(remquo) (1.625, -1.0, &quo);
+ check ("remquo(1.125, -1.0, &x) == 0.125", result, 0.125);
+ check ("remquo(1.125, -1.0, &x) puts 1 in x", quo, -1);
+
+ result = FUNC(remquo) (-1.625, -1.0, &quo);
+ check ("remquo(-1.125, -1.0, &x) == 0.125", result, 0.125);
+ check ("remquo(-1.125, -1.0, &x) puts 1 in x", quo, 1);
+}
+
+
+static void
inverse_func_pair_test (const char *test_name,
mathfunc f1, mathfunc inverse,
MATHTYPE x, MATHTYPE epsilon)
@@ -1244,33 +1460,33 @@ inverse_func_pair_test (const char *test_name,
static void
inverse_functions (void)
{
- inverse_func_pair_test ("(asin(sin(x)) == x",
+ inverse_func_pair_test ("asin(sin(x)) == x",
FUNC(sin), FUNC(asin), 1.0, CHOOSE (0, 0, 1e-7L));
- inverse_func_pair_test ("(sin(asin(x)) == x",
+ inverse_func_pair_test ("sin(asin(x)) == x",
FUNC(asin), FUNC(sin), 1.0, 0.0);
- inverse_func_pair_test ("(acos(cos(x)) == x",
+ inverse_func_pair_test ("acos(cos(x)) == x",
FUNC(cos), FUNC(acos), 1.0, CHOOSE (0, 1e-15L, 0));
- inverse_func_pair_test ("(cos(acos(x)) == x",
+ inverse_func_pair_test ("cos(acos(x)) == x",
FUNC(acos), FUNC(cos), 1.0, 0.0);
- inverse_func_pair_test ("(atan(tan(x)) == x",
+ inverse_func_pair_test ("atan(tan(x)) == x",
FUNC(tan), FUNC(atan), 1.0, 0.0);
- inverse_func_pair_test ("(tan(atan(x)) == x",
+ inverse_func_pair_test ("tan(atan(x)) == x",
FUNC(atan), FUNC(tan), 1.0, CHOOSE (0, 1e-15L, 0));
- inverse_func_pair_test ("(asinh(sinh(x)) == x",
+ inverse_func_pair_test ("asinh(sinh(x)) == x",
FUNC(sinh), FUNC(asinh), 1.0, CHOOSE (1e-18L, 0, 0));
- inverse_func_pair_test ("(sinh(asinh(x)) == x",
+ inverse_func_pair_test ("sinh(asinh(x)) == x",
FUNC(asinh), FUNC(sinh), 1.0, 0.0);
- inverse_func_pair_test ("(acosh(cosh(x)) == x",
+ inverse_func_pair_test ("acosh(cosh(x)) == x",
FUNC(cosh), FUNC(acosh), 1.0, CHOOSE (1e-18L, 1e-15L, 0));
- inverse_func_pair_test ("(cosh(acosh(x)) == x",
+ inverse_func_pair_test ("cosh(acosh(x)) == x",
FUNC(acosh), FUNC(cosh), 1.0, 0.0);
- inverse_func_pair_test ("(atanh(tanh(x)) == x",
+ inverse_func_pair_test ("atanh(tanh(x)) == x",
FUNC(tanh), FUNC(atanh), 1.0, CHOOSE (0, 1e-15L, 0));
- inverse_func_pair_test ("(tanh(atanh(x)) == x",
+ inverse_func_pair_test ("tanh(atanh(x)) == x",
FUNC(atanh), FUNC(tanh), 1.0, 0.0);
}
@@ -1401,6 +1617,15 @@ basic_tests (void)
check_bool ("!isinf (-NAN)", !(isinf (-NAN)));
check_bool ("NAN != NAN", NAN != NAN);
+ /*
+ And again with the value returned by the `nan' function.
+ */
+ check_bool ("isnan (NAN)", isnan (FUNC(nan) ("")));
+ check_bool ("isnan (-NAN)", isnan (-FUNC(nan) ("")));
+ check_bool ("!isinf (NAN)", !(isinf (FUNC(nan) (""))));
+ check_bool ("!isinf (-NAN)", !(isinf (-FUNC(nan) (""))));
+ check_bool ("NAN != NAN", FUNC(nan) ("") != FUNC(nan) (""));
+
/* test if EPSILON is ok */
x1 = MATHCONST (1.0);
x2 = x1 + CHOOSE (LDBL_EPSILON, DBL_EPSILON, FLT_EPSILON);
@@ -1520,6 +1745,16 @@ main (int argc, char *argv[])
fpclassify_test ();
hypot_test ();
pow_test ();
+ fdim_test ();
+ fmin_test ();
+ fmax_test ();
+ nextafter_test ();
+ copysign_test ();
+ trunc_test ();
+#if 0
+ /* XXX I'm not sure what is the correct result. */
+ remquo_test ();
+#endif
identities ();
inverse_functions ();
diff --git a/sysdeps/generic/dl-sysdep.c b/sysdeps/generic/dl-sysdep.c
index 9408e61dbf..e9fbcdf4bc 100644
--- a/sysdeps/generic/dl-sysdep.c
+++ b/sysdeps/generic/dl-sysdep.c
@@ -154,7 +154,7 @@ _dl_sysdep_read_whole_file (const char *file, size_t *sizep, int prot)
int fd = __open (file, O_RDONLY);
if (fd < 0)
return NULL;
- if (__fstat (fd, &st) < 0)
+ if (__fxstat (_STAT_VER, fd, &st) < 0)
result = NULL;
else
{
diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h
index 40623e795c..8e6df12d6b 100644
--- a/sysdeps/i386/dl-machine.h
+++ b/sysdeps/i386/dl-machine.h
@@ -218,7 +218,14 @@ _dl_start_user:\n\
/* Nonzero iff TYPE describes relocation of a PLT entry, so
PLT entries should not be allowed to define the value. */
-#define elf_machine_pltrel_p(type) ((type) == R_386_JMP_SLOT)
+#define elf_machine_lookup_noexec_p(type) ((type) == R_386_COPY)
+
+/* Nonzero iff TYPE describes relocation of a PLT entry, so
+ PLT entries should not be allowed to define the value. */
+#define elf_machine_lookup_noplt_p(type) ((type) == R_386_JMP_SLOT)
+
+/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. */
+#define ELF_MACHINE_RELOC_NOPLT R_386_JMP_SLOT
/* The i386 never uses Elf32_Rela relocations. */
#define ELF_MACHINE_NO_RELA 1
@@ -235,62 +242,63 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
const Elf32_Sym *sym, const struct r_found_version *version)
{
Elf32_Addr *const reloc_addr = (void *) (map->l_addr + reloc->r_offset);
- Elf32_Addr loadbase;
- switch (ELF32_R_TYPE (reloc->r_info))
+ if (ELF32_R_TYPE (reloc->r_info) == R_386_RELATIVE)
{
- case R_386_COPY:
- loadbase = RESOLVE (&sym, version, DL_LOOKUP_NOEXEC);
- memcpy (reloc_addr, (void *) (loadbase + sym->st_value), sym->st_size);
- break;
- case R_386_GLOB_DAT:
- loadbase = RESOLVE (&sym, version, 0);
- *reloc_addr = sym ? (loadbase + sym->st_value) : 0;
- break;
- case R_386_JMP_SLOT:
- loadbase = RESOLVE (&sym, version, DL_LOOKUP_NOPLT);
- *reloc_addr = sym ? (loadbase + sym->st_value) : 0;
- break;
- case R_386_32:
- {
- Elf32_Addr undo = 0;
-#ifndef RTLD_BOOTSTRAP
- /* This is defined in rtld.c, but nowhere in the static libc.a;
- make the reference weak so static programs can still link. This
- declaration cannot be done when compiling rtld.c (i.e. #ifdef
- RTLD_BOOTSTRAP) because rtld.c contains the common defn for
- _dl_rtld_map, which is incompatible with a weak decl in the same
- file. */
- weak_extern (_dl_rtld_map);
- if (map == &_dl_rtld_map)
- /* Undo the relocation done here during bootstrapping. Now we will
- relocate it anew, possibly using a binding found in the user
- program or a loaded library rather than the dynamic linker's
- built-in definitions used while loading those libraries. */
- undo = map->l_addr + sym->st_value;
-#endif
- loadbase = RESOLVE (&sym, version, 0);
- *reloc_addr += (sym ? (loadbase + sym->st_value) : 0) - undo;
- break;
- }
- case R_386_RELATIVE:
#ifndef RTLD_BOOTSTRAP
if (map != &_dl_rtld_map) /* Already done in rtld itself. */
#endif
*reloc_addr += map->l_addr;
- break;
- case R_386_PC32:
- loadbase = RESOLVE (&sym, version, 0);
- *reloc_addr += ((sym ? (loadbase + sym->st_value) : 0) -
- (Elf32_Addr) reloc_addr);
- break;
- case R_386_NONE: /* Alright, Wilbur. */
- break;
- default:
- assert (! "unexpected dynamic reloc type");
- break;
}
-
+ else
+ {
+#ifndef RTLD_BOOTSTRAP
+ const Elf32_Sym *const refsym = sym;
+#endif
+ Elf32_Addr value = RESOLVE (&sym, version, ELF32_R_TYPE (reloc->r_info));
+ if (sym)
+ value += sym->st_value;
+
+ switch (ELF32_R_TYPE (reloc->r_info))
+ {
+ case R_386_COPY:
+ memcpy (reloc_addr, (void *) value, sym->st_size);
+ break;
+ case R_386_GLOB_DAT:
+ case R_386_JMP_SLOT:
+ *reloc_addr = value;
+ break;
+ case R_386_32:
+ {
+#ifndef RTLD_BOOTSTRAP
+ /* This is defined in rtld.c, but nowhere in the static
+ libc.a; make the reference weak so static programs can
+ still link. This declaration cannot be done when
+ compiling rtld.c (i.e. #ifdef RTLD_BOOTSTRAP) because
+ rtld.c contains the common defn for _dl_rtld_map, which
+ is incompatible with a weak decl in the same file. */
+ weak_extern (_dl_rtld_map);
+ if (map == &_dl_rtld_map)
+ /* Undo the relocation done here during bootstrapping.
+ Now we will relocate it anew, possibly using a
+ binding found in the user program or a loaded library
+ rather than the dynamic linker's built-in definitions
+ used while loading those libraries. */
+ value -= map->l_addr + refsym->st_value;
+#endif
+ *reloc_addr += value;
+ break;
+ }
+ case R_386_PC32:
+ *reloc_addr += (value - (Elf32_Addr) reloc_addr);
+ break;
+ case R_386_NONE: /* Alright, Wilbur. */
+ break;
+ default:
+ assert (! "unexpected dynamic reloc type");
+ break;
+ }
+ }
}
static inline void
diff --git a/sysdeps/libm-i387/s_nextafterl.c b/sysdeps/libm-i387/s_nextafterl.c
index b574430832..4596c6b93c 100644
--- a/sysdeps/libm-i387/s_nextafterl.c
+++ b/sysdeps/libm-i387/s_nextafterl.c
@@ -49,7 +49,7 @@ static char rcsid[] = "$NetBSD: $";
if(((ix==0x7fff)&&(((hx|lx)|-(hx|lx))&hx)>>31!=0) || /* x is nan */
((iy==0x7fff)&&(((hy|ly)|-(hy|ly))&hy)>>31!=0)) /* y is nan */
return x+y;
- if(x==y) return x; /* x=y, return x */
+ if(x==y) return y; /* x=y, return y */
if((ix|hx|lx)==0) { /* x == 0 */
SET_LDOUBLE_WORDS(x,esx&0x8000,0,1);/* return +-minsubnormal */
y = x*x;
diff --git a/sysdeps/libm-i387/s_remquo.S b/sysdeps/libm-i387/s_remquo.S
new file mode 100644
index 0000000000..a4c5a35468
--- /dev/null
+++ b/sysdeps/libm-i387/s_remquo.S
@@ -0,0 +1,31 @@
+/*
+ * Written by Ulrich Drepper <drepper@cygnus.com>.
+ * Based on e_remainder by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+ENTRY(__remquo)
+ fldl 12(%esp)
+ fldl 4(%esp)
+1: fprem1
+ fstsw %ax
+ sahf
+ jp 1b
+ fstpl %st(1)
+ /* Compute the congruent of the quotient. */
+ movl %eax, %ecx
+ shrl $8, %eax
+ shrl $12, %ecx
+ andl $4, %ecx
+ andl $3, %eax
+ orl %eax, %ecx
+ movl $0xef2960, %eax
+ shrl %cl, %eax
+ andl $3, %eax
+ movl 20(%esp), %ecx
+ movl %eax, (%ecx)
+ ret
+END (__remquo)
+weak_alias (__remquo, remquo)
diff --git a/sysdeps/libm-i387/s_remquof.S b/sysdeps/libm-i387/s_remquof.S
new file mode 100644
index 0000000000..56954323a6
--- /dev/null
+++ b/sysdeps/libm-i387/s_remquof.S
@@ -0,0 +1,31 @@
+/*
+ * Written by Ulrich Drepper <drepper@cygnus.com>.
+ * Based on e_remainder by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+ENTRY(__remquof)
+ flds 8(%esp)
+ flds 4(%esp)
+1: fprem1
+ fstsw %ax
+ sahf
+ jp 1b
+ fstpl %st(1)
+ /* Compute the congruent of the quotient. */
+ movl %eax, %ecx
+ shrl $8, %eax
+ shrl $12, %ecx
+ andl $4, %ecx
+ andl $3, %eax
+ orl %eax, %ecx
+ movl $0xef2960, %eax
+ shrl %cl, %eax
+ andl $3, %eax
+ movl 12(%esp), %ecx
+ movl %eax, (%ecx)
+ ret
+END (__remquof)
+weak_alias (__remquof, remquof)
diff --git a/sysdeps/libm-i387/s_remquol.S b/sysdeps/libm-i387/s_remquol.S
new file mode 100644
index 0000000000..9c91d90c45
--- /dev/null
+++ b/sysdeps/libm-i387/s_remquol.S
@@ -0,0 +1,31 @@
+/*
+ * Written by Ulrich Drepper <drepper@cygnus.com>.
+ * Based on e_remainder by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+ENTRY(__remquol)
+ fldt 16(%esp)
+ fldt 4(%esp)
+1: fprem1
+ fstsw %ax
+ sahf
+ jp 1b
+ fstpl %st(1)
+ /* Compute the congruent of the quotient. */
+ movl %eax, %ecx
+ shrl $8, %eax
+ shrl $12, %ecx
+ andl $4, %ecx
+ andl $3, %eax
+ orl %eax, %ecx
+ movl $0xef2960, %eax
+ shrl %cl, %eax
+ andl $3, %eax
+ movl 28(%esp), %ecx
+ movl %eax, (%ecx)
+ ret
+END (__remquol)
+weak_alias (__remquol, remquol)
diff --git a/sysdeps/libm-ieee754/s_nan.c b/sysdeps/libm-ieee754/s_nan.c
new file mode 100644
index 0000000000..58551c1ad5
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_nan.c
@@ -0,0 +1,47 @@
+/* Return quiet nan.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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. */
+
+/* XXX The ISO C 9X standard mentions a `n-char-sequence' which is provided
+ as the argument to this function but I have no clue what this means.
+ Perhaps it is a description of the bits set in the mantissa. */
+#include <math.h>
+#ifdef HANDLE_TAGP
+# include <stdlib.h>
+# include <string.h>
+#else
+# include <ieee754.h>
+#endif
+
+
+double
+nan (const char *tagp)
+{
+#ifdef HANDLE_TAGP
+ /* If we ever should have use of the TAGP parameter we will use the
+ strtod function to analyze it. */
+ char buf[6 + strlen (tagp)];
+ sprintf (buf, "NAN(%s)", tagp);
+ return strtod (buf, NULL);
+#else
+ static const union ieee754_double nan_value =
+ { ieee: { mantissa1: 0x1, mantissa0: 0x0, exponent: 0x7ff, negative: 0 } };
+ return nan_value.d;
+#endif
+}
diff --git a/sysdeps/libm-ieee754/s_nanf.c b/sysdeps/libm-ieee754/s_nanf.c
new file mode 100644
index 0000000000..e965b94b33
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_nanf.c
@@ -0,0 +1,47 @@
+/* Return quiet nan.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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. */
+
+/* XXX The ISO C 9X standard mentions a `n-char-sequence' which is provided
+ as the argument to this function but I have no clue what this means.
+ Perhaps it is a description of the bits set in the mantissa. */
+#include <math.h>
+#ifdef HANDLE_TAGP
+# include <stdlib.h>
+# include <string.h>
+#else
+# include <ieee754.h>
+#endif
+
+
+float
+nanf (const char *tagp)
+{
+#ifdef HANDLE_TAGP
+ /* If we ever should have use of the TAGP parameter we will use the
+ strtod function to analyze it. */
+ char buf[6 + strlen (tagp)];
+ sprintf (buf, "NAN(%s)", tagp);
+ return strtof (buf, NULL);
+#else
+ static const union ieee754_float nan_value =
+ { ieee: { mantissa: 0x1, exponent: 0xff, negative: 0 } };
+ return nan_value.f;
+#endif
+}
diff --git a/sysdeps/libm-ieee754/s_nanl.c b/sysdeps/libm-ieee754/s_nanl.c
new file mode 100644
index 0000000000..df0180ee46
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_nanl.c
@@ -0,0 +1,48 @@
+/* Return quiet nan.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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. */
+
+/* XXX The ISO C 9X standard mentions a `n-char-sequence' which is provided
+ as the argument to this function but I have no clue what this means.
+ Perhaps it is a description of the bits set in the mantissa. */
+#include <math.h>
+#ifdef HANDLE_TAGP
+# include <stdlib.h>
+# include <string.h>
+#else
+# include <ieee754.h>
+#endif
+
+
+long double
+nanl (const char *tagp)
+{
+#ifdef HANDLE_TAGP
+ /* If we ever should have use of the TAGP parameter we will use the
+ strtod function to analyze it. */
+ char buf[6 + strlen (tagp)];
+ sprintf (buf, "NAN(%s)", tagp);
+ return strtold (buf, NULL);
+#else
+ static const union ieee854_long_double nan_value =
+ { ieee: { mantissa1: 0x1, mantissa0: 0x80000000,
+ exponent: 0x7fff, negative: 0 } };
+ return nan_value.d;
+#endif
+}
diff --git a/sysdeps/libm-ieee754/s_nextafter.c b/sysdeps/libm-ieee754/s_nextafter.c
index ee973bcee8..b98a161cf2 100644
--- a/sysdeps/libm-ieee754/s_nextafter.c
+++ b/sysdeps/libm-ieee754/s_nextafter.c
@@ -42,7 +42,7 @@ static char rcsid[] = "$NetBSD: s_nextafter.c,v 1.8 1995/05/10 20:47:58 jtc Exp
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(x==y) return y; /* x=y, return y */
if((ix|lx)==0) { /* x == 0 */
INSERT_WORDS(x,hy&0x80000000,1); /* return +-minsubnormal */
y = x*x;
diff --git a/sysdeps/libm-ieee754/s_nextafterf.c b/sysdeps/libm-ieee754/s_nextafterf.c
index bc8d04260f..611742bdf4 100644
--- a/sysdeps/libm-ieee754/s_nextafterf.c
+++ b/sysdeps/libm-ieee754/s_nextafterf.c
@@ -8,7 +8,7 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
@@ -34,15 +34,15 @@ static char rcsid[] = "$NetBSD: s_nextafterf.c,v 1.4 1995/05/10 20:48:01 jtc Exp
ix = hx&0x7fffffff; /* |x| */
iy = hy&0x7fffffff; /* |y| */
- if((ix>0x7f800000) || /* x is nan */
- (iy>0x7f800000)) /* y is nan */
- return x+y;
- if(x==y) return x; /* x=y, return x */
+ if((ix>0x7f800000) || /* x is nan */
+ (iy>0x7f800000)) /* y is nan */
+ return x+y;
+ if(x==y) return y; /* x=y, return y */
if(ix==0) { /* x == 0 */
SET_FLOAT_WORD(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) { /* x > y, x -= ulp */
hx -= 1;
diff --git a/sysdeps/libm-ieee754/s_nextafterl.c b/sysdeps/libm-ieee754/s_nextafterl.c
index 0327261f33..1d3fc86c44 100644
--- a/sysdeps/libm-ieee754/s_nextafterl.c
+++ b/sysdeps/libm-ieee754/s_nextafterl.c
@@ -46,7 +46,7 @@ static char rcsid[] = "$NetBSD: $";
if(((ix==0x7fff)&&((hx|lx)|-(hx|lx))!=0) || /* x is nan */
((iy==0x7fff)&&((hy|ly)|-(hy|ly))!=0)) /* y is nan */
return x+y;
- if(x==y) return x; /* x=y, return x */
+ if(x==y) return y; /* x=y, return y */
if((ix|hx|lx)==0) { /* x == 0 */
SET_LDOUBLE_WORDS(x,esx&0x8000,0,1);/* return +-minsubnormal */
y = x*x;
diff --git a/sysdeps/libm-ieee754/s_remquo.c b/sysdeps/libm-ieee754/s_remquo.c
new file mode 100644
index 0000000000..5a96f75f3b
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_remquo.c
@@ -0,0 +1,106 @@
+/* Compute remainder and a congruent to the quotient.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <math.h>
+
+#include "math_private.h"
+
+
+static const double zero = 0.0;
+
+
+double
+__remquo (double x, double y, int *quo)
+{
+ int32_t hx,hp;
+ u_int32_t sx,lx,lp;
+ int cquo;
+
+ EXTRACT_WORDS (hx, lx, x);
+ EXTRACT_WORDS (hp, lp, p);
+ sx = hx & 0x80000000;
+ qs = (sx ^ (hp & 0x80000000)) >> 31;
+ hp &= 0x7fffffff;
+ hx &= 0x7fffffff;
+
+ /* Purge off exception values. */
+ if ((hp | lp) == 0)
+ return (x * p) / (x * p); /* p = 0 */
+ if ((hx >= 0x7ff00000) /* x not finite */
+ || ((hp >= 0x7ff00000) /* p is NaN */
+ && (((hp - 0x7ff00000) | lp) != 0)))
+ return (x * p) / (x * p);
+
+ if (hp <= 0x7fbfffff)
+ {
+ x = __ieee754_fmod (x, 8 * p); /* now x < 8p */
+
+ if (fabs (x) >= 4 * fabs (p))
+ cquo += 4;
+ }
+
+ if (((hx - hp) | (lx - lp)) == 0)
+ {
+ *quo = qs ? -1 : 1;
+ return zero * x;
+ }
+
+ x = fabs (x);
+ p = fabs (p);
+ cquo = 0;
+
+ if (x >= 2 * p)
+ {
+ x -= 4 * p;
+ cquo += 2;
+ }
+ if (x >= p)
+ {
+ x -= 2 * p;
+ ++cquo;
+ }
+
+ if (hp < 0x00200000)
+ {
+ if (x + x > p)
+ {
+ x -= p;
+ if (x + x >= p)
+ x -= p;
+ }
+ }
+ else
+ {
+ double p_half = 0.5 * p;
+ if(x > p_half)
+ {
+ x -= p;
+ if (x >= p_half)
+ x -= p;
+ }
+ }
+
+ *quo = qs ? -cquo : cquo;
+
+ GET_HIGH_WORD (hx, x);
+ SET_HIGH_WORD (x, hx ^ sx);
+ return x;
+}
+weak_alias (__remquo, remquo)
diff --git a/sysdeps/libm-ieee754/s_remquof.c b/sysdeps/libm-ieee754/s_remquof.c
new file mode 100644
index 0000000000..cce5495ce8
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_remquof.c
@@ -0,0 +1,105 @@
+/* Compute remainder and a congruent to the quotient.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <math.h>
+
+#include "math_private.h"
+
+
+static const float zero = 0.0;
+
+
+float
+__remquof (float x, float y, int *quo)
+{
+ int32_t hx,hp;
+ u_int32_t sx;
+ int cquo;
+
+ GET_FLOAT_WORD (hx, x);
+ GET_FLOAT_WORD (hp, p);
+ sx = hx & 0x80000000;
+ qs = (sx ^ (hp & 0x80000000)) >> 31;
+ hp &= 0x7fffffff;
+ hx &= 0x7fffffff;
+
+ /* Purge off exception values. */
+ if (hp == 0)
+ return (x * p) / (x * p); /* p = 0 */
+ if ((hx >= 0x7f800000) /* x not finite */
+ || (hp > 0x7f800000)) /* p is NaN */
+ return (x * p) / (x * p);
+
+ if (hp <= 0x7dffffff)
+ {
+ x = __ieee754_fmodf (x, 8 * p); /* now x < 8p */
+
+ if (fabs (x) >= 4 * fabs (p))
+ cquo += 4;
+ }
+
+ if ((hx - hp) == 0)
+ {
+ *quo = qs ? -1 : 1;
+ return zero * x;
+ }
+
+ x = fabsf (x);
+ p = fabsf (p);
+ cquo = 0;
+
+ if (x >= 2 * p)
+ {
+ x -= 4 * p;
+ cquo += 2;
+ }
+ if (x >= p)
+ {
+ x -= 2 * p;
+ ++cquo;
+ }
+
+ if (hp < 0x01000000)
+ {
+ if (x + x > p)
+ {
+ x -= p;
+ if (x + x >= p)
+ x -= p;
+ }
+ }
+ else
+ {
+ float p_half = 0.5 * p;
+ if(x > p_half)
+ {
+ x -= p;
+ if (x >= p_half)
+ x -= p;
+ }
+ }
+
+ *quo = qs ? -cquo : cquo;
+
+ GET_FLOAT_WORD (hx, x);
+ SET_FLOAT_WORD (x, hx ^ sx);
+ return x;
+}
+weak_alias (__remquof, remquof)
diff --git a/sysdeps/libm-ieee754/s_remquol.c b/sysdeps/libm-ieee754/s_remquol.c
new file mode 100644
index 0000000000..9515b218c6
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_remquol.c
@@ -0,0 +1,106 @@
+/* Compute remainder and a congruent to the quotient.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <math.h>
+
+#include "math_private.h"
+
+
+static const double zero = 0.0;
+
+
+long double
+__remquol (long double x, long double y, int *quo)
+{
+ int32_t ex,ep,hx,hp;
+ u_int32_t sx,lx,lp;
+ int cquo;
+
+ GET_LDOUBLE_WORDS (ex, hx, lx, x);
+ GET_LDOUBLE_WORDS (ep, hp, lp, p);
+ sx = ex & 0x8000;
+ qs = (sx ^ (ep & 0x8000)) >> 15;
+ ep &= 0x7fff;
+ ex &= 0x7fff;
+
+ /* Purge off exception values. */
+ if ((ep | hp | lp) == 0)
+ return (x * p) / (x * p); /* p = 0 */
+ if ((ex == 0x7fff) /* x not finite */
+ || ((ep == 0x7fff) /* p is NaN */
+ && ((hp | lp) != 0)))
+ return (x * p) / (x * p);
+
+ if (ep <= 0x7ffb)
+ {
+ x = __ieee754_fmodl (x, 8 * p); /* now x < 8p */
+
+ if (fabsl (x) >= 4 * fabsl (p))
+ cquo += 4;
+ }
+
+ if (((ex - ep) | (hx - hp) | (lx - lp)) == 0)
+ {
+ *quo = qs ? -1 : 1;
+ return zero * x;
+ }
+
+ x = fabsl (x);
+ p = fabsl (p);
+ cquo = 0;
+
+ if (x >= 2 * p)
+ {
+ x -= 4 * p;
+ cquo += 2;
+ }
+ if (x >= p)
+ {
+ x -= 2 * p;
+ ++cquo;
+ }
+
+ if (ep < 0x0002)
+ {
+ if (x + x > p)
+ {
+ x -= p;
+ if (x + x >= p)
+ x -= p;
+ }
+ }
+ else
+ {
+ long double p_half = 0.5 * p;
+ if(x > p_half)
+ {
+ x -= p;
+ if (x >= p_half)
+ x -= p;
+ }
+ }
+
+ *quo = qs ? -cquo : cquo;
+
+ GET_LDOUBLE_EXP (ex, x);
+ SET_LDOUBLE_EXP (x, ex ^ sx);
+ return x;
+}
+weak_alias (__remquol, remquol)
diff --git a/sysdeps/libm-ieee754/s_rintl.c b/sysdeps/libm-ieee754/s_rintl.c
index c9f12b162a..5b4b647880 100644
--- a/sysdeps/libm-ieee754/s_rintl.c
+++ b/sysdeps/libm-ieee754/s_rintl.c
@@ -54,7 +54,7 @@ TWO64[2]={
GET_LDOUBLE_WORDS(se,i0,i1,x);
sx = (se>>15)&1;
j0 = (se&0x7fff)-0x3fff;
- if(j0<32) {
+ if(j0<31) {
if(j0<0) {
if(((se&0x7fff)|i0|i1)==0) return x;
i1 |= i0;
@@ -67,7 +67,7 @@ TWO64[2]={
SET_LDOUBLE_EXP(t,(i0&0x7fff)|(sx<<15));
return t;
} else {
- i = (0xffffffff)>>j0;
+ i = (0x7fffffff)>>j0;
if(((i0&i)|i1)==0) return x; /* x is integral */
i>>=1;
if(((i0&i)|i1)!=0) {
diff --git a/sysdeps/libm-ieee754/s_trunc.c b/sysdeps/libm-ieee754/s_trunc.c
new file mode 100644
index 0000000000..721dce5a55
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_trunc.c
@@ -0,0 +1,61 @@
+/* Truncate argument to nearest integral value not larger than the argument.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <math.h>
+
+#include "math_private.h"
+
+
+double
+__trunc (double x)
+{
+ int32_t i0, j0;
+ u_int32_t i1;
+ int sx;
+
+ EXTRACT_WORDS (i0, i1, x);
+ sx = i0 & 0x80000000;
+ j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
+ if (j0 < 20)
+ {
+ if (j0 < 0)
+ /* The magnitude of the number is < 1 so the result is +-0. */
+ INSERT_WORDS (x, sx, 0);
+ else
+ INSERT_WORDS (x, sx | i0 & ~(0x000fffff >> j0), 0);
+ }
+ else if (j0 > 51)
+ {
+ if (j0 == 0x400)
+ /* x is inf or NaN. */
+ return x + x;
+ }
+ else
+ {
+ INSERT_WORDS (x, i0, i1 & ~(0xffffffffu >> (j0 - 20)));
+ }
+
+ return x;
+}
+weak_alias (__trunc, trunc)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__trunc, __truncl)
+weak_alias (__trunc, truncl)
+#endif
diff --git a/sysdeps/libm-ieee754/s_truncf.c b/sysdeps/libm-ieee754/s_truncf.c
new file mode 100644
index 0000000000..3e7b133c37
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_truncf.c
@@ -0,0 +1,52 @@
+/* Truncate argument to nearest integral value not larger than the argument.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <math.h>
+
+#include "math_private.h"
+
+
+float
+__truncf (float x)
+{
+ int32_t i0, j0;
+ int sx;
+
+ GET_FLOAT_WORD (i0, x);
+ sx = i0 & 0x80000000;
+ j0 = ((i0 >> 23) & 0xff) - 0x7f;
+ if (j0 < 23)
+ {
+ if (j0 < 0)
+ /* The magnitude of the number is < 1 so the result is +-0. */
+ SET_FLOAT_WORD (x, sx);
+ else
+ SET_FLOAT_WORD (x, sx | i0 & ~(0x007fffff >> j0));
+ }
+ else
+ {
+ if (j0 == 0x80)
+ /* x is inf or NaN. */
+ return x + x;
+ }
+
+ return x;
+}
+weak_alias (__truncf, truncf)
diff --git a/sysdeps/libm-ieee754/s_truncl.c b/sysdeps/libm-ieee754/s_truncl.c
new file mode 100644
index 0000000000..206eab2f22
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_truncl.c
@@ -0,0 +1,57 @@
+/* Truncate argument to nearest integral value not larger than the argument.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 <math.h>
+
+#include "math_private.h"
+
+
+long double
+__truncl (long double x)
+{
+ int32_t i0, j0;
+ u_int32_t se, i1;
+ int sx;
+
+ GET_LDOUBLE_WORDS (se, i0, i1, x);
+ sx = se & 0x8000;
+ j0 = se & 0x7fff;
+ if (j0 < 31)
+ {
+ if (j0 < 0)
+ /* The magnitude of the number is < 1 so the result is +-0. */
+ SET_LDOUBLE_WORDS (x, sx, 0, 0);
+ else
+ SET_LDOUBLE_WORDS (x, se, i0 & ~(0x7fffffff >> j0), 0);
+ }
+ else if (j0 > 63)
+ {
+ if (j0 == 0x4000)
+ /* x is inf or NaN. */
+ return x + x;
+ }
+ else
+ {
+ SET_LDOUBLE_WORDS (x, se, i0, i1 & ~(0xffffffffu >> (j0 - 31)));
+ }
+
+ return x;
+}
+weak_alias (__truncl, truncl)
diff --git a/sysdeps/sparc/dl-machine.h b/sysdeps/sparc/dl-machine.h
index e87f1970e7..880542d2b3 100644
--- a/sysdeps/sparc/dl-machine.h
+++ b/sysdeps/sparc/dl-machine.h
@@ -104,93 +104,66 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
Elf32_Addr *const reloc_addr = (void *) (map->l_addr + reloc->r_offset);
Elf32_Addr loadbase;
- switch (ELF32_R_TYPE (reloc->r_info))
+ if (ELF32_R_TYPE (reloc->r_info) == R_SPARC_RELATIVE)
+ *reloc_addr += map->l_addr + reloc->r_addend;
+ else
{
- case R_SPARC_COPY:
- loadbase = RESOLVE (&sym, version, DL_LOOKUP_NOEXEC);
- memcpy (reloc_addr, (void *) (loadbase + sym->st_value), sym->st_size);
- break;
- case R_SPARC_GLOB_DAT:
- case R_SPARC_32:
- loadbase = RESOLVE (&sym, version, 0);
- *reloc_addr = ((sym ? (loadbase + sym->st_value) : 0)
- + reloc->r_addend);
- break;
- case R_SPARC_JMP_SLOT:
- loadbase = RESOLVE (&sym, version, DL_LOOKUP_NOPLT);
- {
- Elf32_Addr value = ((sym ? (loadbase + sym->st_value) : 0)
- + reloc->r_addend);
- reloc_addr[1] = OPCODE_SETHI_G1 | (value >> 10);
- reloc_addr[2] = OPCODE_JMP_G1 | (value & 0x3ff);
- }
- break;
- case R_SPARC_8:
- loadbase = RESOLVE (&sym, version, 0);
- *(char *) reloc_addr = ((sym ? (loadbase + sym->st_value) : 0)
- + reloc->r_addend);
- break;
- case R_SPARC_16:
- loadbase = RESOLVE (&sym, version, 0);
- *(short *) reloc_addr = ((sym ? (loadbase + sym->st_value) : 0)
- + reloc->r_addend);
- break;
- case R_SPARC_RELATIVE:
- *reloc_addr += map->l_addr + reloc->r_addend;
- break;
- case R_SPARC_DISP8:
- loadbase = RESOLVE (&sym, version, 0);
- *(char *) reloc_addr = ((sym ? (loadbase + sym->st_value) : 0)
- + reloc->r_addend
- - (Elf32_Addr) reloc_addr);
- break;
- case R_SPARC_DISP16:
- loadbase = RESOLVE (&sym, version, 0);
- *(short *) reloc_addr = ((sym ? (loadbase + sym->st_value) : 0)
- + reloc->r_addend
- - (Elf32_Addr) reloc_addr);
- break;
- case R_SPARC_DISP32:
- loadbase = RESOLVE (&sym, version, 0);
- *reloc_addr = ((sym ? (loadbase + sym->st_value) : 0)
- + reloc->r_addend
- - (Elf32_Addr) reloc_addr);
- break;
- case R_SPARC_LO10:
+ Elf32_Addr value;
+ if (sym->st_shndx != SHN_UNDEF &&
+ ELF32_ST_BIND (sym->st_info) == STB_LOCAL)
+ value = map->l_addr;
+ else
{
- unsigned int saddr;
-
- loadbase = RESOLVE (&sym, version, 0);
- saddr = (loadbase ? loadbase : map->l_addr) + reloc->r_addend;
-
- *reloc_addr = (*reloc_addr & ~0x3ff) | (saddr & 0x3ff);
+ value = RESOLVE (&sym, version, ELF32_R_TYPE (reloc->r_info));
+ if (sym)
+ value += sym->st_value;
}
- break;
- case R_SPARC_WDISP30:
- {
- unsigned int saddr;
-
- loadbase = RESOLVE (&sym, version, 0);
- saddr = (loadbase ? loadbase : map->l_addr) + reloc->r_addend;
- *reloc_addr = ((*reloc_addr & 0xc0000000)
- | ((saddr - (unsigned int) reloc_addr)>>2));
- }
- break;
- case R_SPARC_HI22:
- {
- unsigned int saddr;
-
- loadbase = RESOLVE (&sym, version, 0);
- saddr = (loadbase ? loadbase : map->l_addr) + reloc->r_addend;
+ value += reloc->r_addend; /* Assume copy relocs have zero addend. */
- *reloc_addr = (*reloc_addr & 0xffc00000)|(saddr >> 10);
- }
- break;
- case R_SPARC_NONE: /* Alright, Wilbur. */
- break;
- default:
- assert (! "unexpected dynamic reloc type");
- break;
+ switch (ELF32_R_TYPE (reloc->r_info))
+ {
+ case R_SPARC_COPY:
+ memcpy (reloc_addr, (void *) value, sym->st_size);
+ break;
+ case R_SPARC_GLOB_DAT:
+ case R_SPARC_32:
+ *reloc_addr = value;
+ break;
+ case R_SPARC_JMP_SLOT:
+ reloc_addr[1] = OPCODE_SETHI_G1 | (value >> 10);
+ reloc_addr[2] = OPCODE_JMP_G1 | (value & 0x3ff);
+ break;
+ case R_SPARC_8:
+ *(char *) reloc_addr = value;
+ break;
+ case R_SPARC_16:
+ *(short *) reloc_addr = value;
+ break;
+ case R_SPARC_DISP8:
+ *(char *) reloc_addr = (value - (Elf32_Addr) reloc_addr);
+ break;
+ case R_SPARC_DISP16:
+ *(short *) reloc_addr = (value - (Elf32_Addr) reloc_addr);
+ break;
+ case R_SPARC_DISP32:
+ *reloc_addr = (value - (Elf32_Addr) reloc_addr);
+ break;
+ case R_SPARC_LO10:
+ *reloc_addr = (*reloc_addr & ~0x3ff) | (value & 0x3ff);
+ break;
+ case R_SPARC_WDISP30:
+ *reloc_addr = ((*reloc_addr & 0xc0000000)
+ | ((value - (unsigned int) reloc_addr) >> 2));
+ break;
+ case R_SPARC_HI22:
+ *reloc_addr = (*reloc_addr & 0xffc00000) | (value >> 10);
+ break;
+ case R_SPARC_NONE: /* Alright, Wilbur. */
+ break;
+ default:
+ assert (! "unexpected dynamic reloc type");
+ break;
+ }
}
}
@@ -213,7 +186,14 @@ elf_machine_lazy_rel (struct link_map *map, const Elf32_Rela *reloc)
/* Nonzero iff TYPE describes relocation of a PLT entry, so
PLT entries should not be allowed to define the value. */
-#define elf_machine_pltrel_p(type) ((type) == R_SPARC_JMP_SLOT)
+#define elf_machine_lookup_noexec_p(type) ((type) == R_SPARC_COPY)
+
+/* Nonzero iff TYPE describes relocation of a PLT entry, so
+ PLT entries should not be allowed to define the value. */
+#define elf_machine_lookup_noplt_p(type) ((type) == R_SPARC_JMP_SLOT)
+
+/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. */
+#define ELF_MACHINE_RELOC_NOPLT R_SPARC_JMP_SLOT
/* The SPARC never uses Elf32_Rel relocations. */
#define ELF_MACHINE_NO_REL 1
diff --git a/sysdeps/unix/sysv/linux/alpha/termbits.h b/sysdeps/unix/sysv/linux/alpha/termbits.h
index d0932c1cd7..743bb3d283 100644
--- a/sysdeps/unix/sysv/linux/alpha/termbits.h
+++ b/sysdeps/unix/sysv/linux/alpha/termbits.h
@@ -112,6 +112,10 @@ struct termios
#define VT1 00200000
#define XTABS 01000000 /* Hmm.. Linux/i386 considers this part of TABDLY.. */
+/* On Linux there is no OXTABS bit defined. Take it as an alias for
+ XTABS. */
+#define OXTABS XTABS
+
/* c_cflag bit meaning */
#define CBAUD 0000037
#define B0 0000000 /* hang up */
diff --git a/sysdeps/unix/sysv/linux/termbits.h b/sysdeps/unix/sysv/linux/termbits.h
index 8224ac5403..91ba78b950 100644
--- a/sysdeps/unix/sysv/linux/termbits.h
+++ b/sysdeps/unix/sysv/linux/termbits.h
@@ -105,6 +105,10 @@ struct termios
#define FF0 0000000
#define FF1 0100000
+/* On Linux there is no OXTABS bit defined. Take it as an alias for
+ XTABS. */
+#define OXTABS XTABS
+
/* c_cflag bit meaning */
#define CBAUD 0010017
#define B0 0000000 /* hang up */
diff --git a/termios/sys/ttydefaults.h b/termios/sys/ttydefaults.h
index a615b3d6c6..78c4b4f8a5 100644
--- a/termios/sys/ttydefaults.h
+++ b/termios/sys/ttydefaults.h
@@ -48,11 +48,7 @@
* Defaults on "first" open.
*/
#define TTYDEF_IFLAG (BRKINT | ISTRIP | ICRNL | IMAXBEL | IXON | IXANY)
-#ifdef OXTABS
#define TTYDEF_OFLAG (OPOST | ONLCR | OXTABS)
-#else
-#define TTYDEF_OFLAG (OPOST | ONLCR | XTABS)
-#endif
#define TTYDEF_LFLAG (ECHO | ICANON | ISIG | IEXTEN | ECHOE|ECHOKE|ECHOCTL)
#define TTYDEF_CFLAG (CREAD | CS7 | PARENB | HUPCL)
#define TTYDEF_SPEED (B9600)
diff --git a/time/sys/time.h b/time/sys/time.h
index 5519f716ca..c4745f1546 100644
--- a/time/sys/time.h
+++ b/time/sys/time.h
@@ -81,11 +81,14 @@ enum __itimer_which
{
/* Timers run in real time. */
ITIMER_REAL = 0,
+#define ITIMER_REAL ITIMER_REAL
/* Timers run only when the process is executing. */
ITIMER_VIRTUAL = 1,
+#define ITIMER_VIRTUAL ITIMER_VIRTUAL
/* Timers run when the process is executing and when
the system is executing on behalf of the process. */
ITIMER_PROF = 2
+#define ITIMER_PROF ITIMER_PROF
};
/* Type of the second argument to `getitimer' and