Commit Graph

20407 Commits

Author SHA1 Message Date
Wainer dos Santos Moschetta dbcc7d0893 powerpc: refactor stpcpy, stpncpy, strcpy, and strncpy IFUNC.
Clean up the IFUNC implementations for powerpc in order to remove
unneeded macro definitions.

Tested on ppc64le with and without --disable-multi-arch flag.

	* sysdeps/powerpc/powerpc64/multiarch/stpcpy-power8.S: Define the
	implementation-specific function name and remove unneeded macros
	definition.
	* sysdeps/powerpc/powerpc64/multiarch/stpncpy-power7.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/stpncpy-power8.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strcpy-power8.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strncpy-power7.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strncpy-power8.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/strncpy.S: Set a default
	function name if not defined.
	* sysdeps/powerpc/powerpc64/power8/strcpy.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/strncpy.S: Likewise.
2017-04-11 17:13:31 -03:00
Paul Clarke d031600dd2 Support auxilliary vector components for cache geometries.
Add support to getauxval() for new types to get L1, L2, L3 cache sizes,
cache line sizes, and cache associativities.  The new types for
getauxval() were added in the stream for Linux kernel v4.11 in commit
98a5f361b8625c6f4841d6ba013bbf0e80d08147.

	* elf/elf.h (AT_L1I_CACHESIZE, AT_L1I_CACHEGEOMETRY, AT_L1D_CACHESIZE,
	AT_L1D_CACHEGEOMETRY, AT_L2_CACHESIZE, AT_L2_CACHEGEOMETRY,
	AT_L3_CACHESIZE, AT_L3_CACHEGEOMETRY): New.  Add auxvec
	identifiers from kernel arch/powerpc/include/uapi/asm/auxvec.h.
2017-04-11 14:05:54 -03:00
Florian Weimer a42478b7bf manual: readdir, readdir64 are thread-safe
They only modify the state in the dirstream argument, and we
generally do not treat this as a reason to mark a function as
not thread-safe.  For an example, see random_r, which is marked
as thread-safe even though the random state is not protected
by a lock.
2017-04-11 18:04:34 +02:00
Adhemerval Zanella 38efe8c5a5 Consolidate pthreadtype.h placementConsolidate pthreadtype.h placement
This patch moves all arch specific pthreadtypes.h to a similar path
for all architectures (sysdeps/unix/sysv/<arch>/bits).  No functional
or build change is expected.  The idea is mainly to organize the
header placement for all architectures.

Checked with a build for all major ABI (aarch64-linux-gnu, alpha-linux-gnu,
arm-linux-gnueabi, i386-linux-gnu, ia64-linux-gnu,
m68k-linux-gnu, microblaze-linux-gnu [1], mips{64}-linux-gnu, nios2-linux-gnu,
powerpc{64le}-linux-gnu, s390{x}-linux-gnu, sparc{64}-linux-gnu,
tile{pro,gx}-linux-gnu, and x86_64-linux-gnu).

	* sysdeps/unix/sysv/linux/x86/Implies: New file.
	* sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h: Move to ...
	* sysdeps/alpha/nptl/bits/pthreadtypes.h: ... here.
	* sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h: Move to ...
	* sysdeps/powerpc/nptl/bits/pthreadtypes.h: ... here.
	* sysdeps/x86/bits/pthreadtypes.h: Move to ...
	* sysdeps/x86/nptl/bits/pthreadtypes.h: ... here.
2017-04-10 17:33:10 -03:00
H.J. Lu fda19e0438 Add sysdeps/x86/dl-procinfo.c
Add sysdeps/x86/dl-procinfo.c for x86 version of processor capability
information to reduce duplication between i386 and x86_64 dl-procinfo.c.

	* sysdeps/i386/dl-procinfo.c: Include
	<sysdeps/x86/dl-procinfo.c>.
	* sysdeps/x86_64/dl-procinfo.c: Likewise.
	* sysdeps/x86/dl-procinfo.c: New file.
2017-04-10 12:01:45 -07:00
Gabriel F. T. Gomes 6d4adeb700 Remove unneeded declarations from math_private.h
The declarations of many functions in math_private.h are not required
since __MATHDECL and __MATHDECLX, in math.h, already provide the
declarations for these functions.  This patch removes the declarations
from math_private.h. It also adds the inclusion of math.h to the files
which depended on the declaration of functions in math_private.h.

Tested for powerpc64le and s390x.

	* sysdeps/generic/math_private.h: Remove declarations of
	many functions that are already declared in math.h.
	* sysdeps/ieee754/ldbl-128/e_logl.c: Include math.h to get the
	declaration for __frexpl.
	* sysdeps/ieee754/ldbl-128ibm/e_logl.c: Include math.h to get
	the declarations for __scalbnl and fabsl.
