Paul E. Murphy [Thu, 25 Aug 2016 22:25:40 +0000 (17:25 -0500)]
Remove unneeded stubs for k_rem_pio2l.
This is only used for the float and double variants.
Instead, just add it to the type specific list of files,
and remove all stubs, and remove the declaration from
math_private.h.
I verified x86_64, i486, ia64, m68k, and ppc64 build.
Paul E. Murphy [Thu, 25 Aug 2016 22:03:36 +0000 (17:03 -0500)]
Make common fmin implementation generic.
Paul E. Murphy [Thu, 25 Aug 2016 21:48:03 +0000 (16:48 -0500)]
Make common fmax implementation generic.
Also update aarch64 to ensure the correct s_fmin.c is included.
The include order favors including the generated copy.
Paul E. Murphy [Wed, 24 Aug 2016 21:05:28 +0000 (16:05 -0500)]
Make common nextdown implementation generic.
With the exception of those machines using the ldbl-opt in
an Implies file, this is a trivial transformation.
nextdownl is not subject to the non-trivial versioning rules
of the other generated functions, so to keep things simple,
it is handled as a one-off case in ldbl-opt to preserve the
existing behavior.
Paul E. Murphy [Thu, 25 Aug 2016 16:25:33 +0000 (11:25 -0500)]
Make common fdim implementation generic.
The only difference is the usage of math_narrow_eval when
building s_fdiml.c. This should be harmless for long double,
but I did observe some code generation changes on m68k, but
lack the resources to test it.
Likewise, to more easily support overriding symbol generation,
the aliasing macros are always conditionally defined on their
absence to reduce boilerplate.
I also ran builds for i486, ppc64, sparcv9, aarch64,
s390x and observed no changes to s_fdim* objects.
Florian Weimer [Thu, 1 Sep 2016 13:53:13 +0000 (15:53 +0200)]
Base <sys/quota.h> on Linux kernel headers [BZ #20525]
Macros which are also defined in <linux/quota.h> are removed, and
<linux/quota.h> is included instead.
This commit cleans up the definition of fs_to_dq_blocks and struct
dqblock and struct dqinfo, too.
Paul E. Murphy [Wed, 31 Aug 2016 18:17:35 +0000 (13:17 -0500)]
ldbl-128: Cleanup e_gammal_r.c after _Float128 rename
Paul E. Murphy [Wed, 20 Jul 2016 20:20:51 +0000 (15:20 -0500)]
ldbl-128: Rename 'long double' to '_Float128'
Add a layer of macro indirection for long double files
which need to be built using another typename. Likewise,
add the L(num) macro used in a later patch to override
real constants.
These macros are only defined through the ldbl-128
math_ldbl.h header, thereby implicitly restricting
these macros to machines which back long double
with an IEEE binary128 format.
Likewise, appropriate changes are made for the few
files which indirectly include such ldbl-128 files.
These changes produce identical binaries for s390x,
aarch64, and ppc64.
Stefan Liebler [Wed, 31 Aug 2016 12:54:55 +0000 (14:54 +0200)]
S390: Do not set FE_INEXACT with feraiseexcept (FE_OWERFLOW|FE_UNDERFLOW).
On s390 feraiseexcept (FE_OVERFLOW|FE_UNDERFLOW) sets FE_INEXACT, too.
This patch uses z196 zarch load rounded instruction which can suppress
FE_INEXACT exception if gcc has z196 support in used configuration.
Otherwise FE_INEXACT flag is set as before. The gcc support is tested
in a new configure-check.
A comment in fsetexcptflg.c is corrected as new exceptions are not
executed with the next floating-point instruction if fpc is set with
_FPU_SETCW macro. It seems the comment was copied e.g. from
sysdeps/x86_64/fpu/fsetexcptflg.c file.
ChangeLog:
* config.h.in (HAVE_S390_MIN_Z196_ZARCH_ASM_SUPPORT):
New undefine.
* sysdeps/s390/configure.ac: Add test for z196 zarch support.
* sysdeps/s390/configure: Regenerated.
* sysdeps/s390/fpu/fraiseexcpt.c (__feraiseexcept): Use ledbra
instruction for raising over-/underflow if z196 zarch is supported
by default.
* sysdeps/s390/fpu/fsetexcptflg.c (fesetexceptflag):
Correct comment.
Svante Signell [Tue, 30 Aug 2016 21:06:31 +0000 (23:06 +0200)]
hurd: Fix adjtime call with OLDDELTA == NULL
* sysdeps/mach/hurd/adjtime.c (__adjtime): When OLDDELTA is NULL, make
it point to a dumb buffer for RPC to fill it.
Siddhesh Poyarekar [Tue, 30 Aug 2016 07:31:59 +0000 (13:01 +0530)]
Use fabs(x) instead of branching on signedness of input to sin and cos
The sin and cos code is inconsistent about its use of fabs to get the
absolute value of X where in some places it conditionalizes the code
while in others it uses fabs. fabs seems to be a better candidate in
most cases because it avoids a branch. Similarly there is an attempt
to make it easier for the compiler to emit conditional assignment
instructions (like fcsel on aarch64) where it can, by isolating
conditional assignment constructs from the rest of the expression.
A further benefit of this change is to identify common constructs
across functions and consolidate them in future patches.
* sysdeps/ieee754/dbl-64/s_sin.c (do_cos_slow): Use ternary
instead of if/else.
(do_sin_slow): Likewise.
(do_sincos_1): Use fabs instead of if/else.
(do_sincos_2): Likewise.
(__sin): Likewise.
(__cos): Likewise.
(slow2): Likewise.
(sloww): Likewise.
(sloww1): Likewise. Drop argument M.
(sloww2): Use fabs instead of if/else.
(bsloww): Likewise.
(bsloww1): Likewise.
(bsloww2): Likewise.
Siddhesh Poyarekar [Tue, 30 Aug 2016 07:30:29 +0000 (13:00 +0530)]
Add fall through comments
Add fall through comments I had missed writing in previously.
Siddhesh Poyarekar [Tue, 30 Aug 2016 07:21:39 +0000 (12:51 +0530)]
Consolidate reduce_and_compute code
This patch reshuffles the reduce_and_compute code so that the
structure matches other code structures of the same type elsewhere in
s_sin.c and s_sincos.c. This is the beginning of an attempt to
consolidate and reduce code duplication in functions in s_sin.c to
make it easier to read and possibly also easier for the compiler to
optimize.
* sysdeps/ieee754/dbl-64/s_sin.c (reduce_and_compute):
Consolidate switch cases 0 and 2.
Paul E. Murphy [Tue, 28 Jun 2016 19:28:04 +0000 (14:28 -0500)]
Convert remaining complex function to generated files
Convert cpow, clog, clog10, cexp, csqrt, and cproj functions
into generated templates. Note, ldbl-opt still retains
s_clog10l.c as the aliasing rules are non-trivial.
Paul E. Murphy [Fri, 1 Jul 2016 16:03:51 +0000 (11:03 -0500)]
Prepare to convert remaining _Complex functions
This patch has no function changes, except to
ensure the git history correctly tracks the
changes to convert the double version of these
functions into a templated version.
Paul E. Murphy [Fri, 26 Aug 2016 18:58:19 +0000 (13:58 -0500)]
sparcv9: Restore fdiml@GLIBC_2.1
Use s_fdim.c from sysdeps/ieee754/ldbl-opt/ instead of
math/ to ensure a compat symbol for fdiml is created.
Joseph Myers [Mon, 29 Aug 2016 11:47:21 +0000 (11:47 +0000)]
Add fetestexceptflag.
TS 18661-1 defines an fetestexceptflag function to test the exception
state saved in an fexcept_t object by fegetexceptflag.
This patch implements this function for glibc. Almost all
architectures save exception state in such a way that it can be
directly ANDed with exception flag bits, so rather than having lots of
fetestexceptflag implementations that all do the same thing, the math/
implementation is made to use this generic logic (which is also OK in
the fallback case where FE_ALL_EXCEPT is zero). The only architecture
that seems to need anything different is s390.
(fegetexceptflag and fesetexceptflag use abbreviated filenames
fgetexcptflg.c and fsetexcptflg.c. Because we are no longer concerned
by 14-character filename limits, fetestexceptflag uses the obvious
filename fetestexceptflag.c.)
The NEWS entry is intended to be expanded along the lines given in
<https://sourceware.org/ml/libc-alpha/2016-08/msg00356.html> when
fegetmode and fesetmode are added.
Tested for x86_64, x86, mips64 and powerpc.
* math/fetestexceptflag.c: New file.
* sysdeps/s390/fpu/fetestexceptflag.c: Likewise. Comment by
Stefan Liebler.
* math/fenv.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
(fetestexceptflag): New function declaration.
* manual/arith.texi (fetestexceptflag): Document function.
* math/Versions (fetestexceptflag): New libm symbol at version
GLIBC_2.25.
* math/Makefile (libm-support): Add fetestexceptflag.
(tests): Add test-fetestexceptflag.
* math/test-fetestexceptflag.c: New file.
* sysdeps/nacl/libm.abilist: Update.
* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
Florian Weimer [Fri, 26 Aug 2016 20:40:27 +0000 (22:40 +0200)]
malloc: Simplify static malloc interposition [BZ #20432]
Existing interposed mallocs do not define the glibc-internal
fork callbacks (and they should not), so statically interposed
mallocs lead to link failures because the strong reference from
fork pulls in glibc's malloc, resulting in multiple definitions
of malloc-related symbols.
Adhemerval Zanella [Fri, 26 Aug 2016 20:33:47 +0000 (17:33 -0300)]
Fix test-skeleton C99 designed initialization
ISO C forbids empty initializer braces (6.7.9 initializer-list must
contain at least one initializer). However GCC allows it, generating
a warning depending of the version.
With GCC 4.8 on ARM I noticed tst-initializers1.c fails to build with:
In file included from tst-initializers1.c:60:0:
../test-skeleton.c: In function 'delayed_exit_thread':
../test-skeleton.c:687:10: error: missing initializer for field 'tv_sec' of 'struct timespec' [-Werror=missing-field-initializers]
struct timespec remaining = {}
While with GCC 5.1 the same warning is just spilled with -pedantic.
To be safe this patch just zero initialize the struct as expected.
Tested on armhf.
* test-skeleton.c (delayed_exit_thread): Add initializer on struct
timespec C99 designated initialization.
Florian Weimer [Fri, 26 Aug 2016 17:43:29 +0000 (19:43 +0200)]
Correct incorrect bug number in changelog
Florian Weimer [Fri, 26 Aug 2016 17:27:16 +0000 (19:27 +0200)]
nptl: Avoid expected SIGALRM in most tests [BZ #20432]
Before this change, several tests did not detect early deadlocks
because they used SIGALRM as the expected signal, and they ran
for the full default TIMEOUT seconds.
This commit adds a new delayed_exit function to the test skeleton,
along with several error-checking wrappers to pthread functions.
Additional error checking is introduced into several tests.
H.J. Lu [Fri, 26 Aug 2016 15:57:42 +0000 (08:57 -0700)]
X86-64: Correct CFA in _dl_runtime_resolve
When stack is re-aligned in _dl_runtime_resolve, there is no need to
adjust CFA when allocating register save area on stack.
* sysdeps/x86_64/dl-trampoline.h (_dl_runtime_resolve): Don't
adjust CFA when allocating register save area on re-aligned
stack.
Florian Weimer [Fri, 26 Aug 2016 12:28:46 +0000 (14:28 +0200)]
string: More tests for strcmp, strcasecmp, strncmp, strncasecmp
Mark Wielaard [Thu, 25 Aug 2016 21:47:19 +0000 (23:47 +0200)]
Reduce memory size of tsearch red-black tree.
A tsearch red-black tree node contains 3 pointers (key, left, right)
and 1 bit to hold the red-black flag. When allocating new nodes
this 1 bit is expanded to a full word. Causing the overhead per node
to be 3 times the key size.
We can reduce this overhead to just 2 times the key size.
malloc returns naturally aligned memory. All nodes are internally
allocated with malloc and the left/right node pointers are used
as implementation details. So we can use the low bits of the
left/right node pointers to store extra information.
Replace all direct accesses of the struct node_t node pointers and
red-black value with defines that take care of the red-black flag in
the low bit of the (left) node pointer. This reduces the size of the
nodes on 32-bit systems from 16 to 12 bytes and on 64-bit systems
from 32 to 24 bytes.
Also fix a call to CHECK_TREE so the code can be build (and tested)
with DEBUGGING defined again.
V2 changes:
- Add assert after malloc to catch any odd pointers from bad
interposed mallocs.
- Rename implementation flag to USE_MALLOC_LOW_BIT.
ChangeLog:
* misc/tsearch.c (struct node_t): Reduce to 3 pointers if
USE_MALLOC_LOW_BIT. Define pointer/value accessors.
(check_tree_recurse): Use newly defined accessors.
(check_tree): Likewise.
(maybe_split_for_insert): Likewise.
(__tfind): Likewise.
(__tdelete): Likewise.
(trecurse): Likewise.
(tdestroy_recurse): Likewise.
(__tsearch): Likewise. And add asserts for malloc alignment.
(__twalk): Cast root to node in case CHECK_TREE is defined.
Ernestas Kulik [Sun, 21 Aug 2016 11:39:36 +0000 (14:39 +0300)]
localedata: lt_LT: use hyphens in d_fmt [BZ #20497]
The standard currently in effect (LST ISO 8601:1997) mandates the use
of hyphens (as opposed to full stops, currently) in date formats. It
also matches current CLDR data (v29), Wikipedia's & Wikia's settings,
and Microsoft's Lithuanian Style Guide.
Samuel Thibault [Sun, 21 Aug 2016 01:24:32 +0000 (03:24 +0200)]
mach: Add more allowed external headers
* scripts/check-local-headers.sh (exclude): Add mach_debug/.
Paul E. Murphy [Tue, 28 Jun 2016 16:06:42 +0000 (11:06 -0500)]
Convert _Complex tangent functions to generated code
This converts s_c{,a}tan{,h}{f,,l} into a single
templated file c{,a}tan{,h}_template.c with the
exception of alpha.
Paul E. Murphy [Fri, 1 Jul 2016 16:00:21 +0000 (11:00 -0500)]
Prepare to convert _Complex tangent functions
This patch has no function changes, except to
ensure the git history correctly tracks the
changes to convert the double version of these
functions into a templated version.
Paul E. Murphy [Tue, 28 Jun 2016 13:49:23 +0000 (08:49 -0500)]
Convert _Complex sine functions to generated code
Refactor s_c{,a}sin{,h}{f,,l} into a single templated
macro.
Paul E. Murphy [Fri, 1 Jul 2016 15:55:27 +0000 (10:55 -0500)]
Prepare to convert _Complex sine functions
This patch has no function changes, except to
ensure the git history correctly tracks the
changes to convert the double version of these
functions into a templated version.
H.J. Lu [Fri, 19 Aug 2016 20:32:21 +0000 (13:32 -0700)]
X86: Change bit_YMM_state to (1 << 2)
All other state bits, except for bit_YMM_state, are defined as (1 << N).
This patch changes bit_YMM_state from (2 << 1) to (1 << 2).
* sysdeps/x86/cpu-features.h (bit_YMM_state): Set to (1 << 2).
Paul E. Murphy [Mon, 8 Aug 2016 20:58:28 +0000 (15:58 -0500)]
Merge common usage of mul_split function
A number of files share identical code for the
mul_split function.
This moves the duplicated function mul_split into its
own header, and refactors the fma usage into a single
selection macro. Likewise, mul_split when used by a
long double implementation is renamed mul_splitl for
clarity.
Paul E. Murphy [Mon, 27 Jun 2016 22:11:46 +0000 (17:11 -0500)]
Convert _Complex cosine functions to generated code
This is fairly straight fowards. m68k overrides are
updated to use the framework, and thus are simplified
a bit.
Paul E. Murphy [Fri, 1 Jul 2016 15:49:03 +0000 (10:49 -0500)]
Prepare to convert _Complex cosine functions
This patch has no function changes, except to
ensure the git history correctly tracks the
changes to convert the double version of these
functions into a templated version.
Paul E. Murphy [Thu, 28 Jul 2016 16:14:11 +0000 (11:14 -0500)]
Add tst-wcstod-round
This extends tst-strtod-round with a few trivial changes
to also test the wide character variants of strto* using
similar macros to other shared tests.
Zack Weinberg [Wed, 17 Aug 2016 14:05:43 +0000 (10:05 -0400)]
Add tests for fortification of bcopy and bzero.
* debug/tst-chk1.c: Add tests for fortification of bcopy and bzero.
Torvald Riegel [Wed, 17 Aug 2016 11:56:11 +0000 (13:56 +0200)]
Fix incorrect double-checked locking related to _res_hconf.initialized.
_res_hconf.initialized was not suitable for use in a multi-threaded
environment due to the lack of atomics and memory barriers. Use of it was
also unnecessary because _res_hconf_init did the right thing by using
__libc_once. This patch fixes the glibc-internal uses by just calling
_res_hconf_init unconditionally, and switches to a release MO atomic store
for _res_hconf.initialized to fix the glibc side of the synchronization
problem (which will maintain backward compatibility, but cannot fix the
lack of acquire MO on any glibc-external loads).
[BZ #20477]
* resolv/res_hconf.c (do_init): Use atomic access.
* resolv/res_hconf.h: Add comments.
* nscd/aicache.c (addhstaiX): Call _res_hconf_init unconditionally.
* nss/getXXbyYY_r.c (REENTRANT_NAME): Likewise.
* sysdeps/posix/getaddrinfo.c (gaih_inet): Likewise.
Stefan Liebler [Thu, 18 Aug 2016 10:20:35 +0000 (12:20 +0200)]
Get rid of array-bounds warning in __kernel_rem_pio2[f] with gcc 6.1 -O3.
On s390x I get the following werror when build with gcc 6.1 (or current gcc head) and -O3:
../sysdeps/ieee754/dbl-64/k_rem_pio2.c: In function ‘__kernel_rem_pio2’:
../sysdeps/ieee754/dbl-64/k_rem_pio2.c:254:18: error: array subscript is below array bounds [-Werror=array-bounds]
for (k = 1; iq[jk - k] == 0; k++)
~~^~~~~~~~
I get the same error with sysdeps/ieee754/flt-32/k_rem_pio2f.c.
This patch adds DIAG_* macros around it.
ChangeLog:
* sysdeps/ieee754/dbl-64/k_rem_pio2.c (__kernel_rem_pio2):
Use DIAG_*_NEEDS_COMMENT macro to get rid of array-bounds warning.
* sysdeps/ieee754/flt-32/k_rem_pio2f.c (__kernel_rem_pio2f):
Likewise.
Florian Weimer [Thu, 18 Aug 2016 09:15:42 +0000 (11:15 +0200)]
argp: Do not override GCC keywords with macros [BZ #16907]
glibc provides fallback definitions already. It is not necessary to
suppress warnings for unknown attributes because GCC does this
automatically for system headers.
This commit does not sync with gnulib because gnulib has started to use
_GL_* macros in the header file, which are arguably in the gnulib
implementation space and not suitable for an installed glibc header
file.
Paul E. Murphy [Tue, 16 Aug 2016 15:49:39 +0000 (10:49 -0500)]
ldbl-128: Remove unused sqrtl declaration in e_asinl.c
This did not alter compilation for s390x and aarch64
targets.
Paul E. Murphy [Tue, 14 Jun 2016 16:44:14 +0000 (11:44 -0500)]
Support for type-generic libm function implementations libm
This defines a new classes of libm objects. The
<func>_template.c file which is used in conjunction
with the new makefile hooks to derive variants for
each type supported by the target machine.
The headers math-type-macros-TYPE.h are used to supply
macros to a common implementation of a function in
a file named FUNC_template.c and glued togethor via
a generated file matching existing naming in the
build directory.
This has the properties of preserving the existing
override mechanism and not requiring any arcane
build system twiddling. Likewise, it enables machines
to override these files without any additional work.
I have verified the built objects for ppc64, x86_64,
alpha, arm, and m68k do not change in any meaningful
way with these changes using the Fedora cross toolchains.
I have verified the x86_64 and ppc64 changes still run.
Florian Weimer [Wed, 17 Aug 2016 14:14:02 +0000 (16:14 +0200)]
nptl/tst-once5: Reduce time to expected failure
Florian Weimer [Wed, 17 Aug 2016 12:57:00 +0000 (14:57 +0200)]
Do not override objects in libc.a in other static libraries [BZ #20452]
With this change, we no longer add sysdep.o and similar objects which
are present in libc.a to other static libraries.
Joseph Myers [Tue, 16 Aug 2016 17:11:46 +0000 (17:11 +0000)]
Fix soft-fp extended.h unpacking (GCC bug 77265).
soft-fp unpacking for x86 "extended" fails to clear the implicit
mantissa high bit that is explicit in that format, resulting in
problems for operations that expect this bit to be clear in raw
unpacked values. Specifically, the code for this format is used only
for conversions to and from TFmode (__float128) in libgcc, where this
issue results in GCC bug 77265, extension of long double infinity to
__float128 wrongly produces a NaN.
This patch fixes this by always masking out the implicit bit on
unpacking, so that the results of unpacking meet the expectations of
the rest of the soft-fp code for a normal IEEE format.
Tested for x86_64 in libgcc in conjunction with a GCC testcase for
this issue (this code isn't used in glibc, only in libgcc).
* soft-fp/extended.h [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_RAW_E):
Mask implicit bit out of unpacked value.
[_FP_W_TYPE_SIZE < 64] (FP_UNPACK_RAW_EP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_RAW_E): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_RAW_EP): Likewise.
Joseph Myers [Tue, 16 Aug 2016 16:25:57 +0000 (16:25 +0000)]
Add fesetexcept: sparc.
This patch adds a SPARC version of fesetexcept. Untested.
* sysdeps/sparc/fpu/fesetexcept.c: New file.
Joseph Myers [Tue, 16 Aug 2016 16:25:10 +0000 (16:25 +0000)]
Add fesetexcept: sh.
This patch adds an SH version of fesetexcept. Untested.
* sysdeps/sh/sh4/fpu/fesetexcept.c: New file.
Joseph Myers [Tue, 16 Aug 2016 16:24:11 +0000 (16:24 +0000)]
Add fesetexcept: s390.
This patch adds an S/390 version of fesetexcept. Tested and corrected
by Stefan Liebler.
* sysdeps/s390/fpu/fesetexcept.c: New file.
Joseph Myers [Tue, 16 Aug 2016 16:22:12 +0000 (16:22 +0000)]
Add fesetexcept: powerpc.
This patch adds PowerPC versions of fesetexcept.
* sysdeps/powerpc/fpu/fesetexcept.c: New file.
* sysdeps/powerpc/nofpu/fesetexcept.c: Likewise.
* sysdeps/powerpc/powerpc32/e500/nofpu/fesetexcept.c: Likewise.
Joseph Myers [Tue, 16 Aug 2016 16:21:21 +0000 (16:21 +0000)]
Add fesetexcept: mips.
This patch adds a MIPS version of fesetexcept.
* sysdeps/mips/fpu/fesetexcept.c: New file.
Joseph Myers [Tue, 16 Aug 2016 16:20:33 +0000 (16:20 +0000)]
Add fesetexcept: m68k.
This patch adds an M68K version of fesetexcept. Untested.
* sysdeps/m68k/fpu/fesetexcept.c: New file.
Joseph Myers [Tue, 16 Aug 2016 16:19:55 +0000 (16:19 +0000)]
Add fesetexcept: ia64.
This patch adds an IA64 version of fesetexcept. Untested.
* sysdeps/ia64/fpu/fesetexcept.c: New file.
Joseph Myers [Tue, 16 Aug 2016 16:19:03 +0000 (16:19 +0000)]
Add fesetexcept: hppa.
This patch adds an HPPA version of fesetexcept. Untested.
* sysdeps/hppa/fpu/fesetexcept.c: New file.
Joseph Myers [Tue, 16 Aug 2016 16:18:24 +0000 (16:18 +0000)]
Add fesetexcept: arm.
This patch adds an ARM version of fesetexcept.
* sysdeps/arm/fesetexcept.c: New file.
Joseph Myers [Tue, 16 Aug 2016 16:17:42 +0000 (16:17 +0000)]
Add fesetexcept: alpha.
This patch adds an Alpha version of fesetexcept. Untested.
* sysdeps/alpha/fpu/fesetexcept.c: New file.
Joseph Myers [Tue, 16 Aug 2016 16:16:57 +0000 (16:16 +0000)]
Add fesetexcept: aarch64.
This patch adds an AArch64 version of fesetexcept. Untested.
* sysdeps/aarch64/fpu/fesetexcept.c: New file.
Joseph Myers [Tue, 16 Aug 2016 16:16:10 +0000 (16:16 +0000)]
Add fesetexcept.
TS 18661-1 defines an fesetexcept function for setting floating-point
exception flags without the side-effect of causing enabled traps to be
taken.
This patch series implements this function for glibc. The present
patch adds the fallback stub implementation, x86 and x86_64
implementations, documentation, tests and ABI baseline updates. The
remaining patches, some of them untested, add implementations for
other architectures. The implementations generally follow those of
the fesetexceptflag function.
As for fesetexceptflag, the approach taken for architectures where
setting flags causes enabled traps to be taken is to set the flags
(and potentially cause traps) rather than refusing to set the flags
and returning an error. Since ISO C and TS 18661 provide no way to
enable traps, this is formally in accordance with the standards.
The NEWS entry should be considered a placeholder, since this patch
series is intended to be followed by further such series adding other
TS 18661-1 features, so that the NEWS entry would end up looking more
like
* New <fenv.h> features from TS 18661-1:2014 are added to libm: the
fesetexcept, fetestexceptflag, fegetmode and fesetmode functions,
the femode_t type and the FE_DFL_MODE macro.
with hopefully more such entries for other features, rather than
having an entry for a single function in the end.
I believe we have consensus for adding TS 18661-1 interfaces as per
<https://sourceware.org/ml/libc-alpha/2016-06/msg00421.html>.
Tested for x86_64, x86, mips64 (hard float, and soft float to test the
fallback version), arm (hard float) and powerpc (hard float, soft
float and e500).
* math/fesetexcept.c: New file.
* sysdeps/i386/fpu/fesetexcept.c: Likewise.
* sysdeps/x86_64/fpu/fesetexcept.c: Likewise.
* math/fenv.h: Define
__GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION and include
<bits/libc-header-start.h> instead of including <features.h>.
[__GLIBC_USE (IEC_60559_BFP_EXT)] (fesetexcept): New function
declaration.
* manual/arith.texi (fesetexcept): Document function.
* math/Versions (fesetexcept): New libm symbol at version
GLIBC_2.25.
* math/Makefile (libm-support): Add fesetexcept.
(tests): Add test-fesetexcept and test-fesetexcept-traps.
* math/test-fesetexcept.c: New file.
* math/test-fesetexcept-traps.c: Likewise.
* sysdeps/nacl/libm.abilist: Update.
* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
Florian Weimer [Tue, 16 Aug 2016 09:18:06 +0000 (11:18 +0200)]
Add CVE-2016-6323 missing from NEWS entry
Florian Weimer [Tue, 16 Aug 2016 09:15:09 +0000 (11:15 +0200)]
Add NEWS entry for CVE-2016-6323
Florian Weimer [Tue, 16 Aug 2016 09:06:13 +0000 (11:06 +0200)]
nptl/tst-tls3-malloc: Force freeing of thread stacks
It turns out that due to the reduced stack size in tst-tls3 and the
(fixed) default stack cache size, allocated TLS variables are never
freed, so the test coverage for tst-tls3-malloc is less than complete.
This change increases the thread stack size for tst-tls3-malloc only,
to make sure thread stacks and TLS variables are freed.
Andreas Schwab [Mon, 8 Aug 2016 07:29:18 +0000 (09:29 +0200)]
arm: mark __startcontext as .cantunwind (bug 20435)
__startcontext marks the bottom of the call stack of the contexts created
by makecontext.
Märt Põder [Mon, 15 Aug 2016 09:46:21 +0000 (11:46 +0200)]
locales: et_EE: locale has wrong {p,n}_cs_precedes value [BZ #20459]
According to "Requirements of information technology in Estonian
language and cultural environment" the monetary symbol should be
written after the amount number:
https://www.evs.ee/products/evs-8-2008
Joseph Myers [Fri, 12 Aug 2016 17:49:07 +0000 (17:49 +0000)]
Add comment from sysdeps/powerpc/fpu/fraiseexcpt.c to fsetexcptflg.c.
* sysdeps/powerpc/fpu/fsetexcptflg.c (__fesetexceptflag): Add
comment from fraiseexcpt.c.
Joseph Myers [Fri, 12 Aug 2016 17:34:01 +0000 (17:34 +0000)]
Fix test-fexcept when "inexact" implicitly raised.
ISO C allows feraiseexcept to raise "inexact", in addition to the
requested exceptions, when requested to raise "overflow" or
"underflow". Testing on ARM and PowerPC e500 (where glibc's
feraiseexcept has this property) showed that the new test-fexcept test
failed to allow for this; this patch fixes it, by wrapping
feraiseexcept to clear FE_INEXACT if implicitly raised and not raised
before the call. (It would also be possible to do this with
fesetexcept, which always affects exactly the requested flags, but
this patch avoids making this fix depend on the fesetexcept changes.)
Tested for x86_64, x86, arm and e500.
* math/test-fexcept.c (feraiseexcept_exact): New function.
(test_set): Call feraiseexcept_exact instead of feraiseexcept.
(test_except): Likewise.
Florian Weimer [Thu, 11 Aug 2016 12:39:03 +0000 (14:39 +0200)]
Add missing reference to bug 20452
Joseph Myers [Wed, 10 Aug 2016 21:47:35 +0000 (21:47 +0000)]
Fix powerpc fesetexceptflag clearing FE_INVALID (bug 20455).
As shown by the test math/test-fexcept, the powerpc fesetexceptflag
implementation fails to clear a previously set FE_INVALID flag, when
that flag is clear in the saved exceptions and FE_INVALID is included
in the mask of flags to restore, because it fails to mask out the
sub-exceptions of FE_INVALID from the FPSCR state. This patch fixes
the masking logic accordingly.
Tested for powerpc.
[BZ #20455]
* sysdeps/powerpc/fpu/fsetexcptflg.c (__fesetexceptflag): Mask out
all FE_INVALID sub-exceptions from FPSCR when FE_INVALID specified
to be restored.
Joseph Myers [Wed, 10 Aug 2016 21:01:08 +0000 (21:01 +0000)]
Add tests for fegetexceptflag, fesetexceptflag.
I noticed that there was no meaningful test coverage for
fegetexceptflag and fesetexceptflag (one test ensures that calls to
them compile and link, but nothing to verify they work correctly).
This patch adds tests for these functions.
fesetexceptflag is meant to set the relevant exception flag bits to
the saved state without causing enabled traps to be taken. On some
architectures, it is not possible to set exception flag bits without
causing enabled traps to occur. Such architectures need to define
EXCEPTION_SET_FORCES_TRAP to 1 in their math-tests.h, as is done in
this patch for powerpc. x86 avoids needing to define this because the
traps resulting from setting exception bits don't occur until the next
floating-point operation or fwait instruction.
Tested for x86_64, x86 and powerpc. Note that test-fexcept fails for
powerpc because of a pre-existing bug in fesetexceptflag for powerpc,
which I'll fix separately.
* math/test-fexcept-traps.c: New file.
* math/test-fexcept.c: Likewise.
* math/Makefile (tests): Add test-fexcept and test-fexcept-traps.
* sysdeps/generic/math-tests.h (EXCEPTION_SET_FORCES_TRAP): New
macro.
* sysdeps/powerpc/math-tests.h [!__NO_FPRS__]
(EXCEPTION_SET_FORCES_TRAP): Likewise.
Martin Pitt [Fri, 14 Aug 2015 05:22:37 +0000 (01:22 -0400)]
locales: en_CA: update d_fmt [BZ #9842]
The date format in en_CA/LC_TIME specifies the date format as "%d/%m/%y".
However, it should be "%Y-%m-%d". This is the standard date format in
Canada as specified by the Canadian Standards Association in CSA Z234.5:1989,
which adopts the ISO 8601 standard.
Here's the web page from the National Research Council of Canada
citing ISO 8601 as the standard date/time format in Canada:
http://www.nrc-cnrc.gc.ca/eng/services/time/faq/#Q8
International Standard ISO 8601 specifies numeric representations
of date and time. The recommended full format is of the form
2001-12-31 23:59:28.73 UTC. The intent of this standard is to avoid
confusion in international communications which can arise with the
many different national notations. This format has the advantage
that it permits dates to be readily sorted in chronological order
by computer systems.
Windows 8+ and OS X also switched to this format.
Mike Frysinger [Tue, 9 Aug 2016 16:49:28 +0000 (00:49 +0800)]
ChangeLog: change Winblowz to Windows
Mike Frysinger [Tue, 9 Aug 2016 16:49:14 +0000 (00:49 +0800)]
localedata: change M$ to Microsoft
Torvald Riegel [Wed, 25 May 2016 22:57:27 +0000 (00:57 +0200)]
Add atomic operations required by the new condition variable.
* include/atomic.h (atomic_fetch_and_relaxed,
atomic_fetch_and_release, atomic_fetch_or_release,
atomic_fetch_xor_release): New.
Samuel Thibault [Mon, 8 Aug 2016 23:42:50 +0000 (01:42 +0200)]
Fix recvmsg returning SIGLOST on PF_LOCAL sockets
when msg_name is not NULL.
* sysdeps/mach/hurd/recvmsg.c (__libc_recvmsg): Cope with aport being
MACH_PORT_NULL.
Aurelien Jarno [Fri, 5 Aug 2016 20:35:01 +0000 (22:35 +0200)]
sparc32/sparcv9: add a VIS3 version of fdim
sparc32 passes floating point values in the integer registers. VIS3
instructions gives access to the movwtos instruction to directly
transfer a value from an integer register to a floating point register.
Therefore it makes sense to provide a VIS3 version consisting in the
generic version compiled with -mvis3.
Changelog:
* math/s_fdim.c: Avoid alias renamed.
* math/s_fdimf.c: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
[$(subdir) = math && $(have-as-vis3) = yes] (libm-sysdep_routines):
Add s_fdimf-vis3, s_fdim-vis3.
(CFLAGS-s_fdimf-vis3.c): New. Set to -Wa,-Av9d -mvis3.
(CFLAGS-s_fdim-vis3.c): Likewise.
sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim-vis3.c: New file.
sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim.c: Likewise.
Aurelien Jarno [Fri, 5 Aug 2016 20:35:01 +0000 (22:35 +0200)]
sparc: remove fdim sparc specific implementations
The fdim and fdimf functions on sparc do not fully follow the standard
and do not set errno to ERANGE when the result overflows. Since glibc
2.24 this causes the two following tests to fail:
Failure: fdim (max_value, -max_value): errno set to 0, expected 34 (ERANGE)
Failure: fdim_upward (max_value, -max_value): errno set to 0, expected 34 (ERANGE)
It happens that using GCC with the generic C code generates very similar
code to the sparc specific implementations. Therefore this patches
remove them. Note it might still worth adding a vis3 specific version of
fdim on sparc32/sparcv9, this is done in a following patch to ease
backporting.
Changelog:
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
[$(subdir) = math && $(have-as-vis3) = yes] (libm-sysdep_routines):
Remove s_fdimf-vis3, s_fdim-vis3.
* sysdeps/sparc/sparc32/fpu/s_fdim.S: Delete file.
* sysdeps/sparc/sparc32/fpu/s_fdimf.S: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim-vis3.S: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim.S: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf-vis3.S: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf.S: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/s_fdim.S: Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/s_fdimf.S: Likewise.
* sysdeps/sparc/sparc64/fpu/s_fdim.S: Likewise.
* sysdeps/sparc/sparc64/fpu/s_fdimf.S: Likewise.
Aurelien Jarno [Fri, 5 Aug 2016 20:35:01 +0000 (22:35 +0200)]
sparc: build with -mvis on sparc32/sparcv9 and sparc64
When building for sparc32/sparcv9 or sparc64, we assume that VIS
instructions are available and use them in the sparc specific assembly
code. However we do not tell GCC to use such instructions, resulting in
slightly suboptimal code.
Fix that by passing -Wa,-Av9a -mvis to GCC.
Changelog:
* sysdeps/sparc/sparc32/sparcv9/Makefile (sysdep-CFLAGS): Add -mvis.
* sysdeps/sparc/sparc64/Makefile (sysdep-CFLAGS): New. Define to
-Wa,-Av9a -mvis.
Paul E. Murphy [Fri, 15 Jul 2016 15:57:07 +0000 (10:57 -0500)]
Improve gen-libm-test.pl LIT() application
When bootstrapping float128, this exposed a number of areas where
the L suffix is incorrectly applied to simple expressions when it
should be applied to each constant in the expression.
In order to stave off more macros in libm-test.inc, apply_lit is
made slightly more intelligent. It will now split expressions
based on space characters, and attempt to apply LIT() to each
token.
Having done this, there are numerous spacing issues within
libm-test.inc which have been fixed.
The above is problematic when the L real suffix is not the most
expressive modifier, and the compiler complains (i.e ppc64) or
silently truncates a value (i.e ppc64).
Joseph Myers [Fri, 5 Aug 2016 18:15:00 +0000 (18:15 +0000)]
Fix math.h comment about bits/mathdef.h.
math.h has a comment about definitions from <bits/mathdef.h>. This
comment is in the wrong place in math.h, far below the inclusion of
<bits/mathdef.h>. It was originally above the inclusion, but the
inclusion was moved by
1998-11-05 Ulrich Drepper <drepper@cygnus.com>
* math/math.h: Unconditionally include bits/mathdef.h. Declare
long double functions only if __NO_LONG_DOUBLE_MATH is not
defined.
[...]
without moving the comment. Furthermore, the comment refers
incorrectly to FLT_EVAL_METHOD and DECIMAL_DIG, which are actually
<float.h> macros, and INFINITY, which is in <bits/inf.h>.
This patch moves the comment back above the include it refers to and
removes the description of macros not defined by the header.
Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).
* math/math.h: Move comment about <bits/mathdef.h> definitions
above inclusion of <bits/mathdef.h>. Do not mention
FLT_EVAL_METHOD, INFINITY or DECIMAL_DIG in that comment.
Torvald Riegel [Thu, 21 Jul 2016 12:31:28 +0000 (14:31 +0200)]
Add atomic_exchange_relaxed.
* include/atomic.h (atomic_exchange_relaxed): New.
Joseph Myers [Thu, 4 Aug 2016 20:50:31 +0000 (20:50 +0000)]
Do not call __nan in scalb functions.
When libm functions return a NaN: if it is for NaN input, it should be
computed from that input (e.g. adding it to itself), so that payloads
are propagated and signaling NaNs quieted, while if it is for non-NaN
input, it should be produced by a computation such as
(x - x) / (x - x), which raises "invalid" at the same time as
producing an appropriate NaN, so avoiding any need for a call to
feraiseexcept.
Various libm functions, however, call __nan ("") (or __nanf or __nanl)
to determine the NaN to return, together with using feraiseexcept
(FE_INVALID) to raise the exception. sysdeps/generic/math_private.h
has an optimization for those functions with constant "" argument so
this doesn't actually involve a call to the __nan function, but it is
still not the preferred approach for producing NaNs. (The optimized
code also always uses the NAN macro, i.e. produces a default NaN for
float converted to whatever the target type is, and on some
architectures that may not be the same as the preferred default NaN
for double or long double.)
This patch fixes the scalb functions to use the conventional method of
generating NaNs and raising "invalid" with an appropriate
computation. (Most instances of this issue are in the complex
functions, where it can more readily be fixed once they have been made
type-generic and so only a third as many places need fixing. Some of
the complex functions use __nan ("") + __nan (""), where the addition
serves no purpose whatsoever.)
Tested for x86_64 and x86.
* math/e_scalb.c: Do not include <fenv.h>.
(invalid_fn): Do calculation resulting in NaN instead of raising
FE_INVALID and returning a NaN explicitly.
* math/e_scalbf.c: Do not include <fenv.h>.
(invalid_fn): Do calculation resulting in NaN instead of raising
FE_INVALID and returning a NaN explicitly.
* math/e_scalbl.c: Do not include <fenv.h>.
(invalid_fn): Do calculation resulting in NaN instead of raising
FE_INVALID and returning a NaN explicitly.
Carlos O'Donell [Thu, 4 Aug 2016 15:40:21 +0000 (11:40 -0400)]
Update PO files.
Update the PO files from the latest available from the Translation
Project.
Florian Weimer [Thu, 4 Aug 2016 09:10:57 +0000 (11:10 +0200)]
x86: Use sysdep.o from libc.a in static libraries
Static libraries can use the sysdep.o copy in libc.a without
a performance penalty. This results in a visible difference
if libpthread.a is relinked into a single object file (which
is needed to support libraries which check for the presence
of certain symbols to enable threading support, which generally
fails with static linking unless libpthread.a is relinked).
Joseph Myers [Wed, 3 Aug 2016 22:56:54 +0000 (22:56 +0000)]
Also handle __STDC_WANT_IEC_60559_BFP_EXT__ in <tgmath.h>.
My __STDC_WANT_IEC_60559_BFP_EXT__ patch omitted to update the
conditions on the nextup and nextdown type-generic macros in
<tgmath.h>. This patch updates those conditions accordingly. (As
glibc doesn't currently have an exp10 type-generic macro, no such
changes are needed relating to __STDC_WANT_IEC_60559_FUNCS_EXT__;
adding such a type-generic macro would be a new feature.)
Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch). Committed.
* math/tgmath.h (nextdown): Define if
[__GLIBC_USE (IEC_60559_BFP_EXT)], not if [__USE_GNU].
(nextup): Likewise.
Joseph Myers [Wed, 3 Aug 2016 22:21:37 +0000 (22:21 +0000)]
Support __STDC_WANT_IEC_60559_FUNCS_EXT__ feature test macro.
This patch implements support for the
__STDC_WANT_IEC_60559_FUNCS_EXT__ feature test macro, following the
__GLIBC_USE approach used for other ISO C feature test macros.
Currently this only affects the exp10 functions (which glibc has had
for a long time).
Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).
* bits/libc-header-start.h (__GLIBC_USE_IEC_60559_FUNCS_EXT): New
macro.
* include/features.h (__STDC_WANT_IEC_60559_FUNCS_EXT__):
Document.
* manual/creature.texi (__STDC_WANT_IEC_60559_FUNCS_EXT__):
Document macro.
* manual/math.texi (exp10): Document as ISO from TS 18661-4:2015.
(exp10f): Likewise.
(exp10l): Likewise.
* math/bits/mathcalls.h (exp10): Declare if
[__GLIBC_USE (IEC_60559_FUNCS_EXT)], not [__USE_GNU].
Joseph Myers [Wed, 3 Aug 2016 21:15:51 +0000 (21:15 +0000)]
Fix typo in last arith.texi change.
* manual/arith.texi (nextup): Fix typo in last change.
Zack Weinberg [Tue, 10 May 2016 15:07:42 +0000 (11:07 -0400)]
Deprecate inclusion of <sys/sysmacros.h> by <sys/types.h>
The macros defined by <sys/sysmacros.h> are not part of POSIX nor XSI, and
their names frequently collide with user code; see for instance glibc bug
19239 and Red Hat bug 130601. <stdlib.h> includes <sys/types.h> under
_GNU_SOURCE, and C++ code presently cannot avoid being compiled under
_GNU_SOURCE, exacerbating the problem.
* NEWS: Inclusion of <sys/sysmacros.h> by <sys/types.h> is deprecated.
* misc/sys/sysmacros.h: If __SYSMACROS_DEPRECATED_INCLUSION is defined,
define major, minor, and makedev to issue deprecation warnings on use.
If __SYSMACROS_DEPRECATED_INCLUSION is *not* defined, suppress
previously-activated deprecation warnings for these macros and prevent
subsequent inclusions of this header from having any effect.
* posix/sys/types.h: Define __SYSMACROS_DEPRECATED_INCLUSION before
including <sys/sysmacros.h>, and undefine it again afterward.
Zack Weinberg [Thu, 28 Apr 2016 16:29:55 +0000 (12:29 -0400)]
Minimize sysdeps code involved in defining major/minor/makedev.
Presently sys/sysmacros.h is entirely defined in sysdeps. This would
mean that the deprecation logic coming up in the next patch would have
to be written twice (in generic/ and unix/sysv/linux/). To avoid that,
hoist all but the unavoidably system-dependent logic to misc/, leaving a
bits/ header behind. This also promotes the Linux-specific encoding of
dev_t, which accommodates 32-bit major and minor numbers in a 64-bit dev_t,
to generic, as glibc's dev_t is always 64 bits wide.
The former Linux implementation used inline functions to avoid evaluating
arguments more than once. After this change, all platforms use inline
functions, which means that three new symbols are added to the generic ABI.
(These symbols are in the user namespace, which is how they have always
been on Linux. They begin with "gnu_dev_", so collisions with user code
are pretty unlikely.)
New ports henceforth need only provide a bits/sysmacros.h defining
internal macros __SYSMACROS_{DECLARE,DEFINE}_{MAJOR,MINOR,MAKEDEV}.
This is only necessary if the kernel encoding is incompatible with
the now-generic encoding (for instance, it would be necessary for
FreeBSD).
While I was at it, I added a basic round-trip test for these functions.
* sysdeps/generic/sys/sysmacros.h: Delete file.
* sysdeps/unix/sysv/linux/makedev.c: Delete file.
* sysdeps/unix/sysv/linux/sys/sysmacros.h: Move file ...
* bits/sysmacros.h: ... here; this encoding is now the generic
encoding. Now defines only the following macros:
__SYSMACROS_DECLARE_MAJOR, __SYSMACROS_DEFINE_MAJOR,
__SYSMACROS_DECLARE_MINOR, __SYSMACROS_DEFINE_MINOR,
__SYSMACROS_DECLARE_MAKEDEV, __SYSMACROS_DEFINE_MAKEDEV.
* misc/sys/sysmacros.h, misc/makedev.c: New files that use
bits/sysmacros.h and the above new macros to generate the
public implementations of major, minor, and makedev.
* misc/tst-makedev.c: New test.
* include/sys/sysmacros.h: New wrapper.
* misc/Makefile (headers): Add sys/sysmacros.h, bits/sysmacros.h.
(routines): Add makedev.
(tests): Add tst-makedev.
* misc/Versions [GLIBC_2.25]: Add gnu_dev_major, gnu_dev_minor,
gnu_dev_makedev.
* posix/Makefile (headers): Remove sys/sysmacros.h.
* sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Remove makedev.
* sysdeps/arm/nacl/libc.abilist: Add GLIBC_2.25,
gnu_dev_major, gnu_dev_makedev, gnu_dev_minor.
* sysdeps/unix/sysv/linux/aarch64/libc.abilist
* sysdeps/unix/sysv/linux/alpha/libc.abilist
* sysdeps/unix/sysv/linux/arm/libc.abilist
* sysdeps/unix/sysv/linux/hppa/libc.abilist
* sysdeps/unix/sysv/linux/i386/libc.abilist
* sysdeps/unix/sysv/linux/ia64/libc.abilist
* sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
* sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
* sysdeps/unix/sysv/linux/microblaze/libc.abilist
* sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
* sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
* sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
* sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
* sysdeps/unix/sysv/linux/nios2/libc.abilist
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist
* sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
* sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
* sysdeps/unix/sysv/linux/sh/libc.abilist
* sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist
* sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist
* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
* sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist:
Add GLIBC_2.25.
Zack Weinberg [Thu, 28 Apr 2016 15:07:58 +0000 (11:07 -0400)]
Add utility macros for clang detection, and deprecation with messages.
There are three new macros added to features.h and sys/cdefs.h:
* __glibc_clang_prereq: just like __GNUC_PREREQ, but for clang.
* __glibc_clang_has_extension: wraps clang's intrinsic __has_extension.
Writing "#if defined __clang__ && __has_extension (...)" doesn't work,
because compilers other than clang will object to the unknown macro
__has_extension even though they don't need to evaluate it.
Instead, write "#if __glibc_clang_has_extension (...)".
* __attribute_deprecated_msg__(msg): like __attribute_deprecated__, but
if possible, prints a message.
The first two are used to define the third. The third will be used
in subsequent patches.
* include/features.h (__glibc_clang_prereq): New macro.
* misc/sys/cdefs.h (__glibc_clang_has_extension)
(__attribute_deprecated_msg__): New macros.
Joseph Myers [Wed, 3 Aug 2016 17:30:41 +0000 (17:30 +0000)]
Support __STDC_WANT_IEC_60559_BFP_EXT__ feature test macro.
This patch implements support for the __STDC_WANT_IEC_60559_BFP_EXT__
feature test macro from ISO/IEC 18661-1:2014, following the
__GLIBC_USE approach now used for __STDC_WANT_LIB_EXT2__. For this
macro, the relevant consideration is whether it is defined or
undefined when an affected header is included (not what its value is
if defined, and not whether it's defined or undefined when any other
unaffected system header is included).
Currently this macro only affects the issignaling macro and the nextup
and nextdown functions (so they can be enabled by defining this macro,
not just by defining _GNU_SOURCE as previously). Any further features
from this TS added in future would also be conditioned on this macro.
Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).
* bits/libc-header-start.h (__GLIBC_USE_IEC_60559_BFP_EXT): New
macro.
* include/features.h (__STDC_WANT_IEC_60559_BFP_EXT__): Document.
* manual/arith.texi (issignaling): Document as ISO from TS
18661-1:2014.
(nextup): Likewise.
(nextupf): Likewise.
(nextupl): Likewise.
(nextdown): Likewise.
(nextdownf): Likewise.
(nextdownl): Likewise.
* manual/creature.texi (__STDC_WANT_IEC_60559_BFP_EXT__): Document
macro.
* math/math.h: Define
__GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION and include
<bits/libc-header-start.h> instead of including <features.h>.
(issignaling): Define if [__GLIBC_USE (IEC_60559_BFP_EXT)], not
[__USE_GNU].
* math/bits/mathcalls.h (nextdown): Declare if
[__GLIBC_USE (IEC_60559_BFP_EXT)], not [__USE_GNU].
(nextup): Likewise.
(__issignaling): Likewise.
Paul E. Murphy [Fri, 1 Jul 2016 18:17:09 +0000 (13:17 -0500)]
Unify drift between _Complex function type variants
While trying to convert the _Complex function wrappers
into a single generic implementation, a few minor
variations between identical versions emerged.
Paul E. Murphy [Fri, 3 Jun 2016 20:44:12 +0000 (15:44 -0500)]
Refactor part of math Makefile
In order to support more types, the Makefile needs a few bits
shuffled.
F is explictly used as a placeholder to substitute for the
appropriate type suffix. This removes the need to demangle
_r suffixed objects.
The variable libm-compat-calls is added to house any objects which
are only built to provide compat symbols within libm. That is,
no newly added type should ever attempt building these. Note,
k_standard* files have been added there. By consensus they are
deprecated; in practice, we haven't gotten there yet.
New types would be added as noted in the comments preceding
type-TYPE-{suffix,routines,yes} variables. However, some manual
additions will still need to be done to add appropriate flags
when building the various variants of libm-test.c for a new type.
Likewise, test-ildoubl is renamed test-ildouble for consistency's
sake.
Paul E. Murphy [Tue, 2 Aug 2016 18:32:06 +0000 (13:32 -0500)]
Remove tacit double usage in ldbl-128
There is quiet truncation to double arithmetic in several
files. I noticed them when building ldbl-128 in a
soft-fp context. This did not change any test results.
Tom Tromey [Wed, 3 Aug 2016 14:26:32 +0000 (16:26 +0200)]
Update and install proc_service.h [BZ #20311]
This adds an include guard and __BEGIN/__END_DECLS to proc_service.h,
removes some extraneous "const"s, and then arranges to install the
header. The idea here is to make it more convenient to implement the
proc_service.h API.
Florian Weimer [Wed, 3 Aug 2016 14:16:57 +0000 (16:16 +0200)]
elf: Do not use memalign for TCB/TLS blocks allocation [BZ #17730]
Instead, call malloc and explicitly align the pointer.
There is no external location to store the original (unaligned)
pointer, and this commit increases the allocation size to store
the pointer at a fixed location relative to the TCB pointer.
The manual alignment means that some space goes unused which
was previously made available for subsequent allocations.
However, in the TLS_DTV_AT_TP case, the manual alignment code
avoids aligning the pre-TCB to the TLS block alignment. (Even
while using memalign, the allocation had some unused padding
in front.)
This concludes the removal of memalign calls from the TLS code,
and the new tst-tls3-malloc test verifies that only core malloc
routines are used.
Florian Weimer [Wed, 3 Aug 2016 14:15:38 +0000 (16:15 +0200)]
elf: Avoid using memalign for TLS allocations [BZ #17730]
Instead of a flag which indicates the pointer can be freed, dtv_t
now includes the pointer which should be freed. Due to padding,
the size of dtv_t does not increase.
To avoid using memalign, the new allocate_dtv_entry function
allocates a sufficiently large buffer so that a sub-buffer
can be found in it which starts with an aligned pointer. Both
the aligned and original pointers are kept, the latter for calling
free later.
Florian Weimer [Wed, 3 Aug 2016 14:11:01 +0000 (16:11 +0200)]
elf: dl-minimal malloc needs to respect fundamental alignment
The dynamic linker currently uses __libc_memalign for TLS-related
allocations. The goal is to switch to malloc instead. If the minimal
malloc follows the ABI fundamental alignment, we can assume that malloc
provides this alignment, and thus skip explicit alignment in a few
cases as an optimization.
It was requested on libc-alpha that MALLOC_ALIGNMENT should be used,
although this results in wasted space if MALLOC_ALIGNMENT is larger
than the fundamental alignment. (The dynamic linker cannot assume
that the non-minimal malloc will provide an alignment of
MALLOC_ALIGNMENT; the ABI provides _Alignof (max_align_t) only.)
Joseph Myers [Wed, 3 Aug 2016 12:13:16 +0000 (12:13 +0000)]
Define UDP_ENCAP_* from Linux 4.7 in netinet/udp.h.
This patch adds the new UDP_ENCAP_GTP0 and UDP_ENCAP_GTP1U from Linux
4.7 to sysdeps/gnu/netinet/udp.h.
Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).
* sysdeps/gnu/netinet/udp.h (UDP_ENCAP_GTP0): New macro.
(UDP_ENCAP_GTP1U): Likewise.
Joseph Myers [Wed, 3 Aug 2016 12:12:22 +0000 (12:12 +0000)]
Define PF_QIPCRTR, AF_QIPCRTR from Linux 4.7 in bits/socket.h.
This patch adds the new PF_QIPCRTR and AF_QIPCRTR from Linux 4.7 to
sysdeps/unix/sysv/linux/bits/socket.h.
Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).
* sysdeps/unix/sysv/linux/bits/socket.h (PF_QIPCRTR): New macro.
(PF_MAX): Update value.
(AF_QIPCRTR): New macro.
Aurelien Jarno [Sun, 31 Jul 2016 21:45:52 +0000 (23:45 +0200)]
sparc64: add a VIS3 version of ceil, floor and trunc
sparc64 passes floating point values in the floating point registers.
As the the generic ceil, floor and trunc functions use integer
instructions, it makes sense to provide a VIS3 version consisting in
the the generic version compiled with -mvis3. GCC will then use
movdtox, movxtod, movwtos and movstow instructions.
sparc32 passes the floating point values in the integer registers, so it
doesn't make sense to do the same.
Changelog:
* sysdeps/ieee754/dbl-64/s_trunc.c: Avoid alias renamed.
* sysdeps/ieee754/dbl-64/wordsize-64/s_trunc.c: Likewise.
* sysdeps/ieee754/flt-32/s_truncf.c: Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/Makefile
[$(subdir) = math && $(have-as-vis3) = yes] (libm-sysdep_routines):
Add s_ceilf-vis3, s_ceil-vis3, s_floorf-vis3, s_floor-vis3,
s_truncf-vis3, s_trunc-vis3.
(CFLAGS-s_ceilf-vis3.c): New. Set to -Wa,-Av9d -mvis3.
(CFLAGS-s_ceil-vis3.c): Likewise.
(CFLAGS-s_floorf-vis3.c): Likewise.
(CFLAGS-s_floor-vis3.c): Likewise.
(CFLAGS-s_truncf-vis3.c): Likewise.
(CFLAGS-s_trunc-vis3.c): Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_ceil-vis3.c: New file.
* sysdeps/sparc/sparc64/fpu/multiarch/s_ceil.c: Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf-vis3.c: Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf.c: Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_floor-vis3.c: Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_floor.c: Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_floorf-vis3.c: Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_floorf.c: Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_trunc-vis3.c: Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_trunc.c: Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_truncf-vis3.c: Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_truncf.c: Likewise.
David S. Miller [Wed, 3 Aug 2016 04:00:21 +0000 (21:00 -0700)]
Fix sNaN handling in nearbyint on 32-bit sparc.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint-vis3.S
(__nearbyint_vis3): Don't check for sNaN before float register is
loaded with the incoming argument.
* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf-vis3.S
(__nearbyintf_vis3): Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/s_nearbyint.S (__nearbyint):
Likewise.
* sysdeps/sparc/sparc32/sparcv9/fpu/s_nearbyintf.S (__nearbyintf):
Likewise.
David S. Miller [Wed, 3 Aug 2016 00:46:58 +0000 (17:46 -0700)]
Fix wide-char testsuite SIGBUS on platforms such as Sparc.
* string/test-strncmp.c (do_test_limit): Make sure the test data
stream is aligned as required for the type "CHAR".
(do_test): Likewise.
Aurelien Jarno [Tue, 2 Aug 2016 22:22:44 +0000 (00:22 +0200)]
powerpc: fix ifunc-sel.h fix asm constraints and clobber list
As pointer out on the mailing list, the inline assembly code in
sysdeps/powerpc/ifunc-sel.h doesn't have a list of clobbered registers
and used wrong constraints.
This patch fixes that. I verified it doesn't introduce any change in the
generated code.
Changelog:
* sysdeps/powerpc/ifunc-sel.h (ifunc_sel): Add "11", "12", "cr0" to the
clobber list. Use "i" constraint instead of "X".
(ifunc_one): Add "12" to the clobber list. Use "i" constraint instead
of "X".