From aaca11d8a11e4c04c7a5ed1db0adaf4a4c192853 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 30 Sep 2000 22:03:51 +0000 Subject: [PATCH] Update. 2000-09-30 H.J. Lu * sysdeps/ieee754/ldbl-96/s_ceill.c (__ceill): Handle overflow. * sysdeps/ieee754/ldbl-96/s_floorl.c (__floorl): Likewise. 2000-09-29 H.J. Lu * math/libm-test.inc (init_max_error): Clear all exceptions before starting test. (acosh_test): Test for existence of function. (asinh_test): Likewise. (atan2_test): Likewise. (cabs_test): Likewise. (cacos_test): Likewise. (cacosh_test): Likewise. (casin_test): Likewise. (casinh_test): Likewise. (catan_test): Likewise. (catanh_test): Likewise. (ccos_test): Likewise. (ccosh_test): Likewise. (cexp_test): Likewise. (clog_test): Likewise. (clog10_test): Likewise. (cosh_test): Likewise. (cpow_test): Likewise. (csin_test): Likewise. (csinh_test): Likewise. (csqrt_test): Likewise. (ctan_test): Likewise. (ctanh_test): Likewise. (fmod_test): Likewise. (hypot_test): Likewise. (remainder_test): Likewise. (remquo_test): Likewise. (sincos_test): Likewise. (sinh_test): Likewise. (tanh_test): Likewise. 2000-09-29 H.J. Lu * sysdeps/ia64/ieee754.h: New file. * sysdeps/ia64/fpu/math_ldbl.h: New file. 2000-09-30 Jakub Jelinek * elf/ldconfig.h (FLAG_X8664_LIB64): Define. * sysdeps/unix/sysv/linux/i386/readelflib.c: New file. 2000-09-30 Ulrich Drepper * manual/charset.texi: Correct notations, reference to C90 amd 1, and some other details. * manual/ctype.texi: Likewise. Patches by Markus Kuhn . --- ChangeLog | 57 +++++++++ elf/ldconfig.h | 1 + manual/charset.texi | 136 +++++++++++--------- manual/ctype.texi | 4 +- math/libm-test.inc | 175 +++++++++++++++++++++++++ sysdeps/ia64/fpu/math_ldbl.h | 100 +++++++++++++++ sysdeps/ia64/ieee754.h | 205 ++++++++++++++++++++++++++++++ sysdeps/ieee754/ldbl-96/s_ceill.c | 9 +- sysdeps/ieee754/ldbl-96/s_floorl.c | 9 +- sysdeps/unix/sysv/linux/i386/readelflib.c | 81 ++++++++++++ 10 files changed, 710 insertions(+), 67 deletions(-) create mode 100644 sysdeps/ia64/fpu/math_ldbl.h create mode 100644 sysdeps/ia64/ieee754.h create mode 100644 sysdeps/unix/sysv/linux/i386/readelflib.c diff --git a/ChangeLog b/ChangeLog index 648136f..3db5114 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,60 @@ +2000-09-30 H.J. Lu + + * sysdeps/ieee754/ldbl-96/s_ceill.c (__ceill): Handle overflow. + * sysdeps/ieee754/ldbl-96/s_floorl.c (__floorl): Likewise. + +2000-09-29 H.J. Lu + + * math/libm-test.inc (init_max_error): Clear all exceptions + before starting test. + (acosh_test): Test for existence of function. + (asinh_test): Likewise. + (atan2_test): Likewise. + (cabs_test): Likewise. + (cacos_test): Likewise. + (cacosh_test): Likewise. + (casin_test): Likewise. + (casinh_test): Likewise. + (catan_test): Likewise. + (catanh_test): Likewise. + (ccos_test): Likewise. + (ccosh_test): Likewise. + (cexp_test): Likewise. + (clog_test): Likewise. + (clog10_test): Likewise. + (cosh_test): Likewise. + (cpow_test): Likewise. + (csin_test): Likewise. + (csinh_test): Likewise. + (csqrt_test): Likewise. + (ctan_test): Likewise. + (ctanh_test): Likewise. + (fmod_test): Likewise. + (hypot_test): Likewise. + (remainder_test): Likewise. + (remquo_test): Likewise. + (sincos_test): Likewise. + (sinh_test): Likewise. + (tanh_test): Likewise. + +2000-09-29 H.J. Lu + + * sysdeps/ia64/ieee754.h: New file. + + * sysdeps/ia64/fpu/math_ldbl.h: New file. + +2000-09-30 Jakub Jelinek + + * elf/ldconfig.h (FLAG_X8664_LIB64): Define. + * sysdeps/unix/sysv/linux/i386/readelflib.c: New file. + +2000-09-30 Ulrich Drepper + + * manual/charset.texi: Correct notations, reference to C90 amd 1, + and some other details. + * manual/ctype.texi: Likewise. + Patches by Markus Kuhn . + 2000-09-30 Franz Sirl * sysdeps/ieee754/flt-32/s_frexpf.c: Make it aliasing safe. diff --git a/elf/ldconfig.h b/elf/ldconfig.h index 76284f6..336b8e5 100644 --- a/elf/ldconfig.h +++ b/elf/ldconfig.h @@ -29,6 +29,7 @@ #define FLAG_REQUIRED_MASK 0xff00 #define FLAG_SPARC_LIB64 0x0100 #define FLAG_IA64_LIB64 0x0200 +#define FLAG_X8664_LIB64 0x0300 /* Declared in cache.c. */ extern void print_cache (const char *cache_name); diff --git a/manual/charset.texi b/manual/charset.texi index deae7af..89a54d8 100644 --- a/manual/charset.texi +++ b/manual/charset.texi @@ -15,7 +15,7 @@ limitations of this approach became more apparent as more people grappled with non-Roman character sets, where not all the characters that make up a language's character set can be represented by @math{2^8} choices. This chapter shows the functionality which was added to the C -library to correctly support multiple character sets. +library to support multiple character sets. @menu * Extended Char Intro:: Introduction to Extended Characters. @@ -46,13 +46,13 @@ through whatever communication channel. Examples of external representations include files lying in a directory that are going to be read and parsed. -Traditionally there was no difference between the two representations. -It was equally comfortable and useful to use the same one-byte +Traditionally there has been no difference between the two representations. +It was equally comfortable and useful to use the same single-byte representation internally and externally. This changes with more and larger character sets. One of the problems to overcome with the internal representation is -handling text which is externally encoded using different character +handling text that is externally encoded using different character sets. Assume a program which reads two texts and compares them using some metric. The comparison can be usefully done only if the texts are internally kept in a common format. @@ -69,14 +69,28 @@ than four bytes seem not to be necessary). As shown in some other part of this manual, @c !!! Ahem, wide char string functions are not yet covered -- drepper there exists a completely new family of functions which can handle texts -of this kind in memory. The most commonly used character set for such -internal wide character representations are Unicode and @w{ISO 10646}. -The former is a subset of the latter and used when wide characters are -chosen to by 2 bytes (@math{= 16} bits) wide. The standard names of the -@cindex UCS2 -@cindex UCS4 -encodings used in these cases are UCS2 (@math{= 16} bits) and UCS4 -(@math{= 32} bits). +of this kind in memory. The most commonly used character sets for such +internal wide character representations are Unicode and @w{ISO 10646} +(also known as UCS for Universal Character Set). Unicode was originally +planned as a 16-bit character set, whereas @w{ISO 10646} was designed to +be a 31-bit large code space. The two standards are practically identical. +They have the same character repertoire and code table, but Unicode specifies +added semantics. At the moment, only characters in the first @code{0x10000} +code positions (the so-called Basic Multilingual Plane, BMP) have been +assigned, but the assignment of more specialized characters outside this +16-bit space is already in progress. A number of encodings have been +defined for Unicode and @w{ISO 10646} characters: +@cindex UCS-2 +@cindex UCS-4 +@cindex UTF-8 +@cindex UTF-16 +UCS-2 is a 16-bit word that can only represent characters +from the BMP, UCS-4 is a 32-bit word than can represent any Unicode +and @w{ISO 10646} character, UTF-8 is an ASCII compatible encoding where +ASCII characters are represented by ASCII bytes and non-ASCII characters +by sequences of 2-6 non-ASCII bytes, and finally UTF-16 is an extension +of UCS-2 in which pairs of certain UCS-2 words can be used to encode +non-BMP characters up to @code{0x10ffff}. To represent wide characters the @code{char} type is not suitable. For this reason the @w{ISO C} standard introduces a new type which is @@ -93,18 +107,18 @@ for multibyte character strings. The type is defined in @file{stddef.h}. The @w{ISO C90} standard, where this type was introduced, does not say anything specific about the representation. It only requires that this -type is capable to store all elements of the basic character set. +type is capable of storing all elements of the basic character set. Therefore it would be legitimate to define @code{wchar_t} as @code{char}. This might make sense for embedded systems. But for GNU systems this type is always 32 bits wide. It is therefore -capable to represent all UCS4 value therefore covering all of @w{ISO -10646}. Some Unix systems define @code{wchar_t} as a 16 bit type and +capable of representing all UCS-4 values and therefore covering all of +@w{ISO 10646}. Some Unix systems define @code{wchar_t} as a 16-bit type and thereby follow Unicode very strictly. This is perfectly fine with the standard but it also means that to represent all characters from Unicode -and @w{ISO 10646} one has to use surrogate character which is in fact a -multi-wide-character encoding. But this contradicts the purpose of the -@code{wchar_t} type. +and @w{ISO 10646} one has to use UTF-16 surrogate characters which is in +fact a multi-wide-character encoding. But this contradicts the purpose +of the @code{wchar_t} type. @end deftp @comment wchar.h @@ -119,8 +133,8 @@ defined as @code{char} the type @code{wint_t} must be defined as @code{int} due to the parameter promotion. @pindex wchar.h -This type is defined in @file{wchar.h} and got introduced in the second -amendment to @w{ISO C90}. +This type is defined in @file{wchar.h} and got introduced in +@w{Amendment 1} to @w{ISO C90}. @end deftp As there are for the @code{char} data type there also exist macros @@ -133,7 +147,7 @@ type @code{wchar_t}. The macro @code{WCHAR_MIN} evaluates to the minimum value representable by an object of type @code{wint_t}. -This macro got introduced in the second amendment to @w{ISO C90}. +This macro got introduced in @w{Amendment 1} to @w{ISO C90}. @end deftypevr @comment wchar.h @@ -142,7 +156,7 @@ This macro got introduced in the second amendment to @w{ISO C90}. The macro @code{WCHAR_MIN} evaluates to the maximum value representable by an object of type @code{wint_t}. -This macro got introduced in the second amendment to @w{ISO C90}. +This macro got introduced in @w{Amendment 1} to @w{ISO C90}. @end deftypevr Another special wide character value is the equivalent to @code{EOF}. @@ -180,7 +194,7 @@ are used. @end smallexample @pindex wchar.h -This macro was introduced in the second amendment to @w{ISO C90} and is +This macro was introduced in @w{Amendment 1} to @w{ISO C90} and is defined in @file{wchar.h}. @end deftypevr @@ -198,7 +212,7 @@ oriented character set. @cindex multibyte character @cindex EBCDIC For all the above reasons, an external encoding which is different -from the internal encoding is often used if the latter is UCS2 or UCS4. +from the internal encoding is often used if the latter is UCS-2 or UCS-4. The external encoding is byte-based and can be chosen appropriately for the environment and for the texts to be handled. There exist a variety of different character sets which can be used for this external @@ -215,7 +229,7 @@ system calls have to be converted first anyhow. @itemize @bullet @item -The simplest character sets are one-byte character sets. There can be +The simplest character sets are single-byte character sets. There can be only up to 256 characters (for @w{8 bit} character sets) which is not sufficient to cover all languages but might be sufficient to handle a specific text. Another reason to choose this is because of constraints @@ -240,7 +254,7 @@ big advantage that whenever one can identify the beginning of the byte sequence of a character one can interpret a text correctly. Examples of character sets using this policy are the various EUC character sets (used by Sun's operations systems, EUC-JP, EUC-KR, EUC-TW, and EUC-CN) -or SJIS (Shift JIS, a Japanese encoding). +or SJIS (Shift-JIS, a Japanese encoding). But there are also character sets using a state which is valid for more than one character and has to be changed by another byte sequence. @@ -257,23 +271,23 @@ acute accent, following by lower-case `a') to get the ``small a with acute'' character. To get the acute accent character on its on one has to write @code{0xc2 0x20} (the non-spacing acute followed by a space). -This type of characters sets is quite frequently used in embedded -systems such as video text. +This type of character set is used in some embedded systems such as +teletex. @item @cindex UTF-8 -Instead of converting the Unicode or @w{ISO 10646} text used internally +Instead of converting the Unicode or @w{ISO 10646} text used internally, it is often also sufficient to simply use an encoding different than -UCS2/UCS4. The Unicode and @w{ISO 10646} standards even specify such an +UCS-2/UCS-4. The Unicode and @w{ISO 10646} standards even specify such an encoding: UTF-8. This encoding is able to represent all of @w{ISO -10464} 31 bits in a byte string of length one to seven. +10464} 31 bits in a byte string of length one to six. @cindex UTF-7 There were a few other attempts to encode @w{ISO 10646} such as UTF-7 but UTF-8 is today the only encoding which should be used. In fact, -UTF-8 will hopefully soon be the only external which has to be +UTF-8 will hopefully soon be the only external encoding that has to be supported. It proves to be universally usable and the only disadvantage -is that it favor Roman languages very much by making the byte string +is that it favors Roman languages by making the byte string representation of other scripts (Cyrillic, Greek, Asian scripts) longer than necessary if using a specific character set for these scripts. Methods like the Unicode compression scheme can alleviate these @@ -324,7 +338,7 @@ developing libraries (as opposed to applications). The second family of functions got introduced in the early Unix standards (XPG2) and is still part of the latest and greatest Unix standard: @w{Unix 98}. It is also the most powerful and useful set of functions. -But we will start with the functions defined in the second amendment to +But we will start with the functions defined in @w{Amendment 1} to @w{ISO C90}. @node Restartable multibyte conversion @@ -377,7 +391,7 @@ We already said above that the currently selected locale for the by the functions we are about to describe. Each locale uses its own character set (given as an argument to @code{localedef}) and this is the one assumed as the external multibyte encoding. The wide character -character set always is UCS4, at least on GNU systems. +character set always is UCS-4, at least on GNU systems. A characteristic of each multibyte character set is the maximum number of bytes which can be necessary to represent one character. This @@ -456,8 +470,8 @@ about the @dfn{shift state} needed from one call to a conversion function to another. @pindex wchar.h -This type is defined in @file{wchar.h}. It got introduced in the second -amendment to @w{ISO C90}. +This type is defined in @file{wchar.h}. It got introduced in +@w{Amendment 1} to @w{ISO C90}. @end deftp To use objects of this type the programmer has to define such objects @@ -495,7 +509,7 @@ object is in the initial state the return value is nonzero. Otherwise it is zero. @pindex wchar.h -This function was introduced in the second amendment to @w{ISO C90} and +This function was introduced in @w{Amendment 1} to @w{ISO C90} and is declared in @file{wchar.h}. @end deftypefun @@ -559,7 +573,7 @@ which the state information is taken and the function also does not use any static state. @pindex wchar.h -This function was introduced in the second amendment of @w{ISO C90} and +This function was introduced in @w{Amendment 1} to @w{ISO C90} and is declared in @file{wchar.h}. @end deftypefun @@ -608,7 +622,7 @@ value of this function is this character. Otherwise the return value is @code{EOF}. @pindex wchar.h -This function was introduced in the second amendment of @w{ISO C90} and +This function was introduced in @w{Amendment 1} to @w{ISO C90} and is declared in @file{wchar.h}. @end deftypefun @@ -655,7 +669,7 @@ a valid multibyte character also no value is stored, the global variable @code{(size_t) -1}. The conversion state is afterwards undefined. @pindex wchar.h -This function was introduced in the second amendment to @w{ISO C90} and +This function was introduced in @w{Amendment 1} to @w{ISO C90} and is declared in @file{wchar.h}. @end deftypefun @@ -733,7 +747,7 @@ object pointed to by @var{ps}. If @var{ps} is a null pointer, a state object local to @code{mbrlen} is used. @pindex wchar.h -This function was introduced in the second amendment to @w{ISO C90} and +This function was introduced in @w{Amendment 1} to @w{ISO C90} and is declared in @file{wchar.h}. @end deftypefun @@ -839,7 +853,7 @@ character. So the caller has to make sure that there is enough space available, otherwise buffer overruns can occur. @pindex wchar.h -This function was introduced in the second amendment to @w{ISO C} and is +This function was introduced in @w{Amendment 1} to @w{ISO C90} and is declared in @file{wchar.h}. @end deftypefun @@ -977,7 +991,7 @@ byte in the input string was reached) or the address of the byte following the last converted multibyte character. @pindex wchar.h -This function was introduced in the second amendment to @w{ISO C} and is +This function was introduced in @w{Amendment 1} to @w{ISO C90} and is declared in @file{wchar.h}. @end deftypefun @@ -1058,7 +1072,7 @@ the initial shift state in case the terminating NUL wide character was converted. @pindex wchar.h -This function was introduced in the second amendment to @w{ISO C} and is +This function was introduced in @w{Amendment 1} to @w{ISO C90} and is declared in @file{wchar.h}. @end deftypefun @@ -1231,8 +1245,8 @@ file_mbsrtowcs (int input, int output) @node Non-reentrant Conversion @section Non-reentrant Conversion Function -The functions described in the last chapter are defined in the second -amendment to @w{ISO C90}. But the original @w{ISO C90} standard also +The functions described in the last chapter are defined in +@w{Amendment 1} to @w{ISO C90}. But the original @w{ISO C90} standard also contained functions for character set conversion. The reason that they are not described in the first place is that they are almost entirely useless. @@ -1369,8 +1383,8 @@ The function @code{mblen} is declared in @file{stdlib.h}. For convenience reasons the @w{ISO C90} standard defines also functions to convert entire strings instead of single characters. These functions -suffer from the same problems as their reentrant counterparts from the -second amendment to @w{ISO C90}; see @ref{Converting Strings}. +suffer from the same problems as their reentrant counterparts from +@w{Amendment 1} to @w{ISO C90}; see @ref{Converting Strings}. @comment stdlib.h @comment ISO @@ -1513,7 +1527,7 @@ common that they operate on character sets which are not directly specified by the functions. The multibyte encoding used is specified by the currently selected locale for the @code{LC_CTYPE} category. The wide character set is fixed by the implementation (in the case of GNU C -library it always is UCS4 encoded @w{ISO 10646}. +library it always is UCS-4 encoded @w{ISO 10646}. This has of course several problems when it comes to general character conversion: @@ -1806,12 +1820,12 @@ file2wcs (int fd, const char *charset, wchar_t *outbuf, size_t avail) int result = 0; iconv_t cd; - cd = iconv_open ("UCS4", charset); + cd = iconv_open ("UCS-4", charset); if (cd == (iconv_t) -1) @{ /* @r{Something went wrong.} */ if (errno == EINVAL) - error (0, 0, "conversion from `%s' to `UCS4' no available", + error (0, 0, "conversion from '%s' to 'UCS-4' not available", charset); else perror ("iconv_open"); @@ -2024,7 +2038,7 @@ will succeed but how to find @math{@cal{B}}? Unfortunately, the answer is: there is no general solution. On some systems guessing might help. On those systems most character sets can -convert to and from UTF8 encoded @w{ISO 10646} or Unicode text. +convert to and from UTF-8 encoded @w{ISO 10646} or Unicode text. Beside this only some very system-specific methods can help. Since the conversion functions come from loadable modules and these modules must be stored somewhere in the filesystem, one @emph{could} try to find them @@ -2082,7 +2096,7 @@ wanted conversion. @cindex triangulation This is achieved by providing for each character set a conversion from -and to UCS4 encoded @w{ISO 10646}. Using @w{ISO 10646} as an +and to UCS-4 encoded @w{ISO 10646}. Using @w{ISO 10646} as an intermediate representation it is possible to @dfn{triangulate}, i.e., converting with an intermediate representation. @@ -2210,15 +2224,15 @@ ending with @code{//}. There often is a character set named @code{INTERNAL} mentioned. From the discussion above and the chosen name it should have become clear that this is the name for the representation used in the intermediate step of the triangulation. We -have said that this is UCS4 but actually it is not quite right. The -UCS4 specification also includes the specification of the byte ordering -used. Since a UCS4 value consists of four bytes a stored value is +have said that this is UCS-4 but actually it is not quite right. The +UCS-4 specification also includes the specification of the byte ordering +used. Since a UCS-4 value consists of four bytes a stored value is effected by byte ordering. The internal representation is @emph{not} -the same as UCS4 in case the byte ordering of the processor (or at least -the running process) is not the same as the one required for UCS4. This +the same as UCS-4 in case the byte ordering of the processor (or at least +the running process) is not the same as the one required for UCS-4. This is done for performance reasons as one does not want to perform unnecessary byte-swapping operations if one is not interested in actually -seeing the result in UCS4. To avoid trouble with endianess the internal +seeing the result in UCS-4. To avoid trouble with endianess the internal representation consistently is named @code{INTERNAL} even on big-endian systems where the representations are identical. @@ -2570,7 +2584,7 @@ One interesting thing is the initialization of the @code{__min_} and character can consist of one to four bytes. Therefore the @code{MIN_NEEDED_FROM} and @code{MAX_NEEDED_FROM} macros are defined this way. The output is always the @code{INTERNAL} character set (aka -UCS4) and therefore each character consists of exactly four bytes. For +UCS-4) and therefore each character consists of exactly four bytes. For the conversion from @code{INTERNAL} to ISO-2022-JP we have to take into account that escape sequences might be necessary to switch the character sets. Therefore the @code{__max_needed_to} element for this direction diff --git a/manual/ctype.texi b/manual/ctype.texi index dabb03a..8f07cb4 100644 --- a/manual/ctype.texi +++ b/manual/ctype.texi @@ -265,8 +265,8 @@ with the SVID. @node Classification of Wide Characters, Using Wide Char Classes, Case Conversion, Character Handling @section Character class determination for wide characters -The second amendment to @w{ISO C89} defines functions to classify wide -characters. Although the original @w{ISO C89} standard already defined +@w{Amendment 1} to @w{ISO C90} defines functions to classify wide +characters. Although the original @w{ISO C90} standard already defined the type @code{wchar_t}, no functions operating on them were defined. The general design of the classification functions for wide characters diff --git a/math/libm-test.inc b/math/libm-test.inc index e3dff49..9f882d3 100644 --- a/math/libm-test.inc +++ b/math/libm-test.inc @@ -189,6 +189,7 @@ init_max_error (void) max_error = 0; real_max_error = 0; imag_max_error = 0; + feclearexcept (FE_ALL_EXCEPT); } static void @@ -723,6 +724,12 @@ acos_test (void) static void acosh_test (void) { + errno = 0; + FUNC(acosh) (7); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + START (acosh); TEST_f_f (acosh, plus_infty, plus_infty); @@ -770,6 +777,12 @@ asin_test (void) static void asinh_test (void) { + errno = 0; + FUNC(asinh) (0.7); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + START (asinh); TEST_f_f (asinh, 0, 0); @@ -815,6 +828,11 @@ atan_test (void) static void atanh_test (void) { + errno = 0; + FUNC(atanh) (0.7); + if (errno == ENOSYS) + /* Function not implemented. */ + return; START (atanh); @@ -838,6 +856,12 @@ atanh_test (void) static void atan2_test (void) { + errno = 0; + FUNC(atan2) (-0, 1); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + START (atan2); /* atan2 (0,x) == 0 for x > 0. */ @@ -904,6 +928,12 @@ atan2_test (void) static void cabs_test (void) { + errno = 0; + FUNC(cabs) (BUILD_COMPLEX (0.7, 12.4)); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + START (cabs); /* cabs (x + iy) is specified as hypot (x,y) */ @@ -944,6 +974,12 @@ cabs_test (void) static void cacos_test (void) { + errno = 0; + FUNC(cacos) (BUILD_COMPLEX (0.7, 1.2)); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + START (cacos); @@ -1002,6 +1038,12 @@ cacos_test (void) static void cacosh_test (void) { + errno = 0; + FUNC(cacosh) (BUILD_COMPLEX (0.7, 1.2)); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + START (cacosh); @@ -1125,6 +1167,12 @@ carg_test (void) static void casin_test (void) { + errno = 0; + FUNC(casin) (BUILD_COMPLEX (0.7, 1.2)); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + START (casin); TEST_c_c (casin, 0, 0, 0.0, 0.0); @@ -1183,6 +1231,12 @@ casin_test (void) static void casinh_test (void) { + errno = 0; + FUNC(casinh) (BUILD_COMPLEX (0.7, 1.2)); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + START (casinh); TEST_c_c (casinh, 0, 0, 0.0, 0.0); @@ -1241,6 +1295,12 @@ casinh_test (void) static void catan_test (void) { + errno = 0; + FUNC(catan) (BUILD_COMPLEX (0.7, 1.2)); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + START (catan); TEST_c_c (catan, 0, 0, 0, 0); @@ -1303,6 +1363,12 @@ catan_test (void) static void catanh_test (void) { + errno = 0; + FUNC(catanh) (BUILD_COMPLEX (0.7, 1.2)); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + START (catanh); TEST_c_c (catanh, 0, 0, 0.0, 0.0); @@ -1384,6 +1450,11 @@ cbrt_test (void) static void ccos_test (void) { + errno = 0; + FUNC(ccos) (BUILD_COMPLEX (0, 0)); + if (errno == ENOSYS) + /* Function not implemented. */ + return; START (ccos); @@ -1448,6 +1519,11 @@ ccos_test (void) static void ccosh_test (void) { + errno = 0; + FUNC(ccosh) (BUILD_COMPLEX (0.7, 1.2)); + if (errno == ENOSYS) + /* Function not implemented. */ + return; START (ccosh); @@ -1530,6 +1606,12 @@ ceil_test (void) static void cexp_test (void) { + errno = 0; + FUNC(cexp) (BUILD_COMPLEX (0, 0)); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + START (cexp); TEST_c_c (cexp, plus_zero, plus_zero, 1, 0.0); @@ -1602,6 +1684,12 @@ cimag_test (void) static void clog_test (void) { + errno = 0; + FUNC(clog) (BUILD_COMPLEX (-2, -3)); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + START (clog); TEST_c_c (clog, minus_zero, 0, minus_infty, M_PIl, DIVIDE_BY_ZERO_EXCEPTION); @@ -1661,6 +1749,12 @@ clog_test (void) static void clog10_test (void) { + errno = 0; + FUNC(clog10) (BUILD_COMPLEX (0.7, 1.2)); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + START (clog10); TEST_c_c (clog10, minus_zero, 0, minus_infty, M_PIl, DIVIDE_BY_ZERO_EXCEPTION); @@ -1791,6 +1885,12 @@ cos_test (void) static void cosh_test (void) { + errno = 0; + FUNC(cosh) (0.7); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + START (cosh); TEST_f_f (cosh, 0, 1); TEST_f_f (cosh, minus_zero, 1); @@ -1809,6 +1909,12 @@ cosh_test (void) static void cpow_test (void) { + errno = 0; + FUNC(cpow) (BUILD_COMPLEX (1, 0), BUILD_COMPLEX (0, 0)); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + START (cpow); TEST_cc_c (cpow, 1, 0, 0, 0, 1.0, 0.0); @@ -1862,6 +1968,11 @@ creal_test (void) static void csin_test (void) { + errno = 0; + FUNC(csin) (BUILD_COMPLEX (0.7, 1.2)); + if (errno == ENOSYS) + /* Function not implemented. */ + return; START (csin); @@ -1926,6 +2037,11 @@ csin_test (void) static void csinh_test (void) { + errno = 0; + FUNC(csinh) (BUILD_COMPLEX (0.7, 1.2)); + if (errno == ENOSYS) + /* Function not implemented. */ + return; START (csinh); @@ -1988,6 +2104,12 @@ csinh_test (void) static void csqrt_test (void) { + errno = 0; + FUNC(csqrt) (BUILD_COMPLEX (-1, 0)); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + START (csqrt); TEST_c_c (csqrt, 0, 0, 0.0, 0.0); @@ -2048,6 +2170,12 @@ csqrt_test (void) static void ctan_test (void) { + errno = 0; + FUNC(ctan) (BUILD_COMPLEX (0.7, 1.2)); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + START (ctan); TEST_c_c (ctan, 0, 0, 0.0, 0.0); @@ -2100,6 +2228,12 @@ ctan_test (void) static void ctanh_test (void) { + errno = 0; + FUNC(ctanh) (BUILD_COMPLEX (0, 0)); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + START (ctanh); TEST_c_c (ctanh, 0, 0, 0.0, 0.0); @@ -2485,6 +2619,12 @@ fmin_test (void) static void fmod_test (void) { + errno = 0; + FUNC(fmod) (6.5, 2.3); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + START (fmod); /* fmod (+0, y) == +0 for y != 0. */ @@ -2585,6 +2725,12 @@ gamma_test (void) static void hypot_test (void) { + errno = 0; + FUNC(hypot) (0.7, 12.4); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + START (hypot); TEST_ff_f (hypot, plus_infty, 1, plus_infty, IGNORE_ZERO_INF_SIGN); @@ -3399,6 +3545,11 @@ pow_test (void) static void remainder_test (void) { + errno = 0; + FUNC(remainder) (1.625, 1.0); + if (errno == ENOSYS) + /* Function not implemented. */ + return; START (remainder); @@ -3424,6 +3575,12 @@ remquo_test (void) /* x is needed. */ int x; + errno = 0; + FUNC(remquo) (1.625, 1.0, &x); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + START (remquo); TEST_ffI_f1 (remquo, 1, 0, nan_value, IGNORE, INVALID_EXCEPTION); @@ -3637,6 +3794,12 @@ sincos_test (void) { FLOAT sin_res, cos_res; + errno = 0; + FUNC(sincos) (0, &sin_res, &cos_res); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + START (sincos); /* sincos is treated differently because it returns void. */ @@ -3658,6 +3821,12 @@ sincos_test (void) static void sinh_test (void) { + errno = 0; + FUNC(sinh) (0.7); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + START (sinh); TEST_f_f (sinh, 0, 0); TEST_f_f (sinh, minus_zero, minus_zero); @@ -3732,6 +3901,12 @@ tan_test (void) static void tanh_test (void) { + errno = 0; + FUNC(tanh) (0.7); + if (errno == ENOSYS) + /* Function not implemented. */ + return; + START (tanh); TEST_f_f (tanh, 0, 0); diff --git a/sysdeps/ia64/fpu/math_ldbl.h b/sysdeps/ia64/fpu/math_ldbl.h new file mode 100644 index 0000000..e329b70 --- /dev/null +++ b/sysdeps/ia64/fpu/math_ldbl.h @@ -0,0 +1,100 @@ +#ifndef _MATH_PRIVATE_H_ +#error "Never use directly; include instead." +#endif + +/* A union which permits us to convert between a long double and + three 32 bit ints. */ + +#if __FLOAT_WORD_ORDER == BIG_ENDIAN + +typedef union +{ + long double value; + struct + { + unsigned int empty0:32; + unsigned int sign_exponent:16; + unsigned int empty1:16; + u_int32_t msw; + u_int32_t lsw; + } parts; +} ieee_long_double_shape_type; + +#endif + +#if __FLOAT_WORD_ORDER == LITTLE_ENDIAN + +typedef union +{ + long double value; + struct + { + u_int32_t lsw; + u_int32_t msw; + unsigned int sign_exponent:16; + unsigned int empty1:16; + unsigned int empty0:32; + } parts; +} ieee_long_double_shape_type; + +#endif + +/* Get three 32 bit ints from a double. */ + +#define GET_LDOUBLE_WORDS(exp,ix0,ix1,d) \ +do { \ + ieee_long_double_shape_type ew_u; \ + ew_u.value = (d); \ + (exp) = ew_u.parts.sign_exponent; \ + (ix0) = ew_u.parts.msw; \ + (ix1) = ew_u.parts.lsw; \ +} while (0) + +/* Set a double from two 32 bit ints. */ + +#define SET_LDOUBLE_WORDS(d,exp,ix0,ix1) \ +do { \ + ieee_long_double_shape_type iw_u; \ + iw_u.parts.sign_exponent = (exp); \ + iw_u.parts.msw = (ix0); \ + iw_u.parts.lsw = (ix1); \ + (d) = iw_u.value; \ +} while (0) + +/* Get the more significant 32 bits of a long double mantissa. */ + +#define GET_LDOUBLE_MSW(v,d) \ +do { \ + ieee_long_double_shape_type sh_u; \ + sh_u.value = (d); \ + (v) = sh_u.parts.msw; \ +} while (0) + +/* Set the more significant 32 bits of a long double mantissa from an int. */ + +#define SET_LDOUBLE_MSW(d,v) \ +do { \ + ieee_long_double_shape_type sh_u; \ + sh_u.value = (d); \ + sh_u.parts.msw = (v); \ + (d) = sh_u.value; \ +} while (0) + +/* Get int from the exponent of a long double. */ + +#define GET_LDOUBLE_EXP(exp,d) \ +do { \ + ieee_long_double_shape_type ge_u; \ + ge_u.value = (d); \ + (exp) = ge_u.parts.sign_exponent; \ +} while (0) + +/* Set exponent of a long double from an int. */ + +#define SET_LDOUBLE_EXP(d,exp) \ +do { \ + ieee_long_double_shape_type se_u; \ + se_u.value = (d); \ + se_u.parts.sign_exponent = (exp); \ + (d) = se_u.value; \ +} while (0) diff --git a/sysdeps/ia64/ieee754.h b/sysdeps/ia64/ieee754.h new file mode 100644 index 0000000..ec6b551 --- /dev/null +++ b/sysdeps/ia64/ieee754.h @@ -0,0 +1,205 @@ +/* Copyright (C) 2000 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 _IEEE754_H + +#define _IEEE754_H 1 +#include + +#include + +__BEGIN_DECLS + +union ieee754_float + { + float f; + + /* This is the IEEE 754 single-precision format. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:8; + unsigned int mantissa:23; +#endif /* Big endian. */ +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned int mantissa:23; + unsigned int exponent:8; + unsigned int negative:1; +#endif /* Little endian. */ + } ieee; + + /* This format makes it easier to see if a NaN is a signalling NaN. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:8; + unsigned int quiet_nan:1; + unsigned int mantissa:22; +#endif /* Big endian. */ +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned int mantissa:22; + unsigned int quiet_nan:1; + unsigned int exponent:8; + unsigned int negative:1; +#endif /* Little endian. */ + } ieee_nan; + }; + +#define IEEE754_FLOAT_BIAS 0x7f /* Added to exponent. */ + + +union ieee754_double + { + double d; + + /* This is the IEEE 754 double-precision format. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:11; + /* Together these comprise the mantissa. */ + unsigned int mantissa0:20; + unsigned int mantissa1:32; +#endif /* Big endian. */ +#if __BYTE_ORDER == __LITTLE_ENDIAN +# if __FLOAT_WORD_ORDER == BIG_ENDIAN + unsigned int mantissa0:20; + unsigned int exponent:11; + unsigned int negative:1; + unsigned int mantissa1:32; +# else + /* Together these comprise the mantissa. */ + unsigned int mantissa1:32; + unsigned int mantissa0:20; + unsigned int exponent:11; + unsigned int negative:1; +# endif +#endif /* Little endian. */ + } ieee; + + /* This format makes it easier to see if a NaN is a signalling NaN. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int negative:1; + unsigned int exponent:11; + unsigned int quiet_nan:1; + /* Together these comprise the mantissa. */ + unsigned int mantissa0:19; + unsigned int mantissa1:32; +#else +# if __FLOAT_WORD_ORDER == BIG_ENDIAN + unsigned int mantissa0:19; + unsigned int quiet_nan:1; + unsigned int exponent:11; + unsigned int negative:1; + unsigned int mantissa1:32; +# else + /* Together these comprise the mantissa. */ + unsigned int mantissa1:32; + unsigned int mantissa0:19; + unsigned int quiet_nan:1; + unsigned int exponent:11; + unsigned int negative:1; +# endif +#endif + } ieee_nan; + }; + +#define IEEE754_DOUBLE_BIAS 0x3ff /* Added to exponent. */ + + +union ieee854_long_double + { + long double d; + + /* This is the IEEE 854 double-extended-precision format. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int empty0:32; + unsigned int negative:1; + unsigned int exponent:15; + unsigned int empty1:16; + unsigned int mantissa0:32; + unsigned int mantissa1:32; +#endif +#if __BYTE_ORDER == __LITTLE_ENDIAN +# if __FLOAT_WORD_ORDER == BIG_ENDIAN + unsigned int empty0:32; + unsigned int exponent:15; + unsigned int negative:1; + unsigned int empty1:16; + unsigned int mantissa0:32; + unsigned int mantissa1:32; +# else + unsigned int mantissa1:32; + unsigned int mantissa0:32; + unsigned int exponent:15; + unsigned int negative:1; + unsigned int empty1:16; + unsigned int empty0:32; +# endif +#endif + } ieee; + + /* This is for NaNs in the IEEE 854 double-extended-precision format. */ + struct + { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int empty0:32; + unsigned int negative:1; + unsigned int exponent:15; + unsigned int empty1:16; + unsigned int one:1; + unsigned int quiet_nan:1; + unsigned int mantissa0:30; + unsigned int mantissa1:32; +#endif +#if __BYTE_ORDER == __LITTLE_ENDIAN +# if __FLOAT_WORD_ORDER == BIG_ENDIAN + unsigned int empty0:32; + unsigned int exponent:15; + unsigned int negative:1; + unsigned int empty1:16; + unsigned int mantissa0:30; + unsigned int quiet_nan:1; + unsigned int one:1; + unsigned int mantissa1:32; +# else + unsigned int mantissa1:32; + unsigned int mantissa0:30; + unsigned int quiet_nan:1; + unsigned int one:1; + unsigned int exponent:15; + unsigned int negative:1; + unsigned int empty1:16; + unsigned int empty0:32; +# endif +#endif + } ieee_nan; + }; + +#define IEEE854_LONG_DOUBLE_BIAS 0x3fff + +__END_DECLS + +#endif /* ieee754.h */ diff --git a/sysdeps/ieee754/ldbl-96/s_ceill.c b/sysdeps/ieee754/ldbl-96/s_ceill.c index d53f395..b99097f 100644 --- a/sysdeps/ieee754/ldbl-96/s_ceill.c +++ b/sysdeps/ieee754/ldbl-96/s_ceill.c @@ -59,8 +59,13 @@ static long double huge = 1.0e4930; if(((i0&i)|i1)==0) return x; /* x is integral */ if(huge+x>0.0) { /* raise inexact flag */ if(sx==0) { - if (j0>0) i0 += (0x80000000)>>j0; - else ++se; + if (j0>0 && (i0+(0x80000000>>j0))>i0) + i0+=0x80000000>>j0; + else + { + i = 0x7fffffff; + ++se; + } } i0 &= (~i); i1=0; } diff --git a/sysdeps/ieee754/ldbl-96/s_floorl.c b/sysdeps/ieee754/ldbl-96/s_floorl.c index fb0c37e..7115dba 100644 --- a/sysdeps/ieee754/ldbl-96/s_floorl.c +++ b/sysdeps/ieee754/ldbl-96/s_floorl.c @@ -60,8 +60,13 @@ static long double huge = 1.0e4930; if(((i0&i)|i1)==0) return x; /* x is integral */ if(huge+x>0.0) { /* raise inexact flag */ if(sx) { - if (j0>0) i0 += (0x80000000)>>j0; - else ++se; + if (j0>0 && (i0+(0x80000000>>j0))>i0) + i0 += (0x80000000)>>j0; + else + { + i = 0x7fffffff; + ++se; + } } i0 &= (~i); i1=0; } diff --git a/sysdeps/unix/sysv/linux/i386/readelflib.c b/sysdeps/unix/sysv/linux/i386/readelflib.c new file mode 100644 index 0000000..53a6908 --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/readelflib.c @@ -0,0 +1,81 @@ +/* Copyright (C) 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Andreas Jaeger , 1999 and + Jakub Jelinek , 2000. + + 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. */ + + +int process_elf32_file (const char *file_name, const char *lib, int *flag, + char **soname, void *file_contents, + size_t file_length); +int process_elf64_file (const char *file_name, const char *lib, int *flag, + char **soname, void *file_contents, + size_t file_length); + +/* Returns 0 if everything is ok, != 0 in case of error. */ +int +process_elf_file (const char *file_name, const char *lib, int *flag, + char **soname, void *file_contents, size_t file_length) +{ + ElfW(Ehdr) *elf_header = (ElfW(Ehdr) *) file_contents; + int ret; + + if (elf_header->e_ident [EI_CLASS] == ELFCLASS32) + return process_elf32_file (file_name, lib, flag, soname, file_contents, + file_length); + else + { + switch (elf_header->e_machine) + { + case EM_IA_64: + case EM_X8664: + break; + default: + error (0, 0, _("%s is for unknown machine %d.\n"), + file_name, elf_header->e_machine); + return 1; + } + + ret = process_elf64_file (file_name, lib, flag, soname, file_contents, + file_length); + /* IA64/X86-64 64bit libraries are always libc.so.6+. */ + if (!ret) + switch (elf_header->e_machine) + { + case EM_IA_64: + *flag = FLAG_IA64_LIB64|FLAG_ELF_LIBC6; + break; + case EM_X8664: + *flag = FLAG_X8664_LIB64|FLAG_ELF_LIBC6; + break; + } + + return ret; + } +} + +#undef __ELF_NATIVE_CLASS +#undef process_elf_file +#define process_elf_file process_elf32_file +#define __ELF_NATIVE_CLASS 32 +#include "sysdeps/generic/readelflib.c" + +#undef __ELF_NATIVE_CLASS +#undef process_elf_file +#define process_elf_file process_elf64_file +#define __ELF_NATIVE_CLASS 64 +#include "sysdeps/generic/readelflib.c" -- 2.7.4