Commit Graph

22778 Commits

Author SHA1 Message Date
Joseph Myers 418d99e622 Move fenv.h soft-float inlines from fenv_private.h to include/fenv.h.
<fenv_private.h> has inline versions of various <fenv.h> functions,
and their __fe* variants, for systems (generally soft-float) without
support for floating-point exceptions, rounding modes or both.

Having these inlines in a separate header introduces a risk of a
source file including <fenv.h> and compiling OK on x86_64, but failing
to compile (because the feraiseexcept inline is actually a macro that
discards its argument, to avoid the need for #ifdef FE_INVALID
conditionals), or not being properly optimized, on systems without the
exceptions and rounding modes support (when these inlines were in
math_private.h, we had a few cases where this broke the build because
there was no obvious reason for a file to need math_private.h and it
didn't need that header on x86_64).  By moving those inlines to
include/fenv.h, this risk can be avoided, and fenv_private.h becomes
more clearly defined as specifically the header for the internal
libc_fe* and SET_RESTORE_ROUND* interfaces.

This patch makes that move, removing fenv_private.h includes that are
no longer needed (or replacing them by fenv.h includes in a few cases
that didn't already have such an include).

Tested for x86_64 and x86, and tested with build-many-glibcs.py that
installed stripped shared libraries are unchanged by the patch.

	* sysdeps/generic/fenv_private.h [FE_ALL_EXCEPT == 0]: Move this
	code ....
	[!FE_HAVE_ROUNDING_MODES]: And this code ....
	* include/fenv.h [!_ISOMAC]: ... to here.
	* math/fraiseexcpt.c (__feraiseexcept): Undefine as macro.
	(feraiseexcept): Likewise.
	* math/fromfp.h: Do not include <fenv_private.h>.
	* math/s_cexp_template.c: Likewise.
	* math/s_csin_template.c: Likewise.
	* math/s_csinh_template.c: Likewise.
	* math/s_ctan_template.c: Likewise.
	* math/s_ctanh_template.c: Likewise.
	* math/s_iseqsig_template.c: Likewise.
	* math/w_acos_compat.c: Likewise.
	* math/w_acosf_compat.c: Likewise.
	* math/w_acosl_compat.c: Likewise.
	* math/w_asin_compat.c: Likewise.
	* math/w_asinf_compat.c: Likewise.
	* math/w_asinl_compat.c: Likewise.
	* math/w_j0_compat.c: Likewise.
	* math/w_j0f_compat.c: Likewise.
	* math/w_j0l_compat.c: Likewise.
	* math/w_j1_compat.c: Likewise.
	* math/w_j1f_compat.c: Likewise.
	* math/w_j1l_compat.c: Likewise.
	* math/w_jn_compat.c: Likewise.
	* math/w_jnf_compat.c: Likewise.
	* math/w_log10_compat.c: Likewise.
	* math/w_log10f_compat.c: Likewise.
	* math/w_log10l_compat.c: Likewise.
	* math/w_log2_compat.c: Likewise.
	* math/w_log2f_compat.c: Likewise.
	* math/w_log2l_compat.c: Likewise.
	* math/w_log_compat.c: Likewise.
	* math/w_logf_compat.c: Likewise.
	* math/w_logl_compat.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_llrint.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_llround.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_lrint.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_lround.c: Likewise.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_lround.c: Likewise.
	* sysdeps/ieee754/flt-32/s_llrintf.c: Likewise.
	* sysdeps/ieee754/flt-32/s_llroundf.c: Likewise.
	* sysdeps/ieee754/flt-32/s_lrintf.c: Likewise.
	* sysdeps/ieee754/flt-32/s_lroundf.c: Likewise.
	* sysdeps/ieee754/k_standardl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/e_expl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_fmal.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_llrintl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_llroundl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_lrintl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_lroundl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_nearbyintl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_llrintl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_llroundl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_lrintl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_lroundl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_fma.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_fmal.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_llrintl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_llroundl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_lrintl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_lroundl.c: Likewise.
	* math/w_ilogb_template.c: Include <fenv.h> instead of
	<fenv_private.h>.
	* math/w_llogb_template.c: Likewise.
	* sysdeps/powerpc/fpu/e_sqrt.c: Likewise.
	* sysdeps/powerpc/fpu/e_sqrtf.c: Likewise.
2018-09-04 19:52:06 +00:00
Joseph Myers 70e2ba332f Do not include fenv_private.h in math_private.h.
Continuing the clean-up related to the catch-all math_private.h
header, this patch stops math_private.h from including fenv_private.h.
Instead, fenv_private.h is included directly from those users of
math_private.h that also used interfaces from fenv_private.h.  No
attempt is made to remove unused includes of math_private.h, but that
is a natural followup.

(However, since math_private.h sometimes defines optimized versions of
math.h interfaces or __* variants thereof, as well as defining its own
interfaces, I think it might make sense to get all those optimized
versions included from include/math.h, not requiring a separate header
at all, before eliminating unused math_private.h includes - that
avoids a file quietly becoming less-optimized if someone adds a call
to one of those interfaces without restoring a math_private.h include
to that file.)

There is still a pitfall that if code uses plain fe* and __fe*
interfaces, but only includes fenv.h and not fenv_private.h or (before
this patch) math_private.h, it will compile on platforms with
exceptions and rounding modes but not get the optimized versions (and
possibly not compile) on platforms without exception and rounding mode
support, so making it easy to break the build for such platforms
accidentally.

I think it would be most natural to move the inlines / macros for fe*
and __fe* in the case of no exceptions and rounding modes into
include/fenv.h, so that all code including fenv.h with _ISOMAC not
defined automatically gets them.  Then fenv_private.h would be purely
the header for the libc_fe*, SET_RESTORE_ROUND etc. internal
interfaces and the risk of breaking the build on other platforms than
the one you tested on because of a missing fenv_private.h include
would be much reduced (and there would be some unused fenv_private.h
includes to remove along with unused math_private.h includes).

Tested for x86_64 and x86, and tested with build-many-glibcs.py that
installed stripped shared libraries are unchanged by this patch.

	* sysdeps/generic/math_private.h: Do not include <fenv_private.h>.
	* math/fromfp.h: Include <fenv_private.h>.
	* math/math-narrow.h: Likewise.
	* math/s_cexp_template.c: Likewise.
	* math/s_csin_template.c: Likewise.
	* math/s_csinh_template.c: Likewise.
	* math/s_ctan_template.c: Likewise.
	* math/s_ctanh_template.c: Likewise.
	* math/s_iseqsig_template.c: Likewise.
	* math/w_acos_compat.c: Likewise.
	* math/w_acosf_compat.c: Likewise.
	* math/w_acosl_compat.c: Likewise.
	* math/w_asin_compat.c: Likewise.
	* math/w_asinf_compat.c: Likewise.
	* math/w_asinl_compat.c: Likewise.
	* math/w_ilogb_template.c: Likewise.
	* math/w_j0_compat.c: Likewise.
	* math/w_j0f_compat.c: Likewise.
	* math/w_j0l_compat.c: Likewise.
	* math/w_j1_compat.c: Likewise.
	* math/w_j1f_compat.c: Likewise.
	* math/w_j1l_compat.c: Likewise.
	* math/w_jn_compat.c: Likewise.
	* math/w_jnf_compat.c: Likewise.
	* math/w_llogb_template.c: Likewise.
	* math/w_log10_compat.c: Likewise.
	* math/w_log10f_compat.c: Likewise.
	* math/w_log10l_compat.c: Likewise.
	* math/w_log2_compat.c: Likewise.
	* math/w_log2f_compat.c: Likewise.
	* math/w_log2l_compat.c: Likewise.
	* math/w_log_compat.c: Likewise.
	* math/w_logf_compat.c: Likewise.
	* math/w_logl_compat.c: Likewise.
	* sysdeps/aarch64/fpu/feholdexcpt.c: Likewise.
	* sysdeps/aarch64/fpu/fesetround.c: Likewise.
	* sysdeps/aarch64/fpu/fgetexcptflg.c: Likewise.
	* sysdeps/aarch64/fpu/ftestexcept.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_atan2.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_exp.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_exp2.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_gamma_r.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_jn.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_pow.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_remainder.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_sqrt.c: Likewise.
	* sysdeps/ieee754/dbl-64/gamma_product.c: Likewise.
	* sysdeps/ieee754/dbl-64/lgamma_neg.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_atan.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_fma.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_fmaf.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_llrint.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_llround.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_lrint.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_lround.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_nearbyint.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_sin.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_sincos.c: Likewise.
	* sysdeps/ieee754/dbl-64/s_tan.c: Likewise.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_lround.c: Likewise.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_nearbyint.c: Likewise.
	* sysdeps/ieee754/dbl-64/x2y2m1.c: Likewise.
	* sysdeps/ieee754/float128/float128_private.h: Likewise.
	* sysdeps/ieee754/flt-32/e_gammaf_r.c: Likewise.
	* sysdeps/ieee754/flt-32/e_j1f.c: Likewise.
	* sysdeps/ieee754/flt-32/e_jnf.c: Likewise.
	* sysdeps/ieee754/flt-32/lgamma_negf.c: Likewise.
	* sysdeps/ieee754/flt-32/s_llrintf.c: Likewise.
	* sysdeps/ieee754/flt-32/s_llroundf.c: Likewise.
	* sysdeps/ieee754/flt-32/s_lrintf.c: Likewise.
	* sysdeps/ieee754/flt-32/s_lroundf.c: Likewise.
	* sysdeps/ieee754/flt-32/s_nearbyintf.c: Likewise.
	* sysdeps/ieee754/k_standardl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/e_expl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/e_gammal_r.c: Likewise.
	* sysdeps/ieee754/ldbl-128/e_j1l.c: Likewise.
	* sysdeps/ieee754/ldbl-128/e_jnl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/gamma_productl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/lgamma_negl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_fmal.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_llrintl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_llroundl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_lrintl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_lroundl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/s_nearbyintl.c: Likewise.
	* sysdeps/ieee754/ldbl-128/x2y2m1l.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_expl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_j1l.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_jnl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/lgamma_negl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_fmal.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_llrintl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_llroundl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_lrintl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_lroundl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_rintl.c: Likewise.
	* sysdeps/ieee754/ldbl-128ibm/x2y2m1l.c: Likewise.
	* sysdeps/ieee754/ldbl-96/e_gammal_r.c: Likewise.
	* sysdeps/ieee754/ldbl-96/e_jnl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/gamma_productl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/lgamma_negl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_fma.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_fmal.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_llrintl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_llroundl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_lrintl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/s_lroundl.c: Likewise.
	* sysdeps/ieee754/ldbl-96/x2y2m1l.c: Likewise.
	* sysdeps/powerpc/fpu/e_sqrt.c: Likewise.
	* sysdeps/powerpc/fpu/e_sqrtf.c: Likewise.
	* sysdeps/riscv/rv64/rvd/s_ceil.c: Likewise.
	* sysdeps/riscv/rv64/rvd/s_floor.c: Likewise.
	* sysdeps/riscv/rv64/rvd/s_nearbyint.c: Likewise.
	* sysdeps/riscv/rv64/rvd/s_round.c: Likewise.
	* sysdeps/riscv/rv64/rvd/s_roundeven.c: Likewise.
	* sysdeps/riscv/rv64/rvd/s_trunc.c: Likewise.
	* sysdeps/riscv/rvd/s_finite.c: Likewise.
	* sysdeps/riscv/rvd/s_fmax.c: Likewise.
	* sysdeps/riscv/rvd/s_fmin.c: Likewise.
	* sysdeps/riscv/rvd/s_fpclassify.c: Likewise.
	* sysdeps/riscv/rvd/s_isinf.c: Likewise.
	* sysdeps/riscv/rvd/s_isnan.c: Likewise.
	* sysdeps/riscv/rvd/s_issignaling.c: Likewise.
	* sysdeps/riscv/rvf/fegetround.c: Likewise.
	* sysdeps/riscv/rvf/feholdexcpt.c: Likewise.
	* sysdeps/riscv/rvf/fesetenv.c: Likewise.
	* sysdeps/riscv/rvf/fesetround.c: Likewise.
	* sysdeps/riscv/rvf/feupdateenv.c: Likewise.
	* sysdeps/riscv/rvf/fgetexcptflg.c: Likewise.
	* sysdeps/riscv/rvf/ftestexcept.c: Likewise.
	* sysdeps/riscv/rvf/s_ceilf.c: Likewise.
	* sysdeps/riscv/rvf/s_finitef.c: Likewise.
	* sysdeps/riscv/rvf/s_floorf.c: Likewise.
	* sysdeps/riscv/rvf/s_fmaxf.c: Likewise.
	* sysdeps/riscv/rvf/s_fminf.c: Likewise.
	* sysdeps/riscv/rvf/s_fpclassifyf.c: Likewise.
	* sysdeps/riscv/rvf/s_isinff.c: Likewise.
	* sysdeps/riscv/rvf/s_isnanf.c: Likewise.
	* sysdeps/riscv/rvf/s_issignalingf.c: Likewise.
	* sysdeps/riscv/rvf/s_nearbyintf.c: Likewise.
	* sysdeps/riscv/rvf/s_roundevenf.c: Likewise.
	* sysdeps/riscv/rvf/s_roundf.c: Likewise.
	* sysdeps/riscv/rvf/s_truncf.c: Likewise.
2018-09-03 21:09:04 +00:00
Paul Pluzhnikov a6e8926f8d [BZ #20271] Add newlines in __libc_fatal calls. 2018-08-31 18:04:32 -07:00
Joseph Myers 2bbd06bcee Replace conform/list-header-symbols.pl with a Python script.
Continuing the move of test code from Perl to Python (which seems
uncontroversial, unlike dependencies on Python in the actual build of
glibc), this patch replaces conform/list-header-symbols.pl with a
Python script, as a first step in converting the conform/ tests.
(conform/glibcconform.py is an equivalent to GlibcConform.pm,
containing code that will be relevant to move than one of the conform/
scripts.)

Tested for x86_64, including verifying that the symbol lists generated
are identical to those generated by the Perl version.

	* conform/glibcconform.py: New file.
	* conform/list-header-symbols.py: Likewise.
	* conform/list-header-symbols.pl: Remove.
	* conform/Makefile (tests-special): Only add linknamespace tests
	if [PYTHON].
	($(linknamespace-symlists-tests)): Use list-header-symbols.py.
2018-08-31 21:19:51 +00:00
H.J. Lu 81b9d87bae test-container: Use xcopy_file_range for cross-device copy [BZ #23597]
copy_file_range can't be used to copy a file from glibc source directory
to glibc build directory since they may be on different filesystems.
This patch adds xcopy_file_range for cross-device copy.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>

	[BZ #23597]
	* support/Makefile (libsupport-routines): Add
	support_copy_file_range and xcopy_file_range.
	* support/support.h: Include <sys/types.h>.
	(support_copy_file_range): New prototype.
	* support/support_copy_file_range.c: New file.  Copied and
	modified from io/copy_file_range-compat.c.
	* support/test-container.c (copy_one_file): Call xcopy_file_rang
	instead of copy_file_range.
	* support/xcopy_file_range.c: New file.
	* support/xunistd.h (xcopy_file_range): New prototype.
2018-08-31 13:08:02 -07:00
Carlos O'Donell d330f31af6 Fix test failure with -DNDEBUG.
The elf/tst-dlopen-aout.c test uses asserts to verify properties of the
test execution.  Instead of using assert it should use xpthread_create
and xpthread_join to catch errors starting the threads and fail the
test.  This shows up in Fedora 28 when building for i686-pc-linux-gnu
and using gcc 8.1.1.

Tested on i686, and fixes a check failure with -DNDEBUG.

Signed-off-by: Carlos O'Donell <carlos@redhat.com>
2018-08-30 12:33:22 -04:00
Florian Weimer 2bda273aa3 reallocarray: Declare under _DEFAULT_SOURCE
Initially, this function was restricted to _GNU_SOURCE, but experience
shows that compatibility with existing build systems is improved if we
declare it under _DEFAULT_SOURCE as well.
2018-08-30 14:14:53 +02:00
Stefan Liebler 3bad2358d6 Test stdlib/test-bz22786 exits now with unsupported if malloc fails.
The test tries to allocate more than 2^31 bytes which will always fail on s390
as it has maximum 2^31bit of memory.
Before commit 6c3a8a9d86, this test returned
unsupported if malloc fails.  This patch re enables this behaviour.

Furthermore support_delete_temp_files() failed to remove the temp directory
in this case as it is not empty due to the created symlink.
Thus the creation of the symlink is moved behind malloc.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>

ChangeLog:

	* stdlib/test-bz22786.c (do_test): Return EXIT_UNSUPPORTED
	if malloc fails.
2018-08-30 08:44:32 +02:00
Joseph Myers 09c12efcaf Make gen-libm-test.py treat plus_oflow and minus_oflow as non-finite.
When converting gen-libm-test to Python, in one place I noted a bug in
the old Perl version that I preserved in the Python version so that
the generated output files were the same with both versions, as such
comparisons help give confidence in the correctness of such a rewrite
of a script.  Now that the conversion has been done, this patch fixes
that bug, by arranging for tests with plus_oflow or minus_oflow
results (manually written tests in libm-test-*.inc that have
overflowing results that thus depend on the rounding mode) to be
properly treated as having non-finite results, and thus not run for
the __FINITE_MATH_ONLY__ tests.  (As the affected tests in fact did
pass for __FINITE_MATH_ONLY__ testing, this is just a matter of
logical correctness in the choice of which tests run for that case,
rather than fixing any actual test failures.)

Tested for x86_64.

	* math/gen-libm-test.py (gen_test_args_res): Also treat plus_oflow
	and minus_oflow as non-finite.
2018-08-29 20:01:57 +00:00
Joseph Myers ff6b24501f Split fenv_private.h out of math_private.h more consistently.
On some architectures, the parts of math_private.h relating to the
floating-point environment are in a separate file fenv_private.h
included from math_private.h.  As this is purely an
architecture-specific convention used by several architectures,
however, all such architectures still need their own math_private.h,
even if it has nothing to do beyond #include <fenv_private.h> and
peculiarity of including the i386 file directly instead of having a
shared file in sysdeps/x86.

This patch makes the fenv_private.h name an architecture-independent
convention in glibc.  The include of fenv_private.h from
math_private.h becomes architecture-independent (until callers are
updated to include fenv_private.h directly so the include from
math_private.h is no longer needed).  Some architecture math_private.h
headers are removed if no longer needed, or renamed to fenv_private.h
if all they define belongs in that header; architecture fenv_private.h
headers now do require #include_next <fenv_private.h>.  The i386
fenv_private.h file moves to sysdeps/x86/fpu/ to reflect how it is
actually shared with x86_64.  The generic math_private.h gets a new
include of <stdbool.h>, as needed for bool in some prototypes in that
header (previously that was indirectly included via include/fenv.h,
which now only gets included too late in math_private.h, after those
prototypes).

Tested for x86_64 and x86, and tested with build-many-glibcs.py that
installed stripped shared libraries are unchanged by the patch.

	* sysdeps/aarch64/fpu/fenv_private.h: New file.  Based on ....
	* sysdeps/aarch64/fpu/math_private.h: ... this file.  All contents
	moved to fenv_private.h except for ...
	(TOINT_INTRINSICS): Kept in math_private.h.
	(roundtoint): Likewise.
	(converttoint): Likewise.
	* sysdeps/arm/fenv_private.h: Change multiple-include guard to
	[ARM_FENV_PRIVATE_H].  Include next <fenv_private.h>.
	* sysdeps/arm/math_private.h: Remove.
	* sysdeps/generic/fenv_private.h: New file.  Contents moved from
	....
	* sysdeps/generic/math_private.h: ... this file.  Include
	<stdbool.h>.  Do not include <fenv.h> or <get-rounding-mode.h>.
	Include <fenv_private.h>.  Remove functions and macros moved to
	fenv_private.h.
	* sysdeps/i386/fpu/math_private.h: Remove.
	* sysdeps/mips/math_private.h: Move to ....
	* sysdeps/mips/fpu/fenv_private.h: ... here.  Change
	multiple-include guard to [MIPS_FENV_PRIVATE_H].  Remove
	[__mips_hard_float] conditional.  Include next <fenv_private.h>.
	* sysdeps/powerpc/fpu/fenv_private.h: Change multiple-include
	guard to [POWERPC_FENV_PRIVATE_H].  Include next <fenv_private.h>.
	* sysdeps/powerpc/fpu/math_private.h: Do not include
	<fenv_private.h>.
	* sysdeps/riscv/rvf/math_private.h: Move to ....
	* sysdeps/riscv/rvf/fenv_private.h: ... here.  Change
	multiple-include guard to [RISCV_FENV_PRIVATE_H].  Include next
	<fenv_private.h>.
	* sysdeps/sparc/fpu/fenv_private.h: Change multiple-include guard
	to [SPARC_FENV_PRIVATE_H].  Include next <fenv_private.h>.
	* sysdeps/sparc/fpu/math_private.h: Remove.
	* sysdeps/i386/fpu/fenv_private.h: Move to ....
	* sysdeps/x86/fpu/fenv_private.h: ... here.  Change
	multiple-include guard to [X86_FENV_PRIVATE_H].  Include next
	<fenv_private.h>.
	* sysdeps/x86_64/fpu/math_private.h: Do not include
	<sysdeps/i386/fpu/fenv_private.h>.
2018-08-28 20:48:49 +00:00
Florian Weimer 761404b74d regex: Add test tst-regcomp-truncated [BZ #23578] 2018-08-28 19:43:12 +02:00
Florian Weimer d6c44c3d0c test-container: EPERM from unshare is UNSUPPORTED
For example, the security policy on the Fedora build daemons results in
this EPERM error.
2018-08-28 14:02:47 +02:00
Florian Weimer 745664bd79 nscd: Fix use-after-free in addgetnetgrentX [BZ #23520]
addinnetgrX may use the heap-allocated buffer, so free the buffer
in this function.
2018-08-28 13:19:27 +02:00
Rajalakshmi Srinivasaraghavan c8dd67e7c9 Speedup first memmem match
As done in commit 284f42bc77, memcmp
can be used after memchr to avoid the initialization overhead of the
two-way algorithm for the first match.  This has shown improvement
>40% for first match.
2018-08-28 12:42:19 +05:30
Rafal Luzynski 5abedf97a3 en_IN: Set the correct date format for "%x" (bug 17426).
[BZ #17426]
	* localedata/locales/en_IN (d_fmt): Use "%d/%m/%y".
2018-08-28 00:21:52 +02:00
DJ Delorie 86de0499c3 links-dso-program: Fix build-programs=no build case.
* support/Makefile (others): Don't list programs explicitly as a
dependency of "others".
2018-08-27 16:31:33 -04:00
Joseph Myers c3ab211099 Move EXCEPTION_SET_FORCES_TRAP out of math-tests.h.
Completing the move of macros out of math-tests.h to smaller headers
following typo-proof conventions instead of using #ifndef, this patch
moves the EXCEPTION_SET_FORCES_TRAP macro out to its own
math-tests-trap-force.h header.

Tested with build-many-glibcs.py.

	* sysdeps/generic/math-tests-trap-force.h: New file.
	* sysdeps/generic/math-tests.h: Include <math-tests-trap-force.h>.
	(EXCEPTION_SET_FORCES_TRAP): Do not define here.
	* sysdeps/powerpc/math-tests.h: Remove file.
	* sysdeps/powerpc/fpu/math-tests-trap-force.h: New file.
2018-08-27 18:52:41 +00:00
Martin Kuchta 99ea93ca31 pthread_cond_broadcast: Fix waiters-after-spinning case [BZ #23538] 2018-08-27 17:03:35 +02:00
Joseph Myers 4061791fcc Update netinet/udp.h from Linux 4.18.
This patch adds the UDP_SEGMENT constant from Linux 4.18 to
netinet/udp.h.

Tested for x86_64.

	* sysdeps/gnu/netinet/udp.h (UDP_SEGMENT): New macro.
2018-08-27 13:43:05 +00:00
Paul Eggert bc680b3369 regex: fix uninitialized memory access
I introduced this bug into gnulib in commit
8335a4d6c7b4448cd0bcb6d0bebf1d456bcfdb17 dated 2006-04-10;
eventually it was merged into glibc.  The bug was found by
project-repo <bugs@feusi.co> and reported here:
https://lists.gnu.org/r/sed-devel/2018-08/msg00017.html
Diagnosis and draft fix reported by Assaf Gordon here:
https://lists.gnu.org/r/bug-gnulib/2018-08/msg00071.html
https://lists.gnu.org/r/bug-gnulib/2018-08/msg00142.html
* posix/regex_internal.c (build_wcs_upper_buffer):
Fix bug when mbrtowc returns 0.
2018-08-25 20:34:34 -07:00
Carlos O'Donell 02458a5236 Update translations for be. 2018-08-24 22:26:41 -04:00
DJ Delorie acc2842ace Fix IA64 links-dso-program link.
* support/Makefile (LDLIBS-links-dso-program): Add -lgcc and
$(libunwind).
2018-08-24 22:10:00 -04:00
Paul Pluzhnikov 6c3a8a9d86 Fix BZ#23400 (creating temporary files in source tree), and undefined behavior in test. 2018-08-24 18:08:51 -07:00
Joseph Myers 895ef79e04 Move EXCEPTION_ENABLE_SUPPORTED out of math-tests.h.
Continuing moving macros out of math-tests.h to smaller headers
following typo-proof conventions instead of using #ifndef, this patch
moves the EXCEPTION_ENABLE_SUPPORTED macro out to its own
math-tests-trap.h header.

Tested with build-many-glibcs.py.

	* sysdeps/generic/math-tests-trap.h: New file.
	* sysdeps/generic/math-tests.h: Include <math-tests-trap.h>.
	(EXCEPTION_ENABLE_SUPPORTED): Do not define here.
	* sysdeps/aarch64/math-tests.h: Remove file.
	* sysdeps/arm/math-tests.h: Likewise.
	* sysdeps/riscv/math-tests.h: Likewise.
	* sysdeps/aarch64/math-tests-trap.h: New file.
	* sysdeps/arm/math-tests-trap.h: Likewise.
	* sysdeps/riscv/math-tests-trap.h: Likewise.
2018-08-24 19:18:16 +00:00
Wilco Dijkstra ca3aac57ef Remove unused math files
Remove empty files due to the sin/cos improvements: k_sinf.c, k_cosf.c,
k_cos.c, k_sin.c.  After the tanf change s_rem_pio2f.c and k_rem_pio2f.c
(and the ia64, m68k and powerpc equivalents) are no longer used,
so remove them.  All e_rem_pio2.c files were already empty or commented
out, so remove them too.  Passes build-many-glibcs.

	* math/Makefile: Remove empty files k_sin(f).c, k_cos(f).c.
	Remove unused files e_rem_pio2(f).c, k_rem_pio2f.c.
	* sysdeps/i386/fpu/e_rem_pio2.c: Delete file.
	* sysdeps/ia64/fpu/e_rem_pio2.c: Likewise.
	* sysdeps/ia64/fpu/e_rem_pio2f.c: Likewise.
	* sysdeps/ia64/fpu/k_rem_pio2f.c: Likewise.
	* sysdeps/ieee754/dbl-64/e_rem_pio2.c: Likewise.
	* sysdeps/ieee754/dbl-64/k_cos.c: Likewise.
	* sysdeps/ieee754/dbl-64/k_sin.c: Likewise.
	* sysdeps/ieee754/flt-32/e_rem_pio2f.c: Likewise.
	* sysdeps/ieee754/flt-32/k_cosf.c: Likewise.
	* sysdeps/ieee754/flt-32/k_rem_pio2f.c: Likewise.
	* sysdeps/ieee754/flt-32/k_sinf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/e_rem_pio2.c: Likewise
	* sysdeps/m68k/m680x0/fpu/e_rem_pio2f.c: Likewise
	* sysdeps/m68k/m680x0/fpu/k_rem_pio2f.c: Likewise
	* sysdeps/powerpc/fpu/e_rem_pio2f.c: Likewise.
	* sysdeps/powerpc/fpu/k_rem_pio2f.c: Likewise.
2018-08-24 15:34:54 +01:00
Joseph Myers 60bcac09c0 Move EXCEPTION_TESTS_* out of math-tests.h
Continuing moving macros out of math-tests.h to smaller headers
following typo-proof conventions instead of using #ifndef, this patch
moves the EXCEPTION_TESTS_* macros for individual types out to their
own sysdeps header.

As with ROUNDING_TESTS_*, there is no need to define these macros if
FE_ALL_EXCEPT == 0 and the individual exception macros are undefined;
thus, math-tests-exceptions.h headers are only needed for soft-float
ARM and RISC-V, while the other cases that defined these macros do not
need to do so (and the associated math-tests.h headers are thus
removed without needing replacement by math-tests-exceptions.h
headers).

Tested with build-many-glibcs.py.

	* sysdeps/generic/math-tests-exceptions.h: New file.
	* sysdeps/generic/math-tests.h: Include <math-tests-exceptions.h>.
	(EXCEPTION_TESTS_float): Do not define here.
	(EXCEPTION_TESTS_double): Likewise.
	(EXCEPTION_TESTS_long_double): Likewise.
	(EXCEPTION_TESTS_float128): Likewise.
	* sysdeps/arm/math-tests.h [__SOFTFP__] (EXCEPTION_TESTS_float):
	Likewise.
	[__SOFTFP__] (EXCEPTION_TESTS_double): Likewise.
	[__SOFTFP__] (EXCEPTION_TESTS_long_double): Likewise.
	* sysdeps/arm/nofpu/math-tests-exceptions.h: New file.
	* sysdeps/m68k/coldfire/math-tests.h: Remove file.
	* sysdeps/mips/math-tests.h: Likewise.
	* sysdeps/nios2/math-tests.h: Likewise.
	* sysdeps/riscv/math-tests.h [!__riscv_flen]
	(EXCEPTION_TESTS_float): Do not define here.
	[!__riscv_flen] (EXCEPTION_TESTS_double): Likewise.
	[!__riscv_flen] (EXCEPTION_TESTS_long_double): Likewise.
	* sysdeps/riscv/nofpu/math-tests-exceptions.h: New file.
2018-08-23 23:41:13 +00:00
Wilco Dijkstra 3bded567a7 Update NEWS for sinf improvements
The NEWS entry for sinf improvements is listed for 2.28, while it was
committed in 2.29, so move it there and mention tanf.

Committed as obvious.

	* NEWS: Move optimized sinf entry to 2.29.
2018-08-23 12:55:28 +01:00
Wilco Dijkstra 900fb446eb Speedup tanf range reduction
Speedup tanf range reduction by using the new sincosf range
reduction algorithm.  Overall code quality is improved due to
inlining, so there is a speedup even if no range reduction is
required.

tanf throughput gains on Cortex-A72:
* |x| < M_PI_4  : 1.1x
* |x| < M_PI_2  : 1.2x
* |x| < 2 * M_PI: 1.5x
* |x| < 120.0   : 1.6x
* |x| < Inf     : 12.1x

	* sysdeps/ieee754/flt-32/s_tanf.c (__tanf): Use fast range reduction.
2018-08-23 12:38:16 +01:00
DJ Delorie 561b0bec44 Add test-in-container infrastructure.
* Makefile (testroot.pristine): New rules to initialize the
test-in-container "testroot".
* Makerules (all-testsuite): Add tests-container.
* Rules (tests-expected): Add tests-container.
(binaries-all-tests): Likewise.
(tests-container): New, run these tests in the testroot container.
* support/Makefile (others): Add *-container, support_paths.c,
xmkdirp, and links-dso-program.
* support/links-dso-program-c.c: New.
* support/links-dso-program.cc: New.
* support/test-container.c: New.
* support/shell-container.c: New.
* support/echo-container.c: New.
* support/true-container.c: New.
* support/xmkdirp.c: New.
* support/xsymlink.c: New.
* support/support_paths.c: New.
* support/support.h: Add support paths prototypes.
* support/xunistd.h: Add xmkdirp () and xsymlink ().

* nss/tst-nss-test3.c: Convert to test-in-container.
* nss/tst-nss-test3.root/: New.
2018-08-22 21:20:37 -04:00
Paul Eggert b35d3509ca regex: port Gnulib code to z/OS POSIX environment
Problem reported by Arnold Robbins in:
https://lists.gnu.org/r/bug-gnulib/2018-08/msg00129.html
* posix/regex_internal.h (__iswalnum, __towlower, __towupper) [!_LIBC]:
Undef.
2018-08-22 17:46:32 -07:00
Joseph Myers debc4c9870 Don't redefine ROUNDING_TESTS_* in math/test-*-vlen*.h.
This patch completes the move of ROUNDING_TESTS_* macros to typo-proof
conventions by stopping redefining them in test-*-vlen*.h.  Instead,
libm-test-driver.c is made to check TEST_MATHVEC when setting
non-to-nearest rounding modes.

Tested for x86_64.

	* math/test-double-vlen2.h: Don't include <math-tests-rounding.h>.
	(ROUNDING_TESTS_double): Remove.
	* math/test-double-vlen4.h: Don't include <math-tests-rounding.h>.
	(ROUNDING_TESTS_double): Remove.
	* math/test-double-vlen8.h: Don't include <math-tests-rounding.h>.
	(ROUNDING_TESTS_double): Remove.
	* math/test-float-vlen16.h: Don't include <math-tests-rounding.h>.
	(ROUNDING_TESTS_float): Remove.
	* math/test-float-vlen4.h: Don't include <math-tests-rounding.h>.
	(ROUNDING_TESTS_float): Remove.
	* math/test-float-vlen8.h: Don't include <math-tests-rounding.h>.
	(ROUNDING_TESTS_float): Remove.
	* math/libm-test-driver.c (IF_ROUND_INIT_FE_DOWNWARD): Check
	!TEST_MATHVEC here.
	(IF_ROUND_INIT_FE_TOWARDZERO): Likewise.
	(IF_ROUND_INIT_FE_UPWARD): Likewise.
2018-08-22 15:22:06 +00:00
Joseph Myers 16a25138c1 Move ROUNDING_TESTS_* out of math-tests.h.
Continuing moving macros out of math-tests.h to smaller headers
following typo-proof conventions instead of using #ifndef, this patch
moves the ROUNDING_TESTS_* macros for individual types out to their
own sysdeps header.

In the soft-float case where FE_TONEAREST is the only rounding mode
macro defined, there is no need to define ROUNDING_TESTS_*; it is only
necessary when rounding modes macros are defined that may not be
supported at runtime.  Thus, the ROUNDING_TESTS_* definitions for some
configurations are just removed, not moved to new
math-tests-rounding.h headers; the only architectures needing
math-tests-rounding.h are those where the macros are defined in
bits/fenv.h because of the possibility of a soft-float compilation
using a hard-float glibc with the same ABI (i.e., ARM and RISC-V).

The test-*-vlen*.h headers, by using #undef, do not yet follow
typo-proof conventions (but they no longer implicitly rely on being
included before math-tests.h, and this area can always be cleaned up
further in future).

Tested with build-many-glibcs.py.

	* sysdeps/generic/math-tests-rounding.h: New file.
	* sysdeps/generic/math-tests.h: Include <math-tests-rounding.h>.
	(ROUNDING_TESTS_float): Do not define here.
	(ROUNDING_TESTS_double): Likewise.
	(ROUNDING_TESTS_long_double): Likewise.
	(ROUNDING_TESTS_float128): Likewise.
	* math/test-double-vlen2.h: Include <math-tests-rounding.h>.
	(ROUNDING_TESTS_double): Undefine before defining.
	* math/test-double-vlen4.h: Include <math-tests-rounding.h>.
	(ROUNDING_TESTS_double): Undefine before defining.
	* math/test-double-vlen8.h: Include <math-tests-rounding.h>.
	(ROUNDING_TESTS_double): Undefine before defining.
	* math/test-float-vlen16.h: Include <math-tests-rounding.h>.
	(ROUNDING_TESTS_float): Undefine before defining.
	* math/test-float-vlen4.h: Include <math-tests-rounding.h>.
	(ROUNDING_TESTS_float): Undefine before defining.
	* math/test-float-vlen8.h: Include <math-tests-rounding.h>.
	(ROUNDING_TESTS_float): Undefine before defining.
	* sysdeps/arm/nofpu/math-tests-rounding.h: New file.
	* sysdeps/arm/math-tests.h [__SOFTFP__] (ROUNDING_TESTS_float): Do
	not define here.
	[__SOFTFP__] (ROUNDING_TESTS_double): Likewise.
	[__SOFTFP__] (ROUNDING_TESTS_long_double): Likewise.
	* sysdeps/riscv/nofpu/math-tests-rounding.h: New file.
	* sysdeps/riscv/math-tests.h [!__riscv_flen]
	(ROUNDING_TESTS_float): Do not define here.
	[!__riscv_flen] (ROUNDING_TESTS_double): Likewise.
	[!__risv_flen] (ROUNDING_TESTS_long_double): Likewise.
	* sysdeps/m68k/coldfire/math-tests.h [!__mcffpu__]
	(ROUNDING_TESTS_float): Likewise.
	[!__mcffpu__] (ROUNDING_TESTS_double): Likewise.
	[!__mcffpu__] (ROUNDING_TESTS_long_double): Likewise.
	* sysdeps/mips/math-tests.h [__mips_soft_float]
	(ROUNDING_TESTS_float): Likewise.
	[__mips_soft_float] (ROUNDING_TESTS_double): Likewise.
	[__mips_soft_float] (ROUNDING_TESTS_long_double): Likewise.
	* sysdeps/nios2/math-tests.h (ROUNDING_TESTS_float): Likewise.
	(ROUNDING_TESTS_double): Likewise.
	(ROUNDING_TESTS_long_double): Likewise.
2018-08-22 12:25:50 +00:00
Tobias Klauser 38b0593e9a Add PF_XDP, AF_XDP and SOL_XDP from Linux 4.18 to bits/socket.h.
This patch adds the PF_XDP, AF_XDP and SOL_XDP macros from Linux 4.18 to
sysdeps/unix/sysv/linux/bits/socket.h.

	* sysdeps/unix/sysv/linux/bits/socket.h (PF_MAX): Set to 45.
	(PF_XDP): New macro.
	(AF_XDP): New macro.
	(SOL_XDP): New macro.
2018-08-21 17:22:53 +00:00
Joseph Myers 5cd7dbdea1 Update netinet/tcp.h from Linux 4.18.
This patch adds constants from netinet/tcp.h in Linux 4.18, and an
associated struct tcp_zerocopy_receive, to sysdeps/gnu/netinet/tcp.h.
The new TCP_REPAIR_* constants seemed sufficiently related to those
already present to include them.

Note that this patch does not include additions to struct tcp_info;
there are many other elements in this structure in the Linux kernel
that are not included in the glibc version (which was last extended in
2007, it seems).  Such additions to the end of the structure may be OK
with the expected way it is used (size passed explicitly to the kernel
with getsockopt), but in principle any change to the size of a type
provided by glibc is an ABI change for external applications /
libraries using that type in their ABIs, and has the associated risks
of such a change.

Tested for x86_64.

	* sysdeps/gnu/netinet/tcp.h (TCP_ZEROCOPY_RECEIVE): New macro.
	(TCP_INQ): Likewise.
	(TCP_CM_INQ): Likewise.
	(TCP_REPAIR_ON): Likewise.
	(TCP_REPAIR_OFF): Likewise.
	(TCP_REPAIR_OFF_NO_WP): Likewise.
	(struct tcp_zerocopy_receive): New type.
2018-08-21 15:57:22 +00:00
Florian Weimer aa42b3dbcb Avoid running some tests if the file system does not support holes
Otherwise, these tests fills up the entire disk (or just run very
slowly and eventually time out).
2018-08-21 12:56:53 +02:00
Florian Weimer c7627f41ba Makeconfig: Do not sort and deduplicate +cflags [BZ # 17248]
The original intent behind this is unclear.  It interferes with flags
that has to be ordered in a particular way.
2018-08-21 11:43:35 +02:00
Florian Weimer ef939d928a __readlink_chk: Remove micro-optimization 2018-08-21 11:24:12 +02:00
Florian Weimer 88ffb39dc6 __readlink_chk: Assume HAVE_INLINED_SYSCALLS
HAVE_INLINED_SYSCALLS is always defined on Linux.
Switch to INLINE_SYSCALL_CALL as well.
2018-08-20 18:24:09 +02:00
Joseph Myers e6edd40d61 Update struct signalfd_siginfo from Linux 4.18.
This patch updates struct signalfd_siginfo in sys/signalfd.h with new
members from Linux 4.18 (plus ssi_addr_lsb, added to the kernel in
2.6.37 without being added to sys/signalfd.h at that time).  The
__pad2 member name follows the kernel and the existing __pad name.

Tested for x86_64.

	* sysdeps/unix/sysv/linux/sys/signalfd.h (struct
	signalfd_siginfo): Add ssi_addr_lsb, ssi_syscall, ssi_call_addr
	and ssi_arch members.
2018-08-20 15:48:16 +00:00
Joseph Myers 174195409d Add NT_VMCOREDD, AT_MINSIGSTKSZ from Linux 4.18 to elf.h.
This patch adds two new constants from Linux 4.18 to elf.h,
NT_VMCOREDD and AT_MINSIGSTKSZ.

Tested for x86_64.

	* elf/elf.c (NT_VMCOREDD): New macro.
	(AT_MINSIGSTKSZ): Likewise.
2018-08-20 15:46:26 +00:00
Florian Weimer 35cfefd960 malloc: Add ChangeLog for accidentally committed change
Commit b90ddd08f6 ("malloc: Additional
checks for unsorted bin integrity I.") was committed without a
whitespace fix, so it is adjusted here as well.
2018-08-20 14:57:13 +02:00
Rajalakshmi Srinivasaraghavan fa78896b1f powerpc: Remove powerpc specific sinf and cosf optimization
New generic optimization of sinf and cosf introduced by commit
599cf39766 shows improvement
compared to powerpc specific assembly version.  Hence removing
the powerpc assembly versions to make use of generic code.
2018-08-20 08:47:43 +05:30
Florian Weimer 86a6c75a29 math: Regenerate s390 ulps
Based on results on a s390x 2964 machine, with -march=z196 and
-mtune=zEC12, and separately with -march=z13 and -mtune=z14.
2018-08-17 16:39:13 +02:00
Florian Weimer 6413fcde4f Add --with-nonshared-cflags option to configure 2018-08-17 11:44:39 +02:00
Florian Weimer 93a2584cd2 Makeconfig (ASFLAGS): Always append required assembler flags
Otherwise, it is impossible to set ASFLAGS differently from CFLAGS
without also overriding essential flags such as -Wa,--noexecstack.
2018-08-17 11:35:42 +02:00
Florian Weimer f6f275d2d9 Fix attribution of previous change in ChangeLog 2018-08-17 11:33:29 +02:00
Moritz Eckert d6db68e66d malloc: Mitigate null-byte overflow attacks
* malloc/malloc.c (_int_free): Check for corrupt prev_size vs size.
(malloc_consolidate): Likewise.
2018-08-16 21:26:16 -04:00
Pochang Chen 30a17d8c95 malloc: Verify size of top chunk.
The House of Force is a well-known technique to exploit heap
overflow. In essence, this exploit takes three steps:
1. Overwrite the size of top chunk with very large value (e.g. -1).
2. Request x bytes from top chunk. As the size of top chunk
   is corrupted, x can be arbitrarily large and top chunk will
   still be offset by x.
3. The next allocation from top chunk will thus be controllable.

If we verify the size of top chunk at step 2, we can stop such attack.
2018-08-16 15:24:24 -04:00
Siddhesh Poyarekar 34f86d6168 Reallocate buffers for every run in strlen
Try and avoid influencing performance of neighbouring functions.
2018-08-16 14:11:57 +05:30
Siddhesh Poyarekar 953a5a4a59 Print strlen benchmark output in json
Allow reading the benchmark using the compare_strings.py script.
2018-08-16 14:11:56 +05:30