2017-04-10 12:20:47 -03:00
Dmitry V. Levin 9ace4692b2 Check for __mprotect failure in _dl_map_segments [BZ #20831]
* elf/dl-map-segments.h (_dl_map_segments): Check for failure
of __mprotect to change protection on the excess portion
to disallow all access.
2017-04-09 23:34:33 +00:00
H.J. Lu bf7730194f Check if SSE is available with HAS_CPU_FEATURE
Similar to other CPU feature checks, check if SSE is available with
HAS_CPU_FEATURE.

	* sysdeps/i386/fpu/fclrexcpt.c (__feclearexcept): Use
	HAS_CPU_FEATURE to check for SSE.
	* sysdeps/i386/fpu/fedisblxcpt.c (fedisableexcept): Likewise.
	* sysdeps/i386/fpu/feenablxcpt.c (feenableexcept): Likewise.
	* sysdeps/i386/fpu/fegetenv.c (__fegetenv): Likewise.
	* sysdeps/i386/fpu/fegetmode.c (fegetmode): Likewise.
	* sysdeps/i386/fpu/feholdexcpt.c (__feholdexcept): Likewise.
	* sysdeps/i386/fpu/fesetenv.c (__fesetenv): Likewise.
	* sysdeps/i386/fpu/fesetmode.c (fesetmode): Likewise.
	* sysdeps/i386/fpu/fesetround.c (__fesetround): Likewise.
	* sysdeps/i386/fpu/feupdateenv.c (__feupdateenv): Likewise.
	* sysdeps/i386/fpu/fgetexcptflg.c (__fegetexceptflag): Likewise.
	* sysdeps/i386/fpu/fsetexcptflg.c (__fesetexceptflag): Likewise.
	* sysdeps/i386/fpu/ftestexcept.c (fetestexcept): Likewise.
	* sysdeps/i386/setfpucw.c (__setfpucw): Likewise.
	* sysdeps/x86/cpu-features.h (bit_cpu_SSE): New.
	(index_cpu_SSE): Likewise.
	(reg_SSE): Likewise.
2017-04-07 07:44:59 -07:00
Paul Eggert 893ba3eac9 getopt: merge from gnulib: use angle-bracket includes consistently
* posix/getopt1.c: Include <config.h>, not "config.h".
2017-04-07 07:56:40 -04:00
Zack Weinberg 06576cbf4e getopt: annotate files with relationship to gnulib.
As the final act in this patchset, adjust the "This file is part of
the GNU C Library" message at the top of each file to indicate which
files are synced with gnulib.

	* posix/bits/getopt_core.h, posix/bits/getopt_ext.h
	* posix/getopt.c, posix/getopt1.c, posix/getopt_int.h:
	Mention in top-of-file boilerplate that these files are shared
	with gnulib.
	* posix/getopt.h, posix/bits/getopt_posix.h:
	Mention in top-of-file boilerplate that these files are NOT shared
	with gnulib, unlike the rest of the getopt implementation.
2017-04-07 07:53:37 -04:00
Zack Weinberg 10a33cf8b4 getopt: eliminate __need_getopt by splitting up getopt.h.
__need_getopt is misnamed; what it really means is "we want only the
getopt features specified in POSIX, not the GNU extensions".  Because
this code is shared with gnulib, it winds up being cleanest to split
getopt.h into *four* headers.  getopt_core.h and getopt_ext.h will
be shared with gnulib, getopt_posix.h will be just for glibc, and
each project will have its own copy of getopt.h.

	* posix/bits/getopt_core.h, posix/bits/getopt_ext.h:
	New files, intended to be shared with gnulib.
	* posix/bits/getopt_posix.h:
	New file, not intended to be shared with gnulib.
	* posix/getopt.h: Now just includes features.h,
	bits/getopt_core.h, and bits/getopt_ext.h.  Will
	no longer be shared with gnulib.
	* include/bits/getopt_core.h, include/bits/getopt_ext.h
	* include/bits/getopt_posix.h: New wrappers.
	* posix/Makefile: Install new headers.
	* posix/unistd.h, libio/stdio.h:
	Include bits/getopt_posix.h instead of getopt.h.
2017-04-07 07:53:03 -04:00
Zack Weinberg 0f3be8721a getopt: merge _GL_UNUSED annotations from gnulib
gnulib now has annotations on at least some functions to cater to
compilation with -Wunused-parameter.  In order to follow suit cleanly,
I've added to libc-symbols.h some of the _GL_* macros that
gnulib-common.m4 puts into config.h.  (I don't think they belong in
sys/cdefs.h, at least not without further thought.)

At this point all gnulib-side changes to getopt.c have been merged.

	* include/libc-symbols.h: For gnulib compatibility, define
	_GL_UNUSED, _GL_UNUSED_LABEL, _GL_ATTRIBUTE_PURE, and
	_GL_ATTRIBUTE_CONST.
	* posix/getopt.c (_getopt_initialize): Mark argc and argv
	parameters with _GL_UNUSED.
2017-04-07 07:52:29 -04:00
Zack Weinberg aeacb9f912 getopt: merge from gnulib: alloca avoidance
In one place, glibc's getopt uses alloca to construct a linked list of
possibilities for an "ambiguous" long option.  In gnulib, malloc
should be used instead.  Providing for both cases complicates things a
fair bit.  Instead of merging straight across, therefore, I have
chosen to rewrite it using a boolean vector instead of a linked list.
There is then only one allocation that might need freeing; in glibc it
can honor __libc_use_alloca as usual, and in gnulib we define
__libc_use_alloca to always be false, so we don't need ifdefs in the
middle of the function.  This should also be slightly more efficient
in the normal case of long options being fully spelled out -- I think
most people aren't even aware they _can_ sometimes abbreviate long
options.

One interesting consequence is that the list of possibilities is now
printed in exactly the order they appear in the list of long options,
instead of the first possibility being shuffled to the end.  This
shouldn't be a big deal but it did break one test that relied on the
exact text of this error message.

(The reason the previous patch was "in aid of" merging from gnulib is
I didn't want to have to make this change in two places.)

(The patch looks bigger than it really is because there's a fair bit
of reindentation and code rearrangement.)

	* posix/getopt.c: When used standalone, define __libc_use_alloca
	as always false and alloca to abort if called.
	(process_long_option): Rewrite handling of ambiguous long options
	to use a single boolean vector, not a linked list; use
	__libc_use_alloca to decide whether to allocate this using alloca.

	* posix/tst-getopt_long1.c: Adjust text of expected error message.
2017-04-07 07:51:52 -04:00
Zack Weinberg dfbea09f96 getopt: refactor long-option handling
There were two copies of the bulk of the code to handle long options.
Now there is only one.  (Yes, this is in aid of merging from gnulib.)

The change to bug-getopt4.c clarifies the error messages when the test
fails.

	* posix/getopt.c (process_long_option): New function split out
	from _getopt_internal_r.
	(_getopt_internal_r): Replace both copies of the long-option
	processing code with calls to process_long_option.
	* posix/bug-getopt4.c (one_test): Print argv[0] in error messages.
	(do_test): Differentiate argv[0] in the two subtests.
2017-04-07 07:51:28 -04:00
Zack Weinberg c1af8775f2 getopt: tidy up _getopt_initialize a bit
_getopt_data.__posixly_correct is completely redundant to
_getopt_data.__ordering, and some work that logically belongs in
_getopt_initialize was being done by _getopt_internal_r, making the
code harder to understand.

As a side effect, getenv will no longer be called if the first
character of the options string is '+' or '-', which is probably a
Good Thing.  (Perhaps we should have a flag character that
specifically asks for the permutation behavior?)

	* posix/getopt_int.h (_getopt_data): Remove __posixly_correct field.
	* posix/getopt.c (_getopt_internal_r): Move some initialization code...
	(_getopt_initialize): ...here. Don't set d->__posixly_correct.
2017-04-07 07:50:31 -04:00
Zack Weinberg 7a7be6c9a2 getopt: merge from gnulib: function prototype adjustments
For standards compliance, getopt, getopt_long, and getopt_long_only in
glibc have to take 'char *const *argv' even though they can mutate the
array.  gnulib has tried to clean this up as much as possible: all the
internal functions use 'char **argv', and when used standalone, so do
getopt_long and getopt_long_only.

Also brought over are __nonnull annotations, corrections to documentation,
and apparently it is no longer necessary to worry about conflicting
prototypes for getopt.  The macroification of the definitions of
getopt and __posix_getopt goes beyond what is currently in gnulib.

At this point getopt1.c and getopt_int.h are identical to their gnulib
versions.

	* posix/getopt.h: Add backup definition of __nonnull for
	consistency with gnulib.  Define __getopt_argv_const to const
	if not already defined.
	(getopt): Update doc comment from gnulib.  Prototype
	unconditionally.  Add __nonnull annotation.
	(__posix_getopt): Add __nonnull annotation.
	(getopt_long, getopt_long_only): Use __getopt_argv_const in
	prototypes for consistency with gnulib.  Add __nonnull
	annotations.
	* posix/getopt.c (_getopt_initialize, _getopt_internal_r)
	(getopt_internal): Change 'argv' argument to type 'char **'.
	Remove now-unnecessary casts.
	(getopt, __posix_getopt): Eliminate repetition with a macro.
	Cast 'argv' to 'char **' when calling _getopt_internal.
	* posix/getopt1.c (getopt_long, getopt_long_only):
	Use __getopt_argv_const for consistency with gnulib.
	Cast 'argv' to 'char **' when calling _getopt_internal.
	(_getopt_long_r, _getopt_long_only_r):
	Change 'argv' argument to type 'char **'.
	(main): Constify 'long_options'.
	* posix/getopt_int.h (getopt_internal, _getopt_internal_r)
	(_getopt_long_r, _getopt_long_only_r):
	Change 'argv' argument to type 'char **'.
2017-04-07 07:50:06 -04:00
Zack Weinberg 544ce845de getopt: clean up error reporting
getopt can print a whole bunch of error messages, and when used
standalone (from gnulib) it uses fprintf to do that.  But fprintf is a
cancellation point and getopt isn't, and also applying fprintf to a
stream in wide-character mode is not allowed.

glibc has an internal function called __fxprintf that writes a narrow
format string to a stream regardless of mode, but it only handles
ASCII format strings, and it's still a cancellation point.  getopt's
messages are translated, so they might not be ASCII.  So getopt has an
error message to an asprintf buffer, monkeys with internal flag bits
on stderr to disable cancellation, and then calls
__fxprintf(stderr, "%s", buffer).  There isn't even a helper function,
the code is duplicated every time.

This patch fixes __fxprintf to handle arbitrary multibyte format
strings, and adds a variant __fxprintf_nocancel that does the same
thing but also isn't a cancellation point.  (It still _works_ by
monkeying with internal flag bits on the FILE, but that's not really a
layering violation for code in stdio-common.)  All of the #ifdef _LIBC
blocks can then be reduced to their standalone versions with a little
help from some macros at the top of the file.

I also wrote a test case to verify that getopt really isn't a
cancellation point, and I'm glad I did, because it found two bugs, one
of which wasn't even to do with cancellation (see previous patch).

	* stdio-common/fxprintf.c (__fxprintf_nocancel): New function.
	(locked_vfxprintf): New helper function. Handle arbitrary
	multibyte strings, not just ASCII.
	* include/stdio.h: Declare __fxprintf_nocancel.

	* posix/getopt.c: When _LIBC is defined, define fprintf to
	__fxprintf_nocancel, flockfile to _IO_flockfile, and
	funlockfile to _IO_funlockfile.  When neither _LIBC nor
	_POSIX_THREAD_SAFE_FUNCTIONS is defined, define flockfile and
	funlockfile as no-ops.  (_getopt_internal_r): Remove all
	internal #ifdef _LIBC blocks; the standalone error-printing
	code can now be used for libc as well.  Add an
	flockfile/funlockfile pair around one case where the error
	message is printed in several chunks.  Don't use fputc.

	* posix/tst-getopt-cancel.c: New test.
	* posix/Makefile: Run it.
2017-04-07 07:48:57 -04:00
Zack Weinberg 7e161bef0b getopt: fix fencepost error in ambiguous-W-option handling
getopt_long contains an undocumented (AFAICT) feature in which, if you
put "W;" in the short-options list, then '-W foo' and '-Wfoo' are
treated as equivalent to '--foo'.  This is implemented with a partial
second copy of the code for handling long options, and that code
increments optind one too many times when recovering from an ambiguous
abbreviated option, which can cause the main loop to walk past the end
of argv and crash.

I discovered this while writing a test case that tries to exercise all
of getopt's error reporting paths; I wouldn't be surprised to learn
that this feature is never used by real applications.

	* posix/getopt.c (_getopt_internal_r): Don't increment
	d->optind a second time when reporting ambiguous -W options.
2017-04-07 07:47:58 -04:00
Zack Weinberg 7f71f9c1d6 getopt: merge straightforward changes from gnulib
This covers changes with little or no consequences when the code is
used in glibc.

	* posix/getopt_int.h: Include getopt.h.
	Use impl-namespace names for all arguments to _getopt_internal and
	_getopt_internal_r.
	Declare __ordering enum outside the struct.
	Harmonize comments with gnulib.
	* posix/getopt1.c: Simplify #ifdeffage at top of file. Remove
	ELIDE_CODE logic entirely.  Move inclusion of stdlib.h to
	#ifdef TEST block and make unconditional.  Do not define NULL.
	* posix/getopt.c: Partial merge from gnulib, covering the
	initial includes and global declarations, commentary, and
	a couple of semantically-neutral code changes.
2017-04-07 07:47:29 -04:00
Zack Weinberg 7784135eb0 getopt: merge from gnulib: don't use `...' quotes
I'm not sure whether this is official GNU style now, but `...' quotes
haven't looked properly balanced in most people's terminal fonts since
2001ish? and gnulib has chosen to switch over to '...' quotes.
I'm merging this separately from the other changes in gnulib because
it's very mechanical.

	* posix/getopt.c, posix/getopt.h, posix/getopt1.c, posix/getopt_int.h:
	Use '...' instead of `...' for quotation marks inside
	comments and strings.
2017-04-07 07:46:50 -04:00
Zack Weinberg bf079e19f5 getopt: remove USE_NONOPTION_FLAGS
glibc's implementation of getopt includes code to parse an environment
variable named _XXX_GNU_nonoption_argv_flags_ (where XXX is the
current process's PID in decimal); but all of it has been #ifdefed out
since 2001, with no official way to turn it back on.

According to commentary in our config.h.in, bash version 2.0 set this
environment variable to indicate argv elements that were the result of
glob expansion and therefore should not be treated as options, but the
feature was "disabled later" because "it caused problems".  According
to bash's CHANGES file, "later" was release 2.01; it gives no more
detail about what the problems were.

Version 2.0 of bash was released on the last day of 1996, and version
2.01 in June of 1997.  Twenty years later, I think it is safe to
assume that this environment variable isn't coming back.

	* config.h.in (USE_NONOPTION_FLAGS): Remove.
	* csu/init-first.c: Remove all #ifdef USE_NONOPTION_FLAGS blocks.
	* sysdeps/mach/hurd/i386/init-first.c: Likewise.
	* posix/getopt_int.h: Likewise.
	* posix/getopt.c: Likewise. Also remove SWAP_FLAGS and the
	__libc_argc and __libc_argv externs, which were only used by
	#ifdef USE_NONOPTION_FLAGS blocks.
	* posix/getopt_init.c: Remove file.
	* posix/Makefile (routines): Remove getopt_init.
	* include/getopt.h: Don't declare __getopt_initialize_environment.
	* manual/getopt.texi: Remove mention of USE_NONOPTION_FLAGS in
	a comment.
2017-04-07 07:45:53 -04:00
Florian Weimer e4e794841e resolv: Remove IQUERY support 2017-04-07 13:01:21 +02:00
Adhemerval Zanella bdc543e338 sparc: Fix .udiv plt on libc
With the removal of divdi3 object from sparcv9-linux-gnu build, its
definition came from libgcc and its functions internall calls .udiv.
Since glibc also exports these symbols for compatibility reasons, it
will end up creating PLT calls internally in libc.so.

To avoid it, this patch uses the linker option --wrap to replace all
the internal libc.so .udiv calls to the wrapper __wrap_.udiv. Along
with strong alias in the udiv implementations, it makes linker do
local calls.

Checked on sparcv9-linux-gnu.

	* sysdeps/sparc/sparc32/Makefile (libc.so-gnulib): New rule.
	* sysdeps/sparc/sparc32/sparcv8/udiv.S (.udiv): Make a strong_alias
	to __wrap_.udiv.
	* sysdeps/sparc/sparc32/sparcv9/udiv.S (.udiv): Likewise.
	* sysdeps/sparc/sparc32/udiv.S (.udiv): Likewise.
2017-04-06 15:14:44 -03:00
Adhemerval Zanella db3d848e15 Build divdi3 only for architecture that required it
As noted in [1], divdi3 object is only exported in a handful ABIs
(i386, m68k, powerpc32, s390-32, and ia64), however it is built
for all current architectures regardless.

This patch refact the make rules for this object to so only the
aforementioned architectures that actually require it builds it.

Also, to avoid internal PLT calls to the exported symbol from the
module, glibc uses an internal header (symbol-hacks.h) which is
unrequired (and in fact breaks the build for architectures that
intend to get symbol definitions from libgcc.a).  The patch also
changes it to create its own header (divdi3-symbol-hacks.h) and
adjust the architectures that require it accordingly.

I checked the build/check (with run-built-tests=no) on the
following architectures (which I think must cover all supported
ABI/builds) using GCC 6.3:

aarch64-linux-gnu
alpha-linux-gnu
arm-linux-gnueabihf
hppa-linux-gnu
ia64-linux-gnu
m68k-linux-gnu
microblaze-linux-gnu
mips64-n32-linux-gnu
mips-linux-gnu
mips64-linux-gnu
nios2-linux-gnu
powerpc-linux-gnu
powerpc-linux-gnu-power4
powerpc64-linux-gnu
powerpc64le-linux-gnu
s390x-linux-gnu
s390-linux-gnu
sh4-linux-gnu
sh4-linux-gnu-soft
sparc64-linux-gnu
sparcv9-linux-gnu
tilegx-linux-gnu
tilegx-linux-gnu-32
tilepro-linux-gnu
x86_64-linux-gnu
x86_64-linux-gnu-x32
i686-linux-gnu

I only saw one regression on sparcv9-linux-gnu (extra PLT call to
.udiv) which I address in next patch in the set.  It also correctly
build SH with GCC 7.0.1 (without any regression from c89721e25d).

[1] https://sourceware.org/ml/libc-alpha/2017-03/msg00243.html

	* sysdeps/i386/symbol-hacks.h: New file.
	* sysdeps/m68k/symbol-hacks.h: New file.
	* sysdeps/powerpc/powerpc32/symbol-hacks.h: New file.
	* sysdeps/s390/s390-32/symbol-hacks.h: New file.
	* sysdeps/unix/sysv/linux/i386/Makefile
	[$(subdir) = csu] (sysdep_routines): New rule: divdi3 object.
	[$(subdir) = csu] (sysdep-only-routines): Likewise.
	[$(subdir) = csu] (CFLAGS-divdi3.c): Likewise.
	* sysdeps/unix/sysv/linux/m68k/Makefile
	[$(subdir) = csu] (sysdep_routines): Likewise.
	[$(subdir) = csu] (sysdep-only-routines): Likewise.
	[$(subdir) = csu] (CFLAGS-divdi3.c): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/Makefile
	[$(subdir) = csu] (sysdep_routines): Likewise.
	[$(subdir) = csu] (sysdep-only-routines): Likewise.
	[$(subdir) = csu] (CFLAGS-divdi3.c): Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/Makefile
	[$(subdir) = csu] (sysdep_routines): Likewise.
	[$(subdir) = csu] (sysdep-only-routines): Likewise.
	[$(subdir) = csu] (CFLAGS-divdi3.c): Likewise.
	* sysdeps/wordsize-32/Makefile: Remove file.
	* sysdeps/wordsize-32/symbol-hacks.h: Definitions move to ...
	* sysdeps/wordsize-32/divdi3-symbol-hacks.h: ... here.
2017-04-06 15:14:34 -03:00
H.J. Lu 12fb180108 Define TEST_FUNCTION_ARGV in elf/tst-dlopen-aout.c
* elf/tst-dlopen-aout.c (TEST_FUNCTION): Removed.
	(TEST_FUNCTION_ARGV): New.
2017-04-05 14:09:38 -07:00
Wainer dos Santos Moschetta 36fe25fd0e Update elf tests to use the support test driver.
Replaced test-skeleton.c with support/test-driver.c and
adjusted the tests accordinly.

Checked on x86_64.

	* elf/next.c: Import support/test-driver.c instead of
	test-skeleton.c and delete TEST_FUNCTION macro definition.
	* elf/nodelete.c: Likewise.
	* elf/order2.c: Likewise.
	* elf/tst-_dl_addr_inside_object.c: Likewise.
	* elf/tst-addr1.c: Likewise.
	* elf/tst-align.c: Likewise.
	* elf/tst-align2.c: Likewise.
	* elf/tst-audit11.c: Likewise.
	* elf/tst-audit12.c: Likewise.
	* elf/tst-audit2.c: Likewise.
	* elf/tst-audit9.c: Likewise.
	* elf/tst-auxv.c: Likewise and define
	TEST_FUNCTION_ARGV macro.
	* elf/tst-deep1.c: Likewise.
	* elf/tst-dl-iter-static.c: Likewise.
	* elf/tst-dlmodcount.c: Likewise.
	* elf/tst-dlmopen1.c: Likewise.
	* elf/tst-dlmopen2.c: Likewise.
	* elf/tst-dlmopen3.c: Likewise.
	* elf/tst-dlopen-aout.c: Likewise.
	* elf/tst-dlopenrpath.c: Likewise.
	* elf/tst-dlsym-error.c: Likewise.
	* elf/tst-execstack-needed.c: Likewise.
	* elf/tst-execstack-prog.c: Likewise.
	* elf/tst-execstack.c: Likewise.
	* elf/tst-global1.c: Likewise.
	* elf/tst-gnu2-tls1.c: Likewise.
	* elf/tst-latepthread.c: Likewise.
	* elf/tst-leaks1.c: Likewise.
	* elf/tst-linkall-static.c: Likewise.
	(do_test): New function.
	* elf/tst-nodelete-opened.c: Likewise.
	* elf/tst-nodelete.cc: Likewise.
	* elf/tst-nodelete2.c: Likewise.
	* elf/tst-noload.c: Likewise.
	* elf/tst-null-argv.c: Likewise and define
	TEST_FUNCTION_ARGV marcro.
	* elf/tst-order-main.c: Likewise.
	* elf/tst-pathopt.c: Likewise.
	* elf/tst-pie2.c: Likewise.
	* elf/tst-piemod1.c: Likewise.
	* elf/tst-prelink.c: Likewise.
	* elf/tst-protected1a.c: Likewise.
	* elf/tst-protected1b.c: Likewise.
	* elf/tst-ptrguard1.c: Likewise, import getopt.h,
	and define _GNU_SOURCE macro.
	(cmdline_process_function): New function.
	* elf/tst-relsort1.c: Likewise.
	* elf/tst-stackguard1.c: Likewise, import getopt.h,
	and define _GNU_SOURCE macro.
	(cmdline_process_function): New function.
	* elf/tst-thrlock.c: Likewise.
	* elf/tst-tls-dlinfo.c: Likewise.
	* elf/tst-tls-manydynamic.c: Likewise and import
	support/xthread.h.
	* elf/tst-tls1.c: Likewise.
	* elf/tst-tls10.c: Likewise.
	* elf/tst-tls11.c: Likewise.
	* elf/tst-tls12.c: Likewise.
	* elf/tst-tls13.c: Likewise.
	* elf/tst-tls14.c: Likewise.
	* elf/tst-tls15.c: Likewise.
	* elf/tst-tls16.c: Likewise.
	* elf/tst-tls17.c: Likewise.
	* elf/tst-tls18.c: Likewise.
	* elf/tst-tls19.c: Likewise.
	* elf/tst-tls2.c: Likewise.
	* elf/tst-tls3.c: Likewise.
	* elf/tst-tls4.c: Likewise.
	* elf/tst-tls5.c: Likewise.
	* elf/tst-tls6.c: Likewise.
	* elf/tst-tls7.c: Likewise.
	* elf/tst-tls8.c: Likewise.
	* elf/tst-tls9.c: Likewise.
	* elf/tst-tlsalign-extern.c: Likewise.
	* elf/tst-tlsalign.c: Likewise.
	* elf/tst-unique1.c: Likewise.
	* elf/tst-unique2.c: Likewise.
	* elf/vismain.c: Likewise.
2017-04-05 10:34:58 -03:00
Wainer dos Santos Moschetta ff65c87443 Add page tests to string/test-strnlen.
May be tricky for otimized implementations to handle strings around
page boundary once, for instance, it is performed unaligned loads or
when maxlen is used as a hint for vectorized loops. The test cases
should unveil regression bugs on these cases.

To some extend do_random_tests in string/test-strnlen tests strings
placed at page end but it does not cover all cases. So this change
adds tests which consists of placing strings of varying sizes ending
at the page boundary. It also combines with different values of maxlen.

Tested on ppc64le and x86_64.

	* string/test-strnlen.c (do_page_tests): New function
	to check length of strings ending at the page boundary.
	(test_main): Added call to the do_page_tests function.
2017-04-05 10:28:41 -03:00
Wainer dos Santos Moschetta 18b6e2c86c powerpc64: Add POWER8 strnlen
Added strnlen POWER8 otimized for long strings. It delivers
same performance as POWER7 implementation for short strings.

This takes advantage of reasonably performing unaligned loads
and bit permutes to check the first 1-16 bytes until
quadword aligned, then checks in 64 bytes strides until unsafe,
then 16 bytes, truncating the count if need be.

Likewise, the POWER7 code is recycled for less than 32 bytes strings.

Tested on ppc64 and ppc64le.

	* sysdeps/powerpc/powerpc64/multiarch/Makefile
	(sysdep_routines): Add strnlen-power8.
	* sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
	(strnlen): Add __strnlen_power8 to list of strnlen functions.
	* sysdeps/powerpc/powerpc64/multiarch/strnlen-power8.S:
	New file.
	* sysdeps/powerpc/powerpc64/multiarch/strnlen.c
	(__strnlen): Add __strnlen_power8 to ifunc list.
	* sysdeps/powerpc/powerpc64/power8/strnlen.S: New file.
2017-04-05 10:26:58 -03:00
Wainer dos Santos Moschetta b2b1ea8b77 Update wcsmbs tests to use the support test driver
Replaced test-skeleton.c with support/test-driver.c and
adjusted the tests accordinly.

Checked on x86_64-linux-gnu.

	* wcsmbs/tst-btowc.c: Import support/test-driver.c and remove
	the TEST_FUNCTION macro definition.
	* wcsmbs/tst-mbrtowc2.c: Likewise.
	* wcsmbs/tst-mbsrtowcs.c: Likewise.
	* wcsmbs/tst-wchar-h.c: Likewise.
	* wcsmbs/tst-wcpncpy.c: Likewise.
	* wcsmbs/tst-wcrtomb.c: Likewise.
	* wcsmbs/tst-wcsnlen.c: Likewise.
	* wcsmbs/tst-wcstof.c: Likewise.
2017-04-04 18:05:20 -03:00
Adhemerval Zanella a358c80530 Remove CALL_THREAD_FCT macro
This patch removes CALL_THREAD_FCT macro usage and its defition for
x86.  For 32 bits it usage is only for force 16 stack alignment,
however stack is already explicit aligned in clone syscall.  For
64 bits and x32 it just a function call and there is no need to
code it with inline assembly.

Checked on i686-linux-gnu, x86_64-linux-gnu, and x86_64-linux-gnu-x32.

	* nptl/pthread_create.c (START_THREAD_DEFN): Remove
	CALL_THREAD_FCT macro usage.
	* sysdeps/i386/nptl/tls.h (CALL_THREAD_FCT): Remove definition.
	* sysdeps/x86_64/nptl/tls.h (CALL_THREAD_FCT): Likewise.
	* sysdeps/x86_64/32/nptl/tls.h: Remove file.
2017-04-04 18:03:35 -03:00
Adhemerval Zanella 2e4cf77897 Remove __ASSUME_REQUEUE_PI
The new cond var implementation (ed19993b5b) removed all the
__ASSUME_{REQUEUE_PI,FUTEX_LOCK_PI} internal usage so there is no
need to keep defining it.  This patch removes all USE_REQUEUE_PI
and __ASSUME_REQUEUE_PI.  It is as follow up from BZ#18463.

Checked with a build for x86_64-linux-gnu, arm-linux-gnueabhf,
m68-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu.

	* nptl/pthreadP.h (USE_REQUEUE_PI): Remove ununsed macro.
	* sysdeps/unix/sysv/linux/arm/kernel-features.h
	(__ASSUME_REQUEUE_PI): Likewise.
	* sysdeps/unix/sysv/linux/kernel-features.h
	(__ASSUME_REQUEUE_PI): Likewise.
	* sysdeps/unix/sysv/linux/m68k/kernel-features.h
	(__ASSUME_REQUEUE_PI): Likewise.
	* sysdeps/unix/sysv/linux/mips/kernel-features.h
	(__ASSUME_REQUEUE_PI): Likewise.
	* sysdeps/unix/sysv/linux/sparc/kernel-features.h
	(__ASSUME_REQUEUE_PI): Likewise.
2017-04-04 18:02:02 -03:00
Florian Weimer c3261cdb5b resolv: Add tst-resolv-canonname 2017-04-04 20:56:24 +02:00
Florian Weimer 44f28da7ca nss_dns: Replace local declarations with declarations from a header file 2017-04-04 20:56:23 +02:00
Florian Weimer 75b3a15e07 nss_dns: Remove superfluous dn_expand call from network handling 2017-04-04 20:56:23 +02:00
Florian Weimer 07d6f1a3ca resolv: Add test coverage for ns_name_unpack, ns_name_ntop 2017-04-04 20:56:17 +02:00
Stefan Liebler fce3da82e5 S390: Clobber also r14 in TLS_LD, TLS_GD macros on 31bit.
This patch also clobbers r14 in TLS_LD, TLS_GD macros on 31bit.
This ensures that r14 isn't used to save and restore r12 while
r14 is clobbered by the bas-instruction.

As note:
r12 can't be added to clobber list as gcc would fail with:
error: PIC register clobbered by ‘12’ in ‘asm’

For 64bit this fix was already done in 2004 in the
commit b80af23ac6.

ChangeLog:

	* sysdeps/s390/s390-32/tls-macros.h (TLS_LD, TLS_GD):
	Clobber also r14.
2017-04-04 13:16:28 +02:00
Mike Frysinger 83f0ad2bc6 ChangeLog: fix BZ style to be consistent and match majority of existing code 2017-04-03 15:18:07 -04:00
Mike Frysinger 21f042c804 posix_spawn: use a larger min stack for -fstack-check [BZ #21253]
When glibc is built with -fstack-check, trying to use posix_spawn can
lead to segfaults due to gcc internally probing stack memory too far.
The new spawn API will allocate a minimum of 1 page, but the stack
checking logic might probe a couple of pages.  When it tries to walk
them, everything falls apart.

The gcc internal docs [1] state the default interval checking is one
page.  Which means we need two pages (the current one, and the next
probed).  No target currently defines it larger.

Further, it mentions that the default minimum stack size needed to
recover from an overflow is 4/8KiB for sjlj or 8/12KiB for others.
But some Linux targets (like mips and ppc) go up to 16KiB (and some
non-Linux targets go up to 24KiB).

Let's create each child with a minimum of 32KiB slack space to support
them all, and give us future breathing room.

No test is added as existing ones crash.  Even a simple call is
enough to trigger the problem:
	char *argv[] = { "/bin/ls", NULL };
	posix_spawn(NULL, "/bin/ls", NULL, NULL, argv, NULL);

[1] https://gcc.gnu.org/onlinedocs/gcc-6.3.0/gccint/Stack-Checking.html
2017-04-03 15:15:41 -04:00
Wladimir J. van der Laan 622222846a Call the right helper function when setting mallopt M_ARENA_MAX (BZ #21338)
Fixes a typo introduced in commit
be7991c070. This caused
mallopt(M_ARENA_MAX) as well as the environment variable
MALLOC_ARENA_MAX to not work as intended because it set the
wrong internal parameter.

 	[BZ #21338]
	* malloc/malloc.c: Call do_set_arena_max for M_ARENA_MAX
	instead of incorrect do_set_arena_test
2017-04-01 12:39:10 +05:30
Gabriel F. T. Gomes 1361e98d56 Fix condition for inclusion of math-finite.h for long double
The condition for declaration of long double functions in
math-finite.h was #ifdef __MATH_DECLARE_LDOUBLE before the
macroization of this file.  After the macroization, it was incorreclty
changed to #if __MATH_DECLARE_LDOUBLE, which broke the build for arm.

	* math/math.h: Fix check for __MATH_DECLARE_LDOUBLE.
	* math/bits/math-finite.h: Likewise.
2017-03-31 14:50:00 -03:00
Slava Barinov ce39613205 fts: Fix symbol redirect for fts_set [BZ #21289]
In a 32-bit environment with _FILE_OFFSET_BITS=64, the __REDIRECT macro
combined with __THROW generates an invalid C++ declaration.
2017-03-31 09:11:16 +02:00
Adhemerval Zanella 2183741fdc Fix more test-errno issues
This patch fixes some test-errno-linux unexpected returns for the
tested syscalls on some older kernels (I saw it on a Linux 3.8 on
armv7l).  Basically:

   - inotify_add_watch: Linux v3.8 (676a0675c) removed the test to
     check at least one valid bit in flags (to return EINVAL).  It
     was later added back in v3.9 (04df32fa1).

   - quotactl: returns ENOSYS for kernels not configured with
     CONFIG_QUOTA.

Checked on x86_64-linux-gnu and armv7l-linux-gnueabihf.

	* sysdeps/unix/sysv/linux/test-errno-linux.c (do_test): Handle
	non expected inotify_add_watch and quotactl return.
2017-03-30 18:23:43 -03:00
Gabriel F. T. Gomes 10614335d1 Change return type in the declaration of __ieee754_rem_pio2l
The implementation of __ieee754_rem_pio2l in ldbl-128, ldbl-128ibm,
and ldbl-96 return the type int32_t, whereas math_private.h declares
it as returning int.  This patch changes the declaration to match the
declaration in thoses directories, as well as it changes the stub
implementation in math/e_rem_pio2l.c, similarly.

	* math/e_rem_pio2l.c (__ieee754_rem_pio2l): Change return type
	to int32_t.
	* sysdeps/generic/math_private.h: Declare __ieee754_rem_pio2l
	as returning int32_t.
2017-03-30 15:22:27 -03:00
Gabriel F. T. Gomes f264cca593 Macroize inclusion of math-finite.h
This patch macroizes the declarations in math/bits/math-finite.h
similarly to what math/bits/mathcalls.h does.  For each floating-point
type, the file is included once in math/math.h.  This will reduce the
amount of repetitive boilerplate required when adding float128
versions of these declarations.

Tested for powerpc64le and s390x.

	* math/math.h: Include bits/math-finite.h once per
	floating-point type.
	* math/bits/math-finite.h: Macroize all declarations by
	floating-point type.
2017-03-30 09:59:25 -03:00
Adhemerval Zanella 3abeeec5f4 Fix i686 memchr overflow calculation (BZ#21182)
This patch fixes the regression added by 23d2770 for final address
overflow calculation.  The subtraction of the considered size (16)
at line 120 is at wrong place, for sizes less than 16 subsequent
overflow check will not take in consideration an invalid size (since
the subtraction will be negative).  Also, the lea instruction also
does not raise the carry flag (CF) that is used in subsequent jbe
to check for overflow.

The fix is to follow x86_64 logic from 3daef2c where the overflow
is first check and a sub instruction is issued.  In case of resulting
negative size, CF will be set by the sub instruction and a NULL
result will be returned.  The patch also add similar tests reported
in bug report.

Checked on i686-linux-gnu and x86_64-linux-gnu.

	* string/test-memchr.c (do_test): Add BZ#21182 checks for address
	near end of a page.
	* sysdeps/i386/i686/multiarch/memchr-sse2.S (__memchr): Fix
	overflow calculation.
2017-03-29 09:54:14 -03:00
Steve Ellcey 29d92a8eda Change TEST_NAME to memcpy to fix IFUNC testing of multiple versions.
* benchtests/bench-memcpy-random.c (TEST_NAME): Change to memcpy.
	(IMPL) Call with 1 instead of 0 as argument.
2017-03-28 09:07:03 -07:00
Adhemerval Zanella dd5905de03 Consolidate set* Linux implementation
This patch consolidates the Linux setegid, seteuid, setgid, setgroups,
setregid, setresgid, setresuid, setreuid, and setuid implementation on
default sysdeps/unix/sysv/linux/set*.c implementation.  It basically
removes all the architecture define implementations and add support for
__NR_set*32 syscall on Linux default implementation.

Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu.

	* sysdeps/unix/sysv/linux/arm/setegid.c: Remove file.
	* sysdeps/unix/sysv/linux/arm/seteuid.c: Likewise.
	* sysdeps/unix/sysv/linux/arm/setgid.c: Likewise.
	* sysdeps/unix/sysv/linux/arm/setgroups.c: Likewise.
	* sysdeps/unix/sysv/linux/arm/setregid.c: Likewise.
	* sysdeps/unix/sysv/linux/arm/setresgid.c: Likewise.
	* sysdeps/unix/sysv/linux/arm/setresuid.c: Likewise.
	* sysdeps/unix/sysv/linux/arm/setreuid.c: Likewise.
	* sysdeps/unix/sysv/linux/arm/setuid.c: Likewise.
	* sysdeps/unix/sysv/linux/i386/setegid.c: Likewise.
	* sysdeps/unix/sysv/linux/i386/seteuid.c: Likewise.
	* sysdeps/unix/sysv/linux/i386/setgid.c: Likewise.
	* sysdeps/unix/sysv/linux/i386/setgroups.c: Likewise.
	* sysdeps/unix/sysv/linux/i386/setregid.c: Likewise.
	* sysdeps/unix/sysv/linux/i386/setresgid.c: Likewise.
	* sysdeps/unix/sysv/linux/i386/setresuid.c: Likewise.
	* sysdeps/unix/sysv/linux/i386/setreuid.c: Likewise.
	* sysdeps/unix/sysv/linux/i386/setuid.c: Likewise.
	* sysdeps/unix/sysv/linux/m68k/setegid.c: Likewise.
	* sysdeps/unix/sysv/linux/m68k/seteuid.c: Likewise.
	* sysdeps/unix/sysv/linux/m68k/setgid.c: Likewise.
	* sysdeps/unix/sysv/linux/m68k/setgroups.c: Likewise.
	* sysdeps/unix/sysv/linux/m68k/setregid.c: Likewise.
	* sysdeps/unix/sysv/linux/m68k/setresgid.c: Likewise.
	* sysdeps/unix/sysv/linux/m68k/setresuid.c: Likewise.
	* sysdeps/unix/sysv/linux/m68k/setreuid.c: Likewise.
	* sysdeps/unix/sysv/linux/m68k/setuid.c: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/setgroups.c: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/setegid.c: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/seteuid.c: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/setgid.c: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/setgroups.c: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/setregid.c: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/setresgid.c: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/setresuid.c: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/setreuid.c: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/setuid.c: Likewise.
	* sysdeps/unix/sysv/linux/sh/setegid.c: Likewise.
	* sysdeps/unix/sysv/linux/sh/seteuid.c: Likewise.
	* sysdeps/unix/sysv/linux/sh/setgid.c: Likewise.
	* sysdeps/unix/sysv/linux/sh/setgroups.c: Likewise.
	* sysdeps/unix/sysv/linux/sh/setregid.c: Likewise.
	* sysdeps/unix/sysv/linux/sh/setresgid.c: Likewise.
	* sysdeps/unix/sysv/linux/sh/setresuid.c: Likewise.
	* sysdeps/unix/sysv/linux/sh/setreuid.c: Likewise.
	* sysdeps/unix/sysv/linux/sh/setuid.c: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/setegid.c: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/seteuid.c: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/setgid.c: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/setgroups.c: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/setregid.c: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/setresgid.c: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/setresuid.c: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/setreuid.c: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/setuid.c: Likewise.
	* sysdeps/unix/sysv/linux/setegid.c (setegid): Use
	INLINE_SYSCALL_ERROR_RETURN_VALUE.
	* sysdeps/unix/sysv/linux/seteuid.c (seteuid): Likewise.
	* sysdeps/unix/sysv/linux/setgid.c (setgid): Use __NR_setgid32 if
	defined.
	* sysdeps/unix/sysv/linux/setgroups.c (setgroups): Use
	__NR_setgroups32 if defined.
	* sysdeps/unix/sysv/linux/setregid.c (__setregid): Use __NR_setregid32
	if defined.
	* sysdeps/unix/sysv/linux/setresgid.c (__setresgid): Use
	__NR_setresgid32 is defined.
	* sysdeps/unix/sysv/linux/setresuid.c (__setresuid): Use
	__NR_setresuid32 if defined.
	* sysdeps/unix/sysv/linux/setreuid.c (__setreuid): Use
	__NR_setreuid32 if defined.
	* sysdeps/unix/sysv/linux/setuid.c (__setuid): Use __NR_setuid32 if
	defined.
2017-03-28 12:29:27 -03:00
Joseph Myers 78c0581432 Define more termios.h macros unconditionally for alpha (bug 21277).
termios.h should define IUCLC for UNIX98 and older XSI standards.  The
sysdeps/unix/sysv/linux/alpha version defines it only if __USE_MISC,
so causing some conform/ tests to fail.

Other versions define it unconditionally (I* being a reserved
namespace for this header); the API should be consistent between
architectures in the absence of a clear reason for it to differ (and
given that a symbol is part of the API on two architectures, I don't
see any reason for the feature test macros required ever to differ
between those architectures), so this patch makes the alpha version
define it unconditionally as well.  Two non-POSIX macros alongside it,
IMAXBEL and IUTF8, are also defined unconditionally on other
architectures, so this patch makes them consistent by defining them
unconditionally on alpha as well.

Tested (compilation only) with build-many-glibcs.py.

	[BZ #21277]
	* sysdeps/unix/sysv/linux/alpha/bits/termios.h (IUCLC): Define
	unconditionally.
	(IMAXBEL): Likewise.
	(IUTF8): Likewise.
2017-03-27 15:07:38 +00:00
Szabolcs Nagy b737847f87 [AArch64] Update libm-test-ulps
* sysdeps/aarch64/libm-test-ulps: Update.
2017-03-27 12:02:47 +01:00
Sunyeop Lee 65eff7fbdb Update old tunables framework document/script.
Since commit 8b9e9c3c0b, security_level replaces
is_secure. There were some old files need to be updated.

2017-03-23  Sunyeop Lee  <sunyeop97@gmail.com>

	* README.tunables: Updated descriptions.
	* elf/dl-tunables.list: Fixed typo: SXID_NONE -> NONE.
	* scripts/gen-tunables.awk: Updated the code related to the commit.
2017-03-24 11:08:28 +05:30
Wilco Dijkstra 8d2030d659 Add a new randomized memcpy test for copies up to 256 bytes. The distribution
of the size and alignment is based on a trace of SPEC2006.  Instead of
repeating the same copy over and over again like the existing tests, it times
several thousand different copies to more accurately estimate the overhead of
branch prediction.

	* benchtests/Makefile (string-benchset): Add memcpy-random.
	* benchtests/bench-memcpy-random.c: New file.
2017-03-23 19:00:02 +00:00
Tulio Magno Quites Machado Filho ca4dc74659 Change the order of function attributes in printf.h
ISO C++ section 8.3.5 [dcl.fct] requires exception specifications
to appear before attribute specifiers in function declarations.

This patch fixes issues reported by stdio-common/check-installed-headers-cxx.

	* stdio-common/printf.h (register_printf_modifier): Change the
	order of __wur and __THROW.
	(register_printf_type): Likewise.
2017-03-23 15:48:59 -03:00
Wainer dos Santos Moschetta fb82116f24 Update string tests to use the support test driver.
Replaced all imports of test-skeleton.c with support/test-driver.c.

In some cases it was needed to adjust do_test to return int
instead of static int since that is the method's signature expected by
test-driver.c.

Checked on x86_64.

	* string/test-string.h (TEST_FUNCTION): Use test_main instead of
	test_main ().
	(CMDLINE_PROCESS): Use function instead of defined macro.
	* debug/test-strcpy_chk.c: Import support/test-driver.c and also
	<suppport/support.h> to use set_fortify_handler().
	* string/bug-envz1.c: Import support/test-driver.c instead of
	test-skeleton.c.
	* string/bug-strcoll2.c: Likewise.
	* string/bug-strtok1.c: Likewise.
	* string/stratcliff.c: Likewise.
	* string/test-ffs.c: Likewise.
	* string/test-memccpy.c: Likewise.
	* string/test-memchr.c: Likewise.
	* string/test-memcmp.c: Likewise.
	* string/test-memcpy.c: Likewise.
	* string/test-memmem.c: Likewise.
	* string/test-memmove.c: Likewise.
	* string/test-memrchr.c: Likewise.
	* string/test-memset.c: Likewise.
	* string/test-rawmemchr.c: Likewise.
	* string/test-strcasecmp.c: Likewise.
	* string/test-strcasestr.c: Likewise.
	* string/test-strcat.c: Likewise.
	* string/test-strchr.c: Likewise.
	* string/test-strcmp.c: Likewise.
	* string/test-strcpy.c: Likewise.
	* string/test-string.h: Likewise.
	* string/test-strlen.c: Likewise.
	* string/test-strncasecmp.c: Likewise.
	* string/test-strncat.c: Likewise.
	* string/test-strncmp.c: Likewise.
	* string/test-strncpy.c: Likewise.
	* string/test-strnlen.c: Likewise.
	* string/test-strpbrk.c: Likewise.
	* string/test-strrchr.c: Likewise.
	* string/test-strspn.c: Likewise.
	* string/test-strstr.c: Likewise.
	* string/tst-bswap.c: Likewise.
	* string/tst-cmp.c: Likewise.
	* string/tst-endian.c: Likewise.
	* string/tst-inlcall.c: Likewise.
	* string/tst-strcoll-overflow.c: Likewise.
	* string/tst-strfry.c: Likewise.
	* string/tst-strlen.c: Likewise.
	* string/tst-strtok.c: Likewise.
	* string/tst-strtok_r.c: Likewise.
	* string/tst-strxfrm.c: Likewise.
	* string/tst-strxfrm2.c: Likewise.
	* string/tst-svc.c: Likewise.
	* string/tst-svc2.c: Likewise.
2017-03-23 11:32:29 -03:00
Zack Weinberg b9e8c90875 Another round of inclusion fixes for _ISOMAC testsuite.
* stdio-common/bug25.c: Include stdlib.h.
	* support/tst-support_format_dns_packet.c: Include stdio.h,
	stdlib.h, and string.h.
	* support/tst-support_record_failure.c: Include string.h.
	* support/tst-support_record_failure-2.sh: Adjust line number
	expectations and correct a typo in an error message.
2017-03-22 08:44:32 -04:00
H.J. Lu c15f8eb50c x86-64: Improve branch predication in _dl_runtime_resolve_avx512_opt [BZ #21258]
On Skylake server, _dl_runtime_resolve_avx512_opt is used to preserve
the first 8 vector registers.  The code layout is

  if only %xmm0 - %xmm7 registers are used
     preserve %xmm0 - %xmm7 registers
  if only %ymm0 - %ymm7 registers are used
     preserve %ymm0 - %ymm7 registers
  preserve %zmm0 - %zmm7 registers

Branch predication always executes the fallthrough code path to preserve
%zmm0 - %zmm7 registers speculatively, even though only %xmm0 - %xmm7
registers are used.  This leads to lower CPU frequency on Skylake
server.  This patch changes the fallthrough code path to preserve
%xmm0 - %xmm7 registers instead:

  if whole %zmm0 - %zmm7 registers are used
    preserve %zmm0 - %zmm7 registers
  if only %ymm0 - %ymm7 registers are used
     preserve %ymm0 - %ymm7 registers
  preserve %xmm0 - %xmm7 registers

Tested on Skylake server.

	[BZ #21258]
	* sysdeps/x86_64/dl-trampoline.S (_dl_runtime_resolve_opt):
	Define only if _dl_runtime_resolve is defined to
	_dl_runtime_resolve_sse_vex.
	* sysdeps/x86_64/dl-trampoline.h (_dl_runtime_resolve_opt):
	Fallthrough to _dl_runtime_resolve_sse_vex.
2017-03-21 11:00:12 -07:00
Joseph Myers a640393a18 Regenerate INSTALL. 2017-03-21 16:40:16 +00:00
Thorsten Kukuk 261d0141b3 Merge branch 'master' of ssh://sourceware.org/git/glibc
Conflicts:
	ChangeLog
2017-03-21 16:47:00 +01:00
Stefan Liebler e4e26210c3 Fix failing test malloc/tst-interpose-nothread with GCC 7.
The test malloc/tst-interpose-nothread fails on s390x if built
with GCC 7 and glibc commit "Remove the str(n)dup inlines
from string/bits/string2.h. Although inlining"
(ae65d4f3c3) with output:
error: free: 0x3fffdffa010: invalid allocation index: 0 (not less than 0)

The destructor check_for_allocations in malloc/tst-interpose-aux.c is
called twice.  One time after the test-child-process has finished successfully
and once after the test-parent-process finishes.
During the latter invocation, allocation_index == 0.  GCC 7 is now inlining the
free function and calls unconditionally fail in get_header as
header->allocation_index (type == size_t) is always >= allocation_index (= 0).
Before the mentioned commit above, strdup was replaced by strlen, malloc and
memcpy.  The malloc call was also inlined and allocation_index was set to one.

This patch moves the already existing compiler barrier before the invocation
of free.

ChangeLog:

	* malloc/tst-interpose-aux.c (check_for_allocations):
	Move compiler barrier before free.
2017-03-21 16:41:56 +01:00
Thorsten Kukuk 1e4d83f6fe Deprecate libnsl by default (only shared library will be
build for backward compatibility, no linking possible) and disable building
of libnss_compat, libnss_nis and libnss_nisplus, except --enable-obsolete-nsl
option is given to configure.

        * config.h.in: Add LINK_OBSOLETE_NSL.
        * config.make.in: Add build-obsolete-nsl.
        * configure.ac: Add obsolete-nsl option.
        * include/libc-symbols.h: Define libnsl_hidden_nolink_def.
        * include/rpcsvc/yp.h: Add missing functions as libnsl_hidden_proto.
        * include/rpcsvc/nislib.h: Likewise.
        * include/rpcsvc/ypclnt.h: Likewise.
        * manual/install.texi: Document --enable-obsolete-nsl.
        * nis/Makefile: Build only libnsl by default (add build-obsolete-nsl).
        * nis/nis_add.c: Replace libnsl_hidden_def with
        libnsl_hidden_nolink_def.
        * nis/nis_addmember.c: Likewise.
        * nis/nis_call.c: Likewise.
        * nis/nis_clone_obj.c: Likewise.
        * nis/nis_defaults.c: Likeise.
        * nis/nis_domain_of_r.c: Likewise.
        * nis/nis_error.c: Likewise.
        * nis/nis_file.c: Likewise.
        * nis/nis_free.c: Likewise.
        * nis_local_names.c: Likewise.
        * nis/nis_lookup.c: Likewise.
        * nis/nis_modify.c: Likewise.
        * nis/nis_print.c: Likewise.
        * nis/nis_remove.c: Likewise.
        * nis/nis_table.c: Likewise.
        * nis/nis_util.c: Likewise.
        * nis/nis_xdr.c: Likewise.
        * nis/yp_xdr.c: Likewise.
        * nis/ypclnt.c: Likewise.
        * nis/ypupdate_xdr.c: Likewise.
        * nis/nis_checkpoint.c: Add libnsl_hidden_nolink_def to all functions.
        * nis/nis_clone_dir.c: Likewise.
        * nis/nis_clone_res.c: Likewise.
        * nis/nis_creategroup.c: Likewise.
        * nis/nis_destroygroup.c: Likewise.
        * nis/nis_domain_of.c: Likewise.
        * nis/nis_getservlist.c: Likewise.
        * nis/nis_ismember.c: Likewise.
        * nis/nis_mkdir.c: Likewise.
        * nis/nis_ping.c: Likewise.
        * nis/nis_print_group_entry.c: Likewise.
        * nis/nis_removemember.c: Likewise.
        * nis/nis_rmdir.c: Likewise.
        * nis/nis_server.c: Likewise.
        * nis/nis_subr.c: Likewise.
        * nis/nis_verifygroup.c: Likewise.

Signed-off-by: Thorsten Kukuk <kukuk@suse.com>
2017-03-21 15:14:27 +01:00
Joseph Myers 76b2c32a16 conformtest: Add x32 XFAILs for mq_attr element types (bug 21279).
POSIX specifies long as the type of elements of struct mq_attr.  For
x32, they are __syscall_slong_t (i.e. long long).  This patch XFAILs
the corresponding tests for x32 in the conformtest expectations (the
bug should not be closed without an actual fix).

Tested with build-many-glibcs.py.

	[BZ #21279]
	* sysdeps/unix/sysv/linux/x86_64/x32/Makefile
	[$(subdir) = conform] (conformtest-xfail-conds): Update comment.
	* conform/data/mqueue.h-data (mq_attr.mq_flags): XFAIL for
	x86_64-x32-linux.
	(mq_attr.mq_maxmsg): Likewise.
	(mq_attr.mq_msgsize): Likewise.
	(mq_attr.mq_curmsgs): Likewise.
2017-03-20 21:30:28 +00:00
Joseph Myers 112039611c conformtest: Add mips XFAIL for struct stat st_rdev type (bug 21278).
MIPS o32 struct stat has the wrong type of st_rdev.  This patch XFAILs
that test in the conformtest expectations for this case (the bug
should not be closed without an actual fix, however).

Tested with build-many-glibcs.py.

	[BZ #21278]
	* sysdeps/unix/sysv/linux/mips/mips32/Makefile
	[$(subdir) = conform] (conformtest-xfail-conds): Update comment.
	* conform/data/sys/stat.h-data (stat.st_rdev): XFAIL for
	mips-o32-linux.
2017-03-20 21:28:16 +00:00
Joseph Myers ba7fe6906d Fix alpha termios.h NL2, NL3 namespace (bug 21268).
sysdeps/unix/sysv/linux/alpha/bits/termios.h defines NL2 and NL3 for
__USE_MISC || __USE_XOPEN.  These should only be defined for
__USE_MISC as they are not part of any standard namespace.  This patch
conditions them accordingly, matching the powerpc version of the
header (the only other one in glibc that defines these macros).

Tested (compilation only) with build-many-glibcs.py.

	[BZ #21268]
	* sysdeps/unix/sysv/linux/alpha/bits/termios.h (NL2): Define only
	if [__USE_MISC]
	(NL3): Likewise.
2017-03-20 17:32:19 +00:00
Mike Frysinger ddc3fb3334 posix_spawn: fix stack setup on ia64 [BZ #21275]
The ia64-specific clone2 call expects the base of the stack mapping and
the stack size as sep arguments, not an initial stack value as on other
stack-grows-down architectures.  Reuse the stack-grows-up macro so we
pass in the right stack base.

Reported-by: Matt Turner <mattst88@gentoo.org>
2017-03-20 10:42:34 -04:00
Christian Brauner 15e9a4f378 linux ttyname and ttyname_r: do not return wrong results
If a link (say /proc/self/fd/0) pointing to a device, say /dev/pts/2, in a
parent mount namespace is passed to ttyname, and a /dev/pts/2 exists (in a
different devpts) in the current namespace, then it returns /dev/pts/2.
But /dev/pts/2 is NOT the current tty, it is a different file and device.

Detect this case and return ENODEV.  Userspace can choose to take this as a hint
that the fd points to a tty device but to act on the fd rather than the link.

Signed-off-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-03-19 17:36:13 +00:00
Joseph Myers 345118d7f5 conformtest: XFAIL tv_nsec tests for x32 (bug 16437).
This patch XFAILs the conformtest tv_nsec tests for x32 so that the
incorrect type does not potentially hide other failures.  As this is
not a fix for the bug, it should remain open in Bugzilla.

Tested (compilation only) with build-many-glibcs.py.

	[BZ #16437]
	* sysdeps/unix/sysv/linux/x86_64/x32/Makefile
	[$(subdir) = conform] (conformtest-xfail-conds): New variable.
	* conform/data/signal.h-data (timespec.tv_nsec): XFAIL for
	x86_64-x32-linux.
	* conform/data/sys/select.h-data (timespec.tv_nsec): Likewise.
	* conform/data/sys/stat.h-data (timespec.tv_nsec): Likewise.
	* conform/data/time.h-data (timespec.tv_nsec): Likewise.
2017-03-18 00:24:13 +00:00
Joseph Myers 19641dbd61 Fix sparc64 bits/setjmp.h namespace (bug 21261).
sysdeps/unix/sysv/linux/sparc/bits/setjmp.h defines 64-bit __jmp_buf
with a load of identifiers that are not part of any standard
namespace, resulting in conform/ tests failing.  This patch fixes this
by moving those identifiers to the implementation namespace, so
enabling the conform/ tests to pass for sparc64.

Tested (compilation only) for sparc64 with build-many-glibcs.py.

	[BZ #21261]
	* sysdeps/unix/sysv/linux/sparc/bits/setjmp.h
	[__WORDSIZE == 64 && !_ASM] (__sparc64_jmp_buf): Use reserved
	names for all fields.
	* sysdeps/sparc/sparc64/jmpbuf-unwind.h (_JMPBUF_UNWINDS): Update
	for jmp_buf field renaming.
	(_JMPBUF_UNWINDS_ADJ): Likewise.
2017-03-18 00:17:25 +00:00
Joseph Myers 22b72f356d conformtest: Handle conditional XFAILs with allow-header.
This patch fixes the conformtest handling of headers listed in
allow-header to process xfail[cond]- in the expectations for those
headers.

Tested with build-many-glibcs.py.

	* conform/conformtest.pl: Handle xfail[cond]- in header mentioned
	with allow-header.
2017-03-18 00:16:05 +00:00
DJ Delorie 17f487b7af Further harden glibc malloc metadata against 1-byte overflows.
Additional check for chunk_size == next->prev->chunk_size in unlink()

2017-03-17  Chris Evans  <scarybeasts@gmail.com>

	* malloc/malloc.c (unlink): Add consistency check between size and
	next->prev->size, to further harden against 1-byte overflows.
2017-03-17 15:31:38 -04:00
H.J. Lu b170d2e7ab Use CPU_FEATURES_CPU_P to check if AVX is available
Don't use bit_cpu_AVX directly.

	* sysdeps/x86/cpu-features.c (init_cpu_features): Check AVX with
	CPU_FEATURES_CPU_P.
2017-03-17 11:38:13 -07:00
Joseph Myers 20409ce5e8 Make alpha termios.h define IXANY unconditionally (bug 21259).
sysdeps/unix/sysv/linux/alpha/bits/termios.h defines IXANY only if
__USE_MISC.  But it's in the base standard for POSIX.1:2008, and
XSI-shaded in previous standards.  This patch makes the header define
it unconditionally, like other versions of this header do (it's always
reserved by standards that don't require it, so defining
unconditionally is OK by the standards).

Tested (compilation only) for alpha with build-many-glibcs.py.  Note
that there are still termios.h conformtest failures after this patch
because of other issues with the alpha version of this header.

	[BZ #21259]
	* sysdeps/unix/sysv/linux/alpha/bits/termios.h (IXANY): Define
	unconditionally, not just for [__USE_MISC].
2017-03-17 16:27:03 +00:00
Joseph Myers 0cb521871b conformtest: Add mips XFAIL for struct stat st_dev type (bug 17786).
As noted in bug 17786, MIPS o32 struct stat has the wrong type of
st_dev.  This patch XFAILs that test in the conformtest expectations
for this case (the test still fails after the patch because there's
also a similar issue for st_rdev that needs reporting and XFAILing
separately, and the bug should not be closed without an actual fix,
not just XFAILing).

Tested for mips with build-many-glibcs.py.

	[BZ #17786]
	* sysdeps/unix/sysv/linux/mips/mips32/Makefile: New file.
	* conform/data/sys/stat.h-data (stat.st_dev): XFAIL for
	mips-o32-linux.
2017-03-17 02:54:59 +00:00
Joseph Myers d19887f8bb Add missing piece to last ChangeLog entry. 2017-03-17 02:50:51 +00:00
Joseph Myers bb5cc234e1 conformtest: Add alpha XFAIL for struct netent n_net type (bug 21260).
As noted in bug 21260, sysdeps/unix/sysv/linux/alpha/bits/netdb.h
defines struct netent with n_net of type unsigned long instead of the
correct uint32_t.  This patch XFAILs that test in the conformtest
expectations for alpha.  (This is not a fix for the bug, and it should
not be closed without an actual fix.)

Tested for alpha with build-many-glibcs.py.

	[BZ #21260]
	* sysdeps/unix/sysv/linux/alpha/Makefile
	[$(subdir) = conform] (conformtest-xfail-conds): New variable.
2017-03-17 02:42:16 +00:00
Joseph Myers c33eac51f4 conformtest: Skip execution tests when cross-compiling.
This patch makes conformtest skip execution tests when
cross-compiling, as an interim step towards running most of these
tests (presently disabled) in that case.  It omits the (obvious)
Makefile change to actually enable the conformtest tests when
cross-compiling, as there are still enough failures seen with
build-many-glibcs.py that I'd like to get the results cleaner before
enabling these tests.

Tested for x86_64, and with the tests actually enabled for
cross-compilation with build-many-glibcs.py.

	* conform/conformtest.pl ($cross): New variable.
	(--cross): New command-line option.
	(runtest): Skip test execution when cross-compiling.
	* conform/Makefile (conformtest-cross): New variable.
	($(conformtest-header-tests)): Pass $(conformtest-cross) to
	conformtest.pl.
2017-03-17 01:21:10 +00:00
Joseph Myers 33c02810c5 conformtest: Support system-specific XFAILs.
conformtest has an internal XFAIL mechanism to allow failures of
individual expectations to be ignored, so that known hard-to-fix
failures (e.g. those affecting ABIs or requiring kernel changes) do
not cause the overall tests to FAIL and so hide other failures from
the same (header, standard) pair.

Various such bugs are system-specific, so this patch adds a mechanism
to allow system-specific XFAILs.  A system-independent XFAIL is
achieved by putting "xfail-" at the start of the relevant expectation
in the *-data files.  A system-specific XFAIL instead uses
"xfail[cond]-", where "cond" is a condition listed in
conformtest-xfail-conds in a sysdeps makefile (so one for x32 might
set conformtest-xfail-conds = x86_64-x32-linux, for example, and then
an expectation for tv_nsec's type could use
xfail[x86_64-x32-linux]-).  The actual names are arbitrary, just
needing to match between the makefiles and the expectations, and if
necessary you can use "xfail[cond1|cond2]-" for a test that is
expected to fail under multiple conditions.  As with
system-independent XFAILs, I think system-specific ones should have a
bug filed in Bugzilla and a comment referencing that bug.

Tested for x86_64, including with test expectations and makefiles
changed to use the new facility.

	* conform/conformtest.pl ($xfail_str): New variable.
	(--xfail=): New command-line option.
	(top level): Handle expectations starting xfail[cond]-.
	* conform/Makefile (conformtest-xfail): New variable.
	($(conformtest-header-tests)): Pass $(conformtest-xfail) to
	conformtest.pl.
2017-03-17 01:08:27 +00:00
Joseph Myers 0fbca26c39 conformtest: Make more tests into compilation tests.
The conformtest header tests test some things through compilation
tests and others through execution tests.  This patch makes more of
the tests into compilation tests, using _Static_assert (note: for
float.h tests on floating-point values this is depending on a GNU
extension, that those assertions are allowed in the absence of
-pedantic although they aren't strictly integer constant expressions).
The remaining execution tests are for values of things listed as
"symbol" (in fact no such things have a value expectation listed) and
for values of macros defined as string constants (three such values
listed in total).

This is intended as preparation for enabling the vast bulk of the
tests to run for cross compilation.  (Even the few remaining execution
tests ought in principle to run for cross compilation when a test
wrapper is defined, but that's more complicated.  The existing
execution tests for native builds in fact are linked and run with an
existing installed libc that's required to exist to link against,
rather than with the newly built libc; only the new headers are used.)

Tested for x86_64.

	* conform/conformtest.pl: Use compilation instead of execution
	tests for testing values of constants and usability in #if.
2017-03-16 17:51:23 +00:00
Tulio Magno Quites Machado Filho 598fe6d9f4 XFAIL catan and catanh tests on ibm128
Mark 4 catan and catanh tests as xfail-rounding:ibm128-libgcc.
After this patch all catan and catanh tests pass on ibm128.

Regenerated auto-libm-test-out using gmp 6.1.2, mpfr 3.1.5 and upstream
mpc (9ef8030e50),

Tested on powerpc, powerpc64 and powerpc64le.

	* math/auto-libm-test-in: Mark some catan and catanh as
	xfail-rounding:ibm128-libgcc.
	* math/auto-libm-test-out-catan: Regenerate.
	* math/auto-libm-test-out-catanh: Likewise.
2017-03-16 10:36:37 -03:00
Joseph Myers 2072f5c34e Remove C++ namespace handling from glibc headers.
glibc headers include some code (not particularly consistent or
systematic) to put various declarations in C++ namespaces std and
__c99, if _GLIBCPP_USE_NAMESPACES is defined.

As noted in <https://gcc.gnu.org/ml/libstdc++/2017-03/msg00025.html>,
this macro was removed from libstdc++ in 2000.  I don't expect
compilation with such old versions of libstdc++ to work with current
glibc headers anyway (whereas old *binaries* are expected to stay
working with current glibc); this patch (which should be a no-op with
any libstdc++ version postdating that removal) removes all this code
from the glibc headers.

The begin-end-check.pl test, whose comments say it is about checking
these namespace macro calls, is also removed.  The code in that test
would have covered __BEGIN_DECLS / __END_DECLS as well, but if those
weren't properly matched it would show up with the
check-installed-headers-cxx tests, so I don't think there is an actual
use for keeping begin-end-check.pl with the namespace code removed.

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).

	* misc/sys/cdefs.h (__BEGIN_NAMESPACE_STD): Remove macro.
	(__END_NAMESPACE_STD): Likewise.
	(__USING_NAMESPACE_STD): Likewise.
	(__BEGIN_NAMESPACE_C99): Likewise.
	(__END_NAMESPACE_C99): Likewise.
	(__USING_NAMESPACE_C99): Likewise.
	* math/math.h (_Mdouble_BEGIN_NAMESPACE): Do not define and
	undefine macro.
	(_Mdouble_END_NAMESPACE): Likewise.
	* ctype/ctype.h: Do not handle C++ namespaces.
	* libio/bits/stdio-ldbl.h: Likewise.
	* libio/stdio.h: Likewise.
	* locale/locale.h: Likewise.
	* math/bits/mathcalls.h: Likewise.
	* setjmp/setjmp.h: Likewise.
	* signal/signal.h: Likewise.
	* stdlib/bits/stdlib-float.h: Likewise.
	* stdlib/bits/stdlib-ldbl.h: Likewise.
	* stdlib/stdlib.h: Likewise.
	* string/string.h: Likewise.
	* sysdeps/x86/fpu/bits/mathinline.h: Likewise.
	* time/bits/types/clock_t.h: Likewise.
	* time/bits/types/struct_tm.h: Likewise.
	* time/bits/types/time_t.h: Likewise.
	* time/time.h: Likewise.
	* wcsmbs/bits/wchar-ldbl.h: Likewise.
	* wcsmbs/uchar.h: Likewise.
	* wcsmbs/wchar.h: Likewise.
	[_GLIBCPP_USE_NAMESPACES] (wint_t): Remove conditional definition.
	* wctype/wctype.h: Do not handle C++ namespaces.
	* scripts/begin-end-check.pl: Remove.
	* Makefile (installed-headers): Likewise.
	(tests-special): Do not add $(objpfx)begin-end-check.out.
	($(objpfx)begin-end-check.out): Remove.
2017-03-16 13:31:57 +00:00
Steve Ellcey d6fc3f6516 Add ChangeLog entry for aarch64 ifunc support patch.
Forgot to add ChangeLog entry.
2017-03-15 16:48:25 -07:00
Mike Frysinger fbe355fbd1 x86_64: fix static build of __mempcpy_chk for compilers defaulting to PIC/PIE
When glibc is compiled with gcc 6.2 that has been configured with
to default to PIC/PIE, the static version of __mempcpy_chk is not built,
as the test is done on PIC instead of SHARED.  Fix the test to check for
SHARED, like it is done for similar functions like __memcpy_chk.

2017-03-12  Mike Frysinger  <vapier@gentoo.org>

	* sysdeps/x86_64/mempcpy_chk.S (__mempcpy_chk): Check for SHARED
	instead of PIC.
2017-03-15 16:10:05 -07:00
Joseph Myers e4e52ff059 Improve float range reduction accuracy near pi/2 (bug 21094).
Bug 21094 reports 3ulp errors of cosf and tanf for certain arguments
near pi/2 arising from the use of an insufficiently accurate range
reduction.  (To be clear, this is a quality-of-implementation issue
relating to the apparent intent of those particular cosf and tanf
implementations; 3ulp is within the general glibc accuracy goals, so
not inherently a bug.)

This patch fixes that error by making a wider range of cases use the
existing more accurate range reduction for arguments close to pi/2.
The wider range of values is still narrow enough for the "z -=
pio2_2;" in the more accurate case to be exact, as the code expects.

Tested for x86_64, x86 and mips64; no ulps updates needed (but at
least on mips64, the larger ulps were seen if the tests were added
without the substantive fix).

	[BZ #21094]
	* sysdeps/ieee754/flt-32/e_rem_pio2f.c (__ieee754_rem_pio2f): Use
	24+24+24-bit pi for wider range of values around pi/2.
	* math/auto-libm-test-in: Add more tests of cos and tan.
	* math/auto-libm-test-out-cos: Regenerated.
	* math/auto-libm-test-out-tan: Likewise.
2017-03-15 22:00:54 +00:00
John David Anglin 5d20a49aac hppa: Fix setting of __libc_stack_end
The binutils package was recently changed to fix -z relro support on hppa.
See ld/21000 for details:
https://sourceware.org/bugzilla/show_bug.cgi?id=21000

This exposed a problem with the _dl_start_user function in the RTLD_START
define.  We need to set __libc_stack_end before it is made read only.  For
this, we need to define DL_STACK_END.  The offset of 0x160 gives the same
stack end as the code in _dl_start_user.

A build log with the attached patch is here:
https://buildd.debian.org/status/fetch.php?pkg=glibc&arch=hppa&ver=2.24-9&stamp=1487639205&raw=0
2017-03-15 13:37:16 -07:00
Alexey Neyman 3ab2021fea Fix build with --enable-static-nss [BZ #21088]
Signed-off-by: Alexey Neyman <stilor@att.net>
2017-03-15 13:32:23 -07:00
Alexey Neyman e37fc4aa68 Fix combreloc test with BSD grep
The test for "-z combreloc" fails when cross-compiling on a machine
that uses BSD grep (e.g. on macos). grep complains about empty
subexpression and exits with non-zero status, which is interpreted
by configure as "not found". As a result, support for "-z combreloc"
(HAVE_Z_COMBRELOC) is not detected, leading to link failure on SPARC.

While there, replace fgrep with 'grep -F', as fgrep is non-POSIX.

	* configure.ac: Avoid empty subexpression in grep.

Signed-off-by: Alexey Neyman <stilor@att.net>
2017-03-15 13:26:13 -07:00
Adhemerval Zanella b36a65e5ca Fix test-errno issues
This patch fixes multiple issues of test-errno.c (9a56f87183):

  - Rename Linux test-errno.c to test-errno-linux.c to avoid build
    the same source for both tests.

  - Add a mlock check for 32 bits build running on 64 bits kernels.
    Althuough man pages states that mlock fails with EINVAL if final
    address overflows, kernels does not return it for aforementioned
    condition (it returns ENOMEM instead).  Although it seems to be
    a kernel issue for compat syscall handling, I think it is worth
    to still check syscall return and document the behavior.

  - Initialize option lenght for setsockopt check.

  - Change open test from EINVAL to EISDIR.

Checked on x86_64-linux-gnu and i686-linux-gnu (running on 64 bits
kernel).

	* posix/test-errno.c (do_test): Initialize setsockopt optlen.
	* sysdeps/unix/sysv/linux/test-errno.c: Move to ...
	* sysdeps/unix/sysv/linux/test-errno-linux.c: ... here.
	(test_wrp_rv): Fix format.
	(test_wrp_rv2): New macro.
	(do_test): Handle mlock return on 64 bits kernels with 32 bits
	binaries.
2017-03-15 17:05:34 -03:00
Joseph Myers ffe308e4fc Fix test-math-vector-sincos.h aliasing.
x86_64 libmvec tests have been failing to build lately with GCC
mainline with -Wuninitialized errors, and Markus Trippelsdorf traced
this to an aliasing issue
<https://sourceware.org/ml/libc-alpha/2017-03/msg00169.html>.

This patch fixes the aliasing issue, so that the vectors-of-pointers
are initialized using a union instead of pointer casts.  This also
fixes the testsuite build failures with GCC mainline.

Tested for x86_64 (full testsuite with GCC 6; testsuite build with GCC
mainline with build-many-glibcs.py).

	* sysdeps/x86/fpu/test-math-vector-sincos.h (INIT_VEC_PTRS_LOOP):
	Use a union when storing pointers.
	(VECTOR_WRAPPER_fFF_2): Do not take address of integer vector and
	cast result when passing to INIT_VEC_PTRS_LOOP.
	(VECTOR_WRAPPER_fFF_3): Likewise.
	(VECTOR_WRAPPER_fFF_4): Likewise.
2017-03-15 17:32:46 +00:00
Gabriel F. T. Gomes ff80ec4283 Split helper classification macros from mathcalls.h
The classification macros: finite, fpclassify, iseqsig, isinf, isnan,
issignaling, and signbit are defined by ISO C11 and declared in
mathcalls.h for each of the floating-point types: float, double, and
long double.

TS 18661-3 does not mention these macros for float128, however support
for them must be present when _Float128 is present.  This is true,
even when the feature test macro __STDC_WANT_IEC_60559_TYPES_EXT__ is
false.  Other function declarations in mathcalls.h, on the other hand,
depend on __STDC_WANT_IEC_60559_TYPES_EXT__.

This patch splits the helper functions (__finite, __fpclassify,
__iseqsig, __isinf, __isnan, __issignaling, and __signbit) from
mathcalls.h, so that these helper functions can be declared for
_Float128, even when __STDC_WANT_IEC_60559_TYPES_EXT__ is false.

Tested for powerpc64le, s390x, and x86_64.

	* include/bits/mathcalls-helper-functions.h: New file.
	* math/Makefile (headers): Add bits/mathcalls-helper-functions.h.
	* math/bits/mathcalls.h (__finite, __fpclassify, __iseqsig)
	(__isinf, __isnan, __issignaling, __signbit): Move declarations to
	math/bits/mathcalls-helper-functions.h.
	* math/bits/mathcalls-helper-functions.h: New file.
	* math/math.h: Include bits/mathcalls-helper-functions.h for
	float, double, and long double.
2017-03-15 09:39:16 -03:00
Gabriel F. T. Gomes 826aa1346f Use internal __feraiseexcept in __iseqsig
Replace the use of feraiseexcept with __feraiseexcept in the helper
function __iseqsig (math/s_iseqsig_template.c).

Tested for powerpc64le, s390x, and x86_64.

	* math/s_iseqsig_template.c (__iseqsig): Use __feraiseexcept
	instead of feraiseexcept.
2017-03-15 09:39:16 -03:00
Florian Weimer 2bda2d820d support: Explain ignored failures of temporary file removal [BZ #21243] 2017-03-15 13:33:40 +01:00
Florian Weimer ed3ea040ba support: Add error checking to close system calls [BZ #21244] 2017-03-15 13:33:40 +01:00
Florian Weimer f889e73f60 support_format_dns_packet: Fix CNAME and multiple RR handling
Before this change, the loop iterating over RRs in the answer
section stopped at the first CNAME record, never printing them.
The CNAME and PTR record contents was extracted from the wrong
buffer (whole packet instead RDATA).  This desynced the parsing
after the first CNAME or PTR record.

Also fix the AAAA record parsing by checking their sizes.
2017-03-15 13:33:40 +01:00
Adhemerval Zanella ed7d6072f2 Fix missing posix_fadvise64 mips64 static build (BZ #21232)
This patch fixes the missing posix_fadvise64 symbol for static build
required for _FILE_OFFSET_BITS=64 on mips64 build.

Checked on a mips64-linux-gnu build with run-built-tests=no.

	[BZ #21232]
	* sysdeps/unix/sysv/linux/mips/mips64/n64/posix_fadvise64.c: Add
	posix_fadvise64 weak_alias for static build.
2017-03-14 16:42:08 -03:00
Andreas Schwab 605c5ef4fb Remove _dl_platform_string
There are no non-trivial uses of _dl_platform_string.
2017-03-14 17:18:52 +01:00
Samuel Thibault 9d067269f5 hurd: Make send/recv more posixish
Thanks David Michael for the suggestion.

	* sysdeps/mach/hurd/send.c (__send): Convert hurdish error code into
	posix error code.
	* sysdeps/mach/hurd/recv.c (__recv): Likewise.
2017-03-13 20:41:12 +01:00
Adhemerval Zanella c89721e25d build-many-glibcs: Remove no_isolate from SH config
Now with d40dbe7 SH build does not require more the no_isolate gcc
options to correct build glibc (since SH build now does not generate
a trap anymore).  This patch removes the unrequired options from
SH config.

Checked with a build for sh3-linux-gnu, sh3eb-linux-gnu, sh4-linux-gnu,
and sh4eb-linux-gnu.

	* scripts/build-many-glibcs.py (Context.add_all_configs): Remove
	no_isolate usage for SH.
2017-03-13 16:23:25 -03:00
Wilco Dijkstra ae65d4f3c3 Remove the str(n)dup inlines from string/bits/string2.h. Although inlining
calls with constant strings shows a small (~10%) performance gain, strdup is
typically used in error reporting code, so not performance critical.
Remove the now unused __need_malloc_and_calloc related defines from stdlib.h.

Rename existing uses of str(n)dup to __str(n)dup so it no longer needs to be
redirected to a builtin.  Also building GLIBC with -Os now no longer shows
localplt or linkname space failures (partial fix for BZ #15105 and BZ #19463).

        [BZ #15105]
        [BZ #19463]
        * elf/dl-cache.c (_dl_load_cache_lookup): Use __strdup.
        * inet/rcmd.c (rcmd_af): Likewise.
        * inet/rexec.c   (rexec_af): Likewise.
        * intl/dcigettext.c (_LIBC): Likewise.
        * intl/finddomain.c (_nl_find_domain): Use strdup expansion.
        * locale/loadarchive.c (_nl_load_locale_from_archive): Use __strdup.
        * locale/setlocale.c (setlocale): Likewise.
        * posix/spawn_faction_addopen.c
        (posix_spawn_file_actions_addopen): Likewise.
        * stdlib/putenv.c (putenv): Use __strndup.
        * sunrpc/svc_simple.c (__registerrpc): Use __strdup.
        * sysdeps/posix/getaddrinfo.c (gaih_inet): Use __strdup/__strndup.
        * include/stdlib.h (__need_malloc_and_calloc): Remove uses.
        (__Need_M_And_C) Remove define/undef.
        * stdlib/stdlib.h (__need_malloc_and_calloc): Remove uses.
        (__malloc_and_calloc_defined): Remove define.
        * string/bits/string2.h (__strdup): Remove define.
        (strdup): Likewise.
        (__strndup): Likewise.
        (strndup): Likewise.
2017-03-13 18:45:42 +00:00
Joseph Myers 53a4608f8d Add more IPV6_* macros to sysdeps/unix/sysv/linux/bits/in.h.
Linux 4.10 adds IPV6_RECVFRAGSIZE to include/uapi/linux/in6.h, which
shows that several such IPV6_* macros are missing from glibc's
sysdeps/unix/sysv/linux/bits/in.h (while older ones are present).  I
don't know whether any of these might be deliberately omitted, but
this patch adds what appear to be the missing more recent macros to
glibc.

Tested for x86_64.

	* sysdeps/unix/sysv/linux/bits/in.h (IPV6_AUTOFLOWLABEL): New
	macro.
	(IPV6_ADDR_PREFERENCES): Likewise.
	(IPV6_MINHOPCOUNT): Likewise.
	(IPV6_ORIGDSTADDR): Likewise.
	(IPV6_RECVORIGDSTADDR): Likewise.
	(IPV6_TRANSPARENT): Likewise.
	(IPV6_UNICAST_IF): Likewise.
	(IPV6_RECVFRAGSIZE): Likewise.
2017-03-13 16:45:23 +00:00
Thorsten Kukuk d50a2c094c Add missing ChangeLog entries. 2017-03-13 17:43:10 +01:00
Alexey Neyman d40dbe722f sh: Fix building with gcc5/6
Build glibc for sh4-unknown-linux-gnu currently fails if one's
using GCC5/6: in dl-conflict.c, the elf_machine_rela() function
is called with NULL as its 3rd argument, sym. The implementation
of that function in sysdeps/sh/dl-machine.h dereferences that pointer:

const Elf32_Sym *const refsym = sym;
...
if (map == &GL(dl_rtld_map))
  value -= map->l_addr + refsym->st_value + reloc->r_addend;

GCC discovers a null pointer dereference, and in accordance with
-fdelete-null-pointer-checks (which is enabled in -O2) replaces this
code with a trap - which, as SH does not implement a trap pattern in
GCC, evaluates to an abort() call. This abort() call pulls many more
objects from libc_nonshared.a, eventually resulting in link failure
due to multiple definitions for a number of symbols.

As far as I see, the conditional before this code is always false in
rtld: _dl_resolve_conflicts() is called with main_map as the first
argument, not GL(_dl_rtld_map), but since that call is in yet another
compilation unit, GCC does not know about it. Patch that wraps this
conditional into !defined RESOLVE_CONFLICT_FIND_MAP attached.

	* sysdeps/sh/dl-machine.h (elf_machine_rela): The condition
	in R_SH_DIR32 case is always false when inlined from
	dl-conflict.c. Ifdef out to prevent GCC from insertin an
	abort() call.
2017-03-12 17:29:32 -03:00
Marko Myllynen cb09a3d497 Fix send consolidation typo
Fix 60f9423b type for alpha kernel-features.h definition.

	* sysdeps/unix/sysv/linux/alpha/kernel-features.h
        (__ASSUME_RECV_SYSCALL): Replace duplicate by
        __ASSUME_SEND_SYSCALL.
2017-03-12 17:25:00 -03:00
Stefan Liebler 93adfe2d79 Update auto-libm-test-out for catan / catanh.
I've used gmp 6.1.2, mpfr 3.1.5 and upstream mpc with fix in mpc_atan
(https://scm.gforge.inria.fr/anonscm/gitweb?p=mpc/mpc.git;a=commit;h=958aac9b15a659d6fb5edcb11778123f8a35b14f)
to build gen-auto-libm-tests and regenerated  catan / catanh out files.
Regenerated ULPs for s390 from scratch.  Now the catan / catanh tests
are passing.

ChangeLog:

	* math/auto-libm-test-out-catan: Regenerated.
	* math/auto-libm-test-out-catanh: Likewise.
	* sysdeps/s390/fpu/libm-test-ulps: Likewise.
2017-03-10 08:45:29 +01:00
Joseph Myers b24d6d1550 Regenerate MIPS catan, catanh long double ulps.
This patch regenerates MIPS catan and catanh ulps for long double with
fixed expected results for the tests of those functions.  ulps for
other types (which may see variation depending on whether glibc is
built for a processor with fused multiply-add support) are
deliberately not reduced.  ulps are not regenerated for powerpc-nofpu
as such regeneration does not result in any changes for long double.

	* sysdeps/mips/mips64/libm-test-ulps: Update catan and catanh ulps
	for long double with corrected test expectations.
2017-03-09 22:37:47 +00:00
Adhemerval Zanella 60f9423b6b Consolidate Linux send implementation
This patch consolidates the send Linux syscall implementation on
sysdeps/unix/sysv/linux/send{to}.c.  The changes are:

  1. Remove send from auto-generation syscalls.list on the architecture
     that uses __NR_send.
  2. Define __NR_send for architectures that supports it. It was done instead
     of defining in default kernel-features.h because current Linux practice
     for new ports are to implement only __NR_sendto [1] and it will
     require adding new kernel-features for ports that do not require it
     (aarch64 for instance).
  3. Remove __ASSUME_SENDTO_FOR_SEND_SYSCALL and decide to use
     __NR_sendto for send generation based on __ASSUME_SENDTO_SYSCALL.

Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu.

	* sysdeps/unix/sysv/linux/sysdep.h (HAVE_INTERNAL_SEND_SYMBOL):
	Define.
	* sysdeps/unix/sysv/linux/aarch64/sysdep.h
	(HAVE_INTERNAL_SEND_SYMBOL): Undefine.
	* sysdeps/unix/sysv/linux/nios2/sysdep.h
	(HAVE_INTERNAL_SEND_SYMBOL): Likewise.
	* sysdeps/unix/sysv/linux/tile/sysdep.h
	(HAVE_INTERNAL_SEND_SYMBOL): Likewise.
	* sysdeps/unix/sysv/linux/alpha/kernel-features.h
	(__ASSUME_RECV_SYSCALL): Define.
	* sysdeps/unix/sysv/linux/arm/kernel-features.h
	(__ASSUME_RECV_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/hppa/kernel-features.h
	(__ASSUME_RECV_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/ia64/kernel-features.h
	(__ASSUME_RECV_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/mips/kernel-features.h
	(__ASSUME_RECV_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/i386/kernel-features.h
	(__ASSUME_SENDTO_FOR_SEND_SYSCALL): Remove define.
	* sysdeps/unix/sysv/linux/m68k/kernel-features.h
	(__ASSUME_SENDTO_FOR_SEND_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/s390/kernel-features.h
	(__ASSUME_SENDTO_FOR_SEND_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/alpha/syscalls.list: Remove send from
	auto-generation list.
	* sysdeps/unix/sysv/linux/arm/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/hppa/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/ia64/syscalls.list: Likewike.
	* sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/send.c: Simplify includes.
	(__ASSUME_SENDTO_FOR_SEND_SYSCALL): Replace by
	__ASSUME_SENDTO_SYSCALL.
	* sysdeps/unix/sysv/linux/x86_64/send.c: Remove file.
	* sysdeps/unix/sysv/linux/mips/mips64/send.c: Likewise.
	* sysdeps/unix/sysv/linux/generic/send.c: Likewise.
2017-03-09 15:22:06 +01:00
Adhemerval Zanella 06cf371e97 Consolidate Linux sendto implementation
This patch consolidates the sendto Linux syscall implementation on
sysdeps/unix/sysv/linux/sendto.c.  The changes are:

   1. Define __ASSUME_SENDTO_SYSCALL by default.
   2. Undef it for architectures that do not support __NR_sendto.

Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu.

	* sysdeps/unix/sysv/linux/alpha/syscalls.list: Remove sendto from
	auto-generation list.
	* sysdeps/unix/sysv/linux/arm/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/generic/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/hppa/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/ia64/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/kernel-features.h
	(__ASSUME_SENDTO_SYSCALL): Define by default.
	* sysdeps/unix/sysv/linux/i386/kernel-features.h
	(__ASSUME_SENDTO_SYSCALL): Undef it is kernel does not support
	__NR_sendto.
	* sysdeps/unix/sysv/linux/m68k/kernel-features.h
	(__ASSUME_SENDTO_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/s390/kernel-features.h
	(__ASSUME_SENDTO_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/microblaze/kernel-features.h
	(__ASSUME_SENDTO_SYSCALL): Remove definition.
	* sysdeps/unix/sysv/linux/powerpc/kernel-features.h
	(__ASSUME_SENDTO_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/sh/kernel-features.h:
	(__ASSUME_SENDTO_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/sendto.c: Simplify includes.
2017-03-09 15:22:06 +01:00
Adhemerval Zanella df799d9eb3 Consolidate Linux recv implementation
This patch consolidates the recv Linux syscall implementation on
sysdeps/unix/sysv/linux/recv.c.  The changes are:

  1. Remove recv from auto-generation syscalls.list on the architecture
     that uses __NR_recv.
  2. Define __NR_recv for architectures that supports it.  It was done
     instead of defining in default kernel-features.h because current Linux
     practice for new ports is to implement only __NR_recvfrom [1] and it will
     require adding new kernel-features for ports that do not require it
     (aarch64 for instance).
  3. Remove __ASSUME_RECVFROM_FOR_RECV_SYSCALL and decide to use
     __NR_recvfrom for recv generation based on __ASSUME_RECVFROM_SYSCALL.

Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu.

	* sysdeps/unix/sysv/linux/alpha/syscalls.list: Remove recv from
	auto-generation list.
	* sysdeps/unix/sysv/linux/arm/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/hppa/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/ia64/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/alpha/kernel-features.h
	(__ASSUME_RECV_SYSCALL): New define.
	* sysdeps/unix/sysv/linux/arm/kernel-features.h
	(__ASSUME_RECV_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/hppa/kernel-features.h
	(__ASSUME_RECV_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/ia64/kernel-features.h
	(__ASSUME_RECV_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/mips/kernel-features.h
	(__ASSUME_RECV_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/i386/kernel-features.h
	(__ASSUME_RECVFROM_FOR_RECV_SYSCALL): Remove define.
	* sysdeps/unix/sysv/linux/m68k/kernel-features.h
	(__ASSUME_RECVFROM_FOR_RECV_SYSCALL): Remove define.
	* sysdeps/unix/sysv/linux/s390/kernel-features.h
	(__ASSUME_RECVFROM_FOR_RECV_SYSCALL): Remove define.
	* sysdeps/unix/sysv/linux/generic/recv.c: Remove file.
	* sysdeps/unix/sysv/linux/mips/mips64/recv.c: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/recv.c: Likewise.
	* sysdeps/unix/sysv/linux/recv.c: Simplify includes.
	(__libc_recv): Use __ASSUME_RECVFROM_SYSCALL instead of
	__ASSUME_RECVFROM_FOR_RECV_SYSCALL to issue recvfrom syscall.

[1] include/asm-generic/unistd.h (__ARCH_WANT_SYSCALL_DEPRECATED)
2017-03-09 15:22:06 +01:00
Adhemerval Zanella 1f8161a801 Consolidate Linux recvfrom implementation
This patch consolidates the recvfrom Linux syscall implementation on
sysdeps/unix/sysv/linux/recvfrom.c.  The changes are:

  1. Define __ASSUME_RECVFROM_SYSCALL by default
  2. Undef it for  architectures that do not support __NR_recvfrom.

Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu.

	* sysdeps/unix/sysv/linux/alpha/syscalls.list: Remove recvfrom from
	auto-generation list.
	* sysdeps/unix/sysv/linux/arm/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/generic/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/hppa/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/ia64/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/i386/kernel-features.h
	* sysdeps/unix/sysv/linux/kernel-features.h
	(__ASSUME_RECVFROM_SYSCALL): Define by default.
	(__ASSUME_RECVFROM_SYSCALL): Undef it if kernel does not support
	__NR_recvfrom.
	* sysdeps/unix/sysv/linux/m68k/kernel-features.h
	(__ASSUME_RECVFROM_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/s390/kernel-features.h
	(__ASSUME_RECVFROM_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/microblaze/kernel-features.h
	(__ASSUME_RECVFROM_SYSCALL): Remove definition.
	* sysdeps/unix/sysv/linux/powerpc/kernel-features.h
	(__ASSUME_RECVFROM_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/sh/kernel-features.h
	(__ASSUME_RECVFROM_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/sparc/kernel-features.h
	(__ASSUME_RECVFROM_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/recvfrom.c: Simplify includes.
2017-03-09 15:22:06 +01:00
Adhemerval Zanella 3e9ff426cb Consolidate Linux connect implementation
This patch consolidates the connect Linux syscall implementation on
sysdeps/unix/sysv/linux/accept.c.  The changes are:

  1. Remove connect from auto-generation syscalls.list on the architecture
     that uses __NR_connect.
  2. Define __NR_connect as default (__ASSUME_CONNECT_SYSCALL) and undef for
     architectures that do not support it.

Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu.

	* sysdeps/unix/sysv/linux/alpha/syscalls.list: Remove connect from
	auto-generation list.
	* sysdeps/unix/sysv/linux/arm/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/generic/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/hppa/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/ia64/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/connect.c: Simplify include list.
	* sysdeps/unix/sysv/linux/kernel-features.h
	(__ASSUME_CONNECT_SYSCALL): Define.
	* sysdeps/unix/sysv/linux/i386/kernel-features.h
	(__ASSUME_CONNECT_SYSCALL): Undef if kernel does not support it.
	* sysdeps/unix/sysv/linux/m68k/kernel-features.h
	(__ASSUME_CONNECT_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/s390/kernel-features.h
	(__ASSUME_CONNECT_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/sparc/kernel-features.h
	(__ASSUME_CONNECT_SYSCALL): Likewise.
2017-03-09 15:22:06 +01:00
Adhemerval Zanella 01061a7cab Consolidate Linux accept implementation
This patch consolidates the accept Linux syscall implementation on
sysdeps/unix/sysv/linux/accept.c.  The changes are:

  1. Remove accept from auto-generation syscalls.list on the architecture
     that uses __NR_accept.
  2. Define __NR_accept as default (__ASSUME_ACCEPT_SYSCALL) and undef for
     architectures that do not support it.
  3. Remove __ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL and decide to use
     __NR_accept4 for accept generation based on __ASSUME_ACCEPT4_SYSCALL.

Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu.

	* sysdeps/unix/sysv/linux/accept.c (__libc_accept): Replace
	__ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL by __ASSUME_ACCEPT4_SYSCALL.
	* sysdeps/unix/sysv/linux/alpha/syscalls.list: Remove accept from
	auto-generation list.
	* sysdeps/unix/sysv/linux/arm/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/generic/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/hppa/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/ia64/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/i386/kernel-features.h
	(__ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL): Remove define.
	(__ASSUME_ACCEPT_SYSCALL): Undefine.
	* sysdeps/unix/sysv/linux/kernel-features.h
	(__ASSUME_ACCEPT_SYSCALL): New define.
	* sysdeps/unix/sysv/linux/m68k/kernel-features.h
	(__ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL): Remove define.
	(__ASSUME_ACCEPT_SYSCALL): Define wheter kernel version supports.
	* sysdeps/unix/sysv/linux/microblaze/kernel-features.h
	(__ASSUME_ACCEPT_SYSCALL): Define.
	* sysdeps/unix/sysv/linux/powerpc/kernel-features.h
	(__ASSUME_ACCEPT_SYSCALL): Undefine.
	* sysdeps/unix/sysv/linux/s390/kernel-features.h
	(__ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL): Remove define.
	(__ASSUME_ACCEPT_SYSCALL): Undefine.
	* sysdeps/unix/sysv/linux/sh/kernel-features.h
	(__ASSUME_ACCEPT_SYSCALL): Undefine.
	* sysdeps/unix/sysv/linux/sparc/kernel-features.h
	(__ASSUME_ACCEPT_SYSCALL): Undefine for 32 bits.
2017-03-09 15:22:06 +01:00
Yury Norov 9a56f87183 Test for correct setting of errno.
This patch adds tests for POSIX and Linux specific syscalls
that implemented with syscall templates machinery. The reason
of tests is to receive the expected error code and test if
it's handled properly by glibc.

2017-03-08  Yury Norov <ynorov@caviumnetworks.com>
	    Zack Weinberg  <zackw@panix.com>

	* posix/test-errno.c: New file.
	* posix/Makefile (tests): Add test-errno.
	* sysdeps/unix/sysv/linux/test-errno.c: New file.
	* sysdeps/unix/sysv/linux/Makefile (tests): Add test-errno.
2017-03-08 11:19:47 -05:00
Stefan Liebler 72280a9e55 S390: Regenerate ULPs
Updated ulps file.
There are still fails for long double catan / catanh
due to MPC bug.  See post from Joseph Myers:
https://www.sourceware.org/ml/libc-alpha/2017-03/msg00099.html

ChangeLog:

	* sysdeps/s390/fpu/libm-test-ulps: Regenerated.
2017-03-08 08:34:58 +01:00
Florian Weimer 596d547f50 Fix auto-merge issue in ChangeLog 2017-03-07 17:47:17 +01:00
Florian Weimer 6e3b52292a tzset: Clean up preprocessor macros min, max, sign 2017-03-07 17:45:39 +01:00
Florian Weimer 8492c4dd69 timezone: Remove TZNAME_MAX limit from sysconf [BZ #15576]
glibc does not impose a limit, and POSIX does not allow a
sysconf limit which changes during the lifetime of a process.
2017-03-07 17:45:38 +01:00
Siddhesh Poyarekar 1c1243b6fc Ignore and remove LD_HWCAP_MASK for AT_SECURE programs (bug #21209)
The LD_HWCAP_MASK environment variable may alter the selection of
function variants for some architectures.  For AT_SECURE process it
means that if an outdated routine has a bug that would otherwise not
affect newer platforms by default, LD_HWCAP_MASK will allow that bug
to be exploited.

To be on the safe side, ignore and disable LD_HWCAP_MASK for setuid
binaries.

	[BZ #21209]
	* elf/rtld.c (process_envvars): Ignore LD_HWCAP_MASK for
	AT_SECURE processes.
	* sysdeps/generic/unsecvars.h: Add LD_HWCAP_MASK.
	* elf/tst-env-setuid.c (test_parent): Test LD_HWCAP_MASK.
	(test_child): Likewise.
	* elf/Makefile (tst-env-setuid-ENV): Add LD_HWCAP_MASK.
2017-03-07 20:52:04 +05:30
Adhemerval Zanella a7055e5935 hppa: set __IPC_64 as zero for SysV IPC calls
In 1e5834c38a ("Refactor Linux ipc_priv header") a different
approach to passing __IPC_64 as zero was created.  Hppa kernel ABI
requires to oass __IPC_64 as zero since it does not set
CONFIG_ARCH_WANT_IPC_PARSE_VERSION in the kernel.

Checked on hppa-linux-gnu with some adjustments to avoid BZ#21016
(basically by removing hppa compat implementations and adjusting
required headers).

	* sysdeps/unix/sysv/linux/hppa/ipc_priv.h: New file.
2017-03-07 09:12:48 +01:00
Stefan Liebler 022c9fec9b S390: Optimize atomic macros.
This patch activates C11 atomic builtins by defining
USE_ATOMIC_COMPILER_BUILTINS to 1.
Note:
E.g. in nptl/pthread_key_delete.c if compiled with GCCs 6 and before,
an extra stack-frame is generated and the old value is stored on stack
before cs instruction but it never loads this value from stack.
An unreleased GCC 7 omit those stack operations.

E.g. in nptl/pthread_once.c the condition code of cs instruction is
evaluated by a sequence of ipm, sra, compare and jump instructions instead
of one conditional jump instruction.  This also occurs with an unreleased
GCC 7.

These shortcomings does not really hurt.  Nevertheless, the gcc guys are
investigating those ones and plan to fix them before GCC 7 release.

The atomic_fetch_abc_def C11 builtins are now using load-and-abc instructions
on z196 zarch and higher cpus instead of a loop with compare-and-swap
instruction.

Some of the non-C11 atomic macros from include/atomic.h are now implemented
with help of the C11 atomic builtins.  The other non-C11 atomic macros
are using the macros defined here.

ChangeLog:

	* sysdeps/s390/atomic-machine.h
	(USE_ATOMIC_COMPILER_BUILTINS): Define to 1.
	(__arch_compare_and_exchange_val_8_acq,
	__arch_compare_and_exchange_val_16_acq,
	__arch_compare_and_exchange_val_32_acq,
	__arch_compare_and_exchange_val_64_acq):
	Delete macro.
	(atomic_compare_and_exchange_val_acq,
	atomic_compare_and_exchange_val_rel,
	atomic_compare_and_exchange_bool_acq,
	catomic_compare_and_exchange_bool_acq,
	atomic_exchange_acq, atomic_exchange_rel,
	atomic_exchange_and_add_acq,
	atomic_exchange_and_add_rel,
	catomic_exchange_and_add, atomic_or_val,
	atomic_or, catomic_or, atomic_bit_test_set,
	atomic_and_val, atomic_and, catomic_and):
	Define macros with help of C11 atomic builtins.
2017-03-06 15:28:25 +01:00
Justus Winter 21d58b2a43 hurd: Provide truncate64 and ftruncate64.
* sysdeps/mach/hurd/ftruncate64.c: New file.
	* sysdeps/mach/hurd/truncate64.c: Likewise.
2017-03-04 14:25:49 +01:00
Florian Weimer 7eb5c06c35 tzset: Remove unused NOID macro 2017-03-03 11:25:44 +01:00
Florian Weimer b2f3c0c208 tzset: Remove __attribute_noinline__ from compute_offset
After commit 42261ad731,
compute_offset is only called once, so not inlining it
increases executable size.
2017-03-03 09:06:54 +01:00
Florian Weimer a10e9c4e53 Remove header file inclusion guard from elf/get-dynamic-info.h
This file is included multiple times, so the guard is harmful.
Fixes commit 9090848d06.
2017-03-02 17:28:41 +01:00
Florian Weimer 2d6ab5df3b Document and fix --enable-bind-now [BZ #21015] 2017-03-02 14:44:28 +01:00
Zack Weinberg 9090848d06 Narrowing the visibility of libc-internal.h even further.
posix/wordexp-test.c used libc-internal.h for PTR_ALIGN_DOWN; similar
to what was done with libc-diag.h, I have split the definitions of
cast_to_integer, ALIGN_UP, ALIGN_DOWN, PTR_ALIGN_UP, and PTR_ALIGN_DOWN
to a new header, libc-pointer-arith.h.

It then occurred to me that the remaining declarations in libc-internal.h
are mostly to do with early initialization, and probably most of the
files including it, even in the core code, don't need it anymore.  Indeed,
only 19 files actually need what remains of libc-internal.h.  23 others
need libc-diag.h instead, and 12 need libc-pointer-arith.h instead.
No file needs more than one of them, and 16 don't need any of them!

So, with this patch, libc-internal.h stops including libc-diag.h as
well as losing the pointer arithmetic macros, and all including files
are adjusted.

        * include/libc-pointer-arith.h: New file.  Define
	cast_to_integer, ALIGN_UP, ALIGN_DOWN, PTR_ALIGN_UP, and
        PTR_ALIGN_DOWN here.
        * include/libc-internal.h: Definitions of above macros
	moved from here.  Don't include libc-diag.h anymore either.
	* posix/wordexp-test.c: Include stdint.h and libc-pointer-arith.h.
        Don't include libc-internal.h.

	* debug/pcprofile.c, elf/dl-tunables.c, elf/soinit.c, io/openat.c
	* io/openat64.c, misc/ptrace.c, nptl/pthread_clock_gettime.c
	* nptl/pthread_clock_settime.c, nptl/pthread_cond_common.c
	* string/strcoll_l.c, sysdeps/nacl/brk.c
	* sysdeps/unix/clock_settime.c
	* sysdeps/unix/sysv/linux/i386/get_clockfreq.c
	* sysdeps/unix/sysv/linux/ia64/get_clockfreq.c
	* sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c
	* sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c:
	Don't include libc-internal.h.

	* elf/get-dynamic-info.h, iconv/loop.c
	* iconvdata/iso-2022-cn-ext.c, locale/weight.h, locale/weightwc.h
	* misc/reboot.c, nis/nis_table.c, nptl_db/thread_dbP.h
	* nscd/connections.c, resolv/res_send.c, soft-fp/fmadf4.c
	* soft-fp/fmasf4.c, soft-fp/fmatf4.c, stdio-common/vfscanf.c
	* sysdeps/ieee754/dbl-64/e_lgamma_r.c
	* sysdeps/ieee754/dbl-64/k_rem_pio2.c
	* sysdeps/ieee754/flt-32/e_lgammaf_r.c
	* sysdeps/ieee754/flt-32/k_rem_pio2f.c
	* sysdeps/ieee754/ldbl-128/k_tanl.c
	* sysdeps/ieee754/ldbl-128ibm/k_tanl.c
	* sysdeps/ieee754/ldbl-96/e_lgammal_r.c
	* sysdeps/ieee754/ldbl-96/k_tanl.c, sysdeps/nptl/futex-internal.h:
	Include libc-diag.h instead of libc-internal.h.

        * elf/dl-load.c, elf/dl-reloc.c, locale/programs/locarchive.c
        * nptl/nptl-init.c, string/strcspn.c, string/strspn.c
	* malloc/malloc.c, sysdeps/i386/nptl/tls.h
	* sysdeps/nacl/dl-map-segments.h, sysdeps/x86_64/atomic-machine.h
	* sysdeps/unix/sysv/linux/spawni.c
        * sysdeps/x86_64/nptl/tls.h:
        Include libc-pointer-arith.h instead of libc-internal.h.

	* elf/get-dynamic-info.h, sysdeps/nacl/dl-map-segments.h
	* sysdeps/x86_64/atomic-machine.h:
        Add multiple include guard.
2017-03-01 20:33:46 -05:00
Zack Weinberg 5e4e10636c Miscellaneous low-risk changes preparing for _ISOMAC testsuite.
These are a grab bag of changes where the testsuite was using internal
symbols of some variety, but this was straightforward to fix, and the
fixed code should work with or without the change to compile the
testsuite under _ISOMAC.

Four of these are just more #include adjustments, but I want to highlight
sysdeps/powerpc/fpu/tst-setcontext-fpscr.c, which appears to have been
written before the advent of sys/auxv.h.  I think a big chunk of this file
could be replaced by a simple call to getauxval, but I'll let someone who
actually has a powerpc machine to test on do that.

dlfcn/tst-dladdr.c was including ldsodefs.h just so it could use
DL_LOOKUP_ADDRESS to print an additional diagnostic; as requested by Carlos,
I have removed this.

math/test-misc.c was using #ifndef NO_LONG_DOUBLE, which is an internal
configuration macro, to decide whether to do certain tests involving
'long double'.  I changed the test to #if LDBL_MANT_DIG > DBL_MANT_DIG
instead, which uses only public float.h macros and is equivalent on
all supported platforms.  (Note that NO_LONG_DOUBLE doesn't mean 'the
compiler doesn't support long double', it means 'long double is the
same as double'.)

tst-writev.c has a configuration macro 'ARTIFICIAL_LIMIT' that the
Makefiles are expected to define, and sysdeps/unix/sysv/linux/Makefile
was using the internal __getpagesize in the definition; changed to
sysconf(_SC_PAGESIZE) which is the POSIX equivalent.

ia64-linux doesn't supply 'clone', only '__clone2', which is not
defined in the public headers(!)  All the other clone tests have local
extern declarations of __clone2, but tst-clone.c doesn't; it was
getting away with this because include/sched.h does declare __clone2.

	* nss/tst-cancel-getpwuid_r.c: Include nss.h.
	* string/strcasestr.c: No need to include config.h.
	* sysdeps/powerpc/fpu/tst-setcontext-fpscr.c: Include
	sys/auxv.h. Don't include sysdep.h.
	* sysdeps/powerpc/tst-set_ppr.c: Don't include dl-procinfo.h.

	* dlfcn/tst-dladdr.c: Don't include ldsodefs.h.	 Don't use
	DL_LOOKUP_ADDRESS.
	* math/test-misc.c: Instead of testing NO_LONG_DOUBLE, test whether
	LDBL_MANT_DIG is greater than DBL_MANT_DIG.
	* sysdeps/unix/sysv/linux/Makefile (CFLAGS-tst-writev.c): Use
	sysconf (_SC_PAGESIZE) instead of __getpagesize in definition
	of ARTIFICIAL_LIMIT.
	* sysdeps/unix/sysv/linux/tst-clone.c [__ia64__]: Add extern
	declaration of __clone2.
2017-03-01 20:32:50 -05:00
Florian Weimer d2583c0b77 Add scripts/backport-support.sh
This script is intended for maintaining the stable branches and
distribution backports.
2017-02-28 16:36:26 +01:00
Florian Weimer cf0bd2f73b sunrpc: Improvements for UDP client timeout handling [BZ #20257]
This commit fixes various aspects in the UDP client timeout handling.
Timeouts are now applied in a more consistent fashion.  Discarded UDP
packets no longer prevent the timeout from happening at all.
2017-02-28 15:36:17 +01:00
Florian Weimer 37fb019cb0 sunrpc: Do not unregister services if not registered [BZ #5010]
The change in commit 718946816c
has no effect because of two bugs which cancel each other out:
The svc_is_mapped condition is inverted, and svc_is_mapped
always returns false because the check is performed after
the service has already been unregistered.  As a result,
pmap_unset is called unconditionally, as before.
2017-02-28 15:36:16 +01:00
Andreas Schwab b31737bdf9 Refer to <signal.h> instead of <pthread.h> in <bits/sigthread.h>
The <bits/sigthread.h> header is included by <signal.h>, not <pthread.h>.
2017-02-28 10:34:15 +01:00
Florian Weimer d42eed4a04 sunrpc: Avoid use-after-free read access in clntudp_call [BZ #21115]
After commit bc779a1a5b
(CVE-2016-4429: sunrpc: Do not use alloca in clntudp_call
[BZ #20112]), ancillary data is stored on the heap,
but it is accessed after it has been freed.

The test case must be run under a heap debugger such as valgrind
to observe the invalid access.  A malloc implementation which
immediately calls munmap on free would catch this bug as well.
2017-02-27 19:05:13 +01:00
Zack Weinberg 963394a22b Allow direct use of math_ldbl.h in testsuite.
A few 'long double'-related tests include math_private.h just for
their variety of math_ldbl.h, which contains macros for assembling and
disassembling the binary representation of 'long double'.  math_ldbl.h
insists on being included from math_private.h, but if we relax this
restriction (and fix some portability sloppiness) we can use it
directly and not have to expose all of math_private.h to the testsuite.

	* sysdeps/generic/math_private.h: Use __BIG_ENDIAN and
	__LITTLE_ENDIAN, not BIG_ENDIAN and LITTLE_ENDIAN.

	* sysdeps/generic/math_ldbl.h
	* sysdeps/ia64/fpu/math_ldbl.h
	* sysdeps/ieee754/ldbl-128/math_ldbl.h
	* sysdeps/ieee754/ldbl-128ibm/math_ldbl.h
	* sysdeps/ieee754/ldbl-96/math_ldbl.h
	* sysdeps/powerpc/fpu/math_ldbl.h
	* sysdeps/x86_64/fpu/math_ldbl.h:
	Allow direct inclusion.  Use uintNN_t instead of u_intNN_t.
	Use __BIG_ENDIAN and __LITTLE_ENDIAN, not BIG_ENDIAN and
	LITTLE_ENDIAN.  Include endian.h and/or stdint.h if necessary.
	Add copyright notices.

	* sysdeps/ieee754/ldbl-128ibm/math_ldbl.h (ldbl_canonicalize_int):
	Don't use EXTRACT_WORDS64.

	* sysdeps/ieee754/ldbl-96/test-canonical-ldbl-96.c
	* sysdeps/ieee754/ldbl-96/test-totalorderl-ldbl-96.c
	* sysdeps/ieee754/ldbl-128ibm/test-canonical-ldbl-128ibm.c
	* sysdeps/ieee754/ldbl-128ibm/test-totalorderl-ldbl-128ibm.c:
	Include math_ldbl.h, not math_private.h.
2017-02-25 10:40:48 -05:00
Zack Weinberg e15f7de60c Split DIAG_* macros to new header libc-diag.h.
Quite a few tests include libc-internal.h just for the DIAG_* macros.
Split those macros to their own file, which can be included safely in
_ISOMAC mode.  I also moved ignore_value, since it seems logically
related, even though I didn't notice any tests needing it.

Also add -Wnonnull suppressions to two tests that _should_ have them,
but the error is masked when compiling against internal headers.

	* include/libc-diag.h: New file.  Define ignore_value,
	DIAG_PUSH_NEEDS_COMMENT, DIAG_POP_NEEDS_COMMENT,
	DIAG_IGNORE_NEEDS_COMMENT, and DIAG_IGNORE_Os_NEEDS_COMMENT here.

	* include/libc-internal.h: Definitions of above macros moved from
	here.  Include libc-diag.h.  Add copyright notice.

	* malloc/tst-malloc.c, malloc/tst-memcheck.c, malloc/tst-realloc.c
	* misc/tst-error1.c, posix/tst-dir.c, stdio-common/bug21.c
	* stdio-common/scanf14.c, stdio-common/scanf4.c, stdio-common/scanf7.c
	* stdio-common/test-vfprintf.c, stdio-common/tst-printf.c
	* stdio-common/tst-printfsz.c, stdio-common/tst-sprintf.c
	* stdio-common/tst-unlockedio.c, stdio-common/tstdiomisc.c
	* stdlib/bug-getcontext.c, string/tester.c, string/tst-endian.c
	* time/tst-strptime2.c, wcsmbs/tst-wcstof.c:
	Include libc-diag.h instead of libc-internal.h.

	* stdlib/tst-environ.c: Include libc-diag.h.  Suppress -Wnonnull for
	call to unsetenv (NULL).
	* nptl/tst-mutex1.c: Include libc-diag.h.  Suppress -Wnonnull for
	call to pthread_mutexattr_destroy (NULL).
2017-02-25 09:59:46 -05:00
Zack Weinberg 7caa5054af Clean up conditionals for declaration of gets.
gets has the dubious honor of being the only C89 library feature that
has been completely removed from the current C and C++ standards.
glibc follows suit by not declaring it in _GNU_SOURCE mode either,
but it remains present in older compatibility modes.  Internally,
two test cases need to see stdio.h make the declaration, but all our
internal code is of course compiled under _GNU_SOURCE.  This is currently
kludged by duplicating the gets declaration, fortify wrapper and all,
in include/stdio.h.  Also, the conditional in the public headers for
deciding when to declare gets is complicated and repeated in two places.

This patch adds a new macro to features.h that encapsulates the
complicated rule for when to declare gets.  stdio.h and bits/stdio2.h
then simply test __GLIBC_USE (DEPRECATED_GETS), and instead of having
a duplicate gets declaration in include/stdio.h, debug/tst-chk1.c and
stdio-common/tst-gets.c can force gets to be declared.

        * include/features.h (__GLIBC_USE_DEPRECATED_GETS): New macro.
        * libio/stdio.h, libio/bits/stdio2.h: Condition gets on
        __GLIBC_USE (DEPRECATED_GETS).  Update comments to indicate
        gets was removed from C++ in C++14.
        * include/stdio.h: Remove redundant declaration of gets.
        * debug/tst-chk1.c, stdio-common/tst-gets.c: Force gets to
        be declared, since we are testing it.
        * stdio-common/Makefile (tst-gets.c): Compile with
        -Wno-deprecated-declarations.
	* debug/Makefile (tst-chk1.c, tst-chk2.c, tst-chk3.c, tst-chk4.cc)
	(tst-chk5.cc, tst-chk6.cc, tst-lfschk1.c, tst-lfschk2.c)
	(tst-lfschk3.c, tst-lfschk4.cc, tst-lfschk5.cc, tst-lfschk6.cc):
	Compile with -Wno-deprecated-declarations.
2017-02-25 09:47:51 -05:00
Tulio Magno Quites Machado Filho 4f5a9afffb Use independent type literals in libm-test-support.c
* math/libm-test-support.c (check_ulp): Use LIT() around literal
	numbers.
2017-02-24 21:14:09 -03:00
Stefan Liebler d4f94368a9 Get rid of duplicate const declaration specifier warning in tst-resolv-qtypes.c.
Compiling resolv/tst-resolv-qtypes.c with GCC 7 results in:
tst-resolv-qtypes.c:53:14: error: duplicate ‘const’ declaration specifier [-Werror=duplicate-decl-specifier]
 static const const char *domain = "www.example.com";

This patch removes the duplicate const and makes domain a const pointer
to const char literal.

ChangeLog:

	* resolv/tst-resolv-qtypes.c (domain):
	Change type to const pointer to const char.
2017-02-24 13:30:13 +01:00
Joseph Myers 92061bb033 Run libm tests separately for each function.
At present, libm tests for each function get built into a single
executable (for each floating point type, for each of normal / inline
/ finite-math-only functions, plus vector variants) and run together,
resulting in a single PASS or FAIL (for each of those nine variants
plus vector variants).  Building this executable involves reading
over 50 MB of libm-test-*.c sources.

This patch arranges for tests of each function to be run separately
from the makefiles instead.  There are 121 functions being tested for
each (type, variant pair) (actually 126, but run as 121 from the
Makefile because each of the pairs (exp10, pow10), (isfinite, finite),
(lgamma, gamma), (remainder, drem), (scalbn, ldexp), shares a table of
test results and so is run together), so 1089 separate tests run from
the Makefile, plus 48 vector tests on x86_64 (six functions for eight
vector variants).  Each test only involves a libm-test-<func>.c file
of no more than about 4 MB, rather than all such files taking about 50
MB.  With tests run separately, test summaries will indicate which
functions actually have problems (of course, those problems may just
be out-of-date libm-test-ulps files if the file hasn't been updated
for the architecture in question recently).

All the .c files for the 1089+48 tests are generated automatically
from the Makefiles.  Various checked-in boilerplate .c files are
removed as no longer needed.  CFLAGS definitions for the different
kinds of tests are generated using makefile iterators to apply
target-specific variable settings.  libm-have-vector-test.h is no
longer needed; the list of functions to test for each vector type is
now in the sysdeps Makefile.

This should reduce the amount of boilerplate needed for float128
testing support; test-float128.h will still be needed, but not various
.c files or Makefile CFLAGS definitions.  The logic for creating
dependencies on libm-test-support-*.o files should also render
<https://sourceware.org/ml/libc-alpha/2017-02/msg00279.html>
unnecessary.

Tested for x86_64 and x86.

	* math/Makefile (libm-tests-generated): Remove variable.
	(libm-tests-base-normal): New variable.
	(libm-tests-base-finite): Likewise.
	(libm-tests-base-inline): Likewise.
	(libm-tests-base): Likewise.
	(libm-tests-normal): Likewise.
	(libm-tests-finite): Likewise.
	(libm-tests-inline): Likewise.
	(libm-tests-vector): Likewise.
	(libm-tests): Define in terms of these new variables.
	(libm-tests-for-type): New variable.
	(libm-tests.o): Move definition.
	(tests): Move addition of $(libm-tests).
	(generated): Update for new and removed libm test files.
	($(objpfx)libm-test.c): Remove target.
	($(objpfx)libm-have-vector-test.h): Likewise.
	(CFLAGS-test-double-vlen2.c): Remove variable.
	(CFLAGS-test-double-vlen4.c): Likewise.
	(CFLAGS-test-double-vlen8.c): Likewise.
	(CFLAGS-test-float-vlen4.c): Likewise.
	(CFLAGS-test-float-vlen8.c): Likewise.
	(CFLAGS-test-float-vlen16.c): Likewise.
	(CFLAGS-test-float.c): Likewise.
	(CFLAGS-test-float-finite.c): Likewise.
	(CFLAGS-libm-test-support-float.c): Likewise.
	(CFLAGS-test-double.c): Likewise.
	(CFLAGS-test-double-finite.c): Likewise.
	(CFLAGS-libm-test-support-double.c): Likewise.
	(CFLAGS-test-ldouble.c): Likewise.
	(CFLAGS-test-ldouble-finite.c): Likewise.
	(CFLAGS-libm-test-support-ldouble.c): Likewise.
	(libm-test-inline-cflags): New variable.
	(CFLAGS-test-ifloat.c): Remove variable.
	(CFLAGS-test-idouble.c): Likewise.
	(CFLAGS-test-ildouble.c): Likewise.
	($(addprefix $(objpfx), $(libm-tests.o))): Move target and update
	dependencies.
	($(foreach t,$(libm-tests-normal),$(objpfx)$(t).c)): New rule.
	($(foreach t,$(libm-tests-finite),$(objpfx)$(t).c)): Likewise.
	($(foreach t,$(libm-tests-inline),$(objpfx)$(t).c)): Likewise.
	($(foreach t,$(libm-tests-vector),$(objpfx)$(t).c)): Likewise.
	($(foreach t,$(types),$(objpfx)libm-test-support-$(t).c)):
	Likewise.
	(dependencies on libm-test-support-*.o): Remove.
	($(foreach f,$(libm-test-funcs-all),$(objpfx)$(o)-$(f).o)): New
	rules using iterators.
	($(addprefix $(objpfx),$(call libm-tests-for-type,$(o)))):
	Likewise.
	($(objpfx)libm-test-support-$(o).o): Likewise.
	($(addprefix $(objpfx),$(filter-out $(tests-static)
	$(libm-vec-tests),$(tests)))): Filter out $(libm-tests-vector)
	instead.
	($(addprefix $(objpfx), $(libm-vec-tests))): Use iterator to
	define rule instead.
	* math/README.libm-test: Update.
	* math/libm-test-acos.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-acosh.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-asin.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-asinh.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-atan.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-atan2.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-atanh.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-cabs.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-cacos.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-cacosh.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-canonicalize.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-carg.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-casin.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-casinh.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-catan.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-catanh.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-cbrt.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-ccos.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-ccosh.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-ceil.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-cexp.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-cimag.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-clog.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-clog10.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-conj.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-copysign.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-cos.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-cosh.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-cpow.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-cproj.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-creal.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-csin.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-csinh.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-csqrt.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-ctan.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-ctanh.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-erf.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-erfc.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-exp.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-exp10.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-exp2.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-expm1.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-fabs.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-fdim.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-floor.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-fma.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-fmax.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-fmaxmag.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-fmin.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-fminmag.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-fmod.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-fpclassify.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-frexp.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-fromfp.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-fromfpx.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-getpayload.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-hypot.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-ilogb.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-iscanonical.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-iseqsig.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-isfinite.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-isgreater.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-isgreaterequal.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-isinf.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-isless.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-islessequal.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-islessgreater.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-isnan.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-isnormal.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-issignaling.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-issubnormal.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-isunordered.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-iszero.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-j0.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-j1.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-jn.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-lgamma.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-llogb.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-llrint.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-llround.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-log.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-log10.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-log1p.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-log2.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-logb.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-lrint.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-lround.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-modf.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-nearbyint.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-nextafter.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-nextdown.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-nexttoward.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-nextup.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-pow.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-remainder.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-remquo.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-rint.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-round.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-roundeven.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-scalb.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-scalbln.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-scalbn.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-setpayload.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-setpayloadsig.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-signbit.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-significand.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-sin.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-sincos.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-sinh.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-sqrt.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-tan.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-tanh.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-tgamma.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-totalorder.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-totalordermag.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-trunc.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-ufromfp.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-ufromfpx.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-y0.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-y1.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-yn.inc: Include libm-test-driver.c.
	(do_test): New function.
	* math/libm-test-driver.c: Do not include libm-have-vector-test.h.
	(HAVE_VECTOR): Remove macro.
	(START): Do not call HAVE_VECTOR.
	* math/test-double-vlen2.h (FUNC_TEST): Remove macro.
	* math/test-double-vlen4.h (FUNC_TEST): Remove macro.
	* math/test-double-vlen8.h (FUNC_TEST): Remove macro.
	* math/test-float-vlen16.h (FUNC_TEST): Remove macro.
	* math/test-float-vlen4.h (FUNC_TEST): Remove macro.
	* math/test-float-vlen8.h (FUNC_TEST): Remove macro.
	* math/test-math-vector.h (FUNC_TEST): New macro.
	(WRAPPER_DECL): Rename to WRAPPER_DECL_f.
	* sysdeps/x86_64/fpu/Makefile (double-vlen2-funcs): New variable.
	(double-vlen4-funcs): Likewise.
	(double-vlen4-avx2-funcs): Likewise.
	(double-vlen8-funcs): Likewise.
	(float-vlen4-funcs): Likewise.
	(float-vlen8-funcs): Likewise.
	(float-vlen8-avx2-funcs): Likewise.
	(float-vlen16-funcs): Likewise.
	(CFLAGS-test-double-vlen4-avx2.c): Remove variable.
	(CFLAGS-test-float-vlen8-avx2.c): Likewise.
	* sysdeps/x86_64/fpu/test-double-vlen4.h (TEST_VECTOR_cos): Remove
	macro.
	(TEST_VECTOR_sin): Likewise.
	(TEST_VECTOR_sincos): Likewise.
	(TEST_VECTOR_log): Likewise.
	(TEST_VECTOR_exp): Likewise.
	(TEST_VECTOR_pow): Likewise.
	* sysdeps/x86_64/fpu/test-double-vlen8.h (TEST_VECTOR_cos):
	Likewise.
	(TEST_VECTOR_sin): Likewise.
	(TEST_VECTOR_sincos): Likewise.
	(TEST_VECTOR_log): Likewise.
	(TEST_VECTOR_exp): Likewise.
	(TEST_VECTOR_pow): Likewise.
	* sysdeps/x86_64/fpu/test-float-vlen16.h (TEST_VECTOR_cosf):
	Likewise.
	(TEST_VECTOR_sinf): Likewise.
	(TEST_VECTOR_sincosf): Likewise.
	(TEST_VECTOR_logf): Likewise.
	(TEST_VECTOR_expf): Likewise.
	(TEST_VECTOR_powf): Likewise.
	* sysdeps/x86_64/fpu/test-float-vlen8.h (TEST_VECTOR_cosf):
	Likewise.
	(TEST_VECTOR_sinf): Likewise.
	(TEST_VECTOR_sincosf): Likewise.
	(TEST_VECTOR_logf): Likewise.
	(TEST_VECTOR_expf): Likewise.
	(TEST_VECTOR_powf): Likewise.
	* math/gen-libm-have-vector-test.sh: Remove file.
	* math/libm-test.inc: Likewise.
	* math/libm-test-support-double.c: Likewise.
	* math/libm-test-support-float.c: Likewise.
	* math/libm-test-support-ldouble.c: Likewise.
	* math/test-double-finite.c: Likewise.: Likewise.
	* math/test-double.c: Likewise.
	* math/test-float-finite.c: Likewise.
	* math/test-float.c: Likewise.
	* math/test-idouble.c: Likewise.
	* math/test-ifloat.c: Likewise.
	* math/test-ildouble.c: Likewise.
	* math/test-ldouble-finite.c: Likewise.
	* math/test-ldouble.c: Likewise.
	* sysdeps/x86_64/fpu/test-double-vlen2.c: Likewise.
	* sysdeps/x86_64/fpu/test-double-vlen2.h: Likewise.
	* sysdeps/x86_64/fpu/test-double-vlen4-avx2.c: Likewise.
	* sysdeps/x86_64/fpu/test-double-vlen4.c: Likewise.
	* sysdeps/x86_64/fpu/test-double-vlen8.c: Likewise.
	* sysdeps/x86_64/fpu/test-float-vlen16.c: Likewise.
	* sysdeps/x86_64/fpu/test-float-vlen4.c: Likewise.
	* sysdeps/x86_64/fpu/test-float-vlen4.h: Likewise.
	* sysdeps/x86_64/fpu/test-float-vlen8-avx2.c: Likewise.
	* sysdeps/x86_64/fpu/test-float-vlen8.c: Likewise.
2017-02-24 00:52:49 +00:00
Gabriel F. T. Gomes aec0821ce7 Add new templates for IEEE wrappers
Several wrappers for IEEE functions use _LIB_VERSION / matherr /
__kernel_standard functionality, which we want to obsolete.  New
wrappers, such as for float128, must not use this functionality.

This patch adds new wrappers that only __set_errno and can be used by
the new float128 wrappers.

Tested for powerpc64le.

	* math/Makefile: Add wrappers to gen-libm-calls.
	* math/w_acos_template.c: New file.
	* math/w_acosh_template.c: Likewise.
	* math/w_asin_template.c: Likewise.
	* math/w_atan2_template.c: Likewise.
	* math/w_atanh_template.c: Likewise.
	* math/w_cosh_template.c: Likewise.
	* math/w_exp10_template.c: Likewise.
	* math/w_exp2_template.c: Likewise.
	* math/w_exp_template.c: Likewise.
	* math/w_fmod_template.c: Likewise.
	* math/w_hypot_template.c: Likewise.
	* math/w_j0_template.c: Likewise.
	* math/w_j1_template.c: Likewise.
	* math/w_jn_template.c: Likewise.
	* math/w_lgamma_r_template.c: Likewise.
	* math/w_lgamma_template.c: Likewise.
	* math/w_log10_template.c: Likewise.
	* math/w_log2_template.c: Likewise.
	* math/w_log_template.c: Likewise.
	* math/w_pow_template.c: Likewise.
	* math/w_remainder_template.c: Likewise.
	* math/w_sinh_template.c: Likewise.
	* math/w_sqrt_template.c: Likewise.
	* math/w_tgamma_template.c: Likewise.: Likewise.
	* sysdeps/generic/math-type-macros-double.h
	(__USE_WRAPPER_TEMPLATE): New macro to control inclusion of
	the new wrappers.
	* sysdeps/generic/math-type-macros-float.h: Likewise.
	* sysdeps/generic/math-type-macros-ldouble.h: Likewise.
2017-02-23 11:28:50 -03:00
Joseph Myers 63e1c3768d Add TFD_TIMER_CANCEL_ON_SET to sys/timerfd.h.
In Linux 4.10, timerfd constants moved to a new uapi header, which
showed up that glibc's sys/timerfd.h is missing the old flag
TFD_TIMER_CANCEL_ON_SET.  This patch adds that flag to glibc's header.

Tested for x86_64.

	* sysdeps/unix/sysv/linux/sys/timerfd.h (TFD_TIMER_CANCEL_ON_SET):
	New enum constant and macro.
2017-02-22 20:50:38 +00:00
Joseph Myers bf0b5360da Use Linux 4.10 in build-many-glibcs.py.
* scripts/build-many-glibcs.py (Context.checkout): Default Linux
	kernel version to 4.10.
2017-02-22 17:10:09 +00:00
Joseph Myers 72aaa20bbc Add IP_RECVFRAGSIZE from Linux 4.10.
Linux 4.10 adds a new IP_RECVFRAGSIZE macro to
include/uapi/linux/in.h.  This patch adds it to glibc's
sysdeps/unix/sysv/linux/bits/in.h.

Tested for x86_64.

	* sysdeps/unix/sysv/linux/bits/in.h (IP_RECVFRAGSIZE): New macro.
2017-02-21 18:18:24 +00:00
Tulio Magno Quites Machado Filho 2f78098e39 powerpc: Update powerpc-fpu libm-test-ulps
* sysdeps/powerpc/fpu/libm-test-ulps: Update.
2017-02-21 14:00:01 -03:00
Wainer dos Santos Moschetta 6ec4140255 powerpc: Add tests for __ppc_set_ppr_* functions.
The sys/platform/ppc.h header defines a class of __ppc_set_ppr functions
used to set the Program Priority Register (PPR) in PowerPC.
This patch implements test cases for these functions.

Tested on ppc64le, ppc64, and ppc.

	* sysdeps/powerpc/tst-set_ppr.c: New file.
	Implement test cases for __ppc_set_ppr_* functions.
	* sysdeps/powerpc/Makefile ($(subdir),misc): Add tst-set_ppr
	in the list of tests.
2017-02-21 14:00:01 -03:00
Wainer dos Santos Moschetta ee6df1e6ab powerpc: Convert tests to the new support test-driver
Change the powerpc tests to use <support/test-driver.c>.
Also replace some of pthread calls to its xpthread equivalent.

Tested on ppc64le.

	* sysdeps/powerpc/test-get_hwcap.c: Use <support/test-driver.c>
	instead of test-skeleton.c.
	(do_test): Replaced pthread_create and pthread_join with
	xpthread_create and xpthread_join.  Use TEST_VERIFY_EXIT macro.
	Removed unneeded status variable.
	* sysdeps/powerpc/test-gettimebase.c: Use <support/test-driver.c>
	instead of test-skeleton.c.
	* sysdeps/powerpc/tst-tlsopt-powerpc.c: Likewise.
2017-02-21 14:00:00 -03:00
Mike FABIAN 0b38d66a4e Bug 20313: Update to Unicode 9.0.0
* Unicode 9.0.0 Support: Character encoding, character type info, and
  transliteration tables are all updated to Unicode 9.0.0, using
  generator scripts contributed by Mike FABIAN (Red Hat).
2017-02-21 06:30:38 -05:00
Joseph Myers 24b2a1b122 Remove some unused libm-test exception macros.
This patch removes some libm-test-support.h macros for exceptions that
are no longer used.  EXCEPTIONS_OK has been unused for some time.  The
macros for underflow exceptions with some types only were used when
the results for complex inverse trig and hyperbolic functions were
manually maintained, but are no longer needed now the auto-libm-test
machinery is used to determine the correct result and exceptions for
every floating-point format and rounding mode.

Tested for x86_64.

	* math/libm-test-support.h (EXCEPTIONS_OK): Remove macro.
	(UNDERFLOW_EXCEPTION_FLOAT): Likewise.
	(UNDERFLOW_EXCEPTION_OK_FLOAT): Likewise.
	(UNDERFLOW_EXCEPTION_DOUBLE): Likewise.
	(UNDERFLOW_EXCEPTION_OK_DOUBLE): Likewise.
	(UNDERFLOW_EXCEPTION_LDOUBLE_IBM): Likewise.
2017-02-20 17:53:51 +00:00
Zack Weinberg 71223d6880 One more obvious missing #include in the testsuite.
* rt/tst-mqueue4.c: Include stdint.h.
2017-02-19 10:29:34 -05:00
Joseph Myers 9174b4c3b6 Update arm, mips, powerpc-nofpu libm-test-ulps.
* sysdeps/arm/libm-test-ulps: Update.
	* sysdeps/mips/mips32/libm-test-ulps: Likewise.
	* sysdeps/mips/mips64/libm-test-ulps: Likewise.
	* sysdeps/powerpc/nofpu/libm-test-ulps: Likewise.
2017-02-17 23:10:01 +00:00
Adhemerval Zanella 3b33d6ed60 Rework -fno-omit-frame-pointer support on i386
Commit 6b1df8b27f fixed the -OS build issue on i386 (BZ#20729) by
expliciting disabling frame pointer (-fomit-frame-pointer) on the
faulty objects.  Although it does fix the issue, it is a subpar
workaround that adds complexity in build process (a rule for each
object to add the required compiler option and pontentially more
rules for objects that call {INLINE,INTERNAL}_SYSCALL) and does not
allow the implementations to get all the possible debug/calltrack
information possible (used mainly in debuggers and performance
measurement tools).

This patch fixes it by adding an explicit configure check to see
if -fno-omit-frame-pointer is set and to act accordingly (set or
not OPTIMIZE_FOR_GCC_5).  The make rules is simplified and only
one is required: to add libc-do-syscall on loader due mmap
(which will be empty anyway for default build with
-fomit-frame-pointer).

Checked on i386-linux-gnu with GCC 6.2.1 with CFLAGS sets as
'-Os', '-O2 -fno-omit-frame-pointer', and '-O2 -fomit-frame-pointer'.
For '-Os' the testsuite issues described by BZ#19463 and BZ#15105
still applied.

It fixes BZ #21029, although it is marked as duplicated of #20729
(I reopened to track this cleanup).

	[BZ #21029]
	* config.h.in [CAN_USE_REGISTER_ASM_EBP]: New define.
	* sysdeps/unix/sysv/linux/i386/Makefile
	[$(subdir) = elf] (sysdep-dl-routines): Add libc-do-syscall.
	(uses-6-syscall-arguments): Remove.
	[$(subdir) = misc] (CFLAGS-epoll_pwait.o): Likewise.
	[$(subdir) = misc] (CFLAGS-epoll_pwait.os): Likewise.
	[$(subdir) = misc] (CFLAGS-mmap.o): Likewise.
	[$(subdir) = misc] (CFLAGS-mmap.os): Likewise.
	[$(subdir) = misc] (CFLAGS-mmap64.o): Likewise.
	[$(subdir) = misc] (CFLAGS-mmap64.os): Likewise.
	[$(subdir) = misc] (CFLAGS-pselect.o): Likewise.
	[$(subdir) = misc] (cflags-pselect.o): Likewise.
	[$(subdir) = misc] (cflags-pselect.os): Likewise.
	[$(subdir) = misc] (cflags-rtld-mmap.os): Likewise.
	[$(subdir) = sysvipc] (cflags-semtimedop.o): Likewise.
	[$(subdir) = sysvipc] (cflags-semtimedop.os): Likewise.
	[$(subdir) = io] (CFLAGS-posix_fadvise64.o): Likewise.
	[$(subdir) = io] (CFLAGS-posix_fadvise64.os): Likewise.
	[$(subdir) = io] (CFLAGS-posix_fallocate.o): Likewise.
	[$(subdir) = io] (CFLAGS-posix_fallocate.os): Likewise.
	[$(subdir) = io] (CFLAGS-posix_fallocate64.o): Likewise.
	[$(subdir) = io] (CFLAGS-posix_fallocate64.os): Likewise.
	[$(subdir) = io] (CFLAGS-sync_file_range.o): Likewise.
	[$(subdir) = io] (CFLAGS-sync_file_range.os): Likewise.
	[$(subdir) = io] (CFLAGS-fallocate.o): Likewise.
	[$(subdir) = io] (CFLAGS-fallocate.os): Likewise.
	[$(subdir) = io] (CFLAGS-fallocate64.o): Likewise.
	[$(subdir) = io] (CFLAGS-fallocate64.os): Likewise.
	[$(subdir) = nptl] (CFLAGS-pthread_rwlock_timedrdlock.o):
	Likewise.
	[$(subdir) = nptl] (CFLAGS-pthread_rwlock_timedrdlock.os):
	Likewise.
	[$(subdir) = nptl] (CFLAGS-pthread_rwlock_timedrwlock.o):
	Likewise.
	[$(subdir) = nptl] (CFLAGS-pthread_rwlock_timedrwlock.os):
	Likewise.
	[$(subdir) = nptl] (CFLAGS-sem_wait.o): Likewise.
	[$(subdir) = nptl] (CFLAGS-sem_wait.os): Likewise.
	[$(subdir) = nptl] (CFLAGS-sem_timedwait.o): Likewise.
	[$(subdir) = nptl] (CFLAGS-sem_timedwait.os): Likewise.
	* sysdeps/unix/sysv/linux/i386/configure.ac: Add check if compiler allows
	ebp on inline assembly.
	* sysdeps/unix/sysv/linux/i386/configure: Regenerate.
	* sysdeps/unix/sysv/linux/i386/sysdep.h (OPTIMIZE_FOR_GCC_5):
	Set if CAN_USE_REGISTER_ASM_EBP is set.
	(check_consistency): Likewise.
2017-02-17 18:06:29 -02:00
H.J. Lu 52ac22365a Use index_cpu_RTM and reg_RTM to clear the bit_cpu_RTM bit
* sysdeps/x86/cpu-features.c (init_cpu_features): Use
	index_cpu_RTM and reg_RTM to clear the bit_cpu_RTM bit.
2017-02-17 11:53:26 -08:00
Joseph Myers 2c51dfd05d Move tests of catan, catanh to auto-libm-test-*.
This patch moves tests of catan and catanh with finite inputs (other
than the divide-by-zero cases producing an exact infinity) to using
the auto-libm-test machinery.  Each of auto-libm-test-out-catan and
auto-libm-test-out-catanh takes about three seconds to generate on my
system (so in fact it wasn't necessary after all to defer the move to
auto-libm-test-* until the output files were split up by function).

Tested for x86_64 and x86 and ulps updated accordingly.

	* math/auto-libm-test-in: Add tests of catan and catanh.
	* math/auto-libm-test-out-catan: New generated file.
	* math/auto-libm-test-out-catanh: Likewise.
	* math/libm-test-catan.inc (catan_test_data): Use AUTO_TESTS_c_c.
	Move tests with finite inputs, except divide-by-zero cases, to
	auto-libm-test-in.
	* math/libm-test-catanh.inc (catanh_test_data): Likewise.
	* math/Makefile (libm-test-funcs-auto): Add catan and catanh.
	(libm-test-funcs-noauto): Remove catan and catanh.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
	* sysdeps/i386/i686/fpu/multiarch/libm-test-ulps: Likewise.
	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
2017-02-17 18:42:37 +00:00
Joseph Myers fa2a3dd7a3 Move tests of casin, casinh to auto-libm-test-*.
This patch moves tests of casin and casinh with finite inputs to using
the auto-libm-test machinery.  Each of auto-libm-test-out-casin and
auto-libm-test-out-casinh takes about 38 minutes to generate on my
system because of MPC slowness on special cases that appear in the
tests (with MPC 1.0.3; I don't know to what extent current MPC master
might speed it up).

Tested for x86_64 and x86 and ulps updated accordingly.

	* math/auto-libm-test-in: Add tests of casin and casinh.
	* math/auto-libm-test-out-casin: New generated file.
	* math/auto-libm-test-out-casinh: Likewise.
	* math/libm-test-casin.inc (casin_test_data): Use AUTO_TESTS_c_c.
	Move tests with finite inputs to auto-libm-test-in.
	* math/libm-test-casinh.inc (casinh_test_data): Likewise.
	* math/Makefile (libm-test-funcs-auto): Add casin and casinh.
	(libm-test-funcs-noauto): Remove casin and casinh.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
	* sysdeps/i386/i686/fpu/multiarch/libm-test-ulps: Likewise.
	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
2017-02-17 18:14:02 +00:00
Joseph Myers 6b8303a383 Move tests of cacos, cacosh to auto-libm-test-*.
This patch moves tests of cacos and cacosh with finite inputs to using
the auto-libm-test machinery.  Each of auto-libm-test-out-cacos and
auto-libm-test-out-cacosh takes about 80 minutes to generate on my
system because of MPC slowness on special cases that appear in the
tests (with MPC 1.0.3; I don't know to what extent current MPC master
might speed it up).

Tested for x86_64 and x86 and ulps updated accordingly.

	* math/auto-libm-test-in: Add tests of cacos and cacosh.
	* math/auto-libm-test-out-cacos: New generated file.
	* math/auto-libm-test-out-cacosh: Likewise.
	* math/libm-test-cacos.inc (cacos_test_data): Use AUTO_TESTS_c_c.
	Move tests with finite inputs to auto-libm-test-in.
	* math/libm-test-cacosh.inc (cacosh_test_data): Likewise.
	* math/Makefile (libm-test-funcs-auto): Add cacos and cacosh.
	(libm-test-funcs-noauto): Remove cacos and cacosh.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
	* sysdeps/i386/i686/fpu/multiarch/libm-test-ulps: Likewise.
	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
2017-02-17 17:44:23 +00:00