check-installed-headers tests were failing for x32 because of the x86
bits/sysctl.h containing a #error for x32. This patch makes the tests
ignore sys/sysctl.h for x32, similar to the other special-casing of
particular headers.
Tested for x86_64 (full testing for -m64, compile-only for x32).
* scripts/check-installed-headers.sh: Ignore sys/sysctl.h for x32.
gconv.h is using a flex array to define the __gconv_info member in an
invalid way, causing GCC 7 to issue an error:
| In file included from ../include/gconv.h:1:0,
| from ../sysdeps/unix/sysv/linux/_G_config.h:32,
| from ../libio/libio.h:31,
| from ../include/libio.h:4,
| from ../libio/stdio.h:74,
| from ../include/stdio.h:5,
| from test-math-isinff.cc:22:
| ../iconv/gconv.h:142:50: error: flexible array member '__gconv_info::__data' not at end of 'struct _IO_codecvt'
| In file included from ../include/libio.h:4:0,
| from ../libio/stdio.h:74,
| from ../include/stdio.h:5,
| from test-math-isinff.cc:22:
| ../libio/libio.h:211:14: note: next member '_G_iconv_t _IO_codecvt::__cd_out' declared here
| ../libio/libio.h:187:8: note: in the definition of 'struct _IO_codecvt'
| In file included from ../include/gconv.h:1:0,
| from ../sysdeps/unix/sysv/linux/_G_config.h:32,
| from ../libio/libio.h:31,
| from ../include/libio.h:4,
| from ../libio/stdio.h:74,
| from ../include/stdio.h:5,
| from test-math-isinff.cc:22:
| ../iconv/gconv.h:142:50: error: flexible array member '__gconv_info::__data' not at end of 'struct _IO_wide_data'
| In file included from ../include/libio.h:4:0,
| from ../libio/stdio.h:74,
| from ../include/stdio.h:5,
| from test-math-isinff.cc:22:
| ../libio/libio.h:211:14: note: next member '_G_iconv_t _IO_codecvt::__cd_out' declared here
| ../libio/libio.h:215:8: note: in the definition of 'struct _IO_wide_data'
This is basically a revert to the code from 15 years ago. More details
are available in the GCC bug:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78039
Changelog:
* iconv/gconv.h (__gconv_info): Define __data element using a
zero-length array.
Testing with run-built-tests = no generates many UNRESOLVED results in
tests.sum (and so in the output of "make check"), for all the tests
that are only compiled and not run in such a configuration. This
doesn't seem useful in the "make check" output, and also causes "make
check" to exist with error status even when all tests that can be run
in such a configuration passed.
This patch changes it not to consider those tests when generating
subdir-tests.sum, and so tests.sum, so that you get a smaller number
of tests considered in the final results rather than a huge pile of
UNRESOLVED.
Tested with a cross-compiler to ARM in a run-built-tests = no
configuration.
* Rules (tests-expected): New variable, depending on
$(run-built-tests).
(tests): Pass $(tests-expected) to merge-test-results.sh, not
$(tests).
The tests-unsupported variable lists tests that should neither be
compiled nor run, because some support needed to compile them is
missing.
The implementation of this feature involves having a rule to create
.out files for these tests that takes precedence over the default
rule. This does not work in the run-built-tests = no case (cross
compiling without use of a wrapper to run the tests on a separate
system, in which cases most tests are compiled only) because in that
case the tests target depends on $(tests) to ensure all tests get
compiled. This patch changes that dependency to filter out
$(tests-unsupported).
Tested with cross-compilation to ARM with GCC 5, where libstdc++ is
missing some C++11 support because of the bug I fixed in
<https://gcc.gnu.org/ml/gcc-patches/2015-10/msg01040.html> and so
tests-unsupported is nonempty and the tests in question fail to
compile. (When I originally observed the bug, it was with a native
build / test simply using an x86_64 compiler that had been configured
as a cross compiler to isolate it from the system headers / libraries,
so the configuration issue applied to the compiler but run-built-tests
was yes, so I don't observe the issue with tests-unsupported with that
compiler.)
* Rules [$(run-built-tests) = no] (tests): Do not depend on
$(tests-unsupported).
This patch adds the missing Linux sparc definitions from d060cd0.
Both value are copied from default sparc value [1] and with this
fix now both sparc 32 and 64 bits builds on Linux.
* sysdeps/unix/sysv/linux/sparc/bits/wordsize.h
(__WORDSIZE_TIME64_COMPAT32): Define for both 32 and 64 bits.
[1] sysdeps/sparc/sparc{32,64}/bits/wordsize.h
On alpha, sqrt (a C90 function) brings in references to fegetenv
(C99), resulting in linknamespace test failures:
[initial] __sqrt -> [libm.a(w_sqrt.o)] __ieee754_sqrt ->
[libm.a(e_sqrt.o)] __feholdexcept -> [libm.a(feholdexcpt.o)] fegetenv
This patch fixes this by making __feholdexcept call __fegetenv instead
of fegetenv.
Tested for Alpha (compilation only).
[BZ #20768]
* sysdeps/alpha/fpu/feholdexcpt.c (__feholdexcept): Call
__fegetenv instead of fegetenv.
manual/libm-err-tab.pl hardcodes a list of names for particular
platforms (mapping from sysdeps directory name to friendly name for
the manual). This goes against the principle of keeping information
about individual platforms in their corresponding sysdeps directory,
and the list is also very out-of-date regarding supported platforms
and their corresponding sysdeps directories.
This patch fixes this by adding a libm-test-ulps-name file alongside
each libm-test-ulps file. The script then gets the friendly name from
that file, which is required to exist, so it no longer needs to allow
for the mapping being missing.
Tested for x86_64.
[BZ #14139]
* manual/libm-err-tab.pl (%pplatforms): Initialize to empty.
(find_files): Obtain platform name from libm-test-ulps-name and
store in %pplatforms.
(canonicalize_platform): Remove.
(print_platforms): Use $pplatforms directly.
(by_platforms): Do not allow for platforms missing from
%pplatforms.
* sysdeps/aarch64/libm-test-ulps-name: New file.
* sysdeps/alpha/fpu/libm-test-ulps-name: Likewise.
* sysdeps/arm/libm-test-ulps-name: Likewise.
* sysdeps/generic/libm-test-ulps-name: Likewise.
* sysdeps/hppa/fpu/libm-test-ulps-name: Likewise.
* sysdeps/i386/fpu/libm-test-ulps-name: Likewise.
* sysdeps/i386/i686/fpu/multiarch/libm-test-ulps-name: Likewise.
* sysdeps/ia64/fpu/libm-test-ulps-name: Likewise.
* sysdeps/m68k/coldfire/fpu/libm-test-ulps-name: Likewise.
* sysdeps/m68k/m680x0/fpu/libm-test-ulps-name: Likewise.
* sysdeps/microblaze/libm-test-ulps-name: Likewise.
* sysdeps/mips/mips32/libm-test-ulps-name: Likewise.
* sysdeps/mips/mips64/libm-test-ulps-name: Likewise.
* sysdeps/nios2/libm-test-ulps-name: Likewise.
* sysdeps/powerpc/fpu/libm-test-ulps-name: Likewise.
* sysdeps/powerpc/nofpu/libm-test-ulps-name: Likewise.
* sysdeps/s390/fpu/libm-test-ulps-name: Likewise.
* sysdeps/sh/libm-test-ulps-name: Likewise.
* sysdeps/sparc/fpu/libm-test-ulps-name: Likewise.
* sysdeps/tile/libm-test-ulps-name: Likewise.
* sysdeps/x86_64/fpu/libm-test-ulps-name: Likewise.
The check-installed-headers tests show up that the MIPS <sys/user.h>
is not self-contained, using size_t without including any header that
defines it. This patch fixes it by including <stddef.h>, as done for
other architectures' versions of this header.
Tested for MIPS (all 24 ABIs, compilation only).
* sysdeps/unix/sysv/linux/mips/sys/user.h: Include <stddef.h>.
This patch marks the check-execstack test as expected to fail for
MIPS, with a comment referencing previous RFC discussion of the
changes that would be needed to support non-executable stacks on MIPS.
Tested for MIPS (all 24 ABIs).
* sysdeps/unix/sysv/linux/mips/Makefile [$(subdir) = elf]
(test-xfail-check-execstack): New variable.
This patch adds a localplt.data file for MIPS, reflecting the
peculiarities of MIPS ELF that mean this test cannot detect PLT
entries (there aren't any in shared libraries), not GOT entries
(because of the implicit relocation).
Tested for MIPS (all 24 ABIs).
* sysdeps/mips/localplt.data: New file.
strchr and is significantly faster than the C version.
2016-11-04 Wilco Dijkstra <wdijkstr@arm.com>
Kevin Petit <kevin.petit@arm.com>
* sysdeps/aarch64/memchr.S (__memchr): New file.
This patch makes sysdeps/tile/preconfigure handle tilegx* machine
names instead of just plain tilegx. That matches GCC, and in
particular allows a big-endian toolchain to use the tilegxbe-linux-gnu
name when configuring both GCC and glibc.
Tested with compilation for tilegxbe-linux-gnu, both 32-bit and 64-bit
(building a subsequent GCC against that glibc still falls over because
of both 32-bit and 64-bit libraries going in the lib directory, as
noted at
<https://sourceware.org/ml/libc-alpha/2016-11/msg00129.html>).
* sysdeps/tile/preconfigure: Accept tilegx* instead of tilegx.
Having found that with my script to build many glibc variants I could
reproduce the linknamespace test failures in parallel builds (that
various people had previously reported but I hadn't seen myself), I
investigated those failures further. This patch adds a missing
dependency to those tests.
Tested for x86_64, including the configuration where I saw those
failures and where I don't see them with this patch.
* conform/Makefile ($(linknamespace-header-tests)): Also depend on
$(linknamespace-symlists-tests).
The changes to fix bug 20729 introduced an error which removed an
ignore diagnostic from -O2 by using the new -Os related macro.
This broke ppc64 builds. This commit fixes the mistake.
Tested on x86, x86_64, ppc64, ppc64le, arm, aarch64, and s390x.
Bug 19673 reports that the documentation of clog10 is incorrect, both
failing to include the division by log (10) in the imaginary part and,
in the non-TeX version of the equation only, describing the LHS as log
rather than log10.
This patch fixes both issues. Note: I think it's appropriate that the
LHS says log10 not clog10, and that the cexp and clog descriptions
referred to in a comment in that bug report similarly say exp and log;
this is a mathematical description not a literal C one.
Tested for x86_64.
[BZ #19673]
* manual/math.texi (Exponents and Logarithms): Correct description
of clog10.
The original fix for bug 20729 failed to include
libc-internal.h in the files that needed them and
this caused build failures on machines that don't
implicitly include this header. This commit fixes
that by following the consensus rule that a header,
if needed, should always be directly included.
This commit adds a new DIAG_IGNORE_Os_NEEDS_COMMENT which is only
enabled when compiling with -Os. This allows developers working on
-Os enabled builds to mark false-positive warnings without impacting the
warnings emitted at -O2.
Then using the new DIAG_IGNORE_Os_NEEDS_COMMENT we fix 6 warnings
generated with GCC 5 to get -Os builds working again.
The test case dlfcn/bug-atexit3-lib.cc calls write and doesn't check the
result. When building with GCC 6.2, this generates a warning in 'make
check', which is treated as an error. This patch replaces the call to
write with a call to write_message.
Tested for powerpc64le.
TS 18661-1 defines SNAN macros for signaling NaN values, suitable for
use in static initializers. This patch adds them to glibc's <math.h>
(provided you are building with GCC 3.3 or later; no attempt is made
to provide any kind of nonconforming fallback for older compilers
without the __builtin_nans functions).
Tested for x86_64 and x86.
* math/math.h
[__GLIBC_USE (IEC_60559_BFP_EXT) && __GNUC_PREREQ (3, 3)] (SNANF):
New macro.
[__GLIBC_USE (IEC_60559_BFP_EXT) && __GNUC_PREREQ (3, 3)] (SNAN):
Likewise.
[__GLIBC_USE (IEC_60559_BFP_EXT) && __GNUC_PREREQ (3, 3)] (SNANL):
Likewise.
* manual/arith.texi (Infinity and NaN): Document SNANF, SNAN and
SNANL.
* math/test-double.h (snan_value_MACRO): New macro.
* math/test-float.h (snan_value_MACRO): Likewise.
* math/test-ldouble.h (snan_value_MACRO): Likewise.
* math/libm-test.inc (issignaling_test_data): Add tests of
snan_value_MACRO.
The test math/test-nan-overflow uses malloc without including
stdlib.h. On -Os builds for i486 the header inclusion order
is altered enough that the test fails to build because of the
warning which is turned into an error.
The obvious fix is to include stdlib.h since malloc is being
used directly.
Calling an IFUNC function defined in unrelocated shared library may
lead to segfault. This patch issues an error message to request
relinking the shared library if it references IFUNC function defined
in the unrelocated shared library.
[BZ #20019]
* sysdeps/i386/dl-machine.h (elf_machine_rel): Check IFUNC
definition in unrelocated shared library.
* sysdeps/x86_64/dl-machine.h (elf_machine_rela): Likewise.
The strtod function should raise the "inexact" exception when its
result is inexact, but fails to do so except in the case of underflow
or overflow. This patch fixes it to do so for all inexact results.
tst-strtod-round is extended to test for this exception; the generator
is fixed to properly mark inexact results as such in the case where
the inexactness is from the mpfr_subnormalize step.
Tested for x86_64, x86 and powerpc.
[BZ #19380]
* stdlib/strtod_l.c (round_and_return): Force "inexact" exception
for inexact results.
* stdlib/gen-tst-strtod-round.c (string_to_fp): Return indication
of inexact result where mpfr_subnormalize is the only inexact
step.
* stdlib/tst-strtod-round-data.h: Regenerated.
* stdlib/tst-strtod-round-skeleton.c [!FE_INEXACT] (FE_INEXACT):
Define to 0.
(GEN_ONE_TEST): Test inexact exceptions raised are as expected.
Make mallopt helper functions for each mallopt parameter so that it
can be called consistently in other areas, like setting tunables.
* malloc/malloc.c (do_set_mallopt_check): New function.
(do_set_mmap_threshold): Likewise.
(do_set_mmaps_max): Likewise.
(do_set_top_pad): Likewise.
(do_set_perturb_byte): Likewise.
(do_set_trim_threshold): Likewise.
(do_set_arena_max): Likewise.
(do_set_arena_test): Likewise.
(__libc_mallopt): Use them.
TS 18661-1 defines canonicalize functions to produce a canonical
version of a floating-point representation. This patch implements
these functions for glibc.
As with the iscanonical macro, these functions are oriented to the
decimal floating-point case, where some values have both canonical and
noncanonical representations. However, the functions have a return
value that says whether they succeeded in storing a canonical result;
thus, they can fail for the case of an invalid representation (while
still not making any particular choice from among multiple equally
canonical valid representations of the same value). Since no
floating-point formats in glibc actually have noncanonical valid
representations, a type-generic implementation of these functions can
be used that expects iscanonical to return 0 only for invalid
representations. Now that iscanonical is used within libm.so,
libm_hidden_proto / libm_hidden_def are added for __iscanonicall.
The definition of these functions is intended to correspond to a
convertFormat operation to the same floating-point format. Thus, they
convert signaling NaNs to quiet NaNs, raising the "invalid" exception.
Such a conversion "should" produce "the canonical version of that
signaling NaN made quiet".
libm-test.inc is made to check NaN payloads for the output of these
functions, a new feature (at some point manipulation functions such as
fabs and copysign should have tests added that verify payload
preservation for them). As however some architectures may not follow
the recommended practice of preserving NaN payloads when converting a
signaling NaN to quiet, a new math-tests.h macro
SNAN_TESTS_PRESERVE_PAYLOAD is added, and defined to 0 for non-NAN2008
MIPS; any other architectures seeing test failures for lack of payload
preservation in this case should also define this macro to 0. (If any
cases arise where the sign isn't preserved either, those should have a
similar macro added.)
The ldbl-96 and ldbl-128ibm tests of iscanonical are renamed and
adapted to test canonicalizel as well on the same representations.
Tested for x86_64, x86, mips64 and powerpc.
* math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
(canonicalize): New declaration.
* math/Versions (canonicalize): New libm symbol at version
GLIBC_2.25.
(canonicalizef): Likewise.
(canonicalizel): Likewise.
* math/Makefile (gen-libm-calls): Add s_canonicalizeF.
* math/s_canonicalize_template.c: New file.
* math/libm-test.inc: Update comment on functions tested and
testing of NaN payloads.
(TEST_NAN_PAYLOAD): New macro.
(NO_TEST_INLINE): Update value.
(XFAIL_TEST): Likewise.
(ERRNO_UNCHANGED): Likewise.
(ERRNO_EDOM): Likewise.
(ERRNO_ERANGE): Likewise.
(IGNORE_RESULT): Likewise.
(NON_FINITE): Likewise.
(TEST_SNAN): Likewise.
(NO_TEST_MATHVEC): Likewise.
(TEST_NAN_PAYLOAD_CANONICALIZE): New macro.
(check_float_internal): Check NaN payloads if TEST_NAN_PAYLOAD.
(struct test_Ffp_b1_data): New type.
(RUN_TEST_Ffp_b1): New macro.
(RUN_TEST_LOOP_Ffp_b1): Likewise.
(canonicalize_test_data): New array.
(canonicalize_test): New function.
(main): Call canonicalize_test.
* manual/arith.texi (FP Bit Twiddling): Document canonicalize,
canonicalizef and canonicalizel.
* manual/libm-err-tab.pl: Update comment on interfaces without
ulps tabulated.
* sysdeps/ieee754/ldbl-opt/nldbl-canonicalize.c: New file.
* sysdeps/ieee754/ldbl-opt/s_canonicalizel.c: Likewise.
* sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add
canonicalize.
(CFLAGS-nldbl-canonicalize.c): New variable.
* sysdeps/ieee754/ldbl-128ibm/test-iscanonical-ldbl-128ibm.c: Move
to ...
* sysdeps/ieee754/ldbl-128ibm/test-canonical-ldbl-128ibm.c:
... here.
(do_test): Also test canonicalizel.
* sysdeps/ieee754/ldbl-128ibm/Makefile (tests): Change
test-iscanonical-ldbl-128ibm to test-canonical-ldbl-128ibm.
* sysdeps/ieee754/ldbl-128ibm/include/bits/iscanonical.h: New
file.
* sysdeps/ieee754/ldbl-128ibm/s_iscanonicall.c (__iscanonicall):
Use libm_hidden_def.
* sysdeps/ieee754/ldbl-96/test-iscanonical-ldbl-96.c: Move to ...
* sysdeps/ieee754/ldbl-96/test-canonical-ldbl-96.c: ... here.
(do_test): Also test canonicalizel.
* sysdeps/ieee754/ldbl-96/Makefile (tests): Change
test-iscanonical-ldbl-96 to test-canonical-ldbl-96.
* sysdeps/ieee754/ldbl-96/include/bits/iscanonical.h: New file.
* sysdeps/ieee754/ldbl-96/s_iscanonicall.c (__iscanonicall): Use
libm_hidden_def.
* sysdeps/generic/math-tests.h (SNAN_TESTS_PRESERVE_PAYLOAD): New
macro.
* sysdeps/mips/math-tests.h [__mips_hard_float && !__mips_nan2008]
(SNAN_TESTS_PRESERVE_PAYLOAD): Likewise.
* sysdeps/nacl/libm.abilist: Update.
* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
This patch adds getpayloadl to libnldbl, missed in my patch that
originally implemented getpayload functions.
Tested for powerpc.
* sysdeps/ieee754/ldbl-opt/nldbl-getpayload.c: New file.
* sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add
getpayload.
(CFLAGS-nldbl-getpayload.c): New variable.
The function read_int, from printf-parse.h, parses an integer from a string
while avoiding overflows. It is used by other functions, such as vfprintf,
to avoid undefined behavior.
The function vfscanf (_IO_vfwscanf) parses an integer from the format
string, and can use read_int.
After the removal of __malloc_initialize_hook, newly compiled
Emacs binaries are no longer able to use these interfaces.
malloc_get_state is only used during the Emacs build process,
so we provide a stub implementation only. Existing Emacs binaries
will not call this stub function, but still reference the symbol.
The rewritten tst-mallocstate test constructs a dumped heap
which should approximates what existing Emacs binaries pass
to glibc malloc.
The IBM930, IBM933, IBM935 and IBM939 converters defined lookup
tables which were not constant. They also contained an
unnecessary pointer indirection.
The M_ARENA_MAX and M_ARENA_TEST macros are defined in malloc.c as
well as malloc.h, and the former is unnecessary. This patch removes
the duplicate. Tested on x86_64 to verify that the generated code
remains unchanged barring changed line numbers to __malloc_assert.
* malloc/malloc.c (M_ARENA_TEST, M_ARENA_MAX): Remove.