Commit Graph

22022 Commits

Author SHA1 Message Date
Eric Blake ed8ae46bed Avoid gcc warnings on cygwin
* posix/regex_internal.c (re_string_reconstruct) [!RE_ENABLE_I18N]:
* posix/regexec.c (check_arrival_add_next_nodes) [!RE_ENABLE_I18N]:
Avoid unused variable.
2017-12-22 08:01:27 -08:00
Florian Weimer bad7a0c81f copy_file_range: New function to copy file data
The semantics are based on the Linux system call, but a very close
emulation in user space is provided.
2017-12-22 10:55:40 +01:00
Szabolcs Nagy 6cb86fd21c Add aarch64 disable-multi-arch variant to build-many-glibcs.py
aarch64 has several ifuncs now so test it without multiarch support separately.

	* scripts/build-many-glibcs.py (Context.add_all_configs): Add
	disable-multi-arch variant to aarch64-linux-gnu.
2017-12-21 10:24:14 +00:00
Joseph Myers 41d11b15a1 Update miscellaneous files from upstream sources.
This patch updates various miscellaneous files from their upstream
sources.

Tested for x86_64, including "make pdf".

	* manual/texinfo.tex: Update to version 2017-12-18.20 with
	trailing whitespace removed.
	* scripts/config.guess: Update to version 2017-12-17.
	* scripts/config.sub: Update to version 2017-11-23.
	* scripts/install-sh: Update to version 2017-09-23.17.
	* scripts/move-if-change: Update to version 2017-09-13 06:45.
2017-12-20 22:28:20 +00:00
Adhemerval Zanella 8d2d239cb7 Simplify tile assembly definitions
With tilepro removal, the uppercase instruction are not anymore
required to be defines as potentially macros.  This is a
mechanical change done by the following shell script:

---
INSNS="LD LD4U ST ST4 BNEZ BEQZ BEQZT BGTZ CMPEQI CMPEQ CMOVEQZ CMOVNEZ"

FILES=$(find sysdeps/tile sysdeps/unix/sysv/linux/tile -iname *.S)

for insn in $INSNS; do
  repl=$(echo $insn | tr '[:upper:]' '[:lower:]')
  sed -i 's/\b'$insn'\b/'$repl'/g' $FILES
done
---

Checked with a build for tilegx-linux-gnu and tilegx-linux-gnu-32 with
and without the patch, there is no difference in generated binary with
a dissassemble.

	* sysdeps/tile/__longjmp.S (__longjmp): Use lowercase instructions.
	* sysdeps/tile/__tls_get_addr.S (__tls_get_addr): Likewise.
	* sysdeps/tile/_mcount.S (__mcount): Likewise.
	* sysdeps/tile/crti.S (_init, _fini): Likewise.
	* sysdeps/tile/crtn.S: Likewise.
	* sysdeps/tile/dl-start.S (_start): Likewise.
	* sysdeps/tile/dl-trampoline.S: Likewise.
	* sysdeps/tile/setjmp.S (__sigsetjmp): Likewise.
	* sysdeps/tile/start.S (_start): Likewise.
	* sysdeps/unix/sysv/linux/tile/clone.S (_clone): Likewise.
	* sysdeps/unix/sysv/linux/tile/getcontext.S (__getcontext): Likewise.
	* sysdeps/unix/sysv/linux/tile/ioctl.S (__ioctl): Likewise.
	* sysdeps/unix/sysv/linux/tile/setcontext.S (__setcontext): Likewise.
	* sysdeps/unix/sysv/linux/tile/swapcontext.S (__swapcontext): Likewise.
	* sysdeps/unix/sysv/linux/tile/syscall.S (syscall): Likewise.
	* sysdeps/unix/sysv/linux/tile/vfork.S (__vfork): Likewise.
2017-12-20 16:55:26 -02:00
Adhemerval Zanella 24d1d8ec9e Simplify tilegx sysdeps folder
With tilepro support removal we can now simplify internal tile support by
moving the directory structure to avoid the unnecessary directory levels
in tile/tilegx both on generic and linux folders.

Checked with a build for tilegx-linux-gnu and tilegx-linux-gnu-32 with
and without the patch, there is no difference in generated binary with
a dissassemble.

	* stdlib/bug-getcontext.c (do_test): Remove tilepro mention in
	comment.
	* sysdeps/tile/preconfigure: Remove tilegx folder.
	* sysdeps/tile/tilegx/Implies: Move definitions to ...
	* sysdeps/tile/Implies: ... here.
	* sysdeps/tile/tilegx/Makefile: Move rules to ...
	* sysdeps/tile/Makefile: ... here.
	* sysdeps/tile/tilegx/atomic-machine.h: Move definitions to ...
	* sysdeps/tile/atomic-machine.h: ... here.  Add include guards.
	* sysdeps/tile/tilegx/bits/wordsize.h: Move to ...
	* sysdeps/tile/bits/wordsize.h: ... here.
	* sysdeps/tile/tilegx/*: Move to ...
	* sysdeps/tile/*: ... here.
	* sysdeps/tile/tilegx/tilegx32/Implies: Move to ...
	* sysdeps/tile/tilegx32/Implies: ... here.
	* sysdeps/tile/tilegx/tilegx64/Implies: Move to ...
	* sysdeps/tile/tilegx64/Implies: ... here.
	* sysdeps/unix/sysv/linux/tile/tilegx/Makefile: Move definitions
	to ...
	* sysdeps/unix/sysv/linux/tile/Makefile: ... here.
	* sysdeps/unix/sysv/linux/tile/tilegx/*: Move to ...
	* sysdeps/unix/sysv/linux/tile/*: ... here.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/*: Move to ...
	* sysdeps/unix/sysv/linux/tile/tilegx32/*: ... here.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/*: Move to ...
	* sysdeps/unix/sysv/linux/tile/tilegx64/*: ... here.
2017-12-20 16:55:26 -02:00
Adhemerval Zanella ed95f61149 Remove tilepro-*-linux-gnu support
As from previous discussions [1] this patch removes tileprox-*-linux-gnu
support from GLIBC.  This patch is a straigthfoward one, which just remove
tilepro specific implementation and configurations (no sysdep simplfication
or reorganization is done).

	* README: Remove tilepro-*-linux-gnu from supported architecture.
	* scripts/build-many-glibcs.py: Likewise.
	* sysdeps/tile/__tls_get_addr.S (__tls_get_addr): Likewise.
	* sysdeps/tile/crti.S (PREINIT_FUNCTION): Likewise.
	* sysdeps/tile/dl-machine.h (ELF_MACHINE_NAME,
	elf_machine_matches_host, elf_machine_dynamic,
	elf_machine_load_address, elf_machine_runtime_setup, reloc_howto
	howto, elf_machine_rela): Likewise
	* sysdeps/tile/dl-start.S (_start): Likewise.
	* sysdeps/tile/memcmp.c (DBLALIGN, REVBYTES): Likewise.
	* sysdeps/tile/memcopy.h (MEMCPY_OK_FOR_FWD_MEMMOVE,
	MEMCPY_OK_FOR_FWD_MEMMOVE, op_t): Likewise.
	* sysdeps/tile/nptl/pthread_spin_lock.c (TNS, CMPTNS): Likewise.
	* sysdeps/tile/nptl/pthread_spin_trylock.c (TNS): Likewise.
	* sysdeps/tile/nptl/pthread_spin_unlock.c (pthread_spin_unlock):
	Likewise.
	* sysdeps/tile/nptl/tls.h (DB_THREAD_SELF): Likewise.
	* sysdeps/tile/preconfigure: Likewise.
	* sysdeps/tile/stackguard-macros.h (STACK_CHK_GUARD,
	POINTER_CHK_GUARD): Likewise.
	* sysdeps/tile/stackinfo.h (__stackinfo_sub): Likewise.
	* sysdeps/tile/start.S (_start): Likewise.
	* sysdeps/tile/tls-macros.h (TLS_GD_OFFSET, TLS_IE_OFFSET, _TLS_LE):
	Likewise.
	* sysdeps/tile/sysdep.h (REGSIZE): Likewise.
	(LD, LD4U, ST, ST4, BNEZ, BEQZ, BEQZT, BGTZ, CMPEQI, CMPEQ, CMOVEQZ,
	CMOVNEZ): Remove.
	* sysdeps/unix/sysv/linux/tile/bits/environments.h
	(__ILP32_OFF32_CFLAGS, __ILP32_OFFBIG_CFLAGS, __ILP32_OFF32_LDFLAGS,
	__ILP32_OFFBIG_LDFLAGS, __LP64_OFF64_CFLAGS, __LP64_OFF64_LDFLAGS):
	Likewise.
	* sysdeps/tile/wordcopy.c (DBLALIGN): Likewise.
	* sysdeps/tile/tilepro/Implies: Remove file.
	* sysdeps/tile/tilepro/atomic-machine.h: Likewise.
	* sysdeps/tile/tilepro/bits/wordsize.h: Likewise.
	* sysdeps/tile/tilepro/memchr.c: Likewise.
	* sysdeps/tile/tilepro/memcpy.S: Likewise.
	* sysdeps/tile/tilepro/memset.c: Likewise.
	* sysdeps/tile/tilepro/memusage.h: Likewise.
	* sysdeps/tile/tilepro/rawmemchr.c: Likewise.
	* sysdeps/tile/tilepro/strchr.c: Likewise.
	* sysdeps/tile/tilepro/strchrnul.c: Likewise.
	* sysdeps/tile/tilepro/strlen.c: Likewise.
	* sysdeps/tile/tilepro/strrchr.c: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilepro/Implies: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilepro/c++-types.data: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilepro/jmp_buf-macros.h: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilepro/ld.abilist: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilepro/ldconfig.h: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilepro/libBrokenLocale.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/tile/tilepro/libanl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilepro/libcrypt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilepro/libdl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilepro/libnsl.abilist: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilepro/libpthread.abilist: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilepro/libresolv.abilist: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilepro/librt.abilist: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilepro/libthread_db.abilist: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilepro/libutil.abilist: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilepro/register-dump.h: Likewise.
	* sysdeps/unix/sysv/linux/tile/sysconf.c (linux_sysconf): Remove
	tilepro mention in comment.

[1] https://sourceware.org/ml/libc-alpha/2017-12/msg00038.html
2017-12-20 16:55:24 -02:00
Adhemerval Zanella 4735850f7a nptl: Consolidate pthread_{timed,try}join{_np}
This patch consolidates the pthread_join and gnu extensions to avoid
code duplication.  The function pthread_join, pthread_tryjoin_np, and
pthread_timedjoin_np are now based on pthread_timedjoin_ex.

It also fixes some inconsistencies on ESRCH, EINVAL, EDEADLK handling
(where each implementation differs from each other) and also on
clenup handler (which now always use a CAS).

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

	* nptl/pthreadP.h (__pthread_timedjoin_np): Define.
	* nptl/pthread_join.c (pthread_join): Use __pthread_timedjoin_np.
	* nptl/pthread_tryjoin.c (pthread_tryjoin): Likewise.
	* nptl/pthread_timedjoin.c (cleanup): Use CAS on argument setting.
	(pthread_timedjoin_np): Define internal symbol and common code from
	pthread_join.
	* sysdeps/unix/sysv/linux/i386/lowlevellock.h (__lll_timedwait_tid):
	Remove superflous checks.
	* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h (__lll_timedwait_tid):
	Likewise.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2017-12-20 11:32:54 -02:00
Szabolcs Nagy 8bfb461e20 aarch64: update libm-test-ulps
* sysdeps/aarch64/libm-test-ulps: Update.
2017-12-20 12:07:10 +00:00
Adhemerval Zanella 4e00196912 aarch64: fix memset with --disable-multi-arch
* sysdeps/aarch64/memset.S (MEMSET): Define.
2017-12-20 12:05:32 +00:00
Florian Weimer 8a26ad2ab7 nptl: Implement pthread_self in libc.so [BZ #22635]
All binaries use TLS and thus need a properly set up TCB, so we can
simply return its address directly, instead of forwarding to the
libpthread implementation from libc.

For versioned symbols, the dynamic linker checks that the soname matches
the name supplied by the link editor, so a compatibility symbol in
libpthread is needed.

To avoid linking against the libpthread function in all cases, we would
have to bump the symbol version of libpthread in libc.so and supply a
compat symbol.  This commit does not do that because the function
implementation is so small, so the overhead by two active copies of the
same function might well be smaller than the increase in symbol table
size.
2017-12-20 11:42:04 +01:00
Arnold Robbins 5069ff3284 regex: Fix spelling in comments.
Fix the spelling in various comments throughout the
regex implementation. These changes are also present
in gnulib and will be integrated there also, see:
https://sourceware.org/ml/libc-alpha/2017-12/msg00688.html
2017-12-19 19:28:21 -08:00
Gabriel F. T. Gomes c85e54ac6c Provide a C++ version of iseqsig (bug 22377)
In C++ mode, __MATH_TG cannot be used for defining iseqsig, because
__MATH_TG relies on __builtin_types_compatible_p, which is a C-only
builtin.  This is true when float128 is provided as an ABI-distinct type
from long double.

Moreover, the comparison macros from ISO C take two floating-point
arguments, which need not have the same type.  Choosing what underlying
function to call requires evaluating the formats of the arguments, then
selecting which is wider.  The macro __MATH_EVAL_FMT2 provides this
information, however, only the type of the macro expansion is relevant
(actually evaluating the expression would be incorrect).

This patch provides a C++ version of iseqsig, in which only the type of
__MATH_EVAL_FMT2 (__typeof or decltype) is used as a template parameter
for __iseqsig_type.  This function calls the appropriate underlying
function.

Tested for powerpc64le and x86_64.

	[BZ #22377]
	* math/Makefile [C++] (tests): Add test for iseqsig.
	* math/math.h [C++] (iseqsig): New implementation, which does
	not rely on __MATH_TG/__builtin_types_compatible_p.
	* math/test-math-iseqsig.cc: New file.
	* sysdeps/powerpc/powerpc64le/Makefile
	(CFLAGS-test-math-iseqsig.cc): New variable.
2017-12-19 23:26:59 -02:00
Dmitry V. Levin 10e93d9687 elf: remove redundant __libc_enable_secure check from fillin_rpath
There are just two users of fillin_rpath: one is decompose_rpath that
sets check_trusted argument to 0, another one is _dl_init_paths that
sets check_trusted argument to __libc_enable_secure and invokes
fillin_rpath only when LD_LIBRARY_PATH is non-empty.

Starting with commit
glibc-2.25.90-512-gf6110a8fee2ca36f8e2d2abecf3cba9fa7b8ea7d,
LD_LIBRARY_PATH is ignored for __libc_enable_secure executables,
so check_trusted argument of fillin_rpath is always zero.

* elf/dl-load.c (is_trusted_path): Remove.
(fillin_rpath): Remove check_trusted argument and its use,
all callers changed.
2017-12-19 21:53:11 +00:00
H.J. Lu ce16eb52c0 Replece LDFLAGS-* = $(no-pie-ldflag) with tst-*-no-pie = yes [BZ #22630]
After

commit 9d7a3741c9
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Dec 15 16:59:33 2017 -0800

    Add --enable-static-pie configure option to build static PIE [BZ #19574]

and

commit 00c714df39
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Dec 18 12:24:26 2017 -0800

    Pass -no-pie to GCC only if GCC defaults to PIE [BZ #22614]

$(no-pie-ldflag) is no longer effective since no-pie-ldflag is defined
to -no-pie only if GCC defaults to PIE.  When --enable-static-pie is
used to configure glibc build and GCC doesn't default to PIE. no-pie-ldflag
is undefined and these tests:

elf/Makefile:LDFLAGS-tst-dlopen-aout = $(no-pie-ldflag)
elf/Makefile:LDFLAGS-tst-prelink = $(no-pie-ldflag)
elf/Makefile:LDFLAGS-tst-main1 = $(no-pie-ldflag)
gmon/Makefile:LDFLAGS-tst-gmon := $(no-pie-ldflag)

may fail to link.  This patch replaces "-pie" with

$(if $($(@F)-no-pie),$(no-pie-ldflag),-pie)

and repleces

LDFLAGS-* = $(no-pie-ldflag)

with

tst-*-no-pie = yes

so that tst-dlopen-aout, tst-prelink, tst-main1 and tst-gmon are always
built as non-PIE, with and without --enable-static-pie, regardless if
GCC defaults to PIE or non-PIE.

Tested with build-many-glibcs.py without --enable-static-pie as well as
with --enable-static-pie for x86_64, x32 and i686.

	[BZ #22630]
	* Makeconfig (link-pie-before-libc): Replace -pie with
	$(if $($(@F)-no-pie),$(no-pie-ldflag),-pie).
	* elf/Makefile (LDFLAGS-tst-dlopen-aout): Removed.
	(tst-dlopen-aout-no-pie): New.
	(LDFLAGS-tst-prelink): Removed.
	(tst-prelink-no-pie): New.
	(LDFLAGS-tst-main1): Removed.
	(tst-main1-no-pie): New.
	* gmon/Makefile (LDFLAGS-tst-gmon): Removed.
	(tst-gmon-no-pie): New.
2017-12-19 13:53:11 -08:00
H.J. Lu 126adc89d8 Document that --enable-static-pie implies PIE
To build static PIE, all .o files are compiled with -fPIE.  Since
--enable-static-pie is designed to provide additional security hardening
benefits, it also implies that glibc programs and tests are created as
dynamic position independent executables (PIE) by default for better
security hardening.

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>

	* manual/install.texi: Document that --enable-static-pie
	implies PIE.
	* INSTALL: Regenerated.
2017-12-19 13:51:16 -08:00
Bernd Edlinger 648615e13f Avoid signed shift overflow in pow (bug 21309).
As noted in bug 21309, dbl-64/e_pow.c contains signed int shifts that,
although the shift count is in the range [0, 31], shift bits into and
beyond the sign bit and so are undefined in ISO C.  Although this is
defined in GNU C, this patch from the bug cleans up the code to avoid
those shifts.

Tested for x86_64.

	[BZ #21309]
	* sysdeps/ieee754/dbl-64/e_pow.c (checkint): Make m and n
	unsigned.
2017-12-19 18:41:01 +00:00
Joseph Myers f1e005022e Revert exp reimplementation (causes test failures).
Revert:

	2017-12-19  Joseph Myers  <joseph@codesourcery.com>

	* sysdeps/x86_64/fpu/libm-test-ulps: Update.

	2017-12-19  Patrick McGehearty  <patrick.mcgehearty@oracle.com>

	* sysdeps/ieee754/dbl-64/e_exp.c: Include <math-svid-compat.h> and
	<errno.h>.  Include "eexp.tbl".
	(half): New constant.
	(one): Likewise.
	(__ieee754_exp): Rewrite.
	(__slowexp): Remove prototype.
	* sysdeps/ieee754/dbl-64/eexp.tbl: New file.
	* sysdeps/ieee754/dbl-64/slowexp.c: Remove file.
	* sysdeps/i386/fpu/slowexp.c: Likewise.
	* sysdeps/ia64/fpu/slowexp.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/slowexp.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/slowexp-avx.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/slowexp-fma.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/slowexp-fma4.c: Likewise.
	* sysdeps/generic/math_private.h (__slowexp): Remove prototype.
	* sysdeps/ieee754/dbl-64/e_pow.c: Remove mention of slowexp.c in
	comment.
	* sysdeps/powerpc/power4/fpu/Makefile [$(subdir) = math]
	(CPPFLAGS-slowexp.c): Remove variable.
	* sysdeps/x86_64/fpu/multiarch/Makefile (libm-sysdep_routines):
	Remove slowexp-fma, slowexp-fma4 and slowexp-avx.
	(CFLAGS-slowexp-fma.c): Remove variable.
	(CFLAGS-slowexp-fma4.c): Likewise.
	(CFLAGS-slowexp-avx.c): Likewise.
	* sysdeps/x86_64/fpu/multiarch/e_exp-avx.c (__slowexp): Do not
	define as macro.
	* sysdeps/x86_64/fpu/multiarch/e_exp-fma.c (__slowexp): Likewise.
	* sysdeps/x86_64/fpu/multiarch/e_exp-fma4.c (__slowexp): Likewise.
	* math/Makefile (type-double-routines): Remove slowexp.
	* manual/probes.texi (slowexp_p6): Remove.
	(slowexp_p32): Likewise.
2017-12-19 18:11:37 +00:00
Adhemerval Zanella e184ac3a10 glob: Silence warning about void pointer arithmetic
Sync with gnulib 0e14f025d2.

Checked on x86_64-linux-gnu.

	* lib/glob.c (glob): Use a 'char *', not a 'void *', in pointer
	arithmetic.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-12-19 15:52:12 -02:00
Adhemerval Zanella d711a00f93 glob: pacify fuzzer for mempcpy
Problem reported by Tim Rühsen [1].  Sync with gnulib 0e14f025d2.

[1] https://lists.gnu.org/archive/html/bug-gnulib/2017-10/msg00054.html

Checked on x86_64-linux-gnu.

    * lib/glob.c (glob): Do not pass NULL to mempcpy.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-12-19 15:52:12 -02:00
Joseph Myers 6f58c10ded Update x86_64 libm-test-ulps.
* sysdeps/x86_64/fpu/libm-test-ulps: Update.
2017-12-19 17:38:41 +00:00
Patrick McGehearty 6fd0a3c6a8 Improve __ieee754_exp() performance by greater than 5x on sparc/x86.
These changes will be active for all platforms that don't provide
their own exp() routines. They will also be active for ieee754
versions of ccos, ccosh, cosh, csin, csinh, sinh, exp10, gamma, and
erf.

Typical performance gains is typically around 5x when measured on
Sparc s7 for common values between exp(1) and exp(40).

Using the glibc perf tests on sparc,
      sparc (nsec)    x86 (nsec)
      old     new     old     new
max   17629   395    5173     144
min     399    54      15      13
mean   5317   200    1349      23

The extreme max times for the old (ieee754) exp are due to the
multiprecision computation in the old algorithm when the true value is
very near 0.5 ulp away from an value representable in double
precision. The new algorithm does not take special measures for those
cases. The current glibc exp perf tests overrepresent those values.
Informal testing suggests approximately one in 200 cases might
invoke the high cost computation. The performance advantage of the new
algorithm for other values is still large but not as large as indicated
by the chart above.

Glibc correctness tests for exp() and expf() were run. Within the
test suite 3 input values were found to cause 1 bit differences (ulp)
when "FE_TONEAREST" rounding mode is set. No differences in exp() were
seen for the tested values for the other rounding modes.
Typical example:
exp(-0x1.760cd2p+0)  (-1.46113312244415283203125)
 new code:    2.31973271630014299393707e-01   0x1.db14cd799387ap-3
 old code:    2.31973271630014271638132e-01   0x1.db14cd7993879p-3
    exp    =  2.31973271630014285508337 (high precision)
Old delta: off by 0.49 ulp
New delta: off by 0.51 ulp

In addition, because ieee754_exp() is used by other routines, cexp()
showed test results with very small imaginary input values where the
imaginary portion of the result was off by 3 ulp when in upward
rounding mode, but not in the other rounding modes.  For x86, tgamma
showed a few values where the ulp increased to 6 (max ulp for tgamma
is 5). Sparc tgamma did not show these failures.  I presume the tgamma
differences are due to compiler optimization differences within the
gamma function.The gamma function is known to be difficult to compute
accurately.

	* sysdeps/ieee754/dbl-64/e_exp.c: Include <math-svid-compat.h> and
	<errno.h>.  Include "eexp.tbl".
	(half): New constant.
	(one): Likewise.
	(__ieee754_exp): Rewrite.
	(__slowexp): Remove prototype.
	* sysdeps/ieee754/dbl-64/eexp.tbl: New file.
	* sysdeps/ieee754/dbl-64/slowexp.c: Remove file.
	* sysdeps/i386/fpu/slowexp.c: Likewise.
	* sysdeps/ia64/fpu/slowexp.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/slowexp.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/slowexp-avx.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/slowexp-fma.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/slowexp-fma4.c: Likewise.
	* sysdeps/generic/math_private.h (__slowexp): Remove prototype.
	* sysdeps/ieee754/dbl-64/e_pow.c: Remove mention of slowexp.c in
	comment.
	* sysdeps/powerpc/power4/fpu/Makefile [$(subdir) = math]
	(CPPFLAGS-slowexp.c): Remove variable.
	* sysdeps/x86_64/fpu/multiarch/Makefile (libm-sysdep_routines):
	Remove slowexp-fma, slowexp-fma4 and slowexp-avx.
	(CFLAGS-slowexp-fma.c): Remove variable.
	(CFLAGS-slowexp-fma4.c): Likewise.
	(CFLAGS-slowexp-avx.c): Likewise.
	* sysdeps/x86_64/fpu/multiarch/e_exp-avx.c (__slowexp): Do not
	define as macro.
	* sysdeps/x86_64/fpu/multiarch/e_exp-fma.c (__slowexp): Likewise.
	* sysdeps/x86_64/fpu/multiarch/e_exp-fma4.c (__slowexp): Likewise.
	* math/Makefile (type-double-routines): Remove slowexp.
	* manual/probes.texi (slowexp_p6): Remove.
	(slowexp_p32): Likewise.
2017-12-19 17:27:31 +00:00
Adhemerval Zanella 3bb1ef58b9 ia64: Fix memchr for large input sizes (BZ #22603)
Current optimized ia64 memchr uses a strategy to check for last address
by adding the input one with expected size.  However it does not take
care for possible overflow.

It was triggered by 3038145ca2 where default rawmemchr now uses memchr
(p, c, (size_t)-1).

This patch fixes it by implement a satured addition where overflows
sets the maximum pointer size to UINTPTR_MAX.

Checked on ia64-linux-gnu where it fixes both stratcliff and
test-rawmemchr failures.

	Adhemerval Zanella  <adhemerval.zanella@linaro.org>
	James Clarke <jrtc27@jrtc27.com>

	[BZ #22603]
	* sysdeps/ia64/memchr.S (__memchr): Avoid overflow in pointer
	addition.
2017-12-19 12:02:36 -02:00
Adhemerval Zanella 554e3d51ef sh: Fix clone exit return code (BZ #22605)
Since 3f823e87cc (Call exit directly in clone (BZ #21512)) SH clone
implementation fails to set the exit code resulting in the failures:

FAIL: nptl/tst-align-clone
FAIL: nptl/tst-getpid1

This patch fixes the both testcases.

	[BZ #22605]
	* sysdeps/unix/sysv/linux/sh/clone.S (__clone): Fix exit return
	code.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-12-19 12:02:01 -02:00
H.J. Lu cba595c350 x86: Add feature_1 to tcbhead_t [BZ #22563]
On x86, padding in struct __jmp_buf_tag is used for shadow stack pointer
to support Shadow Stack in Intel Control-flow Enforcemen Technology.
cancel_jmp_buf has been updated to include saved_mask so that it is as
large as struct __jmp_buf_tag.  We must suport the old cancel_jmp_buf
in existing binaries.  Since symbol versioning doesn't work on
cancel_jmp_buf, feature_1 is added to tcbhead_t so that setjmp and
longjmp can check if shadow stack is enabled.  NB: Shadow stack is
enabled only if all modules are shadow stack enabled.

	[BZ #22563]
	* sysdeps/i386/nptl/tcb-offsets.sym (FEATURE_1_OFFSET): New.
	* sysdeps/i386/nptl/tls.h (tcbhead_t): Add feature_1.
	* sysdeps/x86_64/nptl/tcb-offsets.sym (FEATURE_1_OFFSET): New.
	* sysdeps/x86_64/nptl/tls.h (tcbhead_t): Rename __glibc_unused1
	to feature_1.
2017-12-19 02:45:34 -08:00
H.J. Lu f81ddabffd Linux/x86: Update cancel_jmp_buf to match __jmp_buf_tag [BZ #22563]
On x86, padding in struct __jmp_buf_tag is used for shadow stack pointer
to support shadow stack in Intel Control-flow Enforcemen Technology.
Since the cancel_jmp_buf array is passed to setjmp and longjmp by
casting it to pointer to struct __jmp_buf_tag, it should be as large
as struct __jmp_buf_tag.  Otherwise when shadow stack is enabled,
setjmp and longjmp will write and read beyond cancel_jmp_buf when saving
and restoring shadow stack pointer.

This patch adds bits/types/__cancel_jmp_buf_tag.h to define struct
__cancel_jmp_buf_tag so that Linux/x86 can add saved_mask to
cancel_jmp_buf.

Tested natively on i386, x86_64 and x32.  Tested hppa-linux-gnu with
build-many-glibcs.py.

	[BZ #22563]
	* bits/types/__cancel_jmp_buf_tag.h: New file.
	* sysdeps/unix/sysv/linux/x86/bits/types/__cancel_jmp_buf_tag.h
	* sysdeps/unix/sysv/linux/x86/pthreaddef.h: Likewise.
	* sysdeps/unix/sysv/linux/x86/nptl/pthreadP.h: Likewise.
	* nptl/Makefile (headers): Add
	bits/types/__cancel_jmp_buf_tag.h.
	* nptl/descr.h [NEED_SAVED_MASK_IN_CANCEL_JMP_BUF]
	(pthread_unwind_buf): Add saved_mask to cancel_jmp_buf.
	* sysdeps/nptl/pthread.h: Include
	<bits/types/__cancel_jmp_buf_tag.h>.
	(__pthread_unwind_buf_t): Use struct __cancel_jmp_buf_tag with
	__cancel_jmp_buf.
	* sysdeps/unix/sysv/linux/hppa/pthread.h: Likewise.
2017-12-19 02:44:04 -08:00
H.J. Lu 1a49fc59e4 Add --enable-static-pie variants to x86_64, x32 and i686
Since the default GCC and binutils versions used by build-many-glibcs.py,
which are GCC 7 branch and binutils 2.29 branch, support static PIE on
x86_64, x32 and i686, this patch adds --enable-static-pie glibc variants
to x86_64, x32 and i686 to get some coverage for static PIE.

Tested with build-many-glibcs.py.

	* scripts/build-many-glibcs.py (Context.add_all_configs): Add
	--enable-static-pie variants to x86_64, x32 and i686.
2017-12-18 18:11:47 -08:00
Joseph Myers 6642518592 Fix m68k bits/mathinline.h attributes (bug 22631).
m68k bits/mathinline.h declares various functions with const
attributes.  These are inappropriate for functions that have results
depending on the rounding mode; the machine-independent
bits/mathcalls.h only uses const attributes for a very few functions
with no rounding mode dependence, and the m68k header should do
likewise.  GCC uses pure for such functions with -frounding-math,
resulting in GCC mainline warning for conflicts with between the
header and the built-in attributes and glibc failing to build for m68k
with GCC mainline.

This patch fixes the attributes to avoid using const except when
bits/mathcalls.h does so.  (There are a few functions where maybe
bits/mathcalls.h could do so but doesn't, but keeping the headers in
sync in this regard seems to be the safe approach.)

Tested compilation with build-many-glibcs.py with GCC mainline.

	[BZ #22631]
	* sysdeps/m68k/m680x0/fpu/bits/mathinline.h (__m81_defun): Add
	argument for attrubutes.  All callers changed.
	(__inline_mathop1): Likewise.  All callers changed.
	(__inline_mathop): Likewise.  All callers changed.
	[__USE_MISC] (scalbn): Use __inline_forward instead of
	__inline_forward_c.
	[__USE_ISOC99] (scalbln): Likewise.
	[__USE_ISOC99] (nearbyint): Likewise.
	[__USE_ISOC99] (lrint): Likewise.
	[__USE_MISC] (scalbnf): Likewise.
	[__USE_ISOC99] (scalblnf): Likewise.
	[__USE_ISOC99] (nearbyintf): Likewise.
	[__USE_ISOC99] (lrintf): Likewise.
	[__USE_MISC] (scalbnl): Likewise.
	[__USE_ISOC99] (scalblnl): Likewise.
	[__USE_ISOC99] (nearbyintl): Likewise.
	[__USE_ISOC99] (lrintl): Likewise.
	* sysdeps/m68k/m680x0/fpu/mathimpl.h: All callers of
	__inline_mathop and __m81_defun changed.
2017-12-19 02:02:26 +00:00
Joseph Myers 8e52f573a1 Fix build-many-glibcs.py arm-linux-gnueabihf builds with mainline GCC.
My fix to make the arm-linux-gnueabihf build-many-glibcs.py builds
actually use the hard-float ABI as intended showed up another issue
when building with mainline GCC: GCC now determines an FPU based on
the selected CPU or architecture and gives an error for
-mfloat-abi=hard when the CPU does not imply a choice of FPU.  This
patch fixes all the affected configurations to specify a suitable
--with-cpu, --with-fpu or -mfpu option explicitly to avoid that error
from GCC.

Tested the relevant configurations with build-many-glibcs.py with
mainline GCC.

	* scripts/build-many-glibcs.py (Context.add_all_configs): Specify
	CPU or FPU for ARM hard-float configurations.
2017-12-19 00:08:49 +00:00
Joseph Myers 40c4162df6 Disable -Wrestrict for two nptl/tst-attr3.c tests.
nptl/tst-attr3 fails to build with GCC mainline because of
(deliberate) aliasing between the second (attributes) and fourth
(argument to thread start routine) arguments to pthread_create.

Although both those arguments are restrict-qualified in POSIX,
pthread_create does not actually dereference its fourth argument; it's
an opaque pointer passed to the thread start routine.  Thus, the
aliasing is actually valid in this case, and it's deliberate in the
test.  So this patch makes the test disable -Wrestrict for the two
pthread_create calls in question.  (-Wrestrict was added in GCC 7,
hence the __GNUC_PREREQ conditions, but the particular warning in
question is new in GCC 8.)

Tested compilation with build-many-glibcs.py for aarch64-linux-gnu.

	* nptl/tst-attr3.c: Include <libc-diag.h>.
	(do_test) [__GNUC_PREREQ (7, 0)]: Ignore -Wrestrict for two tests.
2017-12-18 22:55:28 +00:00
Joseph Myers 5983df320a Fix truncation warnings in posix/tst-glob_symlinks.c.
The test posix/tst-glob_symlinks.c fails to build with GCC mainline:

tst-glob_symlinks.c: In function 'do_test':
tst-glob_symlinks.c:124:30: error: 'snprintf' output may be truncated before the last format character [-Werror=format-truncation=]
   snprintf (buf, sizeof buf, "%s?", dangling_link);
                              ^~~~~
tst-glob_symlinks.c:124:3: note: 'snprintf' output between 2 and 4097 bytes into a destination of size 4096
   snprintf (buf, sizeof buf, "%s?", dangling_link);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tst-glob_symlinks.c:128:30: error: 'snprintf' output may be truncated before the last format character [-Werror=format-truncation=]
   snprintf (buf, sizeof buf, "%s*", dangling_link);
                              ^~~~~
tst-glob_symlinks.c:128:3: note: 'snprintf' output between 2 and 4097 bytes into a destination of size 4096
   snprintf (buf, sizeof buf, "%s*", dangling_link);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This patch fixes the test to avoid such truncation warnings by
increasing the buffer in question by one byte, to ensure it can hold
any possible result of %s? or %s* formats where %s comes from a buffer
of size PATH_MAX.

Tested compilation with build-many-glibcs.py for aarch64-linux-gnu.

	* posix/tst-glob_symlinks.c (do_test): Increase size of buf.
2017-12-18 22:54:01 +00:00
Joseph Myers 1421f39b7e Disable strncat test array-bounds warnings for GCC 8.
Some strncat tests fail to build with GCC 8 because of -Warray-bounds
warnings.  These tests are deliberately test over-large size arguments
passed to strncat, and already disable -Wstringop-overflow warnings,
but now the warnings for these tests come under -Warray-bounds so that
option needs disabling for them as well, which this patch does (with
an update on the comments; the DIAG_IGNORE_NEEDS_COMMENT call for
-Warray-bounds doesn't need to be conditional itself, because that
option is supported by all versions of GCC that can build glibc).

Tested compilation with build-many-glibcs.py for aarch64-linux-gnu.

	* string/tester.c (test_strncat): Also disable -Warray-bounds
	warnings for two tests.
2017-12-18 22:52:41 +00:00
H.J. Lu 00c714df39 Pass -no-pie to GCC only if GCC defaults to PIE [BZ #22614]
After --enable-static-pie is added to configure, libc_cv_pie_default is
set to yes when either --enable-static-pie is used to configure glibc
or GCC defaults to PIE.  We should set no-pie-ldflag to -no-pie, which
is supported on GCC 6 and later, only if GCC defaults to PIE, not when
--enable-static-pie is used to configure glibc.

Tested on x32 with --enable-static-pie using GCC 5 and without
--enable-static-pie using GCC 7.

	[BZ #22614]
	* Makeconfig (no-pie-ldflag): Set to -no-pie only if
	$(cc-pie-default) == yes.
	* config.make.in (cc-pie-default): New.
	* configure.ac (libc_cv_pie_default): Renamed to ...
	(libc_cv_cc_pie_default): This.
	(libc_cv_pie_default): Set to $libc_cv_cc_pie_default.
	* configure: Regenerated.
2017-12-18 12:24:38 -08:00
Florian Weimer 8e1472d2c1 ld.so: Examine GLRO to detect inactive loader [BZ #20204]
GLRO (_rtld_global_ro) is read-only after initialization and can
therefore not be patched at run time, unlike the hook table addresses
and their contents, so this is a desirable hardening feature.

The hooks are only needed if ld.so has not been initialized, and this
happens only after static dlopen (dlmopen uses a single ld.so object
across all namespaces).

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2017-12-18 20:04:13 +01:00
Joseph Myers 49b036bce9 Fix nscd readlink argument aliasing (bug 22446).
Current GCC mainline detects that nscd calls readlink with the same
buffer for both input and output, which is not valid (those arguments
are both restrict-qualified in POSIX).  This patch makes it use a
separate buffer for readlink's input (with a size that is sufficient
to avoid truncation, so there should be no problems with warnings
about possible truncation, though not strictly minimal, but much
smaller than the buffer for output) to avoid this problem.

Tested compilation for aarch64-linux-gnu with build-many-glibcs.py.

	[BZ #22446]
	* nscd/connections.c (handle_request) [SO_PEERCRED]: Use separate
	buffers for readlink input and output.
2017-12-18 18:50:40 +00:00
Sergei Trofimovich c85c564d14 mips32: fix clobbering s0 in setjmp() [BZ #22624]
Similar to commit 1ab47db00dfbc0128119e3503d3ed640ffc4830b
("mips64: fix clobbering s0 in setjmp() [BZ #22624]")
as sysdeps/mips/setjmp_aux.c is almost an identical copy
of sysdeps/mips/mips64/setjmp_aux.c.

	[BZ #22624]
	* sysdeps/mips/setjmp_aux.c (__sigsetjmp_aux): Use
	inhibit_stack_protector.
2017-12-18 18:26:49 +00:00
Sergei Trofimovich 368b6c8da9 mips64: fix clobbering s0 in setjmp() [BZ #22624]
When configured as --enable-stack-protector=all glibc
inserts stack checking canary into every function
including __sigsetjmp_aux(). Stack checking code
ends up using s0 register to temporary hold address
of global canary value.

Unfortunately __sigsetjmp_aux assumes no caller' caller-save
registers should be clobbered as it stores them as-is.

The fix is to disable stack protection of __sigsetjmp_aux.

Tested on the following test:

    #include <setjmp.h>
    #include <stdio.h>

    int main() {
        jmp_buf jb;
        volatile register long s0 asm ("$s0");
        s0 = 1234;
        if (setjmp(jb) == 0)
            longjmp(jb, 1);
        printf ("$s0 = %lu\n", s0);
    }

Without the fix:
    $ qemu-mipsn32 -L . ./mips-longjmp-bug
    $s0 = 1082346228

With the fix:
    $ qemu-mipsn32 -L . ./mips-longjmp-bug
    $s0 = 1234

	[BZ #22624]
	* sysdeps/mips/mips64/setjmp_aux.c (__sigsetjmp_aux): Use
	inhibit_stack_protector.
2017-12-18 17:23:02 +00:00
Dmitry V. Levin bb195224ac elf: do not substitute dst in $LD_LIBRARY_PATH twice [BZ #22627]
Starting with commit
glibc-2.18.90-470-g2a939a7e6d81f109d49306bc2e10b4ac9ceed8f9 that
introduced substitution of dynamic string tokens in fillin_rpath,
_dl_init_paths invokes _dl_dst_substitute for $LD_LIBRARY_PATH twice:
the first time it's called directly, the second time the result
is passed on to fillin_rpath which calls expand_dynamic_string_token
which in turn calls _dl_dst_substitute, leading to the following
behaviour:

$ mkdir -p /tmp/'$ORIGIN' && cd /tmp/'$ORIGIN' &&
  echo 'int main(){}' |gcc -xc - &&
  strace -qq -E LD_LIBRARY_PATH='$ORIGIN' -e /open ./a.out
open("/tmp//tmp/$ORIGIN/tls/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/tmp//tmp/$ORIGIN/tls/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/tmp//tmp/$ORIGIN/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/tmp//tmp/$ORIGIN/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
open("/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3

Fix this by removing the direct _dl_dst_substitute invocation.

* elf/dl-load.c (_dl_init_paths): Remove _dl_dst_substitute preparatory
code and invocation.
2017-12-18 12:24:48 +00:00
Szabolcs Nagy 14d886edbd aarch64: fix start code for static pie
There are three flavors of the crt startup code:

1) crt1.o used for non-pie,
2) Scrt1.o used for dynamic linked pie (dynamic linker relocates),
3) rcrt1.o used for static linked pie (self relocation is needed)

In the --enable-static-pie case crt1.o is built with -DPIC and in case
of static linking it interposes _dl_relocate_static_pie in libc to
avoid self relocation.

Scrt1.o is built with -DPIC -DSHARED and it relies on GOT entries that
the static linker cannot relax and thus need relocation before the
start code is executed, so rcrt1.o needs separate implementation.

This implementation does not work for .text > 4G position independent
executables, which is fine since the toolchain does not support
-mcmodel=large with -fPIE.

Tests pass with ld/22269 and ld/22263 binutils bugs fixed.

	* sysdeps/aarch64/start.S (_start): Handle PIC && !SHARED case.
2017-12-18 10:07:07 +00:00
Aurelien Jarno 7d38eb3897 ldconfig: set LC_COLLATE to C [BZ #22505]
ldconfig supports `include' directives and use the glob function to
process them. The glob function sort entries according to the LC_COLLATE
category. When using a standard "include /etc/ld.so.conf.d/*.conf" entry
in /etc/ld.so.conf, the order therefore depends on the locale used to
run ldconfig. A few examples of locale specific order that might be
disturbing in that context compared to the C locale:
- The cs_CZ and sk_SK locales sort the digits after the letters.
- The et_EE locale sorts the 'z' between 's' and 't'.

This patch fixes that by setting LC_COLLATE to C in order to process
files in deterministic order, independently of the locale used to launch
ldconfig.

NOTE: This should NOT be backported to older release branches.

Changelog:
	[BZ #22505]
	* elf/ldconfig.c (main): Call setlocale to force LC_COLLATE to C.
2017-12-16 12:25:41 +01:00
Rajalakshmi Srinivasaraghavan 2e77deef67 s390: Update ulps
* sysdeps/s390/fpu/libm-test-ulps: Update.
2017-12-16 14:11:56 +05:30
Rajalakshmi Srinivasaraghavan 0b9bef6d22 powerpc: Update ulps
* sysdeps/powerpc/fpu/libm-test-ulps: Update.
2017-12-16 14:04:14 +05:30
Rajalakshmi Srinivasaraghavan 984ae9967b New generic sincosf
This implementation is based on generic s_sinf.c and s_cosf.c.
Tested on s390x, powerpc64le and powerpc32.
2017-12-16 14:01:37 +05:30
Carlos O'Donell 93930ea935 Fix tst-leaks1 (bug 14681)
The test tst-leaks1 exercises calling dlopen with a $ORIGIN DST.

This results in a theoretical leak e.g.

Memory not freed:
-----------------
           Address     Size     Caller
0x0000000001d766c0     0x21  at 0x7fb1bd8bf4ab

Or as seen via valgrind:

==27582== 33 bytes in 1 blocks are still reachable in loss record 1 of 1
==27582==    at 0x4C2CB6B: malloc (vg_replace_malloc.c:299)
==27582==    by 0x40124AA: _dl_get_origin (dl-origin.c:50)
==27582==    by 0x4007DB9: expand_dynamic_string_token (dl-load.c:382)
==27582==    by 0x400899C: _dl_map_object (dl-load.c:2160)
==27582==    by 0x4013020: dl_open_worker (dl-open.c:224)
==27582==    by 0x5166F9B: _dl_catch_exception (dl-error-skeleton.c:198)
==27582==    by 0x4012BD9: _dl_open (dl-open.c:594)
==27582==    by 0x4E39EF5: dlopen_doit (dlopen.c:66)
==27582==    by 0x5166F9B: _dl_catch_exception (dl-error-skeleton.c:198)
==27582==    by 0x516700E: _dl_catch_error (dl-error-skeleton.c:217)
==27582==    by 0x4E3A514: _dlerror_run (dlerror.c:162)
==27582==    by 0x4E39F70: dlopen@@GLIBC_2.2.5 (dlopen.c:87)

There is no real leak.

The calling link map (the executable's link map) has it's l_origin
expanded for future use as part of _dl_get_origin, and that results
in the main executable link map having a N-byte allocation for
l->l_origin that is never freed since the executable's link map is
just a part of the process.

To take this into account we do one dlopen with $ORIGIN before
calling mtrace to force the initialization of the executable link
map.

Signed-off-by: Carlos O'Donell <carlos@redhat.com>
2017-12-15 20:22:29 -08:00
H.J. Lu 9d7a3741c9 Add --enable-static-pie configure option to build static PIE [BZ #19574]
Static PIE extends address space layout randomization to static
executables.  It provides additional security hardening benefits at
the cost of some memory and performance.

Dynamic linker, ld.so, is a standalone program which can be loaded at
any address.  This patch adds a configure option, --enable-static-pie,
to embed the part of ld.so in static executable to create static position
independent executable (static PIE).  A static PIE is similar to static
executable, but can be loaded at any address without help from a dynamic
linker.  When --enable-static-pie is used to configure glibc, libc.a is
built as PIE and all static executables, including tests, are built as
static PIE.  The resulting libc.a can be used together with GCC 8 or
above to build static PIE with the compiler option, -static-pie.  But
GCC 8 isn't required to build glibc with --enable-static-pie.  Only GCC
with PIE support is needed.  When an older GCC is used to build glibc
with --enable-static-pie, proper input files are passed to linker to
create static executables as static PIE, together with "-z text" to
prevent dynamic relocations in read-only segments, which are not allowed
in static PIE.

The following changes are made for static PIE:

1. Add a new function, _dl_relocate_static_pie, to:
   a. Get the run-time load address.
   b. Read the dynamic section.
   c. Perform dynamic relocations.
Dynamic linker also performs these steps.  But static PIE doesn't load
any shared objects.
2. Call _dl_relocate_static_pie at entrance of LIBC_START_MAIN in
libc.a.  crt1.o, which is used to create dynamic and non-PIE static
executables, is updated to include a dummy _dl_relocate_static_pie.
rcrt1.o is added to create static PIE, which will link in the real
_dl_relocate_static_pie.  grcrt1.o is also added to create static PIE
with -pg.  GCC 8 has been updated to support rcrt1.o and grcrt1.o for
static PIE.

Static PIE can work on all architectures which support PIE, provided:

1. Target must support accessing of local functions without dynamic
relocations, which is needed in start.S to call __libc_start_main with
function addresses of __libc_csu_init, __libc_csu_fini and main.  All
functions in static PIE are local functions.  If PIE start.S can't reach
main () defined in a shared object, the code sequence:

	pass address of local_main to __libc_start_main
	...

local_main:
	tail call to main via PLT

can be used.
2. start.S is updated to check PIC instead SHARED for PIC code path and
avoid dynamic relocation, when PIC is defined and SHARED isn't defined,
to support static PIE.
3. All assembly codes are updated check PIC instead SHARED for PIC code
path to avoid dynamic relocations in read-only sections.
4. All assembly codes are updated check SHARED instead PIC for static
symbol name.
5. elf_machine_load_address in dl-machine.h are updated to support static
PIE.
6. __brk works without TLS nor dynamic relocations in read-only section
so that it can be used by __libc_setup_tls to initializes TLS in static
PIE.

NB: When glibc is built with GCC defaulted to PIE, libc.a is compiled
with -fPIE, regardless if --enable-static-pie is used to configure glibc.
When glibc is configured with --enable-static-pie, libc.a is compiled
with -fPIE, regardless whether GCC defaults to PIE or not.  The same
libc.a can be used to build both static executable and static PIE.
There is no need for separate PIE copy of libc.a.

On x86-64, the normal static sln:

   text	   data	    bss	    dec	    hex	filename
 625425	   8284	   5456	 639165	  9c0bd	elf/sln

the static PIE sln:

   text	   data	    bss	    dec	    hex	filename
 657626	  20636	   5392	 683654	  a6e86	elf/sln

The code size is increased by 5% and the binary size is increased by 7%.

Linker requirements to build glibc with --enable-static-pie:

1. Linker supports --no-dynamic-linker to remove PT_INTERP segment from
static PIE.
2. Linker can create working static PIE.  The x86-64 linker needs the
fix for

https://sourceware.org/bugzilla/show_bug.cgi?id=21782

The i386 linker needs to be able to convert "movl main@GOT(%ebx), %eax"
to "leal main@GOTOFF(%ebx), %eax" if main is defined locally.

Binutils 2.29 or above are OK for i686 and x86-64.  But linker status for
other targets need to be verified.

3. Linker should resolve undefined weak symbols to 0 in static PIE:

https://sourceware.org/bugzilla/show_bug.cgi?id=22269

4. Many ELF backend linkers incorrectly check bfd_link_pic for TLS
relocations, which should check bfd_link_executable instead:

https://sourceware.org/bugzilla/show_bug.cgi?id=22263

Tested on aarch64, i686 and x86-64.

Using GCC 7 and binutils master branch, build-many-glibcs.py with
--enable-static-pie with all patches for static PIE applied have the
following build successes:

PASS: glibcs-aarch64_be-linux-gnu build
PASS: glibcs-aarch64-linux-gnu build
PASS: glibcs-armeb-linux-gnueabi-be8 build
PASS: glibcs-armeb-linux-gnueabi build
PASS: glibcs-armeb-linux-gnueabihf-be8 build
PASS: glibcs-armeb-linux-gnueabihf build
PASS: glibcs-arm-linux-gnueabi build
PASS: glibcs-arm-linux-gnueabihf build
PASS: glibcs-arm-linux-gnueabihf-v7a build
PASS: glibcs-arm-linux-gnueabihf-v7a-disable-multi-arch build
PASS: glibcs-m68k-linux-gnu build
PASS: glibcs-microblazeel-linux-gnu build
PASS: glibcs-microblaze-linux-gnu build
PASS: glibcs-mips64el-linux-gnu-n32 build
PASS: glibcs-mips64el-linux-gnu-n32-nan2008 build
PASS: glibcs-mips64el-linux-gnu-n32-nan2008-soft build
PASS: glibcs-mips64el-linux-gnu-n32-soft build
PASS: glibcs-mips64el-linux-gnu-n64 build
PASS: glibcs-mips64el-linux-gnu-n64-nan2008 build
PASS: glibcs-mips64el-linux-gnu-n64-nan2008-soft build
PASS: glibcs-mips64el-linux-gnu-n64-soft build
PASS: glibcs-mips64-linux-gnu-n32 build
PASS: glibcs-mips64-linux-gnu-n32-nan2008 build
PASS: glibcs-mips64-linux-gnu-n32-nan2008-soft build
PASS: glibcs-mips64-linux-gnu-n32-soft build
PASS: glibcs-mips64-linux-gnu-n64 build
PASS: glibcs-mips64-linux-gnu-n64-nan2008 build
PASS: glibcs-mips64-linux-gnu-n64-nan2008-soft build
PASS: glibcs-mips64-linux-gnu-n64-soft build
PASS: glibcs-mipsel-linux-gnu build
PASS: glibcs-mipsel-linux-gnu-nan2008 build
PASS: glibcs-mipsel-linux-gnu-nan2008-soft build
PASS: glibcs-mipsel-linux-gnu-soft build
PASS: glibcs-mips-linux-gnu build
PASS: glibcs-mips-linux-gnu-nan2008 build
PASS: glibcs-mips-linux-gnu-nan2008-soft build
PASS: glibcs-mips-linux-gnu-soft build
PASS: glibcs-nios2-linux-gnu build
PASS: glibcs-powerpc64le-linux-gnu build
PASS: glibcs-powerpc64-linux-gnu build
PASS: glibcs-tilegxbe-linux-gnu-32 build
PASS: glibcs-tilegxbe-linux-gnu build
PASS: glibcs-tilegx-linux-gnu-32 build
PASS: glibcs-tilegx-linux-gnu build
PASS: glibcs-tilepro-linux-gnu build

and the following build failures:

FAIL: glibcs-alpha-linux-gnu build

elf/sln is failed to link due to:

assertion fail bfd/elf64-alpha.c:4125

This is caused by linker bug and/or non-PIC code in PIE libc.a.

FAIL: glibcs-hppa-linux-gnu build

elf/sln is failed to link due to:

collect2: fatal error: ld terminated with signal 11 [Segmentation fault]

https://sourceware.org/bugzilla/show_bug.cgi?id=22537

FAIL: glibcs-ia64-linux-gnu build

elf/sln is failed to link due to:

collect2: fatal error: ld terminated with signal 11 [Segmentation fault]

FAIL: glibcs-powerpc-linux-gnu build
FAIL: glibcs-powerpc-linux-gnu-soft build
FAIL: glibcs-powerpc-linux-gnuspe build
FAIL: glibcs-powerpc-linux-gnuspe-e500v1 build

elf/sln is failed to link due to:

ld: read-only segment has dynamic relocations.

This is caused by linker bug and/or non-PIC code in PIE libc.a.  See:

https://sourceware.org/bugzilla/show_bug.cgi?id=22264

FAIL: glibcs-powerpc-linux-gnu-power4 build

elf/sln is failed to link due to:

findlocale.c:96:(.text+0x22c): @local call to ifunc memchr

This is caused by linker bug and/or non-PIC code in PIE libc.a.

FAIL: glibcs-s390-linux-gnu build

elf/sln is failed to link due to:

collect2: fatal error: ld terminated with signal 11 [Segmentation fault], core dumped

assertion fail bfd/elflink.c:14299

This is caused by linker bug and/or non-PIC code in PIE libc.a.

FAIL: glibcs-sh3eb-linux-gnu build
FAIL: glibcs-sh3-linux-gnu build
FAIL: glibcs-sh4eb-linux-gnu build
FAIL: glibcs-sh4eb-linux-gnu-soft build
FAIL: glibcs-sh4-linux-gnu build
FAIL: glibcs-sh4-linux-gnu-soft build

elf/sln is failed to link due to:

ld: read-only segment has dynamic relocations.

This is caused by linker bug and/or non-PIC code in PIE libc.a.  See:

https://sourceware.org/bugzilla/show_bug.cgi?id=22263

Also TLS code sequence in SH assembly syscalls in glibc doesn't match TLS
code sequence expected by ld:

https://sourceware.org/bugzilla/show_bug.cgi?id=22270

FAIL: glibcs-sparc64-linux-gnu build
FAIL: glibcs-sparcv9-linux-gnu build
FAIL: glibcs-tilegxbe-linux-gnu build
FAIL: glibcs-tilegxbe-linux-gnu-32 build
FAIL: glibcs-tilegx-linux-gnu build
FAIL: glibcs-tilegx-linux-gnu-32 build
FAIL: glibcs-tilepro-linux-gnu build

elf/sln is failed to link due to:

ld: read-only segment has dynamic relocations.

This is caused by linker bug and/or non-PIC code in PIE libc.a.  See:

https://sourceware.org/bugzilla/show_bug.cgi?id=22263

	[BZ #19574]
	* INSTALL: Regenerated.
	* Makeconfig (real-static-start-installed-name): New.
	(pic-default): Updated for --enable-static-pie.
	(pie-default): New for --enable-static-pie.
	(default-pie-ldflag): Likewise.
	(+link-static-before-libc): Replace $(DEFAULT-LDFLAGS-$(@F))
	with $(if $($(@F)-no-pie),$(no-pie-ldflag),$(default-pie-ldflag)).
	Replace $(static-start-installed-name) with
	$(real-static-start-installed-name).
	(+prectorT): Updated for --enable-static-pie.
	(+postctorT): Likewise.
	(CFLAGS-.o): Add $(pie-default).
	(CFLAGS-.op): Likewise.
	* NEWS: Mention --enable-static-pie.
	* config.h.in (ENABLE_STATIC_PIE): New.
	* configure.ac (--enable-static-pie): New configure option.
	(have-no-dynamic-linker): New LIBC_CONFIG_VAR.
	(have-static-pie): Likewise.
	Enable static PIE if linker supports --no-dynamic-linker.
	(ENABLE_STATIC_PIE): New AC_DEFINE.
	(enable-static-pie): New LIBC_CONFIG_VAR.
	* configure: Regenerated.
	* csu/Makefile (omit-deps): Add r$(start-installed-name) and
	gr$(start-installed-name) for --enable-static-pie.
	(extra-objs): Likewise.
	(install-lib): Likewise.
	(extra-objs): Add static-reloc.o and static-reloc.os
	($(objpfx)$(start-installed-name)): Also depend on
	$(objpfx)static-reloc.o.
	($(objpfx)r$(start-installed-name)): New.
	($(objpfx)g$(start-installed-name)): Also depend on
	$(objpfx)static-reloc.os.
	($(objpfx)gr$(start-installed-name)): New.
	* csu/libc-start.c (LIBC_START_MAIN): Call _dl_relocate_static_pie
	in libc.a.
	* csu/libc-tls.c (__libc_setup_tls): Add main_map->l_addr to
	initimage.
	* csu/static-reloc.c: New file.
	* elf/Makefile (routines): Add dl-reloc-static-pie.
	(elide-routines.os): Likewise.
	(DEFAULT-LDFLAGS-tst-tls1-static-non-pie): Removed.
	(tst-tls1-static-non-pie-no-pie): New.
	* elf/dl-reloc-static-pie.c: New file.
	* elf/dl-support.c (_dl_get_dl_main_map): New function.
	* elf/dynamic-link.h (ELF_DURING_STARTUP): Also check
	STATIC_PIE_BOOTSTRAP.
	* elf/get-dynamic-info.h (elf_get_dynamic_info): Likewise.
	* gmon/Makefile (tests): Add tst-gmon-static-pie.
	(tests-static): Likewise.
	(DEFAULT-LDFLAGS-tst-gmon-static): Removed.
	(tst-gmon-static-no-pie): New.
	(CFLAGS-tst-gmon-static-pie.c): Likewise.
	(CRT-tst-gmon-static-pie): Likewise.
	(tst-gmon-static-pie-ENV): Likewise.
	(tests-special): Likewise.
	($(objpfx)tst-gmon-static-pie.out): Likewise.
	(clean-tst-gmon-static-pie-data): Likewise.
	($(objpfx)tst-gmon-static-pie-gprof.out): Likewise.
	* gmon/tst-gmon-static-pie.c: New file.
	* manual/install.texi: Document --enable-static-pie.
	* sysdeps/generic/ldsodefs.h (_dl_relocate_static_pie): New.
	(_dl_get_dl_main_map): Likewise.
	* sysdeps/i386/configure.ac: Check if linker supports static PIE.
	* sysdeps/x86_64/configure.ac: Likewise.
	* sysdeps/i386/configure: Regenerated.
	* sysdeps/x86_64/configure: Likewise.
	* sysdeps/mips/Makefile (ASFLAGS-.o): Add $(pie-default).
	(ASFLAGS-.op): Likewise.
2017-12-15 17:12:14 -08:00
Joseph Myers 95511aab9d Fix testing with read-only source directory.
Three tests fail with a read-only source directory because they try to
write into the source directory.  None of these write into it in a way
that should actually be problematic for concurrent builds sharing the
same writable source directory, but avoiding any writing into the
source directory (from testing, or from building glibc if the source
timestamps are properly ordered) is still a good idea, as being able
to build with read-only sources helps make sure there isn't anything
that could cause problems for concurrent builds.

This patch changes the tests in question to use either /tmp or the
build directory to write their temporary files (or to test O_TMPFILE,
as applicable).

Tested for x86_64.

	* io/Makefile (tst-open-tmpfile-ARGS): New variable.
	* posix/tst-mmap-offset.c (fname): Use /tmp.
	* stdlib/tst-setcontext3.sh (tempfile): Use ${objpfx}.
2017-12-15 22:37:17 +00:00
Steve Ellcey a7e3edf4f2 Increase buffer size due to warning from ToT GCC
* nscd/dbg_log.c (dbg_log): Increase msg buffer size.
2017-12-15 09:08:23 -08:00
Thomas Schwinge d232f2e137 Don't set errno in Hurd rtld's __access_noerrno
* sysdeps/mach/hurd/dl-sysdep.c (__access_noerrno): Don't set
	errno.

Fixes commit 819ea3347e.

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2017-12-15 18:02:56 +01:00
Joseph Myers 5170fa49b2 Correct build-many-glibcs.py arm-linux-gnueabihf configurations.
The conventional configure triplet for ARM GNU/Linux with hard-float
ABI is arm-*-linux-gnueabihf.  However, GCC does not automatically use
the hard-float ABI based on that triplet.  This patch fixes
build-many-glibcs.py to pass --with-float=hard so that the
arm-linux-gnueabihf configurations actually build with the intended
ABI.

Tested building the affected configurations with build-many-glibcs.py.

	* scripts/build-many-glibcs.py (Context.add_all_configs): Use
	--with-float=hard for arm-linux-gnueabihf configurations.
2017-12-15 16:57:29 +00:00
Joseph Myers f2da2fd81f Do not build .mo files in source directory (bug 14121).
Building and installing glibc leaves .mo files (compiled message
translations) behind in the source directory.  Building those files in
the source directory may once have made sense, if they were included
in release tarballs; now that release tarballs are just the output of
"git archive", building any non-checked-in files in the source
directory does not make sense.  This patch changes these files to be
built in the build directory instead.  The realclean rule is changed
to simply adding the .mo files to the "generated" variable, since once
the files are in the build directory it make no sense to exclude them
from normal cleanup rules.

This is necessary but not sufficient to avoid build-many-glibcs.py
needing to copy the glibc source directory.  Its list of files to
touch on checkout to avoid subsequent regeneration (configure,
preconfigure, *-kw.h) is incomplete (missing at least INSTALL,
sysdeps/gnu/errlist.c, posix/testcases.h, posix/ptestcases.h,
locale/C-translit.h, (only regenerated for Hurd builds)
sysdeps/mach/hurd/bits/errno.h, (only regenerated for 32-bit SPARC
builds) sysdeps/sparc/sparc32/{sdiv,udiv,rem,urem}.S) - the existing
list may be sufficient to prevent regeneration that actually changes
the file contents depending on the installed build tools, but not to
ensure there is no regeneration at all - and there might well be other
things writing into the source directory in the course of building and
testing (so needing appropriate testing with read-only source
directories with different timestamp orderings to find and eliminate
all such cases).

Tested for x86_64.

	[BZ #14121]
	* po/Makefile (generated): Add $(ALL_LINGUAS:%=%.mo).
	(%.mo): Change to $(objpfx)%.mo.  Use $(make-target-directory).
	($(mo-installed)): Use $(objpfx)%.mo.
	(realclean): Remove rule.
2017-12-15 14:27:20 +00:00
Joseph Myers 0c4fe28d7a Remove old po/ code for copying .po files from shared directory.
po/Makefile has both old code for copying .po files from a shared
directory /com/share/ftp/gnu/po/maint/glibc (presumably once present
on some GNU server), and new code for downloading them from the
Translation Project.  This patch removes the old code, leading only
the new code.

Tested for x86_64.

	* po/Makefile (linguas): Remove rule and dependencies.
	(linguas.mo): Likewise.
	(.PHONY): Do not depend on linguas and linguas.mo.
	(podir): Remove variable.
	(pofiles): Likewise.
	[$(pofiles)] (%.po): Remove rule.
2017-12-15 14:20:52 +00:00
Joseph Myers 174edbde7e Update SPARC divrem generation to match output.
While working on another patch I noticed that (a)
sysdeps/sparc/sparc32/Makefile is the only place with special
realclean settings, apart from po/, and (b) the generated files with a
rule in that Makefile to generate them (using m4) had been patched
manually so no longer corresponded with the output of the generator -
so if the timestamps were wrong, a build would result in changes to
the files in the source directory.  (They also didn't correspond
because of changes in make 3.81 to how make handles whitespace at the
start of a line in a sequence of backslash-newline continuation lines
within a recipe.)

This patch fixes the generation and output files to match.  The issue
with make and whitespace at start of continuation lines is fixed by
putting those newlines outside of arguments to echo, so the number of
spaces in the argument matches the number in the existing generated
files.  Then divrem.m4 is changed to avoid generating whitespace-only
lines (my fix to the outputs from 2013; this fix to the generator also
changes the indentation of a label in the output files) and to
generate an alias in udiv.S (Adhemerval's fix from March).

build-many-glibcs.py doesn't have a non-v9 SPARC configuration,
because non-v9 32-bit SPARC didn't build when I set up
build-many-glibcs.py but sparcv9 did build.  Whether or not non-v9
32-bit SPARC now builds (or indeed whether or not support for it is
obsolete), I tested by removing the sparcv8 and sparcv9 versions of
the four files in question, so forcing the generated files to be built
and used, and the compilation parts of the glibc testsuite passed.

	* sysdeps/sparc/sparc32/Makefile
	($(divrem:%=$(sysdep_dir)/sparc/sparc32/%.S)): Do not include
	start-of-line whitespace in argument of echo.
	* sysdeps/sparc/sparc32/divrem.m4: Avoid generating lines starting
	with whitespace.  Generate __wrap_.udiv alias.
	* sysdeps/sparc/sparc32/rem.S: Regenerated.
	* sysdeps/sparc/sparc32/sdiv.S: Likewise.
	* sysdeps/sparc/sparc32/udiv.S: Likewise.
	* sysdeps/sparc/sparc32/urem.S: Likewise.
2017-12-15 14:06:07 +00:00
Rajalakshmi Srinivasaraghavan 1e36806fb8 powerpc: st{r,p}cpy optimization for aligned strings
This patch makes use of vectors for aligned inputs.  Improvements
upto 30% seen for larger aligned inputs.

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
2017-12-15 10:55:58 +05:30
Siddhesh Poyarekar 5f1603c331 Convert strcmp benchmark output to json format
The format is now parseable with the compare_strings.py script.
2017-12-15 02:31:41 +05:30
Siddhesh Poyarekar aa6932aa7b Remove redundant mention of SXID_ERASE
SXID_ERASE is implicit for all environment variables.  Avoid
mentioning it in the tunables list; that way only the ones with
SXID_IGNORE remain prominent and mentioned.  TODO: we need to audit
each of those cases and drop them to SXID_ERASE wherever possible.
2017-12-15 00:48:12 +05:30
Florian Weimer 3ff3dfa5af elf: Count components of the expanded path in _dl_init_path [BZ #22607] 2017-12-14 15:31:46 +01:00
Florian Weimer 8a0b17e48b elf: Compute correct array size in _dl_init_paths [BZ #22606] 2017-12-14 15:27:08 +01:00
Florian Weimer f58bd7f055 support: Simplify compiling most of support/ outside of glibc
Some include files were missing because they are implied by the
in-tree build process.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2017-12-14 13:48:56 +01:00
H.J. Lu 4ca945e9c5 x86-64: Remove sysdeps/x86_64/fpu/s_cosf.S
On Ivy Bridge, bench-cosf reports performance improvement:

           s_cosf.S      s_cosf.c       Improvement
max        114.136       82.401            39%
min        13.119        11.301            16%
mean       22.1882       21.8938           1%

	* sysdeps/x86_64/fpu/s_cosf.S: Removed.
2017-12-14 04:39:53 -08:00
Patrick McGehearty e6a1c5dc77 sparc: M7 optimized memset/bzero
Support added to identify Sparc M7/T7/S7/M8/T8 processor capability.
Performance tests run on Sparc S7 using new code and old niagara4 code.

Optimizations for memset also apply to bzero as they share code.

For memset/bzero, performance comparison with niagara4 code:
For memset nonzero data,
  256-1023 bytes - 60-90% gain (in cache); 5% gain (out of cache)
  1K+ bytes - 80-260% gain (in cache); 40-80% gain (out of cache)
For memset zero data (and bzero),
  256-1023 bytes - 80-120% gain (in cache), 0% gain (out of cache)
  1024+ bytes - 2-4x gain (in cache), 10-35% gain (out of cache)

Tested in sparcv9-*-* and sparc64-*-* targets in both multi and
non-multi arch configurations.

	Patrick McGehearty <patrick.mcgehearty@oracle.com>
	Adhemerval Zanella  <adhemerval.zanella@linaro.org>

	* sysdeps/sparc/sparc32/sparcv9/multiarch/Makefile
	(sysdeps_routines): Add memset-niagara7.
	* sysdeps/sparc/sparc64/multiarch/Makefile (sysdes_rotuines):
	Likewise.
	* sysdeps/sparc/sparc32/sparcv9/multiarch/memset-niagara7.S: New
	file.
	* sysdeps/sparc/sparc64/multiarch/memset-niagara7.S: Likewise.
	* sysdeps/sparc/sparc64/multiarch/ifunc-impl-list.c
	(__libc_ifunc_impl_list): Add __bzero_niagara7 and __memset_niagara7.
	* sysdeps/sparc/sparc64/multiarch/ifunc-memset.h (IFUNC_SELECTOR):
	Add niagara7 option.
	* NEWS: Mention sparc m7 optimized memcpy, mempcpy, memmove, and
	memset.
2017-12-14 08:48:19 -02:00
Patrick McGehearty 1b6e07f8e0 sparc: M7 optimized memcpy/mempcpy/memmove
Support added to identify Sparc M7/T7/S7/M8/T8 processor capability.
Performance tests run on Sparc S7 using new code and old niagara4 code.

Optimizations for memcpy also apply to mempcpy and memmove
where they share code. Optimizations for memset also apply
to bzero as they share code.

For memcpy/mempcpy/memmove, performance comparison with niagara4 code:
Long word aligned data
  0-127 bytes - minimal changes
  128-1023 bytes - 7-30% gain
  1024+ bytes - 1-7% gain (in cache); 30-100% gain (out of cache)
Word aligned data
  0-127 bytes - 50%+ gain
  128-1023 bytes - 10-200% gain
  1024+ bytes - 0-15% gain (in cache); 5-50% gain (out of cache)
Unaligned data
  0-127 bytes - 0-70%+ gain
  128-447 bytes - 40-80%+ gain
  448-511 bytes - 1-3% loss
  512-4096 bytes - 2-3% gain (in cache); 0-20% gain (out of cache)
  4096+ bytes - ± 3% (in cache); 20-50% gain (out of cache)

Tested in sparcv9-*-* and sparc64-*-* targets in both multi and
non-multi arch configurations.

	Patrick McGehearty  <patrick.mcgehearty@oracle.com>
	Adhemerval Zanella  <adhemerval.zanella@linaro.org>

	* sysdeps/sparc/sparc32/sparcv9/multiarch/Makefile
	(sysdeps_routines): Add memcpy-memmove-niagara7 and memmove-ultra1.
	* sysdeps/sparc/sparc64/multiarch/Makefile (sysdeps_routines):
	Likewise.
	* sysdeps/sparc/sparc32/sparcv9/multiarch/memcpy-memmove-niagara7.S:
	New file.
	* sysdeps/sparc/sparc32/sparcv9/multiarch/memmove-ultra1.S: Likewise.
	* sysdeps/sparc/sparc32/sparcv9/multiarch/rtld-memmove.c: Likewise.
	* sysdeps/sparc/sparc64/multiarch/ifunc-impl-list.c
	(__libc_ifunc_impl_list): Add __memcpy_niagara7, __mempcpy_niagara7,
	and __memmove_niagara7.
	* sysdeps/sparc/sparc64/multiarch/ifunc-memcpy.h (IFUNC_SELECTOR):
	Add niagara7 option.
	* sysdeps/sparc/sparc64/multiarch/memmove.c: New file.
	* sysdeps/sparc/sparc64/multiarch/ifunc-memmove.h: Likewise.
	* sysdeps/sparc/sparc64/multiarch/memcpy-memmove-niagara7.S: Likewise.
	* sysdeps/sparc/sparc64/multiarch/memmove-ultra1.S: Likewise.
	* sysdeps/sparc/sparc64/multiarch/rtld-memmove.c: Likewise.
2017-12-14 08:47:38 -02:00
Jose E. Marchesi 767a26d6a0 sparc: assembly version of memmove for ultra1+
Tested in sparcv9-*-* and sparc64-*-* targets in both non-multi-arch and
multi-arch configurations.

	* sysdeps/sparc/sparc32/sparcv9/memmove.S: New file.
	* sysdeps/sparc/sparc32/sparcv9/rtld-memmove.c: Likewise.
	* sysdeps/sparc/sparc64/memmove.S: Likewise.
	* sysdeps/sparc/sparc64/rtld-memmove.c: Likewise.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-12-14 08:47:09 -02:00
Jose E. Marchesi bfb7bf2273 sparc: support the ADP hw capability
This patch adds support for the ADP (also known as adi) hardware
capability, as reported by the kernel sparc port when running on M7
machines.

Tested in both sparcv9-*-* and sparc64-*-* targets.

	* sysdeps/sparc/bits/hwcap.h (HWCAP_SPARC_ADP): Defined.
	* sysdeps/sparc/dl-procinfo.c: Added "adp" to the
	_dl_sparc_cap_flags array.
	* sysdeps/sparc/dl-procinfo.h (_DL_HWCAP_COUNT): Increment.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2017-12-14 08:47:07 -02:00
Siddhesh Poyarekar 2bce01ebba aarch64: Improve strcmp unaligned performance
Replace the simple byte-wise compare in the misaligned case with a
dword compare with page boundary checks in place.  For simplicity I've
chosen a 4K page boundary so that we don't have to query the actual
page size on the system.

This results in up to 3x improvement in performance in the unaligned
case on falkor and about 2.5x improvement on mustang as measured using
bench-strcmp.

	* sysdeps/aarch64/strcmp.S (misaligned8): Compare dword at a
	time whenever possible.
2017-12-13 18:50:27 +05:30
Carlos O'Donell 243b63337c Fix testing with nss-crypt.
A glibc master build with --enable-nss-crypt using the NSS
crypto libraries fails during make check with the following error:

<command-line>:0:0: error: "USE_CRYPT" redefined [-Werror]
<command-line>:0:0: note: this is the location of the previous
definition

This is caused by commit 36975e8e7e
by H.J. Lu which replaces all = with +=. The fix is to undefine
USE_CRYPT before defining it to zero.

Committed as an obvious fix. Fixes the build issue on x86_64 with
no regressions.

Signed-off-by: Carlos O'Donell <carlos@redhat.com>
2017-12-12 18:34:33 -08:00
Joseph Myers 6f7c009282 Add sysdeps/ieee754/soft-fp.
The default sysdeps/ieee754 fma implementations rely on exceptions and
rounding modes to achieve correct results through internal use of
round-to-odd.  Thus, glibc configurations without support for
exceptions and rounding modes instead need to use implementations of
fma based on soft-fp.

At present, this is achieved via having implementation files in
soft-fp/ that are #included by sysdeps files for each glibc
configuration that needs them.  In general this means such a
configuration has its own s_fma.c and s_fmaf.c.

TS 18661-1 adds functions that do an operation (+ - * / sqrt fma) on
arguments wider than the return type, with a single rounding of the
infinite-precision result to that return type.  These are also
naturally implemented using round-to-odd on platforms with hardware
support for rounding modes and exceptions but lacking hardware support
for these narrowing operations themselves.  (Platforms that have
direct hardware support for such narrowing operations include at least
ia64, and Power ISA 2.07 or later, which I think means POWER8 or
later.)

So adding the remaining TS 18661-1 functions would mean at least six
narrowing function implementations (fadd fsub fmul fdiv ffma fsqrt),
with aliases for other types and further implementations in some
configurations, that need to be overridden for configurations lacking
hardware exceptions and rounding modes.  Requiring all such
configurations (currently seven of them) to have their own source
files for all those functions seems undesirable.

Thus, this patch adds a directory sysdeps/ieee754/soft-fp to contain
libm function implementations based on soft-fp.  This directory is
then used via Implies from all the configurations that need it, so no
more files need adding to every such configuration when adding more
functions with soft-fp implementations.  A configuration can still
selectively #include a particular file from this directory if desired;
thus, the MIPS #include of the fmal implementation is retained, since
that's appropriate even for hard float (because long double is always
implementated in software for MIPS64, so the soft-fp implementation of
fmal is better than the ldbl-128 one).

This also provides additional motivation for my recent patch removing
--with-fp / --without-fp: previously there was no need for correct use
of --without-fp for no-FPU ARM or SH3, and now we have autodetection
nofpu/ sysdeps directories can be used by this patch for those
configurations without imposing any new requirements on how glibc is
configured.

(The mips64/*/fpu/s_fma.c files added by this patch are needed to keep
the dbl-64 version of fma for double, rather than the ldbl-128 one,
used in that case.)

Tested with build-many-glibcs.py that installed stripped shared
libraries are unchanged by this patch.

	* soft-fp/fmadf4.c: Move to ....
	* sysdeps/ieee754/soft-fp/s_fma.c: ... here.
	* soft-fp/fmasf4.c: Move to ....
	* sysdeps/ieee754/soft-fp/s_fmaf.c: ... here.
	* soft-fp/fmatf4.c: Move to ....
	* sysdeps/ieee754/soft-fp/s_fmal.c: ... here.
	* sysdeps/ieee754/soft-fp/Makefile: New file.
	* sysdeps/arm/preconfigure.ac: Define with_fp_cond.
	* sysdeps/arm/preconfigure: Regenerated.
	* sysdeps/arm/nofpu/Implies: New file.
	* sysdeps/arm/s_fma.c: Remove file.
	* sysdeps/arm/s_fmaf.c: Likewise.
	* sysdeps/m68k/coldfire/nofpu/Implies: New file.
	* sysdeps/m68k/coldfire/nofpu/s_fma.c: Remove file.
	* sysdeps/m68k/coldfire/nofpu/s_fmaf.c: Likewise.
	* sysdeps/microblaze/Implies: Add ieee754/soft-fp.
	* sysdeps/microblaze/s_fma.c: Remove file.
	* sysdeps/microblaze/s_fmaf.c: Likewise.
	* sysdeps/mips/mips32/nofpu/Implies: New file.
	* sysdeps/mips/mips64/n32/fpu/s_fma.c: Likewise.
	* sysdeps/mips/mips64/n32/nofpu/Implies: Likewise.
	* sysdeps/mips/mips64/n64/fpu/s_fma.c: Likewise.
	* sysdeps/mips/mips64/n64/nofpu/Implies: Likewise.
	* sysdeps/mips/ieee754/s_fma.c: Remove file.
	* sysdeps/mips/ieee754/s_fmaf.c: Likewise.
	* sysdeps/mips/ieee754/s_fmal.c: Update include for move of fmal
	implementation.
	* sysdeps/nios2/Implies: Add ieee754/soft-fp.
	* sysdeps/nios2/s_fma.c: Remove file.
	* sysdeps/nios2/s_fmaf.c: Likewise.
	* sysdeps/sh/nofpu/Implies: New file.
	* sysdeps/sh/s_fma.c: Remove file.
	* sysdeps/sh/s_fmaf.c: Likewise.
	* sysdeps/tile/Implies: Add ieee754/soft-fp.
	* sysdeps/tile/s_fma.c: Remove file.
	* sysdeps/tile/s_fmaf.c: Likewise.
2017-12-12 23:35:21 +00:00
H.J. Lu ac817e083b x86-64: Add cosf with FMA
On Skylake, bench-cosf reports performance improvement:

            Before        After         Improvement
max        135.362       94.552            43%
min        8.532         7.688             11%
mean       17.1446       11.8128           45%

	* sysdeps/x86_64/fpu/multiarch/Makefile (libm-sysdep_routines):
	Add s_cosf-sse2 and s_cosf-fma.
	(CFLAGS-s_cosf-fma.c): New.
	* sysdeps/x86_64/fpu/multiarch/s_cosf-fma.c: New file.
	* sysdeps/x86_64/fpu/multiarch/s_cosf-sse2.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_cosf.c: Likewise.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-12-12 15:32:58 -08:00
Steve Ellcey eb4285768b Use memcpy instead of strncpy in nscd/nscd.h to fix build problem with ToT GCC
* nscd/nscd.h (init_traced_file): Change strncpy to memcpy.
2017-12-12 13:47:32 -08:00
Adhemerval Zanella cc683f7ed4 libio: Free backup area when it not required (BZ#22415)
Some libio operations fail to correctly free the backup area (created
by _IO_{w}default_pbackfail on unget{w}c) resulting in either invalid
buffer free operations or memory leaks.

For instance, on the example provided by BZ#22415 a following
fputc after a fseek to rewind the stream issues an invalid free on
the buffer.  It is because although _IO_file_overflow correctly
(from fputc) correctly calls _IO_free_backup_area, the
_IO_new_file_seekoff (called by fseek) updates the FILE internal
pointers without first free the backup area (resulting in invalid
values in the internal pointers).

The wide version also shows an issue, but instead of accessing invalid
pointers it leaks the backup memory on fseek/fputwc operation.

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

	* libio/Makefile (tests): Add tst-bz22415.
	(tst-bz22415-ENV): New rule.
	(generated): Add tst-bz22415.mtrace and tst-bz22415.check.
	(tests-special): Add tst-bz22415-mem.out.
	($(objpfx)tst-bz22415-mem.out): New rule.
	* libio/fileops.c (_IO_new_file_seekoff): Call _IO_free_backup_area
	in case of a successful seek operation.
	* libio/wfileops.c (_IO_wfile_seekoff): Likewise.
	(_IO_wfile_overflow): Call _IO_free_wbackup_area in case a write
	buffer is required.
	* libio/tst-bz22415.c: New test.
2017-12-12 17:29:54 -02:00
Adhemerval Zanella c80acdc325 Update IA64 libm-test-ulps
Ran on Itanium Processor 9020, GCC 7.2.1.

	* sysdeps/ia64/fpu/libm-test-ulps: Update.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-12-12 16:57:41 -02:00
James Clarke 89bd8016b3 ia64: Add ipc_priv.h header to set __IPC_64 to zero
When running strace, IPC_64 was set in the command, but ia64 is
an architecture where CONFIG_ARCH_WANT_IPC_PARSE_VERSION *isn't* set
in the kernel, so ipc_parse_version just returns IPC_64 without
clearing the IPC_64 bit in the command.

	* sysdeps/unix/sysv/linux/ia64/ipc_priv.h: New file defining
	__IPC_64 to 0 to avoid IPC_64 being set.

Signed-off-by: James Clarke <jrtc27@jrtc27.com>
2017-12-12 12:19:24 -02:00
Szabolcs Nagy 4e0dca54e9 [BZ #22593] Fix nextafter and nexttoward declaration
These functions set errno and thus the const attribute was wrong.

	[BZ #22593]
	* math/bits/mathcalls.h (nextafter): Remove const.
	(nexttoward): Likewise.
2017-12-12 13:59:18 +00:00
Joseph Myers 8df5d34720 Remove --with-fp / --without-fp.
There is a configure option --without-fp that specifies that nofpu
sysdeps directories should be used instead of fpu directories.

For most glibc configurations, this option is of no use: either there
is no valid nofpu variant of that configuration, or there are no fpu
or nofpu sysdeps directories for that processor and so the option does
nothing.  For a few configurations, if you are using a soft-float
compiler this option is required, and failing to use it generally
results in compilation errors from inline asm using unavailable
floating-point instructions.

We're moving away from --with-cpu to configuring glibc based on how
the compiler generates code, and it is natural to do so for
--without-fp as well; in most cases the soft-float and hard-float ABIs
are incompatible so you have no hope of building a working glibc with
an inappropriately configured compiler or libgcc.

This patch eliminates --without-fp, replacing it entirely by automatic
configuration based on the compiler.  Configurations for which this is
relevant (coldfire / mips / powerpc32 / sh) define a variable
with_fp_cond in their preconfigure fragments (under the same
conditions under which those fragments do anything); this is a
preprocessor conditional which the toplevel configure script then uses
in a test to determine which sysdeps directories to use.

The config.make with-fp variable remains.  It's used only by powerpc
(sysdeps/powerpc/powerpc32/Makefile) to add -mhard-float to various
flags variables.  For powerpc, -mcpu= options can imply use of
soft-float.  That could be an issue if you want to build for
e.g. 476fp, but are using --with-cpu=476 because there isn't a 476fp
sysdeps directory.  If in future we eliminate --with-cpu and replace
it entirely by testing the compiler, it would be natural at that point
to eliminate that code as well (as the user should then just use a
compiler defaulting to 476fp and the 476 sysdeps directory would be
used automatically).

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

	* configure.ac (--with-fp): Remove configure option.
	(with_fp_cond): New variable.
	(libc_cv_with_fp): New configure test.  Use this variable instead
	of with_fp.
	* configure: Regenerated.
	* config.make.in (with-fp): Use @libc_cv_with_fp@.
	* manual/install.texi (Configuring and compiling): Remove
	--without-fp.
	* INSTALL: Regenerated.
	* sysdeps/m68k/preconfigure (with_fp_cond): Define for ColdFire.
	* sysdeps/mips/preconfigure (with_fp_cond): Define.
	* sysdeps/powerpc/preconfigure (with_fp_cond): Define for 32-bit.
	* sysdeps/sh/preconfigure (with_fp_cond): Define.
	* scripts/build-many-glibcs.py (Context.add_all_configs): Do not
	use --without-fp to configure glibc.
2017-12-12 13:56:47 +00:00
Rical Jasan 0cee1257a9 manual: Fix a typo in locale.texi.
* manual/locale.texi (nl_langinfo): Fix a typo.
2017-12-12 03:21:53 -08:00
Aurelien Jarno f54ad2f9ea manual/conf.texi: add a missing underscore in front of SC_SSIZE_MAX [BZ #22588]
Changelog:
	* manual/conf.texi (SC_SSIZE_MAX): Rename into _SC_SSIZE_MAX.
2017-12-12 00:11:29 +01:00
H.J. Lu 36975e8e7e Replace = with += in CFLAGS-xxx.c/CPPFLAGS-xxx.c
Replace = with += in CFLAGS-xxx.c and CPPFLAGS-xxx.c to allow Makefile
under sysdeps to define CFLAGS-xx.c and CPPFLAGS-xxx.c.

	* argp/Makefile (CFLAGS-argp-help.c): Replace = with +=.
	(CFLAGS-argp-parse.c): Likewise.
	(CFLAGS-argp-fmtstream.c): Likewise.
	* crypt/Makefile (CPPFLAGS-sha256-crypt.c): Likewise.
	(CPPFLAGS-sha512-crypt.c): Likewise.
	(CPPFLAGS-md5-crypt.c): Likewise.
	* debug/Makefile (CFLAGS-stack_chk_fail.c): Likewise.
	(CFLAGS-stack_chk_fail_local.c): Likewise.
	(CFLAGS-backtrace.c): Likewise.
	(CFLAGS-sprintf_chk.c): Likewise.
	(CFLAGS-snprintf_chk.c): Likewise.
	(CFLAGS-vsprintf_chk.c): Likewise.
	(CFLAGS-vsnprintf_chk.c): Likewise.
	(CFLAGS-asprintf_chk.c): Likewise.
	(CFLAGS-vasprintf_chk.c): Likewise.
	(CFLAGS-obprintf_chk.c): Likewise.
	(CFLAGS-dprintf_chk.c): Likewise.
	(CFLAGS-vdprintf_chk.c): Likewise.
	(CFLAGS-printf_chk.c): Likewise.
	(CFLAGS-fprintf_chk.c): Likewise.
	(CFLAGS-vprintf_chk.c): Likewise.
	(CFLAGS-vfprintf_chk.c): Likewise.
	(CFLAGS-gets_chk.c): Likewise.
	(CFLAGS-fgets_chk.c): Likewise.
	(CFLAGS-fgets_u_chk.c): Likewise.
	(CFLAGS-fread_chk.c): Likewise.
	(CFLAGS-fread_u_chk.c): Likewise.
	(CFLAGS-swprintf_chk.c): Likewise.
	(CFLAGS-vswprintf_chk.c): Likewise.
	(CFLAGS-wprintf_chk.c): Likewise.
	(CFLAGS-fwprintf_chk.c): Likewise.
	(CFLAGS-vwprintf_chk.c): Likewise.
	(CFLAGS-vfwprintf_chk.c): Likewise.
	(CFLAGS-fgetws_chk.c): Likewise.
	(CFLAGS-fgetws_u_chk.c): Likewise.
	(CFLAGS-read_chk.c): Likewise.
	(CFLAGS-pread_chk.c): Likewise.
	(CFLAGS-pread64_chk.c): Likewise.
	(CFLAGS-recv_chk.c): Likewise.
	(CFLAGS-recvfrom_chk.c): Likewise.
	(CFLAGS-tst-longjmp_chk.c): Likewise.
	(CPPFLAGS-tst-longjmp_chk.c): Likewise.
	(CFLAGS-tst-longjmp_chk2.c): Likewise.
	(CPPFLAGS-tst-longjmp_chk2.c): Likewise.
	(CFLAGS-tst-longjmp_chk3.c): Likewise.
	(CPPFLAGS-tst-longjmp_chk3.c): Likewise.
	(CFLAGS-tst-chk1.c): Likewise.
	(CFLAGS-tst-chk2.c): Likewise.
	(CFLAGS-tst-chk3.c): Likewise.
	(CFLAGS-tst-chk4.cc): Likewise.
	(CFLAGS-tst-chk5.cc): Likewise.
	(CFLAGS-tst-chk6.cc): Likewise.
	(CFLAGS-tst-lfschk1.c): Likewise.
	(CFLAGS-tst-lfschk2.c): Likewise.
	(CFLAGS-tst-lfschk3.c): Likewise.
	(CFLAGS-tst-lfschk4.cc): Likewise.
	(CFLAGS-tst-lfschk5.cc): Likewise.
	(CFLAGS-tst-lfschk6.cc): Likewise.
	(CFLAGS-tst-ssp-1.c): Likewise.
	* dirent/Makefile (CFLAGS-scandir.c): Likewise.
	(CFLAGS-scandir64.c): Likewise.
	(CFLAGS-scandir-tail.c): Likewise.
	(CFLAGS-scandir64-tail.c): Likewise.
	* elf/Makefile (CPPFLAGS-dl-tunables.c): Likewise.
	(CFLAGS-dl-tunables.c): Likewise.
	(CFLAGS-dl-runtime.c): Likewise.
	(CFLAGS-dl-lookup.c): Likewise.
	(CFLAGS-dl-iterate-phdr.c): Likewise.
	(CFLAGS-vismain.c): Likewise.
	(CFLAGS-tst-linkall-static.c): Likewise.
	(CFLAGS-tst-linkall-static.c): Likewise.
	(CPPFLAGS-dl-load.c): Likewise.
	(CFLAGS-ldconfig.c): Likewise.
	(CFLAGS-dl-cache.c): Likewise.
	(CFLAGS-cache.c): Likewise.
	(CFLAGS-rtld.c): Likewise.
	(CFLAGS-multiload.c): Likewise.
	(CFLAGS-filtmod1.c): Likewise.
	(CFLAGS-tst-align.c): Likewise.
	(CFLAGS-tst-align2.c): Likewise.
	(CFLAGS-tst-alignmod.c): Likewise.
	(CFLAGS-tst-alignmod2.c): Likewise.
	(CPPFLAGS-tst-execstack.c): Likewise.
	(CFLAGS-tst-ptrguard1-static.c): Likewise.
	(CFLAGS-tst-latepthreadmod.c): Likewise.
	* grp/Makefile (CFLAGS-getgrgid_r.c): Likewise.
	(CFLAGS-getgrnam_r.c): Likewise.
	(CFLAGS-getgrent_r.c): Likewise.
	(CFLAGS-getgrent.c): Likewise.
	(CFLAGS-fgetgrent.c): Likewise.
	(CFLAGS-fgetgrent_r.c): Likewise.
	(CFLAGS-putgrent.c): Likewise.
	(CFLAGS-initgroups.c): Likewise.
	(CFLAGS-getgrgid.c): Likewise.
	* gshadow/Makefile (CFLAGS-getsgent_r.c): Likewise.
	(CFLAGS-getsgent.c): Likewise.
	(CFLAGS-fgetsgent.c): Likewise.
	(CFLAGS-fgetsgent_r.c): Likewise.
	(CFLAGS-putsgent.c): Likewise.
	(CFLAGS-getsgnam.c): Likewise.
	(CFLAGS-getsgnam_r.c): Likewise.
	* iconv/Makefile (CFLAGS-iconv_prog.c): Likewise.
	(CFLAGS-iconv_charmap.c): Likewise.
	(CFLAGS-dummy-repertoire.c): Likewise.
	(CFLAGS-charmap.c): Likewise.
	(CFLAGS-linereader.c): Likewise.
	(CFLAGS-simple-hash.c): Likewise.
	(CFLAGS-gconv_conf.c): Likewise.
	(CFLAGS-iconvconfig.c): Likewise.
	* inet/Makefile (CFLAGS-gethstbyad_r.c): Likewise.
	(CFLAGS-gethstbyad.c): Likewise.
	(CFLAGS-gethstbynm_r.c): Likewise.
	(CFLAGS-gethstbynm.c): Likewise.
	(CFLAGS-gethstbynm2_r.c): Likewise.
	(CFLAGS-gethstbynm2.c): Likewise.
	(CFLAGS-gethstent_r.c): Likewise.
	(CFLAGS-gethstent.c): Likewise.
	(CFLAGS-rcmd.c): Likewise.
	(CFLAGS-getnetbynm_r.c): Likewise.
	(CFLAGS-getnetbynm.c): Likewise.
	(CFLAGS-getnetbyad_r.c): Likewise.
	(CFLAGS-getnetbyad.c): Likewise.
	(CFLAGS-getnetent_r.c): Likewise.
	(CFLAGS-getnetent.c): Likewise.
	(CFLAGS-getaliasent_r.c): Likewise.
	(CFLAGS-getaliasent.c): Likewise.
	(CFLAGS-getrpcent_r.c): Likewise.
	(CFLAGS-getrpcent.c): Likewise.
	(CFLAGS-getservent_r.c): Likewise.
	(CFLAGS-getservent.c): Likewise.
	(CFLAGS-getprtent_r.c): Likewise.
	(CFLAGS-getprtent.c): Likewise.
	(CFLAGS-either_ntoh.c): Likewise.
	(CFLAGS-either_hton.c): Likewise.
	(CFLAGS-getnetgrent.c): Likewise.
	(CFLAGS-getnetgrent_r.c): Likewise.
	(CFLAGS-tst-checks-posix.c): Likewise.
	(CFLAGS-tst-sockaddr.c): Likewise.
	* intl/Makefile (CFLAGS-tst-gettext.c): Likewise.
	(CFLAGS-tst-translit.c): Likewise.
	(CFLAGS-tst-gettext2.c): Likewise.
	(CFLAGS-tst-codeset.c): Likewise.
	(CFLAGS-tst-gettext3.c): Likewise.
	(CFLAGS-tst-gettext4.c): Likewise.
	(CFLAGS-tst-gettext5.c): Likewise.
	(CFLAGS-tst-gettext6.c): Likewise.
	* io/Makefile (CFLAGS-open.c): Likewise.
	(CFLAGS-open64.c): Likewise.
	(CFLAGS-creat.c): Likewise.
	(CFLAGS-creat64.c): Likewise.
	(CFLAGS-fcntl.c): Likewise.
	(CFLAGS-poll.c): Likewise.
	(CFLAGS-ppoll.c): Likewise.
	(CFLAGS-lockf.c): Likewise.
	(CFLAGS-statfs.c): Likewise.
	(CFLAGS-fstatfs.c): Likewise.
	(CFLAGS-statvfs.c): Likewise.
	(CFLAGS-fstatvfs.c): Likewise.
	(CFLAGS-fts.c): Likewise.
	(CFLAGS-fts64.c): Likewise.
	(CFLAGS-ftw.c): Likewise.
	(CFLAGS-ftw64.c): Likewise.
	(CFLAGS-lockf.c): Likewise.
	(CFLAGS-posix_fallocate.c): Likewise.
	(CFLAGS-posix_fallocate64.c): Likewise.
	(CFLAGS-fallocate.c): Likewise.
	(CFLAGS-fallocate64.c): Likewise.
	(CFLAGS-read.c): Likewise.
	(CFLAGS-write.c): Likewise.
	(CFLAGS-test-stat.c): Likewise.
	(CFLAGS-test-lfs.c): Likewise.
	* libio/Makefile (CFLAGS-fileops.c): Likewise.
	(CFLAGS-fputc.c): Likewise.
	(CFLAGS-fputwc.c): Likewise.
	(CFLAGS-freopen64.c): Likewise.
	(CFLAGS-freopen.c): Likewise.
	(CFLAGS-fseek.c): Likewise.
	(CFLAGS-fseeko64.c): Likewise.
	(CFLAGS-fseeko.c): Likewise.
	(CFLAGS-ftello64.c): Likewise.
	(CFLAGS-ftello.c): Likewise.
	(CFLAGS-fwide.c): Likewise.
	(CFLAGS-genops.c): Likewise.
	(CFLAGS-getc.c): Likewise.
	(CFLAGS-getchar.c): Likewise.
	(CFLAGS-getwc.c): Likewise.
	(CFLAGS-getwchar.c): Likewise.
	(CFLAGS-iofclose.c): Likewise.
	(CFLAGS-iofflush.c): Likewise.
	(CFLAGS-iofgetpos64.c): Likewise.
	(CFLAGS-iofgetpos.c): Likewise.
	(CFLAGS-iofgets.c): Likewise.
	(CFLAGS-iofgetws.c): Likewise.
	(CFLAGS-iofputs.c): Likewise.
	(CFLAGS-iofputws.c): Likewise.
	(CFLAGS-iofread.c): Likewise.
	(CFLAGS-iofsetpos64.c): Likewise.
	(CFLAGS-iofsetpos.c): Likewise.
	(CFLAGS-ioftell.c): Likewise.
	(CFLAGS-iofwrite.c): Likewise.
	(CFLAGS-iogetdelim.c): Likewise.
	(CFLAGS-iogetline.c): Likewise.
	(CFLAGS-iogets.c): Likewise.
	(CFLAGS-iogetwline.c): Likewise.
	(CFLAGS-ioputs.c): Likewise.
	(CFLAGS-ioseekoff.c): Likewise.
	(CFLAGS-ioseekpos.c): Likewise.
	(CFLAGS-iosetbuffer.c): Likewise.
	(CFLAGS-iosetvbuf.c): Likewise.
	(CFLAGS-ioungetc.c): Likewise.
	(CFLAGS-ioungetwc.c): Likewise.
	(CFLAGS-oldfileops.c): Likewise.
	(CFLAGS-oldiofclose.c): Likewise.
	(CFLAGS-oldiofgetpos64.c): Likewise.
	(CFLAGS-oldiofgetpos.c): Likewise.
	(CFLAGS-oldiofsetpos64.c): Likewise.
	(CFLAGS-oldiofsetpos.c): Likewise.
	(CFLAGS-peekc.c): Likewise.
	(CFLAGS-putc.c): Likewise.
	(CFLAGS-putchar.c): Likewise.
	(CFLAGS-putwc.c): Likewise.
	(CFLAGS-putwchar.c): Likewise.
	(CFLAGS-rewind.c): Likewise.
	(CFLAGS-wfileops.c): Likewise.
	(CFLAGS-wgenops.c): Likewise.
	(CFLAGS-oldiofopen.c): Likewise.
	(CFLAGS-iofopen.c): Likewise.
	(CFLAGS-iofopen64.c): Likewise.
	(CFLAGS-oldtmpfile.c): Likewise.
	(CFLAGS-tst_putwc.c): Likewise.
	* locale/Makefile (CFLAGS-md5.c): Likewise.
	(CFLAGS-charmap.c): Likewise.
	(CFLAGS-locfile.c): Likewise.
	(CFLAGS-charmap-dir.c): Likewise.
	* login/Makefile (CFLAGS-grantpt.c): Likewise.
	(CFLAGS-getpt.c): Likewise.
	(CFLAGS-pt_chown.c): Likewise.
	* malloc/Makefile (CFLAGS-mcheck-init.c): Likewise.
	(CFLAGS-obstack.c): Likewise.
	* math/Makefile (CFLAGS-test-tgmath3.c): Likewise.
	(CFLAGS-test-double-vlen4-wrappers.c): Likewise.
	(CFLAGS-test-double-vlen8-wrappers.c): Likewise.
	(CFLAGS-test-float-vlen8-wrappers.c): Likewise.
	(CFLAGS-test-float-vlen16-wrappers.c): Likewise.
	(CFLAGS-test-tgmath.c): Likewise.
	(CFLAGS-test-tgmath2.c): Likewise.
	(CFLAGS-test-tgmath-ret.c): Likewise.
	(CFLAGS-test-powl.c): Likewise.
	(CFLAGS-test-snan.c): Likewise.
	(CFLAGS-test-signgam-finite.c): Likewise.
	(CFLAGS-test-signgam-finite-c99.c): Likewise.
	(CFLAGS-test-signgam-finite-c11.c): Likewise.
	(CFLAGS-test-signgam-uchar.c): Likewise.
	(CFLAGS-test-signgam-uchar-init.c): Likewise.
	(CFLAGS-test-signgam-uchar-static.c): Likewise.
	(CFLAGS-test-signgam-uchar-init-static.c): Likewise.
	(CFLAGS-test-signgam-uint.c): Likewise.
	(CFLAGS-test-signgam-uint-init.c): Likewise.
	(CFLAGS-test-signgam-uint-static.c): Likewise.
	(CFLAGS-test-signgam-uint-init-static.c): Likewise.
	(CFLAGS-test-signgam-ullong.c): Likewise.
	(CFLAGS-test-signgam-ullong-init.c): Likewise.
	(CFLAGS-test-signgam-ullong-static.c): Likewise.
	(CFLAGS-test-signgam-ullong-init-static.c): Likewise.
	(CFLAGS-test-math-cxx11.cc): Likewise.
	(CFLAGS-test-math-isinff.cc): Likewise.
	(CFLAGS-test-math-iszero.cc): Likewise.
	(CFLAGS-test-math-issignaling.cc): Likewise.
	(CFLAGS-test-math-iscanonical.cc): Likewise.
	(CFLAGS-test-iszero-excess-precision.c): Likewise.
	(CFLAGS-test-iseqsig-excess-precision.c): Likewise.
	(CFLAGS-test-flt-eval-method.c): Likewise.
	(CFLAGS-test-fe-snans-always-signal.c): Likewise.
	(CFLAGS-test-finite-macros.c): Likewise.
	* misc/Makefile (CFLAGS-select.c): Likewise.
	(CFLAGS-tsearch.c): Likewise.
	(CFLAGS-lsearch.c): Likewise.
	(CFLAGS-pselect.c): Likewise.
	(CFLAGS-readv.c): Likewise.
	(CFLAGS-writev.c): Likewise.
	(CFLAGS-preadv.c): Likewise.
	(CFLAGS-preadv64.c): Likewise.
	(CFLAGS-pwritev.c): Likewise.
	(CFLAGS-pwritev64.c): Likewise.
	(CFLAGS-preadv2.c): Likewise.
	(CFLAGS-preadv64v2.c): Likewise.
	(CFLAGS-pwritev2.c): Likewise.
	(CFLAGS-pwritev64v2.c): Likewise.
	(CFLAGS-usleep.c): Likewise.
	(CFLAGS-syslog.c): Likewise.
	(CFLAGS-error.c): Likewise.
	(CFLAGS-getpass.c): Likewise.
	(CFLAGS-mkstemp.c): Likewise.
	(CFLAGS-mkstemp64.c): Likewise.
	(CFLAGS-getsysstats.c): Likewise.
	(CFLAGS-getusershell.c): Likewise.
	(CFLAGS-err.c): Likewise.
	(CFLAGS-tst-tsearch.c): Likewise.
	(CFLAGS-msync.c): Likewise.
	(CFLAGS-fdatasync.c): Likewise.
	(CFLAGS-fsync.c): Likewise.
	* nptl/Makefile (CFLAGS-nptl-init.c): Likewise.
	(CFLAGS-unwind.c): Likewise.
	(CFLAGS-unwind-forcedunwind.c): Likewise.
	(CFLAGS-pthread_cancel.c): Likewise.
	(CFLAGS-pthread_setcancelstate.c): Likewise.
	(CFLAGS-pthread_setcanceltype.c): Likewise.
	(CFLAGS-cancellation.c): Likewise.
	(CFLAGS-libc-cancellation.c): Likewise.
	(CFLAGS-pthread_exit.c): Likewise.
	(CFLAGS-forward.c): Likewise.
	(CFLAGS-pthread_testcancel.c): Likewise.
	(CFLAGS-pthread_join.c): Likewise.
	(CFLAGS-pthread_timedjoin.c): Likewise.
	(CFLAGS-pthread_once.c): Likewise.
	(CFLAGS-pthread_cond_wait.c): Likewise.
	(CFLAGS-sem_wait.c): Likewise.
	(CFLAGS-sem_timedwait.c): Likewise.
	(CFLAGS-fcntl.c): Likewise.
	(CFLAGS-lockf.c): Likewise.
	(CFLAGS-pread.c): Likewise.
	(CFLAGS-pread64.c): Likewise.
	(CFLAGS-pwrite.c): Likewise.
	(CFLAGS-pwrite64.c): Likewise.
	(CFLAGS-wait.c): Likewise.
	(CFLAGS-waitpid.c): Likewise.
	(CFLAGS-sigwait.c): Likewise.
	(CFLAGS-msgrcv.c): Likewise.
	(CFLAGS-msgsnd.c): Likewise.
	(CFLAGS-tcdrain.c): Likewise.
	(CFLAGS-open.c): Likewise.
	(CFLAGS-open64.c): Likewise.
	(CFLAGS-pause.c): Likewise.
	(CFLAGS-recv.c): Likewise.
	(CFLAGS-send.c): Likewise.
	(CFLAGS-accept.c): Likewise.
	(CFLAGS-sendto.c): Likewise.
	(CFLAGS-connect.c): Likewise.
	(CFLAGS-recvfrom.c): Likewise.
	(CFLAGS-recvmsg.c): Likewise.
	(CFLAGS-sendmsg.c): Likewise.
	(CFLAGS-close.c): Likewise.
	(CFLAGS-read.c): Likewise.
	(CFLAGS-write.c): Likewise.
	(CFLAGS-nanosleep.c): Likewise.
	(CFLAGS-sigsuspend.c): Likewise.
	(CFLAGS-msync.c): Likewise.
	(CFLAGS-fdatasync.c): Likewise.
	(CFLAGS-fsync.c): Likewise.
	(CFLAGS-pt-system.c): Likewise.
	(CFLAGS-tst-cleanup2.c): Likewise.
	(CFLAGS-tst-cleanupx2.c): Likewise.
	(CFLAGS-flockfile.c): Likewise.
	(CFLAGS-ftrylockfile.c): Likewise.
	(CFLAGS-funlockfile.c): Likewise.
	(CFLAGS-tst-initializers1.c): Likewise.
	(CFLAGS-tst-initializers1-c89.c): Likewise.
	(CFLAGS-tst-initializers1-c99.c): Likewise.
	(CFLAGS-tst-initializers1-c11.c): Likewise.
	(CFLAGS-tst-initializers1-gnu89.c): Likewise.
	(CFLAGS-tst-initializers1-gnu99.c): Likewise.
	(CFLAGS-tst-initializers1-gnu11.c): Likewise.
	* nscd/Makefile (CFLAGS-nscd_getpw_r.c): Likewise.
	(CFLAGS-nscd_getgr_r.c): Likewise.
	(CFLAGS-nscd_gethst_r.c): Likewise.
	(CFLAGS-nscd_getai.c): Likewise.
	(CFLAGS-nscd_initgroups.c): Likewise.
	* posix/Makefile (CFLAGS-getaddrinfo.c): Likewise.
	(CFLAGS-pause.c): Likewise.
	(CFLAGS-pread.c): Likewise.
	(CFLAGS-pread64.c): Likewise.
	(CFLAGS-pwrite.c): Likewise.
	(CFLAGS-pwrite64.c): Likewise.
	(CFLAGS-sleep.c): Likewise.
	(CFLAGS-wait.c): Likewise.
	(CFLAGS-waitid.c): Likewise.
	(CFLAGS-waitpid.c): Likewise.
	(CFLAGS-getopt.c): Likewise.
	(CFLAGS-wordexp.c): Likewise.
	(CFLAGS-sysconf.c): Likewise.
	(CFLAGS-pathconf.c): Likewise.
	(CFLAGS-fpathconf.c): Likewise.
	(CFLAGS-spawn.c): Likewise.
	(CFLAGS-spawnp.c): Likewise.
	(CFLAGS-spawni.c): Likewise.
	(CFLAGS-glob.c): Likewise.
	(CFLAGS-glob64.c): Likewise.
	(CFLAGS-getconf.c): Likewise.
	(CFLAGS-nanosleep.c): Likewise.
	* pwd/Makefile (CFLAGS-getpwent_r.c): Likewise.
	(CFLAGS-getpwent.c): Likewise.
	(CFLAGS-getpw.c): Likewise.
	(CFLAGS-fgetpwent_r.c): Likewise.
	* resolv/Makefile (CFLAGS-res_hconf.c): Likewise.
	* rt/Makefile (CFLAGS-aio_suspend.c): Likewise.
	(CFLAGS-mq_timedreceive.c): Likewise.
	(CFLAGS-mq_timedsend.c): Likewise.
	(CFLAGS-clock_nanosleep.c): Likewise.
	(CFLAGS-librt-cancellation.c): Likewise.
	* shadow/Makefile (CFLAGS-getspent_r.c): Likewise.
	(CFLAGS-getspent.c): Likewise.
	(CFLAGS-fgetspent.c): Likewise.
	(CFLAGS-fgetspent_r.c): Likewise.
	(CFLAGS-putspent.c): Likewise.
	(CFLAGS-getspnam.c): Likewise.
	(CFLAGS-getspnam_r.c): Likewise.
	* signal/Makefile (CFLAGS-sigpause.c): Likewise.
	(CFLAGS-sigsuspend.c): Likewise.
	(CFLAGS-sigtimedwait.c): Likewise.
	(CFLAGS-sigwait.c): Likewise.
	(CFLAGS-sigwaitinfo.c): Likewise.
	(CFLAGS-sigreturn.c): Likewise.
	* stdio-common/Makefile (CFLAGS-vfprintf.c): Likewise.
	(CFLAGS-vfwprintf.c): Likewise.
	(CFLAGS-tmpfile.c): Likewise.
	(CFLAGS-tmpfile64.c): Likewise.
	(CFLAGS-tempname.c): Likewise.
	(CFLAGS-psignal.c): Likewise.
	(CFLAGS-vprintf.c): Likewise.
	(CFLAGS-cuserid.c): Likewise.
	(CFLAGS-errlist.c): Likewise.
	(CFLAGS-siglist.c): Likewise.
	(CFLAGS-scanf15.c): Likewise.
	(CFLAGS-scanf17.c): Likewise.
	* stdlib/Makefile (CFLAGS-bsearch.c): Likewise.
	(CFLAGS-msort.c): Likewise.
	(CFLAGS-qsort.c): Likewise.
	(CFLAGS-system.c): Likewise.
	(CFLAGS-fmtmsg.c): Likewise.
	(CFLAGS-strfmon.c): Likewise.
	(CFLAGS-strfmon_l.c): Likewise.
	(CFLAGS-strfromd.c): Likewise.
	(CFLAGS-strfromf.c): Likewise.
	(CFLAGS-strfroml.c): Likewise.
	(CFLAGS-tst-bsearch.c): Likewise.
	(CFLAGS-tst-qsort.c): Likewise.
	(CFLAGS-tst-makecontext2.c): Likewise.
	* sunrpc/Makefile (CFLAGS-xbootparam_prot.c): Likewise.
	(CFLAGS-xnlm_prot.c): Likewise.
	(CFLAGS-xrstat.c): Likewise.
	(CFLAGS-xyppasswd.c): Likewise.
	(CFLAGS-xklm_prot.c): Likewise.
	(CFLAGS-xrex.c): Likewise.
	(CFLAGS-xsm_inter.c): Likewise.
	(CFLAGS-xmount.c): Likewise.
	(CFLAGS-xrusers.c): Likewise.
	(CFLAGS-xspray.c): Likewise.
	(CFLAGS-xnfs_prot.c): Likewise.
	(CFLAGS-xrquota.c): Likewise.
	(CFLAGS-xkey_prot.c): Likewise.
	(CFLAGS-auth_unix.c): Likewise.
	(CFLAGS-key_call.c): Likewise.
	(CFLAGS-pmap_rmt.c): Likewise.
	(CFLAGS-clnt_perr.c): Likewise.
	(CFLAGS-openchild.c): Likewise.
	* sysvipc/Makefile (CFLAGS-msgrcv.c): Likewise.
	(CFLAGS-msgsnd.c): Likewise.
	* termios/Makefile (CFLAGS-tcdrain.c): Likewise.
	* time/Makefile (CFLAGS-tzfile.c): Likewise.
	(CFLAGS-tzset.c): Likewise.
	(CFLAGS-getdate.c): Likewise.
	(CFLAGS-test_time.c): Likewise.
	(CPPFLAGS-tst-tzname.c): Likewise.
	* timezone/Makefile (CFLAGS-zdump.c): Likewise.
	(CFLAGS-zic.c): Likewise.
	* wcsmbs/Makefile (CFLAGS-wcwidth.c): Likewise.
	(CFLAGS-wcswidth.c): Likewise.
	(CFLAGS-wcstol.c): Likewise.
	(CFLAGS-wcstoul.c): Likewise.
	(CFLAGS-wcstoll.c): Likewise.
	(CFLAGS-wcstoull.c): Likewise.
	(CFLAGS-wcstod.c): Likewise.
	(CFLAGS-wcstold.c): Likewise.
	(CFLAGS-wcstof128.c): Likewise.
	(CFLAGS-wcstof.c): Likewise.
	(CFLAGS-wcstol_l.c): Likewise.
	(CFLAGS-wcstoul_l.c): Likewise.
	(CFLAGS-wcstoll_l.c): Likewise.
	(CFLAGS-wcstoull_l.c): Likewise.
	(CFLAGS-wcstod_l.c): Likewise.
	(CFLAGS-wcstold_l.c): Likewise.
	(CFLAGS-wcstof128_l.c): Likewise.
	(CFLAGS-wcstof_l.c): Likewise.
	(CPPFLAGS-tst-wchar-h.c): Likewise.
	(CPPFLAGS-wcstold_l.c): Likewise.

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
2017-12-11 13:11:33 -08:00
Paul Clarke f4b2aea6e1 New generic cosf
The same logic used in s_cosf.S version for x86 and powerpc
is used to create a generic s_cosf.c, so there is no performance
improvement in x86_64 and powerpc64.

	* sysdeps/ieee754/flt-32/s_cosf.c: New implementation.
2017-12-11 17:39:42 -02:00
Adhemerval Zanella c9cd7b0ce5 powerpc: POWER8 memcpy optimization for cached memory
On POWER8, unaligned memory accesses to cached memory has little impact
on performance as opposed to its ancestors.

It is disabled by default and will only be available when the tunable
glibc.tune.cached_memopt is set to 1.

                 __memcpy_power8_cached      __memcpy_power7
============================================================
    max-size=4096:     33325.70 ( 12.65%)        38153.00
    max-size=8192:     32878.20 ( 11.17%)        37012.30
   max-size=16384:     33782.20 ( 11.61%)        38219.20
   max-size=32768:     33296.20 ( 11.30%)        37538.30
   max-size=65536:     33765.60 ( 10.53%)        37738.40

	* manual/tunables.texi (Hardware Capability Tunables): Document
	glibc.tune.cached_memopt.
	* sysdeps/powerpc/cpu-features.c: New file.
	* sysdeps/powerpc/cpu-features.h: New file.
	* sysdeps/powerpc/dl-procinfo.c [!IS_IN(ldconfig)]: Add
	_dl_powerpc_cpu_features.
	* sysdeps/powerpc/dl-tunables.list: New file.
	* sysdeps/powerpc/ldsodefs.h: Include cpu-features.h.
	* sysdeps/powerpc/powerpc32/power4/multiarch/init-arch.h
	(INIT_ARCH): Initialize use_aligned_memopt.
	* sysdeps/powerpc/powerpc64/dl-machine.h [defined(SHARED &&
	IS_IN(rtld))]: Restrict dl_platform_init availability and
	initialize CPU features used by tunables.
	* sysdeps/powerpc/powerpc64/multiarch/Makefile (sysdep_routines):
	Add memcpy-power8-cached.
	* sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c: Add
	__memcpy_power8_cached.
	* sysdeps/powerpc/powerpc64/multiarch/memcpy.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/memcpy-power8-cached.S:
	New file.

Reviewed-by: Rajalakshmi Srinivasaraghavan  <raji@linux.vnet.ibm.com>
2017-12-11 17:39:42 -02:00
H.J. Lu e70c6fee46 string: Replace = with += in CFLAGS-xxx.c
Replace = with += in CFLAGS-xxx.c to allow Makefile under sysdeps to
define CFLAGS-xx.c.

	* string/Makefile (CFLAGS-inl-tester.c): Replace = with +=.
	(CFLAGS-noinl-tester.c): Likewise.
	(CFLAGS-tst-strlen.c): Likewise.
	(CFLAGS-stratcliff.c): Likewise.
	(CFLAGS-test-ffs.c): Likewise.
	(CFLAGS-tst-inlcall.c): Likewise.
	(CFLAGS-tst-xbzero-opt.c): Likewise.
	(CFLAGS-memcpy.c): Likewise.
	(CFLAGS-wordcopy.c): Likewise.
2017-12-11 08:39:24 -08:00
Stefan Liebler dee943668f S390: Add CFI rule in _dl_runtime_resolve[_vx] for unwinding.
In _dl_runtime_resolve[_vx], unwinding fails after the new stack frame
is created as there is no CFI rule for r15. This is also observeable in
GDB: Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Therefore this patch is now storing r15 on stack and is using cfi_offset rule.
The stmg/lmg instruction is used to store/load r14 and r15 with one instruction.
On 64bit, the offsets of the fprs have moved to store r15 directly after r14.
On 31bit, the r14/r15 is now stored between the other gprs and fprs as the space
wasn't used.

ChangeLog:

	* sysdeps/s390/s390-64/dl-trampoline.h (_dl_runtime_resolve):
	Store r15 on stack and add cfi rule.
	* sysdeps/s390/s390-32/dl-trampoline.h (_dl_runtime_resolve):
	Likewise.
2017-12-11 08:47:51 +01:00
Aurelien Jarno f648728cb1 elf/rtld.c (init_tls): Add missing new line to the _dl_fatal_printf call [BZ #22577]
Changelog:
	* elf/rtld.c (init_tls): Add missing new line to the _dl_fatal_printf
	call.
2017-12-10 19:10:28 +01:00
H.J. Lu 9d0ffa60ad x86-64: Add sinf with FMA
On Skylake, bench-sinf reports performance improvement:

            Before        After         Improvement
max        153.996       100.094           54%
min        8.546         6.852             25%
mean       18.1223       11.802            54%

	* sysdeps/x86_64/fpu/multiarch/Makefile (libm-sysdep_routines):
	Add s_sinf-sse2 and s_sinf-fma.
	(CFLAGS-s_sinf-fma.c): New.
	* sysdeps/x86_64/fpu/multiarch/s_sinf-fma.c: New file.
	* sysdeps/x86_64/fpu/multiarch/s_sinf-sse2.c: Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_sinf.c: Likewise.
2017-12-07 10:11:16 -08:00
H.J. Lu 9574c7b68d x86-64: Remove sysdeps/x86_64/fpu/s_sinf.S
On Ivy Bridge, bench-sinf reports performance improvement:

          s_sinf.S      s_sinf.c       Improvement
max        91.521        86.148            6%
min        14.061        11.265            25%
mean       23.3758       23.3344           0.2%

	* sysdeps/x86_64/fpu/s_sinf.S: Removed.
2017-12-07 09:44:17 -08:00
Joseph Myers d15e83c5f5 Fix ctanh (0 + i NaN), ctanh (0 + i Inf) (bug 22568, DR#471).
As per C11 DR#471, ctanh (0 + i NaN) and ctanh (0 + i Inf) should
return 0 + i NaN (with "invalid" exception in the second case but not
the first), not NaN + i NaN.  This has corresponding implications for
ctan since its special cases are defined by ctan (z) = -i ctanh (iz).
This patch implements these cases for ctanh and ctan, updating
tests accordingly.

Tested for x86_64.

	[BZ #22568]
	* math/s_ctan_template.c (M_DECL_FUNC (__ctan)): Set imaginary
	part of result to imaginary part of argument if it is zero and the
	real part of the argument is not finite.
	* math/s_ctanh_template.c (M_DECL_FUNC (__ctanh)): Set real part
	of result to real part of argument if it is zero and the imaginary
	part of the argument is not finite.
2017-12-07 16:21:00 +00:00
Mike FABIAN d89756ebe1 lt_LT locale: Base collation on copy "iso14651_t1" [BZ #22524]
[BZ #22524]
	* localedata/Makefile: Add lt_LT.UTF-8 to test-input
	and to the list of locales to be built for testing.
	* localedata/lt_LT.UTF-8.in: New file for testing the collation.
	* localedata/locales/lt_LT (LC_COLLATE): Use “copy "iso14651_t1"”
	and build the collation rules upon that.
2017-12-07 15:38:11 +01:00
Joseph Myers 1f9055ce04 Add _Float32 function aliases.
This patch concludes filling out TS 18661-3 support for different
types by adding *f32 function aliases of float functions to support
_Float32.  As with _Float64 and _Float32x, this is supported for all
glibc configurations.  As with the previous such patches there are
some x86 ulps updates because of inline functions present for float
but not for _Float32.  The patch also has the usual
bits/floatn-common.h update, symbol versions, ABI baselines updates,
test enablement and documentation.

Tested for x86_64 and x86, and with build-many-glibcs.py, with both
GCC 6 and GCC 7.

	* bits/floatn-common.h (__HAVE_FLOAT32): Define to 1.
	* manual/math.texi (Mathematics): Document support for _Float32.
	* math/Makefile (test-types): Add float32.
	* math/Versions (GLIBC_2.27): Add _Float32 functions.
	* stdlib/Versions (GLIBC_2.27): Likewise.
	* wcsmbs/Versions (GLIBC_2.27): Likewise.
	* sysdeps/unix/sysv/linux/aarch64/libc.abilist: Update.
	* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/alpha/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/arm/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/hppa/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/i386/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/ia64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/nios2/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist:
	Likewise.

	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.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/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sh/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
	* sysdeps/i386/fpu/libm-test-ulps: Likewise.
	* sysdeps/i386/i686/fpu/multiarch/libm-test-ulps: Likewise.
2017-12-07 00:48:31 +00:00
Joseph Myers fb1ca2aa3e Support defining strtof32, wcstof32 aliases.
This patch adds support for defining strtof32, wcstof32, strtof32_l
and wcstof32_l functions as aliases of the corresponding float
functions when _Float32 support is enabled.

Tested for x86_64; also tested with build-many-glibcs.py in
conjunction with other _Float32 changes.

	* stdlib/strtof.c: Include <bits/floatn.h>
	[__HAVE_FLOAT32 && !__HAVE_DISTINCT_FLOAT32] (strtof32): Define
	and later undefine as macro.  Define as weak alias if
	[!USE_WIDE_CHAR].
	[__HAVE_FLOAT32 && !__HAVE_DISTINCT_FLOAT32] (wcstof32): Define
	and later undefine as macro.  Define as weak alias if
	[USE_WIDE_CHAR].
	* stdlib/strtof_l.c: Include <bits/floatn.h>
	[__HAVE_FLOAT32 && !__HAVE_DISTINCT_FLOAT32] (strtof32_l): Define
	and later undefine as macro.  Define as weak alias if
	[!USE_WIDE_CHAR].
	[__HAVE_FLOAT32 && !__HAVE_DISTINCT_FLOAT32] (wcstof32_l): Define
	and later undefine as macro.  Define as weak alias if
	[USE_WIDE_CHAR].
2017-12-06 23:06:12 +00:00
Joseph Myers fc10cc3f32 Support defining strfromf32 alias.
This patch adds support for defining strfromf32 as an alias of
strfromf when _Float32 support is enabled.

Tested for x86_64; also tested with build-many-glibcs.py in
conjunction with other _Float32 changes.

	* stdlib/strfromf.c: Include <bits/floatn.h>.
	[__HAVE_FLOAT32 && !__HAVE_DISTINCT_FLOAT32] (strfromf32): Define
	and later undefine as macro and define as weak alias.
2017-12-06 22:44:56 +00:00
Joseph Myers e420d22826 Add header for _Float32 testing.
This patch adds the header required for testing _Float32 function
aliases, using float ulps.  The corresponding makefile support will be
included in the main patch that enables those aliases.

In conjunction with other _Float32 changes, tested for x86_64 and with
build-many-glibcs.py.

	* math/test-float32.h: New file.
2017-12-06 22:17:11 +00:00
Joseph Myers 26007a2f68 Support _Float32 in libm_alias_float.
This patch makes the libm_alias_float macro support creating _Float32
aliases, in preparation for enabling glibc support for that type.

Tested for x86_64; also tested with build-many-glibcs.py in
conjunction with other _Float32 changes.

	* sysdeps/generic/libm-alias-float.h: Include <bits/floatn.h>.
	[__HAVE_FLOAT32 && !__HAVE_DISTINCT_FLOAT32]
	(libm_alias_float_other_r): Create f32 alias.
	(libm_alias_float_r): Use semicolon before call to
	libm_alias_float_other_r.
2017-12-06 22:14:09 +00:00
Joseph Myers c191f64cd5 Correct some ia64 libm_alias_float_other calls.
This patch corrects three ia64 libm_alias_float_other calls so they
generate the intended _Float32 aliases when such aliases are enabled.

Tested with build-many-glibcs.py for ia64-linux-gnu (that installed
stripped shared libraries are unchanged when applied to current
sources, and that this enables compilation tests to pass when used in
conjunction with other _Float32 patches).

	* sysdeps/ia64/fpu/e_exp2f.S (__exp2f): Use exp2 not __exp2 as
	second argument to libm_alias_float_other.
	* sysdeps/ia64/fpu/e_log2f.S (__log2f): Use log2 not __log2 as
	second argument to libm_alias_float_other.
	* sysdeps/ia64/fpu/e_powf.S (__powf): Use pow not __pow as second
	argument to libm_alias_float_other.
2017-12-06 21:50:32 +00:00
Joseph Myers 5244527da1 Make cacosh (0 + iNaN) return NaN + i pi/2 (bug 22561, DR#471).
As per C11 DR#471 (adjusted resolution accepted for C17), cacosh (0 +
iNaN) should return NaN +/- i pi/2, not NaN + iNaN.

This patch fixes the code accordingly.  The test has hardcoded the
result with positive sign of the imaginary part (with an associated
comment), since the unspecified sign for a result other than 0 or
infinity isn't currently supported by the test infrastructure.

Tested for x86_64.

	[BZ #22561]
	* math/s_cacosh_template.c (M_DECL_FUNC (__cacosh)): Use pi/2 for
	real part of result for argument 0 + i * NaN.
	* math/libm-test-cacosh.inc (cacosh_test_data): Update expected
	results for tests of 0 + i * NaN.
2017-12-06 21:35:20 +00:00
Adhemerval Zanella d73fac82be Update Alpha libm-test-ulps
* sysdeps/alpha/fpu/libm-test-ulps: Update.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-12-06 18:55:09 -02:00
David S. Miller 7ec094e801 Sparc ulp update.
* sysdeps/sparc/fpu/libm-test-ulps: Update
	exp_{downward,towardzero,upward} ulps.
2017-12-06 12:18:51 -08:00
Joseph Myers 1dbe6f64ab Don't make local variables static in ldbl-96 j1l.
The ldbl-96 implementation of j1l has some function-local variables
that are declared static for no apparent reason (this dates back to
the first addition of that file).

Any vaguely recent compiler, probably including any that are supported
for building glibc, optimizes away the "static" here, as the values of
the variables on entry to the function are dead.  So there is not
actually a user-visible bug here at present (but with any compilers
that didn't optimize away the static at all, possibly building with
less or no optimization, so that the function stored intermediate
values to and then loaded them from the variables, there would have
been a thread-safety issue).  But the "static" clearly doesn't belong
there and might potentially make things unsafe were compilation
without optimization to be supported in future, so this patch removes
it.

Tested for x86_64.

	* sysdeps/ieee754/ldbl-96/e_j1l.c (qone): Don't make local
	variables static.
2017-12-06 15:19:06 +00:00
Joseph Myers 53994f1263 Make some ldbl-128, ldbl-128ibm arrays const.
I noticed that an x86_64 build of libm unexpectedly contained more
non-constant data than an older version (before _Float128 support)
did.  The problem is non-const arrays in the ldbl-128 j0l and j1l
implementations; this patch makes those arrays, and the corresponding
ldbl-128ibm ones, const.

Tested for x86_64, and tested compilation for powerpc with
build-many-glibcs.py.

	* sysdeps/ieee754/ldbl-128/e_j0l.c (Y0_2N): Make const.
	(Y0_2D): Likewise.
	* sysdeps/ieee754/ldbl-128/e_j1l.c (Y0_2N): Likewise.
	(Y0_2D): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_j0l.c (Y0_2N): Likewise.
	(Y0_2D): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/e_j1l.c (Y0_2N): Likewise.
	(Y0_2D): Likewise.
2017-12-06 13:42:58 +00:00
Mike FABIAN 62ea2193ee hsb_DE locale: Base collation on copy "iso14651_t1" [BZ #22515]
[BZ #22515]
	* localedata/Makefile: Add hsb_DE.UTF-8 to test-input
	and to the list of locales to be built for testing.
	* localedata/hsb_DE.UTF-8.in: New file for testing the collation.
	* localedata/locales/hsb_DE (LC_COLLATE): Use “copy "iso14651_t1"”
	and build the collation rules upon that.
2017-12-06 12:04:29 +01:00
Florian Weimer 37ac8e635a Add references to CVE-2017-17426 2017-12-06 07:40:42 +01:00
Rajalakshmi Srinivasaraghavan 87235d7006 Update NEWS to add sinf optimization 2017-12-06 10:49:11 +05:30
Joseph Myers 0d93b7fd7c Add _Float64, _Float32x function aliases.
This patch continues filling out TS 18661-3 support by adding *f64 and
*f32x function aliases, supporting _Float64 and _Float32x, as aliases
for double functions.  These types are supported for all glibc
configurations.  The API corresponds exactly to that for _Float128 and
_Float64x.  _Float32 aliases to float functions remain to be added in
subsequent patches to complete this process (then there are a few
miscellaneous functions in TS 18661-3 to implement that aren't simply
versions of existing functions for new types).

The patch enables the feature in bits/floatn-common.h, adds symbol
versions and documentation with updates to ABI baselines, and arranges
for the libm functions for the new types to be tested.  As with the
_Float64x changes there are some x86 ulps updates because of header
inlines not used for the new types (and one other change to the
non-multiarch libm-test-ulps, which I suppose comes from using a
different compiler version / configuration from when it was last
regenerated).

Tested for x86_64 and x86, and with build-many-glibcs.py, with both
GCC 6 and GCC 7.

	* bits/floatn-common.h (__HAVE_FLOAT64): Define to 1.
	(__HAVE_FLOAT32X): Likewise.
	* manual/math.texi (Mathematics): Document support for _Float64
	and _Float32x.
	* math/Makefile (test-types): Add float64 and float32x.
	* math/Versions (GLIBC_2.27): Add _Float64 and _Float32x
	functions.
	* stdlib/Versions (GLIBC_2.27): Likewise.
	* wcsmbs/Versions (GLIBC_2.27): Likewise.
	* sysdeps/unix/sysv/linux/aarch64/libc.abilist: Update.
	* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/alpha/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/arm/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/hppa/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/i386/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/ia64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/nios2/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.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/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sh/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
	* sysdeps/i386/fpu/libm-test-ulps: Likewise.
	* sysdeps/i386/i686/fpu/multiarch/libm-test-ulps: Likewise.
2017-12-06 00:58:03 +00:00
Joseph Myers f778723496 Use long double not double for _Float64 with old GCC if values the same.
If double, long double and _Float64 all have the same set of values,
TS 18661-3 requires the usual arithmetic conversions on long double
and _Float64 to produce _Float64.  For this to be the case when
building with a compiler without a distinct _Float64 type, _Float64
must be a typedef for long double, not for double.  (_Float32x,
however, must be double in such a case, not long double, because the
usual arithmetic conversions on _Float32x and double must produce
double.)

This patch adjusts the fallback definition of _Float64 and associated
macros accordingly in that case, to fix the build of test-tgmath3 with
GCC 6 for such a configuration.  Tested in conjunction with _Float64
changes with build-many-glibcs.py for arm-linux-gnueabi, to make sure
the issue with test-tgmath3 is fixed.  Also tested for x86_64.

	* bits/floatn-common.h: Include <bits/long-double.h>.
	[__HAVE_FLOAT64 && (!__GNUC_PREREQ (7, 0) || defined __cplusplus)
	&& __NO_LONG_DOUBLE_MATH] (__f64): Use suffix 'l'.
	[__HAVE_FLOAT64 && (!__GNUC_PREREQ (7, 0) || defined __cplusplus)
	&& __NO_LONG_DOUBLE_MATH] (__CFLOAT64): Use _Complex long double.
	[__HAVE_FLOAT64 && (!__GNUC_PREREQ (7, 0) || defined __cplusplus)
	&& __NO_LONG_DOUBLE_MATH] (_Float64): Use long double.
	[__HAVE_FLOAT64 && !__GNUC_PREREQ (7, 0) && __NO_LONG_DOUBLE_MATH]
	(__builtin_huge_valf64): Use __builtin_huge_vall.
	[__HAVE_FLOAT64 && !__GNUC_PREREQ (7, 0) && __NO_LONG_DOUBLE_MATH]
	(__builtin_inff64): Use __builtin_infl.
	[__HAVE_FLOAT64 && !__GNUC_PREREQ (7, 0) && __NO_LONG_DOUBLE_MATH]
	(__builtin_nanf64): Use __builtin_nanl.
	[__HAVE_FLOAT64 && !__GNUC_PREREQ (7, 0) && __NO_LONG_DOUBLE_MATH]
	(__builtin_nansf64): Use __builtin_nansl.
2017-12-05 21:52:15 +00:00
Rogerio Alves 07ed18d26a Add elision tunables
This patch adds several new tunables to control the behavior of
elision on supported platforms[1].   Since elision now depends
on tunables, we should always *compile* with elision enabled,
and leave the code disabled, but available for runtime
selection.  This gives us *much* better compile-time testing of
the existing code to avoid bit-rot[2].

Tested on ppc, ppc64, ppc64le, s390x and x86_64.

[1] This part of the patch was initially proposed by
Paul Murphy but was "staled" because the framework have changed
since the patch was originally proposed:

https://patchwork.sourceware.org/patch/10342/

[2] This part of the patch was inititally proposed as a RFC by
Carlos O'Donnell.  Make sense to me integrate this on the patch:

https://sourceware.org/ml/libc-alpha/2017-05/msg00335.html

	* elf/dl-tunables.list: Add elision parameters.
	* manual/tunables.texi: Add entries about elision tunable.
	* sysdeps/unix/sysv/linux/powerpc/elision-conf.c:
	Add callback functions to dynamically enable/disable elision.
	Add multiple callbacks functions to set elision parameters.
	Deleted __libc_enable_secure check.
	* sysdeps/unix/sysv/linux/s390/elision-conf.c: Likewise.
	* sysdeps/unix/sysv/linux/x86/elision-conf.c: Likewise.
	* configure: Regenerated.
	* configure.ac: Option enable_lock_elision was deleted.
	* config.h.in: ENABLE_LOCK_ELISION flag was deleted.
	* config.make.in: Remove references to enable_lock_elision.
	* manual/install.texi: Elision configure option was removed.
	* INSTALL: Regenerated to remove enable_lock_elision.
	* nptl/Makefile:
	Disable elision so it can verify error case for destroying a mutex.
	* sysdeps/powerpc/nptl/elide.h:
	Cleanup ENABLE_LOCK_ELISION check.
	Deleted macros for the case when ENABLE_LOCK_ELISION was not defined.
	* sysdeps/s390/configure: Regenerated.
	* sysdeps/s390/configure.ac: Remove references to enable_lock_elision..
	* nptl/tst-mutex8.c:
	Deleted all #ifndef ENABLE_LOCK_ELISION from the test.
	* sysdeps/powerpc/powerpc32/sysdep.h:
	Deleted all ENABLE_LOCK_ELISION checks.
	* sysdeps/powerpc/powerpc64/sysdep.h: Likewise.
	* sysdeps/powerpc/sysdep.h: Likewise.
	* sysdeps/s390/nptl/bits/pthreadtypes-arch.h: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/force-elision.h: Likewise.
	* sysdeps/unix/sysv/linux/s390/elision-conf.h: Likewise.
	* sysdeps/unix/sysv/linux/s390/force-elision.h: Likewise.
	* sysdeps/unix/sysv/linux/s390/lowlevellock.h: Likewise.
	* sysdeps/unix/sysv/linux/s390/Makefile: Remove references to
	enable-lock-elision.

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
2017-12-05 17:48:48 -02:00
Joseph Myers a5a2a76bb7 Support defining strtof64, strtof32x, wcstof64, wcstof32x aliases.
This patch adds support for defining strtof64, strtof32x, wcstof64,
wcstof32x and the corresponding _l functions as aliases of the
corresponding double functions when _Float64 and _Float32x support is
enabled.

Tested for x86_64; also tested with build-many-glibcs.py in
conjunction with other _Float64 / _Float32x changes.

	* stdlib/strtod.c: Include <bits/floatn.h>.
	(BUILD_DOUBLE): New macro.
	[BUILD_DOUBLE && __HAVE_FLOAT64 && !__HAVE_DISTINCT_FLOAT64]
	(strtof64): Define and later undefine as macro.  Define as weak
	alias if [!USE_WIDE_CHAR].
	[BUILD_DOUBLE && __HAVE_FLOAT64 && !__HAVE_DISTINCT_FLOAT64]
	(wcstof64): Define and later undefine as macro.  Define as weak
	alias if [USE_WIDE_CHAR].
	[BUILD_DOUBLE && __HAVE_FLOAT32X && !__HAVE_DISTINCT_FLOAT32X]
	(strtof32x): Define and later undefine as macro.  Define as weak
	alias if [!USE_WIDE_CHAR].
	[BUILD_DOUBLE && __HAVE_FLOAT32X && !__HAVE_DISTINCT_FLOAT32X]
	(wcstof32x): Define and later undefine as macro.  Define as weak
	alias if [USE_WIDE_CHAR].
	* stdlib/strtod_l.c: Include <bits/floatn.h>.
	(BUILD_DOUBLE): New macro.
	[BUILD_DOUBLE && __HAVE_FLOAT64 && !__HAVE_DISTINCT_FLOAT64]
	(strtof64_l): Define and later undefine as macro.  Define as weak
	alias if [!USE_WIDE_CHAR].
	[BUILD_DOUBLE && __HAVE_FLOAT64 && !__HAVE_DISTINCT_FLOAT64]
	(wcstof64_l): Define and later undefine as macro.  Define as weak
	alias if [USE_WIDE_CHAR].
	[BUILD_DOUBLE && __HAVE_FLOAT32X && !__HAVE_DISTINCT_FLOAT32X]
	(strtof32x_l): Define and later undefine as macro.  Define as weak
	alias if [!USE_WIDE_CHAR].
	[BUILD_DOUBLE && __HAVE_FLOAT32X && !__HAVE_DISTINCT_FLOAT32X]
	(wcstof32x_l): Define and later undefine as macro.  Define as weak
	alias if [USE_WIDE_CHAR].
2017-12-05 18:31:53 +00:00
Adhemerval Zanella 94d80dfc73 math: Use sign as double for reduced case in sinf
This patch avoid an extra floating point to integer conversion in
reduced internal function for generic sinf by defining the sign as
double instead of integers.

There is no much difference on Haswell with GCC 7.2.1:

           Before        After
min          9.11        9.108
mean       21.982      21.9224

However H.J. Lu reported gains on Skylake:

Before:

  "sinf": {
   "": {
    "duration": 3.4044e+10,
    "iterations": 1.9942e+09,
    "max": 141.106,
    "min": 7.704,
    "mean": 17.0715
   }
  }

After:

  "sinf": {
   "": {
    "duration": 3.40665e+10,
    "iterations": 2.03199e+09,
    "max": 95.994,
    "min": 7.704,
    "mean": 16.765
   }
  }

Checked on x86_64-linux-gnu.

	* sysdeps/ieee754/flt-32/s_sinf.c (ones): Define as double.
	(reduced): Use ones as double instead of integer.
2017-12-05 16:27:44 -02:00
Szabolcs Nagy 00d54af7c8 [PATCH] fix sinf(NAN)
sinf(NAN) should not signal invalid fp exception
so use isless instead of < where NAN is compared.

this makes the sinf tests pass on aarch64.

	* sysdeps/ieee754/flt-32/s_sinf.c (sinf): Use isless.
2017-12-05 18:09:22 +00:00
Joseph Myers 1f70eae4cf Support defining strfromf64, strfromf32x aliases.
This patch adds support for defining strfromf64 and strfromf32x
aliases of strfromd when the corresponding types are enabled.

Tested for x86_64; also tested with build-many-glibcs.py in
conjunction with other _Float64 / _Float32x changes.

	* stdlib/strfromd.c: Include <bits/floatn.h>.
	[__HAVE_FLOAT64 && !__HAVE_DISTINCT_FLOAT64] (strfromf64): Define
	and later undefine as macro and define as weak alias.
	[__HAVE_FLOAT32X && !__HAVE_DISTINCT_FLOAT32X] (strfromf32x):
	Likewise.
2017-12-05 18:01:25 +00:00
Joseph Myers e2c4dce535 Add headers for _Float64, _Float32x testing.
This patch adds the headers required for testing _Float64 and
_Float32x function aliases (using double ulps).  The corresponding
makefile support will be included in the patch that actually adds
those aliases; there doesn't seem much point in adding makefile
conditionals for testing something that will be available
unconditionally.

In conjunction with other _Float64 / _Float32x changes, test for
x86_64 and with build-many-glibcs.py.

	* math/test-float32x.h: New file.
	* math/test-float64.h: Likewise.
2017-12-05 17:34:25 +00:00
Joseph Myers f2d64d621e Support _Float64, _Float32x in libm_alias_double.
This patch makes the libm_alias_double macros support creating
_Float64 and _Float32x aliases, in preparation for enabling glibc
support for those types.

Tested for x86_64; also tested with build-many-glibcs.py in
conjunction with other _Float64 / _Float32x changes.

	* sysdeps/generic/libm-alias-double.h: Include <bits/floatn.h>.
	(libm_alias_double_other_r_f64): New macro.
	(libm_alias_double_other_r_f32x): Likewise.
	(libm_alias_double_other_r): Use libm_alias_double_other_r_f64 and
	libm_alias_double_other_r_f32x.
	(libm_alias_double_r): Use semicolon before call to
	libm_alias_double_other_r.
	* sysdeps/ieee754/ldbl-opt/libm-alias-double.h: Include
	<bits/floatn.h>.
	(libm_alias_double_other_r_f64): New macro.
	(libm_alias_double_other_r_f32x): Likewise.
	(libm_alias_double_other_r): Use libm_alias_double_other_r_f64 and
	libm_alias_double_other_r_f32x.
2017-12-05 17:00:57 +00:00
H.J. Lu 91c318e7b9 s_sinf.c: Replace floor with simple casts
Since s_sinf.c either assigns the return value of floor to integer or
passes double converted from integer to floor, this patch replaces
floor with simple casts.

Also since long == int for 32-bit targets, we can use long instead of
int to avoid 64-bit integer for 64-bit targets.

On Skylake, bench-sinf reports performance improvement:

           Before        After         Improvement
max        130.566       129.564           30%
min        7.704         7.706             0%
mean       21.8188       19.1363           30%

	* sysdeps/ieee754/flt-32/s_sinf.c (reduced): Replace long with
	int.
	(SINF_FUNC): Likewise.  Replace floor with simple casts.
2017-12-05 08:47:27 -08:00
Mike FABIAN de9661d6be et_EE locale: Base collation on iso14651_t1 [BZ #22517]
[BZ #22517]
	* localedata/Makefile: Add et_EE.UTF-8 to test-input
	and to the list of locales to be built for testing.
	* localedata/et_EE.UTF-8.in: New file for testing the collation.
	* localedata/locales/et_EE (LC_COLLATE): Use “copy "iso14651_t1"”
        and build the collation rules upon that.
2017-12-05 17:10:08 +01:00
Chris Metcalf f18b8dc7d7 tilegx: work around vector insn bug in gcc
Avoid an issue in gcc where some of the vector (aka SIMD) ops will
sometimes end up getting wrongly optimized out.  We use these
instructions in many of the string implementations.  If/when we
have an upstreamed fix for this problem in gcc we can conditionalize
the use of the extended assembly workaround in glibc.
2017-12-05 10:24:56 -05:00
Florian Weimer 446d22e91d Linux: Implement interfaces for memory protection keys
This adds system call wrappers for pkey_alloc, pkey_free, pkey_mprotect,
and x86-64 implementations of pkey_get and pkey_set, which abstract over
the PKRU CPU register and hide the actual number of memory protection
keys supported by the CPU.  pkey_mprotect with a -1 key is implemented
using mprotect, so it will work even if the kernel does not support the
pkey_mprotect system call.

The system call wrapers use unsigned int instead of unsigned long for
parameters, so that no special treatment for x32 is needed.  The flags
argument is currently unused, and the access rights bit mask is limited
to two bits by the current PKRU register layout anyway.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-12-05 15:20:35 +01:00
Florian Weimer da616c1496 support/tst-test_compare: Fix 32-bit/64-bit expected output mismatch
The use of a long type resulted in test output differences between
32-bit and 64-bit architectures, causing the test to fail on 32-bit
architectures.
2017-12-05 15:08:59 +01:00
Joseph Myers 216933b242 Use libm_alias_float for powerpc.
Continuing the preparation for additional _FloatN / _FloatNx function
aliases, this patch makes powerpc libm function implementations use
libm_alias_float to define function aliases.

Tested with build-many-glibcs.py that installed stripped shared
libraries are unchanged for all its hard-float powerpc configurations.

	* sysdeps/powerpc/fpu/s_cosf.c: Include <libm-alias-float.h>.
	(cosf): Define using libm_alias_float.
	* sysdeps/powerpc/fpu/s_fabs.S: Include <libm-alias-float.h>.
	(fabsf): Define using libm_alias_float.
	* sysdeps/powerpc/fpu/s_fmaf.S: Include <libm-alias-float.h>.
	(fmaf): Define using libm_alias_float.
	* sysdeps/powerpc/fpu/s_rintf.c: Include <libm-alias-float.h>.
	(rintf): Define using libm_alias_float.
	* sysdeps/powerpc/fpu/s_sinf.c: Include <libm-alias-float.h>.
	(sinf): Define using libm_alias_float.
	* sysdeps/powerpc/power5+/fpu/s_modff.c: Include
	<libm-alias-float.h>.
	(modff): Define using libm_alias_float.
	* sysdeps/powerpc/power7/fpu/s_logbf.c: Include
	<libm-alias-float.h>.
	(logbf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/fpu/s_ceilf.S: Include
	<libm-alias-float.h>.
	(ceilf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/fpu/s_copysign.S: Include
	<libm-alias-float.h>.
	(copysignf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/fpu/s_floorf.S: Include
	<libm-alias-float.h>.
	(floorf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/fpu/s_llrintf.c: Include
	<libm-alias-float.h>.
	(llrintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/fpu/s_llroundf.c: Include
	<libm-alias-float.h>.
	(llroundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/fpu/s_lrint.S: Include
	<libm-alias-float.h>.
	(lrintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/fpu/s_lround.S: Include
	<libm-alias-float.h>.
	(lroundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S: Include
	<libm-alias-float.h>.
	(nearbyintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/fpu/s_rintf.S: Include
	<libm-alias-float.h>.
	(rintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/fpu/s_roundf.S: Include
	<libm-alias-float.h>.
	(roundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/fpu/s_truncf.S: Include
	<libm-alias-float.h>.
	(truncf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceilf.c:
	Include <libm-alias-float.h>.
	(ceilf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysignf.c:
	Include <libm-alias-float.h>.
	(copysignf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floorf.c:
	Include <libm-alias-float.h>.
	(floorf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrintf.c:
	Include <libm-alias-float.h>.
	(llrintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llroundf.c:
	Include <libm-alias-float.h>.
	(llroundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logbf.c:
	Include <libm-alias-float.h>.
	(logbf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lrintf.c:
	Include <libm-alias-float.h>.
	(lrintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lroundf.c:
	Include <libm-alias-float.h>.
	(lroundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modff.c:
	Include <libm-alias-float.h>.
	(modff): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf.c:
	Include <libm-alias-float.h>.
	(roundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf.c:
	Include <libm-alias-float.h>.
	(truncf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S: Include
	<libm-alias-float.h>.
	(llrintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S: Include
	<libm-alias-float.h>.
	(llroundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power5+/fpu/s_ceilf.S: Include
	<libm-alias-float.h>.
	(ceilf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power5+/fpu/s_floorf.S: Include
	<libm-alias-float.h>.
	(floorf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power5+/fpu/s_llround.S: Include
	<libm-alias-float.h>.
	(llroundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power5+/fpu/s_lround.S: Include
	<libm-alias-float.h>.
	(lroundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power5+/fpu/s_roundf.S: Include
	<libm-alias-float.h>.
	(roundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power5+/fpu/s_truncf.S: Include
	<libm-alias-float.h>.
	(truncf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power6/fpu/s_copysign.S: Include
	<libm-alias-float.h>.
	(copysignf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S: Include
	<libm-alias-float.h>.
	(llrintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power6/fpu/s_llround.S: Include
	<libm-alias-float.h>.
	(llroundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power6x/fpu/s_lrint.S: Include
	<libm-alias-float.h>.
	(lrintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc32/power6x/fpu/s_lround.S: Include
	<libm-alias-float.h>.
	(lroundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceilf.c: Include
	<libm-alias-float.h>.
	(ceilf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysignf.c: Include
	<libm-alias-float.h>.
	(copysignf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_cosf.c: Include
	<libm-alias-float.h>.
	(cosf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_floorf.c: Include
	<libm-alias-float.h>.
	(floorf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrintf.c: Include
	<libm-alias-float.h>.
	(llrintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_llroundf.c: Include
	<libm-alias-float.h>.
	(llroundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbf.c: Include
	<libm-alias-float.h>.
	(logbf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_modff.c: Include
	<libm-alias-float.h>.
	(modff): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf.c: Include
	<libm-alias-float.h>.
	(roundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_sinf.c: Include
	<libm-alias-float.h>.
	(sinf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf.c: Include
	<libm-alias-float.h>.
	(truncf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/s_ceilf.S: Include
	<libm-alias-float.h>.
	(ceilf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/s_copysign.S: Include
	<libm-alias-float.h>.
	(copysignf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/s_floorf.S: Include
	<libm-alias-float.h>.
	(floorf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/s_llrint.S: Include
	<libm-alias-float.h>.
	(llrintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/s_llroundf.S: Include
	<libm-alias-float.h>.
	(llroundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S: Include
	<libm-alias-float.h>.
	(nearbyintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/s_rintf.S: Include
	<libm-alias-float.h>.
	(rintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/s_roundf.S: Include
	<libm-alias-float.h>.
	(roundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/fpu/s_truncf.S: Include
	<libm-alias-float.h>.
	(truncf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_ceilf.S: Include
	<libm-alias-float.h>.
	(ceilf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_floorf.S: Include
	<libm-alias-float.h>.
	(floorf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_llround.S: Include
	<libm-alias-float.h>.
	(llroundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_roundf.S: Include
	<libm-alias-float.h>.
	(roundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_truncf.S: Include
	<libm-alias-float.h>.
	(truncf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/power6/fpu/s_copysign.S: Include
	<libm-alias-float.h>.
	(copysignf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/power6x/fpu/s_llrint.S: Include
	<libm-alias-float.h>.
	(llrintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/power6x/fpu/s_llround.S: Include
	<libm-alias-float.h>.
	(llroundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/power8/fpu/s_cosf.S: Include
	<libm-alias-float.h>.
	(cosf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S: Include
	<libm-alias-float.h>.
	(llrintf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/power8/fpu/s_llround.S: Include
	<libm-alias-float.h>.
	(llroundf): Define using libm_alias_float.
	* sysdeps/powerpc/powerpc64/power8/fpu/s_sinf.S: Include
	<libm-alias-float.h>.
	(sinf): Define using libm_alias_float.
2017-12-05 00:26:26 +00:00
Florian Weimer 934855246d support: Add TEST_COMPARE macro 2017-12-04 20:56:08 +01:00
Mike FABIAN 96b06a19e6 tr_TR locale: Base collation on iso14651_t1 [BZ #22527]
[BZ #22527]
	*  localedata/locales/tr_TR (LC_COLLATE): Base collation rules
	on iso14651_t1. A test file localedata/tr_TR.UTF-8.in is already
	available, this rewrite of the collation rules does reproduce
	the test file in the same order.
2017-12-04 18:36:01 +01:00
Mike FABIAN 1f6d91f328 hr_HR locale: Don’t use single code points for the digraphs in LC_TIME
[BZ #10580]
	* localedata/locales/hr_HR (LC_TIME): Use two letters for the
	digraphs in the month and day names. Using single code points for
	digraphs is deprecated.  While there are dedicated Unicode
	codepoints, for the digraphs, these are included for backwards
	compatibility and modern texts use a sequence of Basic Latin
	characters. See: https://www.unicode.org/faq/ligature_digraph.html
	This makes the month and day names agree exactly with CLDR now,
	CLDR does not use the single code points for the digraphs either.
2017-12-04 18:36:01 +01:00
Chris Metcalf 2e49fed84c tile: update ca{cos,sin,tan}{,h} double ULPs 2017-12-04 12:31:20 -05:00
Joseph Myers 73895b499b Use __floor not floor in sinf.
The new sinf implementation introduced localplt failures for all
platforms where the compiler did not inline the calls to floor
(converted to trunc by machine-independent optimizations).  This patch
changes the calls to use __floor as normal in libm.

We can't use the public function names floor / floorf / floorl /
floorf128 in libm code in the absence of appropriate asms to redirect
floor/trunc calls, if not inlined, to use the internal names instead
(while avoiding breaking code building the floor functions themselves)
- while having such asms and then calling the public functions
unconditionally would be desirable for optimization (few architectures
have __floor inlines in math_private.h, and once the built-in function
is used you don't need them), using __floor is the minimum safe fix
for the present test regressions.

Tested with build-many-glibcs.py that this fixes the localplt test
failure for arm-linux-gnueabi.

	* sysdeps/ieee754/flt-32/s_sinf.c (SINF_FUNC): Use __floor instead
	of floor.
2017-12-04 16:58:08 +00:00
Siddhesh Poyarekar 4c1d801a59 aarch64: Avoid hidden symbols for memcpy/memmove into static binaries
The __GI_* symbol aliases for __memcpy_generic are unnecessary since
they're never used.  Add them only for libc.so to avoid PLT.  Maybe
some time in future we need to evaluate the relative cost of PLT vs
gains from multiarch memcpy implementations and take a call on whether
to drop this completely.

	* sysdeps/aarch64/multiarch/memcpy_generic.S (__GI_memcpy):
	Define only for libc.so.
2017-12-04 21:17:17 +05:30
Stefan Liebler 478593e637 S390: Fix backtrace in vdso functions.
On s390, GDB fails to show the complete backtrace from within vdso functions.
The macro INTERNAL_VSYSCALL_CALL saves the return address in r14 to r10
before branching to the vdso function. The branch-instruction updates r14
in order to let the vdso function return. Then the original address in r14 is
restored from r10. Unfortunately, there are no cfi-rules and GDB fails.

Furthermore the call of the vdso function does not comply with the s390 ABI
as no stack-frame for the vdso-function is generated.

This patch removes the s390 specific macro INTERNAL_VSYSCALL_CALL
and the common implementation in sysdeps/unix/sysv/linux/sysdep-vdso.h is used.
Then the vdso function is called via function-pointer and GCC generates a
new stack-frame and emits all needed cfi-rules.

The defines CLOBBER_[0-6] are removed as they  were only used in macro
INTERNAL_VSYSCALL_CALL.

The macro INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK is not used on s390.
The only user is power. Thus it is removed from s390 sysdep.h.

ChangeLog:

	* sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
	(INTERNAL_VSYSCALL_CALL, CLOBBER_0, CLOBBER_1, CLOBBER_2,
	 CLOBBER_3, CLOBBER_4, CLOBBER_5, CLOBBER_6,
	INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK): Remove.
	* sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h: Likewise.
2017-12-04 16:40:13 +01:00
Rajalakshmi Srinivasaraghavan 7863a71181 New generic sinf
This implementation is based on optimized sinf assembly versions
of x86_64 and powerpc.
2017-12-04 10:12:10 +05:30
John David Anglin b3f7fb12f5 Handle __gmon_start__ as undefined weak on hppa.
[BZ libc/19170]
	* sysdeps/hppa/crti.S: Declare PREINIT_FUNCTION weak_extern when
	PREINIT_FUNCTION_WEAK is nonzero.
	(gmon_initializer): New function.  Put procedure label for it in
	.init_array section.
	(_init): Don't call PREINIT_FUNCTION.
	* sysdeps/hppa/crtn.S (__gmon_start__): Remove.
	* sysdeps/hppa/dl-lookupcfg.h (DL_FIXUP_MAKE_VALUE): Create null fixup
	value when map argument is null.
2017-12-02 14:43:28 -05:00
John David Anglin 800a496acb Improve PIC pc-relative instruction sequences on hppa.
* sysdeps/hppa/dl-fptr.c (elf_machine_resolve): Remove unnecessary
	depi instruction from PIC pc-relative sequence.
	* sysdeps/hppa/dl-fptr.h (ELF_MACHINE_LOAD_ADDRESS): Likewise.
	* sysdeps/hppa/dl-machine.h (elf_machine_dynamic): Likewise.
	(elf_machine_load_address): Likewise.
	(elf_machine_runtime_setup): Likewise.
2017-12-02 11:04:16 -05:00
Joseph Myers d17542d235 Use libm_alias_double for remaining powerpc functions.
Continuing the preparation for additional _FloatN / _FloatNx function
aliases, this patch makes the remaining double powerpc functions use
libm_alias_double to define function aliases (with consequent removal
of the need for local compat symbol handling).  Previous cleanups
avoid this patch changing installed stripped shared libraries for any
build-many-glibcs.py configuration (there are still some functions in
this patch for which the order of double and float aliases changes
within an individual source file, but in this case this doesn't result
in changes to the final library).

Tested with build-many-glibcs.py that installed stripped shared
libraries are unchanged for all its hard-float powerpc configurations.

	* sysdeps/powerpc/power7/fpu/s_logb.c: Include
	<libm-alias-double.h>.
	(logb): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/fpu/s_copysign.S: Include
	<libm-alias-double.h>.
	(copysign): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/fpu/s_llrint.c: Include
	<libm-alias-double.h>.
	(llrint): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/fpu/s_llround.c: Include
	<libm-alias-double.h>.
	(llround): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/fpu/s_lrint.S: Include
	<libm-alias-double.h>.
	(lrint): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/fpu/s_lround.S: Include
	<libm-alias-double.h>.
	(lround): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign.c:
	Include <libm-alias-double.h>.
	(copysign): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llrint.c:
	Include <libm-alias-double.h>.
	(llrint): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_llround.c:
	Include <libm-alias-double.h>.
	(llround): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logb.c: Include
	<libm-alias-double.h>.
	(logb): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lrint.c:
	Include <libm-alias-double.h>.
	(lrint): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_lround.c:
	Include <libm-alias-double.h>.
	(lround): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S: Include
	<libm-alias-double.h>.
	(llrint): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S: Include
	<libm-alias-double.h>.
	(llround): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power5+/fpu/s_llround.S: Include
	<libm-alias-double.h>.
	(llround): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power5+/fpu/s_lround.S: Include
	<libm-alias-double.h>.
	(lround): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power6/fpu/s_copysign.S: Include
	<libm-alias-double.h>.
	(copysign): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S: Include
	<libm-alias-double.h>.
	(llrint): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power6/fpu/s_llround.S: Include
	<libm-alias-double.h>.
	(llround): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power6x/fpu/s_lrint.S: Include
	<libm-alias-double.h>.
	(lrint): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power6x/fpu/s_lround.S: Include
	<libm-alias-double.h>.
	(lround): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign.c: Include
	<libm-alias-double.h>.
	(copysign): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint.c: Include
	<libm-alias-double.h>.
	(llrint): Define using libm_alias_double.
	(lrint): Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround.c: Include
	<libm-alias-double.h>.
	(llround): Define using libm_alias_double.
	(lround): Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_logb.c: Include
	<libm-alias-double.h>.
	(logb): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/s_copysign.S: Include
	<libm-alias-double.h>.
	(copysign): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/s_llrint.S: Include
	<libm-alias-double.h>.
	(llrint): Define using libm_alias_double.
	(lrint): Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_llround.S: Include
	<libm-alias-double.h>.
	(llround): Define using libm_alias_double.
	(lround): Likewise.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_llround.S: Include
	<libm-alias-double.h>.
	(llround): Define using libm_alias_double.
	(lround): Likewise.
	* sysdeps/powerpc/powerpc64/power6/fpu/s_copysign.S: Include
	<libm-alias-double.h>.
	(copysign): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/power6x/fpu/s_llrint.S: Include
	<libm-alias-double.h>.
	(llrint): Define using libm_alias_double.
	(lrint): Likewise.
	* sysdeps/powerpc/powerpc64/power6x/fpu/s_llround.S: Include
	<libm-alias-double.h>.
	(llround): Define using libm_alias_double.
	(lround): Likewise.
	* sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S: Include
	<libm-alias-double.h>.
	(llrint): Define using libm_alias_double.
	(lrint): Likewise.
	* sysdeps/powerpc/powerpc64/power8/fpu/s_llround.S: Include
	<libm-alias-double.h>.
	(llround): Define using libm_alias_double.
	(lround): Likewise.
2017-12-02 00:11:37 +00:00
Joseph Myers 0ddde474db Define powerpc64 lroundl compat symbol only once.
sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround.c defines the
lroundl compat symbol, version GLIBC_2_1, twice, once based on llround
and once based on __lround.  Those are aliases for each other (llround
weak, __lround strong), but defining it twice does not make sense.
This patch changes it to define the compat symbol once only, matching
how libm_alias_double defines it.

Tested with build-many-glibcs.py for its powerpc64 configurations.

	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_llround.c
	[LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)] (lroundl): Do not define
	compat symbol based on llround.
2017-12-01 23:58:05 +00:00
Joseph Myers 0d5ba561c1 Base powerpc logbl compat symbols on __logb not logb.
Some powerpc logb implementations define a compat symbol for logbl
based on logb, whereas libm_alias_double defines such a compat symbol
based on __logb instead.  This difference (logb is weak, __logb isn't)
is enough to result in different installed stripped shared libraries.
The difference in the installed libraries isn't significant, but first
changing the compat_symbol calls helps make it possible to validate a
subsequent change to use libm_alias_double by comparison of libraries,
so this patch does such a preliminary change.

Tested with build-many-glibcs.py for all its hard-float powerpc
configurations.

	* sysdeps/powerpc/power7/fpu/s_logb.c
	[LONG_DOUBLE_COMPAT (libm, GLIBC_2_0)] (logbl): Define as compat
	symbol based on __logb, not on logb.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logb.c
	[LONG_DOUBLE_COMPAT (libm, GLIBC_2_0)] (logbl): Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_logb.c
	[LONG_DOUBLE_COMPAT (libm, GLIBC_2_0)] (logbl): Likewise.
2017-12-01 23:37:46 +00:00
Joseph Myers 51ea3b2042 Ues libm_alias_double for various powerpc functions.
Continuing the preparation for additional _FloatN / _FloatNx function
aliases, this patch various powerpc functions use libm_alias_double to
define function aliases (with consequent removal of the need for local
compat symbol handling).  (The present patch excludes the changes to
some functions where such changes could result in differences in
installed stripped shared libraries because of changes to the exact
ordering or properties of symbols in individual .os files.)

Tested with build-many-glibcs.py that installed stripped shared
libraries are unchanged for all its hard-float powerpc configurations.

	* sysdeps/powerpc/fpu/s_rint.c: Include <libm-alias-double.h>.
	(rint): Define using libm_alias_double.
	* sysdeps/powerpc/power5+/fpu/s_modf.c: Include
	<libm-alias-double.h>.
	(modf): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/fpu/s_ceil.S: Include
	<libm-alias-double.h>.
	(ceil): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/fpu/s_floor.S: Include
	<libm-alias-double.h>.
	(floor): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S: Include
	<libm-alias-double.h>.
	(nearbyint): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/fpu/s_rint.S: Include
	<libm-alias-double.h>.
	(rint): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/fpu/s_round.S: Include
	<libm-alias-double.h>.
	(round): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/fpu/s_trunc.S: Include
	<libm-alias-double.h>.
	(trunc): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil.c: Include
	<libm-alias-double.h>.
	(ceil): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor.c:
	Include <libm-alias-double.h>.
	(floor): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modf.c: Include
	<libm-alias-double.h>.
	(modf): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round.c:
	Include <libm-alias-double.h>.
	(round): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc.c:
	Include <libm-alias-double.h>.
	(trunc): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power5+/fpu/s_ceil.S: Include
	<libm-alias-double.h>.
	(ceil): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power5+/fpu/s_floor.S: Include
	<libm-alias-double.h>.
	(floor): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power5+/fpu/s_round.S: Include
	<libm-alias-double.h>.
	(round): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/power5+/fpu/s_trunc.S: Include
	<libm-alias-double.h>.
	(trunc): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil.c: Include
	<libm-alias-double.h>.
	(ceil): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_floor.c: Include
	<libm-alias-double.h>.
	(floor): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_modf.c: Include
	<libm-alias-double.h>.
	(modf): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_round.c: Include
	<libm-alias-double.h>.
	(round): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc.c: Include
	<libm-alias-double.h>.
	(trunc): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/s_ceil.S: Include
	<libm-alias-double.h>.
	(ceil): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/s_floor.S: Include
	<libm-alias-double.h>.
	(floor): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S: Include
	<libm-alias-double.h>.
	(nearbyint): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/s_rint.S: Include
	<libm-alias-double.h>.
	(rint): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/s_round.S: Include
	<libm-alias-double.h>.
	(round): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/fpu/s_trunc.S: Include
	<libm-alias-double.h>.
	(trunc): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_ceil.S: Include
	<libm-alias-double.h>.
	(ceil): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_floor.S: Include
	<libm-alias-double.h>.
	(floor): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_round.S: Include
	<libm-alias-double.h>.
	(round): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc64/power5+/fpu/s_trunc.S: Include
	<libm-alias-double.h>.
	(trunc): Define using libm_alias_double.
2017-12-01 23:09:47 +00:00
Joseph Myers ec2cf3f444 Use libm_alias_double for powerpc fabs, fma.
Continuing the preparation for additional _FloatN / _FloatNx function
aliases, this patch makes powerpc fabs and fma use libm_alias_double
to define function aliases.  This brings in automatic symbol
versioning compat handling, so the powerpc32 and powerpc64 wrappers
that added such handling to the generic sysdeps/powerpc/fpu versions
are removed as no longer required (there are no sysdeps directory
ordering issues that would necessitate keeping trivial wrappers
there).

Tested with build-many-glibcs.py that installed stripped shared
libraries are unchanged for all its hard-float powerpc configurations.

	* sysdeps/powerpc/fpu/s_fabs.S: Include <libm-alias-double.h>.
	(fabs): Define using libm_alias_double.
	* sysdeps/powerpc/fpu/s_fma.S: Include <libm-alias-double.h>.
	(fma): Define using libm_alias_double.
	* sysdeps/powerpc/powerpc32/fpu/s_fabs.S: Remove file.
	* sysdeps/powerpc/powerpc32/fpu/s_fma.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_fabs.S: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/s_fma.S: Likewise.
2017-12-01 22:23:28 +00:00
Adhemerval Zanella 0594b13f5d x32: Remove unused getcpu implementation
Checked on x86_64-linux-gnu-x32.

	* sysdeps/unix/sysv/linux/x86_64/x32/getcpu.c: Remove file.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-12-01 15:48:40 -02:00
Adhemerval Zanella dbdfcf3bba sparc: Remove ununsed ifunc assembly macros
Now that all SPARC ifunc converted to C implementation there is no need
for both C and assembly macros.  This patch removes the assembly ones.

Checked on sparcv9-linux-gnu and sparc64-linux-gnu.

	* sysdeps/sparc/sparc-ifunc.h (SPARC_ASM_IFUNC_DFLT,
	SPARC_ASM_IFUNC1, SPARC_ASM_IFUNC2, SET, SPARC_ASM_VIS2_IFUNC,
	SPARC_ASM_VIS3_IFUNC, SPARC_ASM_VIS3_VIS2_IFUNC): Remove macros.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-12-01 15:48:40 -02:00
Adhemerval Zanella 5b7bd9756c sparc: Fix sparv9 multiarch build
Fix build caused by 5b4e5e7869.

	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.c: Fix build
	due redirect macro.
2017-12-01 15:47:23 -02:00
Andreas Schwab ef9ecfa63c intl: create target directory for bison 2017-12-01 15:15:16 +01:00
Adhemerval Zanella 2a14526bfa sparc: refactor cpu_relax to C
* sysdeps/sparc/sparc64/cpu_relax.c: New file.
	* sysdeps/sparc/sparc32/sparcv9/cpu_relax.c: Likewise.
	* sysdeps/sparc/sparc64/cpu_relax.S: Remove file.
	* sysdeps/sparc/sparc32/sparcv9/cpu_relax.S: Likewise.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-12-01 11:51:10 -02:00
Adhemerval Zanella 1c051a9b09 sparc: refactor sparc32 nearbyint{f} selector to C
This patch refactors the sparc32 ifunc selector to a C implementation.
Also, the generic symbol is moved to its own implementation file
s_nearbyint{f}-generic.S).

Checked on sparc64-linux-gnu and sparcv9-linux-gnu.

	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
	(libm-sysdep_routines): Add s_nearbyintf-generic and
	s_nearbyint-generic.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint-generic.S:
	New file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint.c: Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf-generic.S:
	Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf.c:
	Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint.S: Remove
	file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf.S:
	Likewise.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-12-01 11:51:08 -02:00
Adhemerval Zanella dbeb74ef84 sparc: refactor sparc32 rint{f} selector to C
This patch refactors the sparc32 ifunc selector to a C implementation.
Also, the generic symbol is moved to its own implementation file
s_rint{f}-generic.S).

Checked on sparc64-linux-gnu and sparcv9-linux-gnu.

	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
	(libm-sysdep_routines): Add s_rintf-generic and s_rint-generic.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_rint-generic.S: New
	file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_rint.c: Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_rintf-generic.S:
	Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_rintf.c: Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_rint.S: Remove file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_rintf.S: Likewise.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-12-01 11:49:36 -02:00
Adhemerval Zanella fa7ded9612 sparc: refactor sparc32 llrint{f} selector to C
This patch refactors the sparc32 ifunc selector to a C implementation.
Also, the generic symbol is moved to its own implementation file
s_llrint{f}-generic.S).

Checked on sparc64-linux-gnu and sparcv9-linux-gnu.

	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
	(libm-sysdep_routines): Add s_llrintf-generic and s_llrint-generic.
	* sysdeps/sparc/sparcv9/fpu/multiarch/s_llrint-generic.S: New
	file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_llrint.c: Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_llrintf-generic.S:
	Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_llrintf.c: Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_llrint.S: Remove file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_llrintf.S: Likewise.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-12-01 11:49:19 -02:00
Adhemerval Zanella e240cf0e0e sparc: refactor sparc32 fabs{f} selector to C
This patch refactors the sparc32 ifunc selector to a C implementation.
Also, the generic symbol is moved to its own implementation file
s_fabs{f}-generic.S).

Checked on sparc64-linux-gnu and sparcv9-linux-gnu.

	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
	(libm-sysdep_routines): Add s_fabsf-generic and s_fabs-generic.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fabs-generic.S: New
	file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fabs.c: Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fabsf-generic.S:
	Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fabsf.c: Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fabs.S: Remove file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fabsf.S: Likewise.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-12-01 11:48:58 -02:00
Adhemerval Zanella 5b4e5e7869 sparc: refactor sparc32 copysign selector to C
This patch refactors the sparc32 ifunc selector to a C implementation.
Also, the generic symbol is moved to its own implementation file
s_copysign{f}-generic.S).

Checked on sparc64-linux-gnu and sparcv9-linux-gnu.

	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
	(sysdep_calls): New rule.
	(sysdep_routines): Use sysdep_calls as base.
	(libm-sysdep_routines): Add generic rule for symbols shared with
	libc.  Add s_copysign-generic and s_copysign-generic objects.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign-generic.S:
	New file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.c: Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf-generic.S:
	Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.c: Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.S: Remove file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.S: Likewise.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-12-01 11:48:39 -02:00
Mike FABIAN d985adae22 is_IS locale: Base collation on iso14651_t1 [BZ #22519] 2017-12-01 14:08:58 +01:00
Joseph Myers ff84a0e050 Use libm_alias_float for e500.
Continuing the preparation for additional _FloatN / _FloatNx function
aliases, this patch makes an e500 libm function implementation use
libm_alias_float to define function aliases.

Tested with build-many-glibcs.py that installed stripped shared
libraries are unchanged for its e500 configurations.

	* sysdeps/powerpc/powerpc32/e500/nofpu/s_fabsf.S: Include
	<libm-alias-float.h>.
	(fabsf): Define using libm_alias_float.
2017-12-01 01:12:42 +00:00
H.J. Lu ef5d8b4342 mips: Don't use MIN in dl-machine.h
MIN is used, but param.h may not be included, so expand its single use
inline.

	* sysdeps/mips/dl-machine.h (elf_machine_reloc): Expand MIN.
2017-11-30 16:34:09 -08:00
Joseph Myers f938b397dd Use libm_alias_float for coldfire.
Continuing the preparation for additional _FloatN / _FloatNx function
aliases, this patch makes coldfire libm function implementations use
libm_alias_float to define function aliases.

Untested, given the currently broken state of GCC for coldfire.

	* sysdeps/m68k/coldfire/fpu/s_fabsf.c: Include
	<libm-alias-float.h>.
	(fabsf): Define using libm_alias_float.
	* sysdeps/m68k/coldfire/fpu/s_lrintf.c: Include
	<libm-alias-float.h>.
	(lrintf): Define using libm_alias_float.
	* sysdeps/m68k/coldfire/fpu/s_rintf.c: Include
	<libm-alias-float.h>.
	(rintf): Define using libm_alias_float.
2017-11-30 23:52:35 +00:00
Joseph Myers 2251fad025 Use libm_alias_double for coldfire.
Continuing the preparation for additional _FloatN / _FloatNx function
aliases, this patch makes coldfire libm function implementations use
libm_alias_double to define function aliases.

Untested, given the currently broken state of GCC for coldfire.

	* sysdeps/m68k/coldfire/fpu/s_fabs.c: Include
	<libm-alias-double.h>.
	(fabs): Define using libm_alias_double.
	* sysdeps/m68k/coldfire/fpu/s_lrint.c: Include
	<libm-alias-double.h>.
	(lrint): Define using libm_alias_double.
	* sysdeps/m68k/coldfire/fpu/s_rint.c: Include
	<libm-alias-double.h>.
	(rint): Define using libm_alias_double.
2017-11-30 23:47:18 +00:00
Joseph Myers e53df1dee8 Rework m68k libm functions to use declare_mgen_alias.
Many m68k libm functions use their own system to share code between
different types and functions, involving defining macros before
including code for another function (for example, s_atan.c also acts
as a template that can define other functions).

Thes files serving as templates generate function aliases directly
with e.g. "weak_alias (__CONCATX(__,FUNC), FUNC)" in s_atan.c.  To be
prepared to generate _Float32, _Float64 and _Float32x function
aliases, this needs changing so that the libm_alias_* macros get used
instead.  As the macro to use varies depending on the type, that would
mean additional macros to define in several different places to get
the appropriate alias-generation macro used in each case.

Rather than adding to the m68k-specific mechanisms, this patch
converts the functions in question to use something closer to the
math/ type-generic template mechanism.  After this patch, these
functions have m68k-specific templates such as s_atan_template.c, but
those templates use all the same macros as in the math/ templates,
such as FLOAT, M_DECL_FUNC, M_SUF and declare_mgen_alias.  There is no
automatic generation of the files such as s_atan.c that include the
appropriate math-type-macros-*.h header and the template file (the
existing automatic generation logic is only applicable for the fixed
set of templates listed in math/ - and sysdeps sources always override
files generated that way), so those files are still checked in, but
they are all the obvious two-line files (with one additional
definition in the case of the expm1 implementations), rather than
making e.g. s_atan.c special.

Functions are only converted where they should have aliases for
_FloatN / _FloatNx types.  Those m68k functions that do not generate
public names (those that only generate __ieee754_*, with wrappers
generating the public names, and classification functions that only
exist once per format not once per type so don't get aliases) are
unchanged.  However, log1p (public names generated by wrapper) and
significand (not provided for new types so no new aliases needed)
needed changing because they previously included the atan
implementations.  Now, s_significand.c is the main implementation for
functions with that prototype and using the old implementation
approach, while log1p includes it in place of atan.

Any further cleanups in this area (which preserve the proper set of
functions getting aliases defined by libm_alias_float and
libm_alias_double) are of course welcome, just not needed for the
goals of this patch.

Tested with build-many-glibcs.py that installed stripped shared
libraries are unchanged by the patch.

	* sysdeps/m68k/m680x0/fpu/s_atan_template.c: New file.
	* sysdeps/m68k/m680x0/fpu/s_ceil_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_cos_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_expm1_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_fabs_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_floor_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_frexp_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_lrint_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_modf_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_nearbyint_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_remquo_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_rint_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_sin_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_sincos_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_tan_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_tanh_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_trunc_template.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_atan.c: Reimplement to use
	s_atan_template.c.
	* sysdeps/m68k/m680x0/fpu/s_atanf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_atanl.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_ceil.c: Reimplement to use
	s_ceil_template.c.
	* sysdeps/m68k/m680x0/fpu/s_ceilf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_ceill.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_cos.c: Reimplement to use
	s_cos_template.c.
	* sysdeps/m68k/m680x0/fpu/s_cosf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_cosl.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_expm1.c: Reimplement to use
	s_expm1_template.c.
	* sysdeps/m68k/m680x0/fpu/s_expm1f.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_expm1l.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_fabs.c: Reimplement to use
	s_fabs_template.c.
	* sysdeps/m68k/m680x0/fpu/s_fabsf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_fabsl.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_floor.c: Reimplement to use
	s_floor_template.c.
	* sysdeps/m68k/m680x0/fpu/s_floorf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_floorl.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_frexp.c: Reimplement to use
	s_frexp_template.c.
	* sysdeps/m68k/m680x0/fpu/s_frexpf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_lrint.c: Reimplement to use
	s_lrint_template.c.
	* sysdeps/m68k/m680x0/fpu/s_lrintf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_lrintl.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_modf.c: Reimplement to use
	s_modf_template.c.
	* sysdeps/m68k/m680x0/fpu/s_modff.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_modfl.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_nearbyint.c: Reimplement to use
	s_nearbyint_template.c.
	* sysdeps/m68k/m680x0/fpu/s_nearbyintf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_nearbyintl.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_remquo.c: Reimplement to use
	s_remquo_template.c.
	* sysdeps/m68k/m680x0/fpu/s_remquof.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_remquol.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_rint.c: Reimplement to use
	s_rint_template.c.
	* sysdeps/m68k/m680x0/fpu/s_rintf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_rintl.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_sin.c: Reimplement to use
	s_sin_template.c.
	* sysdeps/m68k/m680x0/fpu/s_sinf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_sinl.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_sincos.c: Reimplement to use
	s_sincos_template.c.
	* sysdeps/m68k/m680x0/fpu/s_sincosf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_sincosl.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_tan.c: Reimplement to use
	s_tan_template.c.
	* sysdeps/m68k/m680x0/fpu/s_tanf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_tanl.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_tanh.c: Reimplement to use
	s_tanh_template.c.
	* sysdeps/m68k/m680x0/fpu/s_tanhf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_tanhl.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_trunc.c: Reimplement to use
	s_trunc_template.c.
	* sysdeps/m68k/m680x0/fpu/s_truncf.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_truncl.c: Likewise.
	* sysdeps/m68k/m680x0/fpu/s_significand.c: Reimplement based on
	s_atan.c instead of including s_atan.c.
	* sysdeps/m68k/m680x0/fpu/s_significandf.c: Reimplement based on
	s_atanf.c instead of including s_atanf.c.
	* sysdeps/m68k/m680x0/fpu/s_significandl.c: Reimplement based on
	s_atanl.c instead of including s_atanl.c.
	* sysdeps/m68k/m680x0/fpu/s_log1p.c: Include s_significand.c
	instead of s_atan.c.
	* sysdeps/m68k/m680x0/fpu/s_log1pf.c: Include s_significandf.c
	instead of s_atanf.c.
	* sysdeps/m68k/m680x0/fpu/s_log1pl.c: Include s_significandl.c
	instead of s_atanl.c.
2017-11-30 22:39:07 +00:00
Joseph Myers c0535adfeb Remove scripts/update-copyrights handling of intl/plural.c.
Since this file is no longer checked in, update-copyrights no longer
needs to avoid changing it.

	* scripts/update-copyrights: Do not handle intl/plural.c
	specially.
2017-11-30 21:25:25 +00:00
Juro Bystricky 1faaf7035c plural.c: improve reproducibility
There is a subtle non-determinism when building glibc.
This depends on whether the glibc is built using the distibuted
file intl/plural.c or built using the generated file intl/plural.c.
These two files (intl/plural.c generated vs. distributed) are slightly
different, hence we may end up with slightly different libraries.

Originally, having "bison" installed was optional. So if "bison" was
not present, we always built libraries with the distributed plural.c.
If bison was installed, we *** may have *** replaced the distributed
file plural.c with a new plural.c generated from plural.y. if the
timestamps triggered this rule:

plural.c plural.y
	$(BISON) $(BISONFLAGS) $@ $^

Given that timestamps are not preserved in GIT repositories, the above
rule is not reliable without explicitly touching plural.c or plural.y.
In other words, the rule may or may not have fired.

In summary: there are two distinct sources of non-determinism:

1. Having "bison" installed or not
2. Having "bison" installed but timestamps poorly defined.

This patch fixes this by requiring "bison" being installed
and by always generating intl/plural.c from intl/plural.y.
(This is achieved by simply removing checked-in intl/plural.c)

	[BZ #22432]
	* configure.ac (BISON): Require to be present.
	* configure: Regenerated.
	* intl/Makefile (generated): Add plural.c.
	[$(BISON) != no]: Make code unconditional.
	(plural.c): Change rule to $(objpfx)plural.c.
	($(objpfx)plural.o): Depend on $(objpfx)plural.c.
	* intl/plural.c: Remove.
	* manual/install.texi (Tools for Compilation): Document bison as
	required.
	* INSTALL: Regenerated.
2017-11-30 21:21:15 +00:00
Joseph Myers bd6ea9edd1 Use libm_alias macros in m68k llrint functions.
Most m68k libm functions share code via sources for one function
including those for another function or type, in a way that will
require significant changes to create function aliases in a way
friendly to adding _FloatN / _FloatNx aliases.

The llrint function implementations, however, use a conventional
separate implementation for each floating-point type.  Thus preparing
them for _FloatN / _FloatNx aliases is just a matter of changing them
to include the appropriate headers and use the appropriate macros,
which this patch does.  The llrintl changes aren't strictly required,
since m68k long double does not meet the criteria for a _FloatN /
_FloatNx type, but are included anyway to keep consistency between the
implementations for the three types.

Tested with build-many-glibcs.py that installed stripped shared
libraries for m68k-linux-gnu are unchanged by the patch.

	* sysdeps/m68k/m680x0/fpu/s_llrint.c: Include
	<libm-alias-double.h>.
	(llrint): Define using libm_alias_double.
	* sysdeps/m68k/m680x0/fpu/s_llrintf.c: Include
	<libm-alias-float.h>.
	(llrintf): Define using libm_alias_float.
	* sysdeps/m68k/m680x0/fpu/s_llrintl.c: Include
	<libm-alias-ldouble.h>.
	(llrintl): Define using libm_alias_ldouble.
2017-11-30 19:15:21 +00:00
Joseph Myers faec63238f Use declare_mgen_alias in m68k templates.
Some m68k libm functions have their own templates replacing the
generic math/ ones but using the type-generic template machinery.
These currently define function aliases directly using weak_alias.  In
preparation for additional _FloatN / _FloatNx function aliases, this
patch changes them to use declare_mgen_alias for creating aliases
instead.

Tested with build-many-glibcs.py that installed stripped shared
libraries for m68k-linux-gnu are unchanged by the patch.

	* sysdeps/m68k/m680x0/fpu/s_ccosh_template.c (ccosh): Use
	declare_mgen_alias instead of weak_alias.
	* sysdeps/m68k/m680x0/fpu/s_cexp_template.c (cexp): Likewise.
	* sysdeps/m68k/m680x0/fpu/s_csin_template.c (csin): Likewise.
	* sysdeps/m68k/m680x0/fpu/s_csinh_template.c (csinh): Likewise.
2017-11-30 19:03:57 +00:00
Adhemerval Zanella 9e2279a0e9 sparc: refactor sparc64 __mpn_add_n selector to C
This patch refactors the sparc64 ifunc selector to a C implementation.
Also, the generic symbol is moved to its own implementation file
add_n-generic.S).

Checked on sparc64-linux-gnu and sparcv9-linux-gnu.

	* sysdeps/sparc/sparc64/multiarch/Makefile (sysdep_routines):
	Add add_n-generic.
	* sysdeps/sparc/sparc64/multiarch/add_n-generic.S: New file.
	* sysdeps/sparc/sparc64/multiarch/add_n.c: Likewise.
	* sysdeps/sparc/sparc64/multiarch/add_n.S: Remove file.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-11-30 14:10:28 -02:00
Adhemerval Zanella 75f37c71db sparc: refactor sparc64 __mpn_submul_1 selector to C
This patch refactors the sparc64 ifunc selector to a C implementation.
Also, the generic symbol is moved to its own implementation file
submul_1-generic.S).

Checked on sparc64-linux-gnu and sparcv9-linux-gnu.

	* sysdeps/sparc/sparc64/multiarch/Makefile (sysdep_routines):
	Add submul_1-generic.
	* sysdeps/sparc/sparc64/multiarch/submul_1-generic.S: New file.
	* sysdeps/sparc/sparc64/multiarch/submul_1.c: Likewise.
	* sysdeps/sparc/sparc64/multiarch/submul_1.S: Remove file.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-11-30 14:10:25 -02:00
Adhemerval Zanella dda1d2e88b sparc: refactor sparc64 __mpn_addmul_1 selector to C
This patch refactors the sparc64 ifunc selector to a C implementation.
Also, the generic symbol is moved to its own implementation file
addmul_1-generic.S).

Checked on sparc64-linux-gnu and sparcv9-linux-gnu.

	* sysdeps/sparc/sparc64/multiarch/Makefile (sysdep_routines):
	Add addmul_1-generic.
	* sysdeps/sparc/sparc64/multiarch/addmul_1-generic.S: New file.
	* sysdeps/sparc/sparc64/multiarch/addmul_1.c: Likewise.
	* sysdeps/sparc/sparc64/multiarch/addmul_1.S: Remove file.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-11-30 14:10:20 -02:00
Adhemerval Zanella b70cbbfcc8 sparc: refactor sparc64 __mpn_sub_n selector to C
This patch refactors the sparc64 ifunc selector to a C implementation.
Also, the generic symbol is moved to its own implementation file
sub_n-generic.S).

Checked on sparc64-linux-gnu and sparcv9-linux-gnu.

	* sysdeps/sparc/sparc64/multiarch/Makefile (sysdep_routines):
	Add sub_n-generic.
	* sysdeps/sparc/sparc64/multiarch/sub_n-generic.S: New file.
	* sysdeps/sparc/sparc64/multiarch/sub_n.c: Likewise.
	* sysdeps/sparc/sparc64/multiarch/sub_n.S: Remove file.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-11-30 14:10:16 -02:00
Adhemerval Zanella 023cade3b3 sparc: refactor sparc64 __mpn_mul_1 selector to C
This patch refactors the sparc64 ifunc selector to a C implementation.
Also, the generic symbol is moved to its own implementation file
mul_1-generic.S).

Checked on sparc64-linux-gnu and sparcv9-linux-gnu.

	* sysdeps/sparc/sparc64/multiarch/Makefile (sysdep_routines):
	Add mul_1-generic.
	* sysdeps/sparc/sparc64/multiarch/mul_1-generic.S: New file.
	* sysdeps/sparc/sparc64/multiarch/mul_1.c: Likewise.
	* sysdeps/sparc/sparc64/multiarch/mul_1.S: Remove file.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-11-30 14:10:12 -02:00
Mike FABIAN fbb5fd03d3 sr_RS and bs_BA locales: make collation rules the same as for hr_HR [BZ #22534]
According to CLDR, collation rules for Serbian and Bosnian
	should be the same as for Croatian.

	[BZ #22534]
	* localedata/Makefile: Add sr_RS.UTF-8 and bs_BA.UTF-8 to test-input
	and to the list of locales to be built for testing.
	* localedata/bs_BA.UTF-8.in: New file (same as hr_HR.UTF-8.in).
	* localedata/sr_RS.UTF-8.in: New file (same as hr_HR.UTF-8.in).
	* localedata/locales/bs_BA (LC_COLLATE): Use “copy "hr_HR"”.
	* localedata/locales/sr_RS (LC_COLLATE): Use “copy "hr_HR"”.
2017-11-30 16:03:22 +01:00
Mike FABIAN 5e56e937c9 hr_HR locale: fix collation and expand collation test file
* localedata/locales/hr_HR (LC_COLLATE): Fix collation
	to make test case pass.
	* localedata/hr_HR.UTF-8.in: Add more test strings.
2017-11-30 14:57:46 +01:00
Mike FABIAN cf4341ca90 Fix test case for hr_HR monetary formatting
* stdlib/tst-strfmon_l.c: Fix testcase. Needed because of [BZ #10580]
2017-11-30 14:56:49 +01:00
Dragan Stanojević - Nevidljivi 9ca6b34378 Add test case for collation in hr_HR locale
* localedata/Makefile: Add hr_HR.UTF-8 to test-input and to
	the list of locales to built for testing.
	* localedata/hr_HR.UTF-8.in: New file.
2017-11-30 14:55:38 +01:00
Dragan Stanojević - Nevidljivi 37075ae18d hr_HR locale: various updates [BZ #10580]
[BZ #10580]
        * localedata/locales/hr_HR (LC_COLLATE): Base collation rules on
        iso14651_t1.
        * localedata/locales/hr_HR (LC_TIME): Sync month and day names with
        CLDR (except use ligatures for the digraphs, CLDR does not use
        the ligatures), add first_workday, some fixes in the date and time
        formats.
        * localedata/locales/hr_HR (LC_CTYPE): Add transliteration rules
        for Đ and đ.
        * localedata/locales/hr_HR (LC_MONETARY): Change currency_symbol to
        lower case. p_cs_precedes and n_cs_precedes should be 0 instead of 1.
        Add int_p_cs_precedes and int_n_cs_precedes.
        * localedata/locales/hr_HR (LC_NUMERIC): Change thousands_sep to
        "<U202F>" (NARROW NO-BREAK SPACE) and grouping to 3;3 (Agrees with
        LC_MONETARY now).
        * localedata/locales/hr_HR (LC_TELEPHONE): Add tel_dom_fmt.
	* localedata/locales/hr_HR (LC_NAME): Add name_mr, name_mrs, and
        name_miss.
	* localedata/locales/hr_HR (LC_ADDRESS): Add country_post, country_isbn,
        and lang_lib. Change postal_fmt.

change
2017-11-30 14:53:30 +01:00
H.J. Lu f33632ccd1 x86: Make a space in jmpbuf for shadow stack pointer
To support Shadow Stack (SHSTK) in Intel Control-flow Enforcement
Technology (CET) in setjmp/longjmp, we need to save shadow stack
pointer in jmp_buf.  The __saved_mask field in jmp_buf has type
of __sigset_t.  On Linux, __sigset_t is defined as

 #define _SIGSET_NWORDS (1024 / (8 * sizeof (unsigned long int)))
typedef struct
{
  unsigned long int __val[_SIGSET_NWORDS];
} __sigset_t;

which is much bigger than expected by the __sigprocmask system call,
which has

typedef struct {
        unsigned long sig[_NSIG_WORDS];
} sigset_t;

For Linux/x86, we can shrink __sigset_t used by __saved_mask in jmp_buf
to add paddings for shadow stack pointer.  As long as the new __sigset_t
is not smaller than sigset_t expected by the __sigprocmask system call,
it should work correctly.

This patch adds an internal header file, <setjmpP.h>, to define
__jmp_buf_sigset_t for __saved_mask in jmp_buf for Linux/x86 with a
space to store shadow stack pointer.  It verifies __jmp_buf_sigset_t has
the suitable size for the __sigprocmask system call.   A run-time test,
tst-saved_mask-1.c, is added to verify that size of __jmp_buf_sigset_t
is sufficient.  If its size is too small, the test fails with

rt_sigprocmask(SIG_SETMASK, strace: umoven: short read (4 < 8) @0x7fa8aa28effc
0x7fa8aa28effc, NULL, 8) = -1 EFAULT (Bad address)
rt_sigprocmask(SIG_SETMASK, strace: umoven: short read (4 < 8) @0x7fa8aa28effc
0x7fa8aa28effc, NULL, 8) = -1 EFAULT (Bad address)
rt_sigprocmask(SIG_SETMASK, NULL, 0x7fa8aa28effc, 8) = -1 EFAULT (Bad address)
exit_group(1)                           = ?

Tested with build-many-glibcs.py.

	* debug/longjmp_chk.c: Include <setjmpP.h> instead of
	<setjmp.h>.
	* setjmp/longjmp.c: Include <setjmpP.h> instead of <setjmp.h>.
	(__libc_siglongjmp): Cast &env[0].__saved_mask to "sigset_t *".
	* setjmp/sigjmp.c: Include <setjmpP.h> instead of <setjmp.h>.
	(__sigjmp_save): Cast &env[0].__saved_mask to "sigset_t *".
	* sysdeps/generic/setjmpP.h: New file.
	* sysdeps/unix/sysv/linux/x86/jmp_buf-ssp.sym: Likewise.
	* sysdeps/unix/sysv/linux/x86/setjmpP.h: Likewise.
	* sysdeps/unix/sysv/linux/x86/tst-saved_mask-1.c: Likewise.
	* sysdeps/unix/sysv/linux/x86/Makefile (gen-as-const-headers):
	Add jmp_buf-ssp.sym.
	(tests): Add tst-saved_mask-1.
2017-11-30 04:58:01 -08:00
Arjun Shankar 34697694e8 Fix integer overflow in malloc when tcache is enabled [BZ #22375]
When the per-thread cache is enabled, __libc_malloc uses request2size (which
does not perform an overflow check) to calculate the chunk size from the
requested allocation size. This leads to an integer overflow causing malloc
to incorrectly return the last successfully allocated block when called with
a very large size argument (close to SIZE_MAX).

This commit uses checked_request2size instead, removing the overflow.
2017-11-30 13:42:53 +01:00
Joseph Myers 18305fba55 Remove SPARC lllrint aliases.
The sparc32/sparcv9/fpu/multiarch implementations of llrint / llrintf
have aliases lllrint / lllrintf.  No such function is exported from or
used in libm and these aliases should not be there; I expect they
arose accidentally in the course of converting a 64-bit implementation
(where lrint and llrint can be aliases) to a 32-bit llrint
implementation.  This patch removes those spurious aliases.

Tested (compilation only) with build-many-glibcs.py for
sparcv9-linux-gnu.

	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_llrint.S
	(__lllrint): Remove alias.
	(lllrint): Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_llrintf.S
	(__lllrintf): Likewise.
	(lllrintf): Likewise.
2017-11-30 00:43:28 +00:00
Joseph Myers 3e5efdbdbe Use libm_alias_float for sparc.
Continuing the preparation for additional _FloatN / _FloatNx function
aliases, this patch makes sparc libm function implementations use
libm_alias_float to define function aliases.

Tested with build-many-glibcs.py for all its sparc configurations that
installed stripped shared libraries are unchanged by the patch.

	* sysdeps/sparc/sparc32/fpu/s_copysignf.S: Include
	<libm-alias-float.h>.
	(copysignf): Define using libm_alias_float.
	* sysdeps/sparc/sparc32/fpu/s_fabsf.S: Include
	<libm-alias-float.h>.
	(fabsf): Define using libm_alias_float.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysignf.S:
	Include <libm-alias-float.h>.
	(copysignf): Define using libm_alias_float.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fabsf.S: Include
	<libm-alias-float.h>.
	(fabsf): Define using libm_alias_float.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf.c: Include
	<libm-alias-float.h>.
	(fdimf): Define using libm_alias_float.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmaf.c: Include
	<libm-alias-float.h>.
	(fmaf): Define using libm_alias_float.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_llrintf.S: Include
	<libm-alias-float.h>.
	(llrintf): Define using libm_alias_float.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyintf.S:
	Include <libm-alias-float.h>.
	(nearbyintf): Define using libm_alias_float.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_rintf.S: Include
	<libm-alias-float.h>.
	(rintf): Define using libm_alias_float.
	* sysdeps/sparc/sparc32/sparcv9/fpu/s_llrintf.S: Include
	<libm-alias-float.h>.
	(llrintf): Define using libm_alias_float.
	* sysdeps/sparc/sparc32/sparcv9/fpu/s_lrintf.S: Include
	<libm-alias-float.h>.
	(lrintf): Define using libm_alias_float.
	* sysdeps/sparc/sparc32/sparcv9/fpu/s_nearbyintf.S: Include
	<libm-alias-float.h>.
	(nearbyintf): Define using libm_alias_float.
	* sysdeps/sparc/sparc32/sparcv9/fpu/s_rintf.S: Include
	<libm-alias-float.h>.
	(rintf): Define using libm_alias_float.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf.c: Include
	<libm-alias-float.h>.
	(ceilf): Define using libm_alias_float.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_floorf.c: Include
	<libm-alias-float.h>.
	(floorf): Define using libm_alias_float.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_fmaf.c: Include
	<libm-alias-float.h>.
	(fmaf): Define using libm_alias_float.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf.c: Include
	<libm-alias-float.h>.
	(lrintf): Define using libm_alias_float.
	(llrintf): Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyintf.c: Include
	<libm-alias-float.h>.
	(nearbyintf): Define using libm_alias_float.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_rintf.c: Include
	<libm-alias-float.h>.
	(rintf): Define using libm_alias_float.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_truncf.c: Include
	<libm-alias-float.h>.
	(truncf): Define using libm_alias_float.
	* sysdeps/sparc/sparc64/fpu/s_copysignf.S: Include
	<libm-alias-float.h>.
	(copysignf): Define using libm_alias_float.
	* sysdeps/sparc/sparc64/fpu/s_fabsf.c: Include
	<libm-alias-float.h>.
	(fabsf): Define using libm_alias_float.
	* sysdeps/sparc/sparc64/fpu/s_lrintf.S: Include
	<libm-alias-float.h>.
	(lrintf): Define using libm_alias_float.
	(llrintf): Likewise.
	* sysdeps/sparc/sparc64/fpu/s_nearbyintf.S: Include
	<libm-alias-float.h>.
	(nearbyintf): Define using libm_alias_float.
	* sysdeps/sparc/sparc64/fpu/s_rintf.S: Include
	<libm-alias-float.h>.
	(rintf): Define using libm_alias_float.
2017-11-30 00:30:40 +00:00
Joseph Myers 875cd54855 Use libm_alias_double for sparc.
Continuing the preparation for additional _FloatN / _FloatNx function
aliases, this patch makes sparc libm function implementations use
libm_alias_double to define function aliases (with consequent
simplification where compat symbol handling is now done by those
macros rather than locally in architecture-specific code).

Tested with build-many-glibcs.py for all its sparc configurations that
installed stripped shared libraries are unchanged by the patch.

	* sysdeps/sparc/sparc32/fpu/s_copysign.S: Include
	<libm-alias-double.h>.
	(copysign): Define using libm_alias_double.
	* sysdeps/sparc/sparc32/fpu/s_fabs.S: Include
	<libm-alias-double.h>.
	(fabs): Define using libm_alias_double.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_copysign.S:
	Include <libm-alias-double.h>.
	(copysign): Define using libm_alias_double.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fabs.S: Include
	<libm-alias-double.h>.
	(fabs): Define using libm_alias_double.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim.c: Include
	<libm-alias-double.h>.
	(fdim): Define using libm_alias_double.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fma.c: Include
	<libm-alias-double.h>.
	(fma): Define using libm_alias_double.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_llrint.S: Include
	<libm-alias-double.h>.
	(llrint): Define using libm_alias_double.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_nearbyint.S:
	Include <libm-alias-double.h>.
	(nearbyint): Define using libm_alias_double.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_rint.S: Include
	<libm-alias-double.h>.
	(rint): Define using libm_alias_double.
	* sysdeps/sparc/sparc32/sparcv9/fpu/s_fabs.S: Include
	<libm-alias-double.h>.
	(fabs): Define using libm_alias_double.
	* sysdeps/sparc/sparc32/sparcv9/fpu/s_llrint.S: Include
	<libm-alias-double.h>.
	(llrint): Define using libm_alias_double.
	* sysdeps/sparc/sparc32/sparcv9/fpu/s_nearbyint.S: Include
	<libm-alias-double.h>.
	(nearbyint): Define using libm_alias_double.
	* sysdeps/sparc/sparc32/sparcv9/fpu/s_rint.S: Include
	<libm-alias-double.h>.
	(rint): Define using libm_alias_double.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_ceil.c: Include
	<libm-alias-double.h>.
	(ceil): Define using libm_alias_double.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_floor.c: Include
	<libm-alias-double.h>.
	(floor): Define using libm_alias_double.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_fma.c: Include
	<libm-alias-double.h>.
	(fma): Define using libm_alias_double.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_lrint.c: Include
	<libm-alias-double.h>.
	(lrint): Define using libm_alias_double.
	(llrint): Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyint.c: Include
	<libm-alias-double.h>.
	(nearbyint): Define using libm_alias_double.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_rint.c: Include
	<libm-alias-double.h>.
	(rint): Define using libm_alias_double.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_trunc.c: Include
	<libm-alias-double.h>.
	(trunc): Define using libm_alias_double.
	* sysdeps/sparc/sparc64/fpu/s_copysign.S: Include
	<libm-alias-double.h>.
	(copysign): Define using libm_alias_double.
	* sysdeps/sparc/sparc64/fpu/s_fabs.c: Include
	<libm-alias-double.h>.
	(fabs): Define using libm_alias_double.
	* sysdeps/sparc/sparc64/fpu/s_lrint.S: Include
	<libm-alias-double.h>.
	(lrint): Define using libm_alias_double.
	(llrint): Likewise.
	* sysdeps/sparc/sparc64/fpu/s_nearbyint.S: Include
	<libm-alias-double.h>.
	(nearbyint): Define using libm_alias_double.
	* sysdeps/sparc/sparc64/fpu/s_rint.S: Include
	<libm-alias-double.h>.
	(rint): Define using libm_alias_double.
2017-11-29 23:40:07 +00:00
Joseph Myers cf4ebc27fe Fix missing sparcv9 --disable-multi-arch fabsl compat symbol (bug 22229).
The --disable-multi-arch case of sparcv9 libm is missing a fabsl
compat symbol for when long double had the same ABI as double.  This
patch adds the missing compat symbol to this implementation.  As my
fix for other instances of this missing compat symbol postdates the
last release, I'm considering this as being part of bug 22229 that was
missing from my previous fix rather than as a separate issue, and so
as not needing a new bug report in Bugzilla.

Tested (compilation only) with build-many-glibcs.py for
sparcv9-linux-gnu --disable-multi-arch.

	[BZ #22229]
	* sysdeps/sparc/sparc32/sparcv9/fpu/s_fabs.S: Include
	<math_ldbl_opt.h>.
	(fabsl): Define as compat symbol at version GLIBC_2_0 for libm.
2017-11-29 23:09:03 +00:00
Joseph Myers 0c09737883 Add SPARC --disable-multi-arch builds to build-many-glibcs.py.
While working on SPARC changes to use libm_alias_* I noticed that the
non-multi-arch sparc32/sparcv9/fpu/s_fabs.S was missing compat symbol
support for fabsl.  This clearly shows inadequate test coverage, so
this patch adds SPARC --disable-multi-arch builds to
build-many-glibcs.py (the 32-bit one fails testing until that bug is
fixed, the 64-bit one passes testing).

	* scripts/build-many-glibcs.py (Context.add_all_configs): Add
	SPARC --disable-multi-arch glibc variants.
2017-11-29 22:51:46 +00:00
Joseph Myers 34bb10aabf Use libm_alias_float for x86_64.
Continuing the preparation for additional _FloatN / _FloatNx function
aliases, this patch makes x86_64 libm function implementations use
libm_alias_float to define function aliases, or libm_alias_float_other
where the main name is defined with versioned_symbol.

Tested with the glibc testsuite for x86_64, and tested with
build-many-glibcs.py for all its x86_64 configurations that installed
stripped shared libraries are unchanged by the patch.

	* sysdeps/x86_64/fpu/multiarch/e_exp2f.c: Include
	<libm-alias-float.h>.
	(exp2f): Define using libm_alias_float, or libm_alias_float_other
	if [SHARED].
	* sysdeps/x86_64/fpu/multiarch/e_expf.c: Include
	<libm-alias-float.h>.
	(exp2f): Define using libm_alias_float, or libm_alias_float_other
	if [SHARED].
	* sysdeps/x86_64/fpu/multiarch/e_log2f.c: Include
	<libm-alias-float.h>.
	(exp2f): Define using libm_alias_float, or libm_alias_float_other
	if [SHARED].
	* sysdeps/x86_64/fpu/multiarch/e_logf.c: Include
	<libm-alias-float.h>.
	(exp2f): Define using libm_alias_float, or libm_alias_float_other
	if [SHARED].
	* sysdeps/x86_64/fpu/multiarch/e_powf.c: Include
	<libm-alias-float.h>.
	(exp2f): Define using libm_alias_float, or libm_alias_float_other
	if [SHARED].
	* sysdeps/x86_64/fpu/multiarch/s_ceilf.c: Include
	<libm-alias-float.h>.
	(ceilf): Define using libm_alias_float.
	* sysdeps/x86_64/fpu/multiarch/s_floorf.c: Include
	<libm-alias-float.h>.
	(floorf): Define using libm_alias_float.
	* sysdeps/x86_64/fpu/multiarch/s_fmaf.c: Include
	<libm-alias-float.h>.
	(fmaf): Define using libm_alias_float.
	* sysdeps/x86_64/fpu/multiarch/s_nearbyintf.c: Include
	<libm-alias-float.h>.
	(nearbyintf): Define using libm_alias_float.
	* sysdeps/x86_64/fpu/multiarch/s_rintf.c: Include
	<libm-alias-float.h>.
	(rintf): Define using libm_alias_float.
	* sysdeps/x86_64/fpu/multiarch/s_truncf.c: Include
	<libm-alias-float.h>.
	(truncf): Define using libm_alias_float.
	* sysdeps/x86_64/fpu/s_copysignf.S: Include <libm-alias-float.h>.
	(copysignf): Define using libm_alias_float.
	* sysdeps/x86_64/fpu/s_cosf.S: Include <libm-alias-float.h>.
	(cosf): Define using libm_alias_float.
	* sysdeps/x86_64/fpu/s_fabsf.c: Include <libm-alias-float.h>.
	(fabsf): Define using libm_alias_float.
	* sysdeps/x86_64/fpu/s_fmaxf.S: Include <libm-alias-float.h>.
	(fmaxf): Define using libm_alias_float.
	* sysdeps/x86_64/fpu/s_fminf.S: Include <libm-alias-float.h>.
	(fminf): Define using libm_alias_float.
	* sysdeps/x86_64/fpu/s_llrintf.S: Include <libm-alias-float.h>.
	(llrintf): Define using libm_alias_float.
	[!__ILP32__] (lrintf): Likewise.
	* sysdeps/x86_64/fpu/s_sincosf.S: Include <libm-alias-float.h>.
	(sincosf): Define using libm_alias_float.
	* sysdeps/x86_64/fpu/s_sinf.S: Include <libm-alias-float.h>.
	(sinf): Define using libm_alias_float.
	* sysdeps/x86_64/x32/fpu/s_lrintf.S: Include <libm-alias-float.h>.
	(lrintf): Define using libm_alias_float.
2017-11-29 21:25:41 +00:00
Joseph Myers 011fba7e48 Use libm_alias_double for x86_64.
Continuing the preparation for additional _FloatN / _FloatNx function
aliases, this patch makes x86_64 libm function implementations use
libm_alias_double to define function aliases.

Tested with the glibc testsuite for x86_64, and tested with
build-many-glibcs.py for all its x86_64 configurations that installed
stripped shared libraries are unchanged by the patch.

	* sysdeps/x86_64/fpu/multiarch/s_atan.c: Include
	<libm-alias-double.h>.
	(atan): Define using libm_alias_double.
	* sysdeps/x86_64/fpu/multiarch/s_ceil.c: Include
	<libm-alias-double.h>.
	(ceil): Define using libm_alias_double.
	* sysdeps/x86_64/fpu/multiarch/s_floor.c: Include
	<libm-alias-double.h>.
	(floor): Define using libm_alias_double.
	* sysdeps/x86_64/fpu/multiarch/s_fma.c: Include
	<libm-alias-double.h>.
	(fma): Define using libm_alias_double.
	* sysdeps/x86_64/fpu/multiarch/s_nearbyint.c: Include
	<libm-alias-double.h>.
	(nearbyint): Define using libm_alias_double.
	* sysdeps/x86_64/fpu/multiarch/s_rint.c: Include
	<libm-alias-double.h>.
	(rint): Define using libm_alias_double.
	* sysdeps/x86_64/fpu/multiarch/s_sin.c: Include
	<libm-alias-double.h>.
	(sin): Define using libm_alias_double.
	(cos): Likewise.
	* sysdeps/x86_64/fpu/multiarch/s_tan.c: Include
	<libm-alias-double.h>.
	(tan): Define using libm_alias_double.
	* sysdeps/x86_64/fpu/multiarch/s_trunc.c: Include
	<libm-alias-double.h>.
	(trunc): Define using libm_alias_double.
	* sysdeps/x86_64/fpu/s_copysign.S: Include <libm-alias-double.h>.
	(copysign): Define using libm_alias_double.
	* sysdeps/x86_64/fpu/s_fabs.c: Include <libm-alias-double.h>.
	(fabs): Define using libm_alias_double.
	* sysdeps/x86_64/fpu/s_fmax.S: Include <libm-alias-double.h>.
	(fmax): Define using libm_alias_double.
	* sysdeps/x86_64/fpu/s_fmin.S: Include <libm-alias-double.h>.
	(fmin): Define using libm_alias_double.
	* sysdeps/x86_64/fpu/s_llrint.S: Include <libm-alias-double.h>.
	(llrint): Define using libm_alias_double.
	[!__ILP32__] (lrint): Likewise.
	* sysdeps/x86_64/x32/fpu/s_lrint.S: Include <libm-alias-double.h>.
	(lrint): Define using libm_alias_double.
2017-11-29 19:01:21 +00:00
Adhemerval Zanella 21bfcc3d24 sparc: refactor sparc64 rint{f} selector to C
This patch refactors the sparc64 ifunc selector to a C implementation.
Also, the generic symbol is moved to its own implementation file
s_rint{f}-generic.S).

Checked on sparc64-linux-gnu and sparcv9-linux-gnu.

	* sysdeps/sparc/sparc64/fpu/multiarch/Makefile
	(libm-sysdep_routines): Add s_rintf-generic and s_rint-generic
	objects.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_rint-generic.S: New file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_rint.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_rintf-generic.S: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_rintf.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_rint.S: Remove file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_rintf.S: Likewise.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-11-29 16:22:21 -02:00
Adhemerval Zanella 522228ddea sparc: refactor sparc64 lrint{f} selector to C
This patch refactors the sparc64 ifunc selector to a C implementation.
Also, the generic symbol is moved to its own implementation file
s_lrint{f}-generic.S).

Checked on sparc64-linux-gnu and sparcv9-linux-gnu.

	* sysdeps/sparc/sparc64/fpu/multiarch/Makefile
	(libm-sysdep_routines): Add s_lrint-generic and s_lrint-generic
	objects.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_lrint-generic.S: New file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_lrint.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf-generic.S: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_lrint.S: Remove file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_lrintf.S: Likewise.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-11-29 16:22:21 -02:00
Adhemerval Zanella 2a6f4fab24 sparc: refactor sparc64 nearbyint{f} selector to C
This patch refactors the sparc64 ifunc selector to a C implementation.
Also, the generic symbol is moved to its own implementation file
s_nearbyint{f}-generic.S).

Checked on sparc64-linux-gnu and sparcv9-linux-gnu.

	* sysdeps/sparc/sparc64/fpu/multiarch/Makefile
	(libm-sysdep_routines): Add s_nearbyint-generic and
	s_nearbyintf-generic objects.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyint-generic.S: New file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyint.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyintf-generic.S: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyintf.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyint.S: Remove file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_nearbyintf.S: Likewise.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-11-29 16:22:20 -02:00
Adhemerval Zanella 712b5b83e1 sparc: refactor sparc64 finite{f} selector to C
This patch refactors the sparc64 ifunc selector to a C implementation.
Also, the generic symbol is moved to its own implementation file
s_finite{f}-generic.S).

Checked on sparc64-linux-gnu and sparcv9-linux-gnu.

	* sysdeps/sparc/sparc64/fpu/multiarch/Makefile (sysdeps_calls):
	Add s_finitef-generic and s_finite-generic objects.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_finite-generic.S: New file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_finite.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_finitef-generic.S: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_finitef.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_finite.S: Remove file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_finitef.S: Remove file.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-11-29 16:22:20 -02:00
Adhemerval Zanella c96d3335a3 sparc: refactor sparc64 isinf{f} selector to C
This patch refactors the sparc64 ifunc selector to a C implementation.
Also, the generic symbol is moved to its own implementation file
s_isinf{f}-generic.S).

Checked on sparc64-linux-gnu and sparcv9-linux-gnu.

	* sysdeps/sparc/sparc64/fpu/multiarch/Makefile (sysdeps_calls):
	Add isinff-generic and s_isinf-generic objects.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_isinf-generic.S: New file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_isinf.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_isinff-generic.S: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_isinff.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_isinf.S: Remove file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_isinff.S: Likewise.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-11-29 16:22:20 -02:00
Adhemerval Zanella c6862a2371 sparc: refactor sparc64 isnan{f} selector to C
This patch refactors the sparc64 ifunc selector to a C implementation.
Also, the generic symbol is moved to its own implementation file
(s_isnan{f}-generic.S).

Checked on sparc64-linux-gnu and sparcv9-linux-gnu.

	* sysdeps/sparc/sparc64/fpu/multiarch/Makefile (sysdeps_calls):
	Add s_isnanf-generic and s_isnan-generic objects.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_isnan-generic.S: New file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_isnanf-generic.S: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_isnan.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_isnanf.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_isnan.S: Remove file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_isnanf.S: Likewise.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-11-29 16:22:15 -02:00
Adhemerval Zanella 1cbd7bfe65 sparc: refactor sparc64 signbit{f} selector to C
This patch refactors the sparc64 ifunc selector to a C implementation.
Also, the generic symbol is moved to its own implementation file
(s_signbit{f}-generic.S).

It also simplifies the multiarch Makefile by moving the common objects
from libm-sysdeps_routines and sysdeps_routines to a new sysdeps_call
rule and including it where required with the correct prefix.

Checked on sparc64-linux-gnu and sparcv9-linux-gnu.

	* sysdeps/sparc/sparc-ifunc.h (sparc_libm_ifunc_redirected): New
	macro.
	* sysdeps/sparc/sparc64/fpu/multiarch/Makefile (sysdep_calls): New
	rule.
	(sysdep_routines): Use sysdep_calls as base.
	(libm-sysdep_routines): Add generic rule for symbols shared with
	libc.  Add s_signbit-generic and s_signbitf-generic objects.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_signbit.c: New file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_signbit-generic.S: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf-generic.S: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_signbit.S: Remove file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf.S: Likewise.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-11-29 16:21:27 -02:00
Joseph Myers aa1142c593 Use libm_alias_float for ia64.
Continuing the preparation for additional _FloatN / _FloatNx function
aliases, this patch makes ia64 libm function implementations use
libm_alias_float to define function aliases.  The same approach is
followed as with the corresponding long double and double patches: the
ia64-specific macros are left unchanged, with calls to
libm_alias_float_other being added in most cases and libm_alias_float
itself being used in only a few places.

Tested with build-many-glibcs.py for ia64-linux-gnu that installed
stripped shared libraries are unchanged by the patch.

	* sysdeps/ia64/fpu/libm-symbols.h: Include <libm-alias-float.h>.
	* sysdeps/ia64/fpu/e_acosf.S (acosf): Use libm_alias_float_other.
	* sysdeps/ia64/fpu/e_acoshf.S (acoshf): Likewise.
	* sysdeps/ia64/fpu/e_asinf.S (asinf): Likewise.
	* sysdeps/ia64/fpu/e_atan2f.S (atan2f): Likewise.
	* sysdeps/ia64/fpu/e_atanhf.S (atanhf): Likewise.
	* sysdeps/ia64/fpu/e_coshf.S (coshf): Likewise.
	* sysdeps/ia64/fpu/e_exp10f.S (exp10f): Likewise.
	* sysdeps/ia64/fpu/e_exp2f.S (exp2f): Likewise.
	* sysdeps/ia64/fpu/e_expf.S (expf): Likewise.
	* sysdeps/ia64/fpu/e_fmodf.S (fmodf): Likewise.
	* sysdeps/ia64/fpu/e_hypotf.S (hypotf): Likewise.
	* sysdeps/ia64/fpu/e_lgammaf_r.c (lgammaf_r): Define using
	libm_alias_float_r.
	* sysdeps/ia64/fpu/e_log2f.S (log2f): Use libm_alias_float_other.
	* sysdeps/ia64/fpu/e_logf.S (log10f): Likewise.
	(logf): Likewise.
	* sysdeps/ia64/fpu/e_powf.S (powf): Likewise.
	* sysdeps/ia64/fpu/e_remainderf.S (remainderf): Likewise.
	* sysdeps/ia64/fpu/e_sinhf.S (sinhf): Likewise.
	* sysdeps/ia64/fpu/e_sqrtf.S (sqrtf): Likewise.
	* sysdeps/ia64/fpu/libm_sincosf.S (sincosf): Likewise.
	* sysdeps/ia64/fpu/s_asinhf.S (asinhf): Likewise.
	* sysdeps/ia64/fpu/s_atanf.S (atanf): Likewise.
	* sysdeps/ia64/fpu/s_cbrtf.S (cbrtf): Likewise.
	* sysdeps/ia64/fpu/s_ceilf.S (ceilf): Likewise.
	* sysdeps/ia64/fpu/s_copysign.S (copysignf): Define using
	libm_alias_float.
	* sysdeps/ia64/fpu/s_cosf.S (sinf): Use libm_alias_float_other.
	(cosf): Likewise.
	* sysdeps/ia64/fpu/s_erfcf.S (erfcf): Likewise.
	* sysdeps/ia64/fpu/s_erff.S (erff): Likewise.
	* sysdeps/ia64/fpu/s_expm1f.S (expm1f): Likewise.
	* sysdeps/ia64/fpu/s_fabsf.S (fabsf): Likewise.
	* sysdeps/ia64/fpu/s_fdimf.S (fdimf): Likewise.
	* sysdeps/ia64/fpu/s_floorf.S (floorf): Likewise.
	* sysdeps/ia64/fpu/s_fmaf.S (fmaf): Likewise.
	* sysdeps/ia64/fpu/s_fmaxf.S (fmaxf): Likewise.
	* sysdeps/ia64/fpu/s_frexpf.c (frexpf): Likewise.
	* sysdeps/ia64/fpu/s_ldexpf.c (ldexpf): Likewise.
	* sysdeps/ia64/fpu/s_log1pf.S (log1pf): Likewise.
	* sysdeps/ia64/fpu/s_logbf.S (logbf): Likewise.
	* sysdeps/ia64/fpu/s_modff.S (modff): Likewise.
	* sysdeps/ia64/fpu/s_nearbyintf.S (nearbyintf): Likewise.
	* sysdeps/ia64/fpu/s_nextafterf.S (nextafterf): Likewise.
	* sysdeps/ia64/fpu/s_rintf.S (rintf): Likewise.
	* sysdeps/ia64/fpu/s_roundf.S (roundf): Likewise.
	* sysdeps/ia64/fpu/s_scalblnf.c (scalblnf): Likewise.
	* sysdeps/ia64/fpu/s_scalbnf.c (scalbnf): Define using
	libm_alias_float.
	* sysdeps/ia64/fpu/s_tanf.S (tanf): Use libm_alias_float_other.
	* sysdeps/ia64/fpu/s_tanhf.S (tanhf): Likewise.
	* sysdeps/ia64/fpu/s_truncf.S (truncf): Likewise.
	* sysdeps/ia64/fpu/w_lgammaf_main.c
	[BUILD_LGAMMA && !USE_AS_COMPAT] (lgammaf): Likewise.
	* sysdeps/ia64/fpu/w_tgammaf_compat.S (tgammaf): Likewise.
2017-11-29 17:38:35 +00:00
Alexandre Oliva 8da25eec0a Collation fix: make forward accent sorting the default [BZ #17750]
[BZ #17750]
	* Makefile: add fr_CA.UTF-8 to test-input and LOCALES.
	* localedata/fr_CA.UTF-8.in: New file with test data for backward
	accents sorting.
	* localedata/fr_FR.UTF-8.in: Fix test data for forward accents
	sorting.
	* localedata/locales/cs_CZ (LC_COLLATE): Remove “define DIACRIT_FORWARD”
	* localedata/locales/de_DE (LC_COLLATE): Likewise.
	* localedata/locales/hu_HU (LC_COLLATE): Likewise.
	* localedata/locales/lb_LU (LC_COLLATE): Likewise.
	* localedata/locales/yuw_PG (LC_COLLATE): Likewise.
	* localedata/locales/fr_CA (LC_COLLATE): Add “define DIACRIT_BACKWARD”
	* localedata/locales/iso14651_t1_common: Use “ifdef DIACRIT_FORWARD”
	instead of “ifdef DIACRIT_BACKWARD”.

The only locale which currently needs backward accents sorting is fr_CA.
Therefore, forward accents sorting should be the default.

Before this patch, backwards accent sorting was the default and all
locales except fr_CA had to use

    define DIACRIT_FORWARD

before

    copy "iso14651_t1"

Most locales didn’t do that and thus got the inappropriate backwards accents sorting
by accident. Now only the fr_CA locale needs to use

    define DIACRIT_BACKWARD

before

    copy "iso14651_t1"

Original patch slightly modified by: Mike FABIAN <mfabian@redhat.com>
2017-11-29 11:56:46 +01:00
Adhemerval Zanella a55430cb0e sparc: Assume VIS3 support
This patch assumes VIS3 support by binutils, which is supported since
version 2.22.  This leads to some code simplification, mostly on
multiarch build where there is only one variant instead of previously
two (whether binutils supports VIS3 instructions or not).

For multiarch files where HAVE_AS_VIS3_SUPPORT was checked and
the default implementation was built with a different name, a new
file with (implementation with -generic appended) is added.

Checked on sparc64-linux-gnu and sparcv9-linux-gnu.

	* config.h.in (HAVE_AS_VIS3_SUPPORT): Remove check for VIS3 support.
	* sysdeps/sparc/configure.ac (HAVE_AS_VIS3_SUPPORT): Likewise.
	* sysdeps//sparc/sparc32/sparcv9/fpu/multiarch/s_fdim.c: Likewise.
	* sysdeps//sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf.c: Likewise.
	* sysdeps//sparc/sparc32/sparcv9/fpu/multiarch/s_fma.c: Likewise.
	* sysdeps//sparc/sparc32/sparcv9/fpu/multiarch/s_fmaf.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_ceil.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_floor.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_floorf.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_fma.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_fmaf.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_trunc.c: Likewise.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_truncf.c: Likewise.
	* sysdeps/sparc/sparc-ifunc.h [!HAVE_AS_VIS3_SUPPORT]
	(SPARC_ASM_VIS3_IFUNC, SPARC_ASM_VIS3_VIS2_IFUNC): Remove macros.
	* sysdeps/sparc/sparc32/sparcv9/Makefile [$(have-as-vis3) != yes]
	(ASFLAGS.o, ASFLAGS-.os, ASFLAGS-.op, ASFLAGS-.oS): Remove rules.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/Makefile
	($(have-as-vis3) == yes): Remove conditional.
	* sysdeps/sparc/sparc64/Makefile (($(have-as-vis3) == yes)):
	Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdim-generic.c: New
	file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fdimf-generic.c: New
	file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fma-generic.c: New
	file.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_fmaf-generic.c: New
	file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_ceil-generic.c: New file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_ceilf-generic.c: New file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_floor-generic.c: New file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_floorf-generic.c: New file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_fma-generic.c: New file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_fmaf-generic.c: New file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_trunc-generic.c: New file.
	* sysdeps/sparc/sparc64/fpu/multiarch/s_truncf-generic.c: New file.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-11-29 08:18:00 -02:00
Joseph Myers 0609ec0a74 Use libm_alias_double for ia64.
Continuing the preparation for additional _FloatN / _FloatNx function
aliases, this patch makes ia64 libm function implementations use
libm_alias_double to define function aliases.  The same approach is
followed as with the corresponding long double patch: the
ia64-specific macros are left unchanged, with calls to
libm_alias_double_other being added in most cases and
libm_alias_double itself being used in only a few places.

Tested with build-many-glibcs.py for ia64-linux-gnu that installed
stripped shared libraries are unchanged by the patch.

	* sysdeps/ia64/fpu/libm-symbols.h: Include <libm-alias-double.h>.
	* sysdeps/ia64/fpu/e_acos.S (acos): Use libm_alias_double_other.
	* sysdeps/ia64/fpu/e_acosh.S (acosh): Likewise.
	* sysdeps/ia64/fpu/e_asin.S (asin): Likewise.
	* sysdeps/ia64/fpu/e_atan2.S (atan2): Likewise.
	* sysdeps/ia64/fpu/e_atanh.S (atanh): Likewise.
	* sysdeps/ia64/fpu/e_cosh.S (cosh): Likewise.
	* sysdeps/ia64/fpu/e_exp.S (exp): Likewise.
	* sysdeps/ia64/fpu/e_exp10.S (exp10): Likewise.
	* sysdeps/ia64/fpu/e_exp2.S (exp2): Likewise.
	* sysdeps/ia64/fpu/e_fmod.S (fmod): Likewise.
	* sysdeps/ia64/fpu/e_hypot.S (hypot): Likewise.
	* sysdeps/ia64/fpu/e_lgamma_r.c (lgamma_r): Define using
	libm_alias_double_r.
	* sysdeps/ia64/fpu/e_log.S (log10): Use libm_alias_double_other.
	(log): Likewise.
	* sysdeps/ia64/fpu/e_log2.S (log2): Likewise.
	* sysdeps/ia64/fpu/e_pow.S (pow): Likewise.
	* sysdeps/ia64/fpu/e_remainder.S (remainder): Likewise.
	* sysdeps/ia64/fpu/e_sinh.S (sinh): Likewise.
	* sysdeps/ia64/fpu/e_sqrt.S (sqrt): Likewise.
	* sysdeps/ia64/fpu/libm_sincos.S (sincos): Likewise.
	* sysdeps/ia64/fpu/s_asinh.S (asinh): Likewise.
	* sysdeps/ia64/fpu/s_atan.S (atan): Likewise.
	* sysdeps/ia64/fpu/s_cbrt.S (cbrt): Likewise.
	* sysdeps/ia64/fpu/s_ceil.S (ceil): Likewise.
	* sysdeps/ia64/fpu/s_copysign.S (copysign): Define using
	libm_alias_double.
	* sysdeps/ia64/fpu/s_cos.S (sin): Use libm_alias_double_other.
	(cos): Likewise.
	* sysdeps/ia64/fpu/s_erf.S (erf): Likewise.
	* sysdeps/ia64/fpu/s_erfc.S (erfc): Likewise.
	* sysdeps/ia64/fpu/s_expm1.S (expm1): Likewise.
	* sysdeps/ia64/fpu/s_fabs.S (fabs): Likewise.
	* sysdeps/ia64/fpu/s_fdim.S (fdim): Likewise.
	* sysdeps/ia64/fpu/s_floor.S (floor): Likewise.
	* sysdeps/ia64/fpu/s_fma.S (fma): Likewise.
	* sysdeps/ia64/fpu/s_fmax.S (fmax): Likewise.
	* sysdeps/ia64/fpu/s_frexp.c (frexp): Likewise.
	* sysdeps/ia64/fpu/s_ldexp.c (ldexp): Likewise.
	* sysdeps/ia64/fpu/s_log1p.S (log1p): Likewise.
	* sysdeps/ia64/fpu/s_logb.S (logb): Likewise.
	* sysdeps/ia64/fpu/s_modf.S (modf): Likewise.
	* sysdeps/ia64/fpu/s_nearbyint.S (nearbyint): Likewise.
	* sysdeps/ia64/fpu/s_nextafter.S (nextafter): Likewise.
	* sysdeps/ia64/fpu/s_rint.S (rint): Likewise.
	* sysdeps/ia64/fpu/s_round.S (round): Likewise.
	* sysdeps/ia64/fpu/s_scalbn.c (scalbn): Define using
	libm_alias_double.
	* sysdeps/ia64/fpu/s_tan.S (tan): Use libm_alias_double_other.
	* sysdeps/ia64/fpu/s_tanh.S (tanh): Likewise.
	* sysdeps/ia64/fpu/s_trunc.S (trunc): Likewise.
	* sysdeps/ia64/fpu/w_lgamma_main.c
	[BUILD_LGAMMA && !USE_AS_COMPAT] (lgamma): Likewise.
	* sysdeps/ia64/fpu/w_tgamma_compat.S (tgamma): Likewise.
2017-11-29 01:23:23 +00:00
John David Anglin d5bfa34a53 Fix gmon static test failures.
* sysdeps/hppa/start.S (_start): Check PIC instead of SHARED.  Load
	address of $global$ into %dp register earlier.  Use pc-relative
	instruction sequence for PIC case.
2017-11-28 20:01:05 -05:00
Joseph Myers e4602cba2f Use libm_alias_float for i386.
Continuing the preparation for additional _FloatN / _FloatNx function
aliases, this patch makes i386 libm function implementations use
libm_alias_float (or libm_alias_float_other in cases where the main
symbol name is defined with versioned_symbol) to define function
aliases.

Tested with build-many-glibcs.py for all its i386 configurations that
installed stripped shared libraries are unchanged by the patch, as
well as running the full glibc testsuite for i686.

	* sysdeps/i386/fpu/s_asinhf.S: Include <libm-alias-float.h>.
	(asinhf): Define using libm_alias_float.
	* sysdeps/i386/fpu/s_atanf.S: Include <libm-alias-float.h>.
	(atanf): Define using libm_alias_float.
	* sysdeps/i386/fpu/s_cbrtf.S: Include <libm-alias-float.h>.
	(cbrtf): Define using libm_alias_float.
	* sysdeps/i386/fpu/s_ceilf.S: Include <libm-alias-float.h>.
	(ceilf): Define using libm_alias_float.
	* sysdeps/i386/fpu/s_copysignf.S: Include <libm-alias-float.h>.
	(copysignf): Define using libm_alias_float.
	* sysdeps/i386/fpu/s_expm1f.S: Include <libm-alias-float.h>.
	(expm1f): Define using libm_alias_float.
	* sysdeps/i386/fpu/s_fabsf.S: Include <libm-alias-float.h>.
	(fabsf): Define using libm_alias_float.
	* sysdeps/i386/fpu/s_floorf.S: Include <libm-alias-float.h>.
	(floorf): Define using libm_alias_float.
	* sysdeps/i386/fpu/s_fmaxf.S: Include <libm-alias-float.h>.
	(fmaxf): Define using libm_alias_float.
	* sysdeps/i386/fpu/s_fminf.S: Include <libm-alias-float.h>.
	(fminf): Define using libm_alias_float.
	* sysdeps/i386/fpu/s_frexpf.S: Include <libm-alias-float.h>.
	(frexpf): Define using libm_alias_float.
	* sysdeps/i386/fpu/s_llrintf.S: Include <libm-alias-float.h>.
	(llrintf): Define using libm_alias_float.
	* sysdeps/i386/fpu/s_logbf.S: Include <libm-alias-float.h>.
	(logbf): Define using libm_alias_float.
	* sysdeps/i386/fpu/s_lrintf.S: Include <libm-alias-float.h>.
	(lrintf): Define using libm_alias_float.
	* sysdeps/i386/fpu/s_nearbyintf.S: Include <libm-alias-float.h>.
	(nearbyintf): Define using libm_alias_float.
	* sysdeps/i386/fpu/s_remquof.S: Include <libm-alias-float.h>.
	(remquof): Define using libm_alias_float.
	* sysdeps/i386/fpu/s_rintf.S: Include <libm-alias-float.h>.
	(rintf): Define using libm_alias_float.
	* sysdeps/i386/fpu/s_truncf.S: Include <libm-alias-float.h>.
	(truncf): Define using libm_alias_float.
	* sysdeps/i386/i686/fpu/multiarch/e_exp2f.c: Include
	<libm-alias-float.h>.
	(exp2f): Define using libm_alias_float, or libm_alias_float_other
	if [SHARED].
	* sysdeps/i386/i686/fpu/multiarch/e_expf.c: Include
	<libm-alias-float.h>.
	(expf): Define using libm_alias_float, or libm_alias_float_other
	if [SHARED].
	* sysdeps/i386/i686/fpu/multiarch/e_log2f.c: Include
	<libm-alias-float.h>.
	(log2f): Define using libm_alias_float, or libm_alias_float_other
	if [SHARED].
	* sysdeps/i386/i686/fpu/multiarch/e_logf.c: Include
	<libm-alias-float.h>.
	(logf): Define using libm_alias_float, or libm_alias_float_other
	if [SHARED].
	* sysdeps/i386/i686/fpu/multiarch/e_powf.c: Include
	<libm-alias-float.h>.
	(powf): Define using libm_alias_float, or libm_alias_float_other
	if [SHARED].
	* sysdeps/i386/i686/fpu/multiarch/s_cosf.c: Include
	<libm-alias-float.h>.
	(cosf): Define using libm_alias_float.
	* sysdeps/i386/i686/fpu/multiarch/s_sincosf.c: Include
	<libm-alias-float.h>.
	(sincosf): Define using libm_alias_float.
	* sysdeps/i386/i686/fpu/multiarch/s_sinf.c: Include
	<libm-alias-float.h>.
	(sinf): Define using libm_alias_float.
	* sysdeps/i386/i686/fpu/s_fmaxf.S: Include <libm-alias-float.h>.
	(fmaxf): Define using libm_alias_float.
	* sysdeps/i386/i686/fpu/s_fminf.S: Include <libm-alias-float.h>.
	(fminf): Define using libm_alias_float.
	* sysdeps/i386/i686/multiarch/s_fmaf.c: Include
	<libm-alias-float.h>.
	(fmaf): Define using libm_alias_float.
2017-11-29 00:10:35 +00:00
Joseph Myers bc4e8f9b49 Use libm_alias_double for i386.
Continuing the preparation for additional _FloatN / _FloatNx function
aliases, this patch makes i386 libm function implementations use
libm_alias_double to define function aliases.

Tested with build-many-glibcs.py for all its i386 configurations that
installed stripped shared libraries are unchanged by the patch, as
well as running the full glibc testsuite for i686.

	* sysdeps/i386/fpu/s_asinh.S: Include <libm-alias-double.h>.
	(asinh): Define using libm_alias_double.
	* sysdeps/i386/fpu/s_atan.S: Include <libm-alias-double.h>.
	(atan): Define using libm_alias_double.
	* sysdeps/i386/fpu/s_cbrt.S: Include <libm-alias-double.h>.
	(cbrt): Define using libm_alias_double.
	* sysdeps/i386/fpu/s_ceil.S: Include <libm-alias-double.h>.
	(ceil): Define using libm_alias_double.
	* sysdeps/i386/fpu/s_copysign.S: Include <libm-alias-double.h>.
	(copysign): Define using libm_alias_double.
	* sysdeps/i386/fpu/s_expm1.S: Include <libm-alias-double.h>.
	(expm1): Define using libm_alias_double.
	* sysdeps/i386/fpu/s_fabs.S: Include <libm-alias-double.h>.
	(fabs): Define using libm_alias_double.
	* sysdeps/i386/fpu/s_fdim.c: Include <libm-alias-double.h>.
	(fdim): Define using libm_alias_double.
	* sysdeps/i386/fpu/s_floor.S: Include <libm-alias-double.h>.
	(floor): Define using libm_alias_double.
	* sysdeps/i386/fpu/s_fmax.S: Include <libm-alias-double.h>.
	(fmax): Define using libm_alias_double.
	* sysdeps/i386/fpu/s_fmin.S: Include <libm-alias-double.h>.
	(fmin): Define using libm_alias_double.
	* sysdeps/i386/fpu/s_frexp.S: Include <libm-alias-double.h>.
	(frexp): Define using libm_alias_double.
	* sysdeps/i386/fpu/s_llrint.S: Include <libm-alias-double.h>.
	(llrint): Define using libm_alias_double.
	* sysdeps/i386/fpu/s_logb.S: Include <libm-alias-double.h>.
	(logb): Define using libm_alias_double.
	* sysdeps/i386/fpu/s_lrint.S: Include <libm-alias-double.h>.
	(lrint): Define using libm_alias_double.
	* sysdeps/i386/fpu/s_nearbyint.S: Include <libm-alias-double.h>.
	(nearbyint): Define using libm_alias_double.
	* sysdeps/i386/fpu/s_remquo.S: Include <libm-alias-double.h>.
	(remquo): Define using libm_alias_double.
	* sysdeps/i386/fpu/s_rint.S: Include <libm-alias-double.h>.
	(rint): Define using libm_alias_double.
	* sysdeps/i386/fpu/s_trunc.S: Include <libm-alias-double.h>.
	(trunc): Define using libm_alias_double.
	* sysdeps/i386/i686/fpu/s_fmax.S: Include <libm-alias-double.h>.
	(fmax): Define using libm_alias_double.
	* sysdeps/i386/i686/fpu/s_fmin.S: Include <libm-alias-double.h>.
	(fmin): Define using libm_alias_double.
	* sysdeps/i386/i686/multiarch/s_fma.c: Include <libm-alias-double.h>.
	(fma): Define using libm_alias_double.
2017-11-28 18:15:44 +00:00
H.J. Lu 8d81ce0c6d Properly compute offsets of note descriptor and next note [BZ #22370]
A note header has 3 4-bytes fields, followed by note name and note
descriptor.  According to gABI, in a note entry, the note name field,
not note name size, is padded for the note descriptor.  And the note
descriptor field, not note descriptor size, is padded for the next
note entry.  Notes are aligned to 4 bytes in 32-bit objects and 8 bytes
in 64-bit objects.

For all GNU notes, the name is "GNU" which is 4 bytes.  They have the
same format in the first 16 bytes in both 32-bit and 64-bit objects.
They differ by note descriptor size and note type.  So far, .note.ABI-tag
and .note.gnu.build-id notes are always aligned to 4 bytes.  The exsting
codes compute the note size by aligning the note name size and note
descriptor size to 4 bytes.  It happens to produce the same value as
the actual note size by luck since the name size is 4 and offset of the
note descriptor is 16.  But it will produce the wrong size when note
alignment is 8 bytes in 64-bit objects.

This patch defines ELF_NOTE_DESC_OFFSET and ELF_NOTE_NEXT_OFFSET to
properly compute offsets of note descriptor and next note.  It uses
alignment of PT_NOTE segment to support both 4-byte and 8-byte note
alignments in 64-bit objects.  To handle PT_NOTE segments with
incorrect alignment, which may lead to an infinite loop, if segment
alignment is less than 4, we treate alignment as 4 bytes since some
note segments have 0 or 1 byte alignment.

	[BZ #22370]
	* elf/dl-hwcaps.c (ROUND): Removed.
	(_dl_important_hwcaps): Replace ROUND with ELF_NOTE_DESC_OFFSET
	and ELF_NOTE_NEXT_OFFSET.
	* elf/dl-load.c (ROUND): Removed.
	(open_verify): Replace ROUND with ELF_NOTE_NEXT_OFFSET.
	* elf/readelflib.c (ROUND): Removed.
	(process_elf_file): Replace ROUND with ELF_NOTE_NEXT_OFFSET.
	* include/elf.h [!_ISOMAC]: Include <libc-pointer-arith.h>.
	[!_ISOMAC] (ELF_NOTE_DESC_OFFSET): New.
	[!_ISOMAC] (ELF_NOTE_NEXT_OFFSET): Likewise.
2017-11-28 09:57:00 -08:00
Joseph Myers 313ba4630f Use libm_alias_float for s390.
Continuing the preparation for additional _FloatN / _FloatNx function
aliases, this patch makes an s390 libm function implementation use
libm_alias_float to define function aliases.

Tested with build-many-glibcs.py for s390-linux-gnu and
s390x-linux-gnu that installed stripped shared libraries are unchanged
by the patch.

	* sysdeps/s390/fpu/s_fmaf.c: Include <libm-alias-float.h>.
	[!__fmaf] (fmaf): Define using libm_alias_float.
2017-11-28 17:34:13 +00:00
Joseph Myers 6940bd966b Use libm_alias_double for s390.
Continuing the preparation for additional _FloatN / _FloatNx function
aliases, this patch makes s390 libm function implementations use
libm_alias_double to define function aliases.  This allows
sysdeps/unix/sysv/linux/s390/fpu/s_fma.c to be removed, as
libm_alias_double handles symbol versioning for long double compat
symbols.

Tested with build-many-glibcs.py for s390-linux-gnu and
s390x-linux-gnu that installed stripped shared libraries are unchanged
by the patch.

	* sysdeps/s390/fpu/s_fma.c: Include <libm-alias-double.h>.
	[!__fma] (fma): Define using libm_alias_double.
	* sysdeps/unix/sysv/linux/s390/fpu/s_fma.c: Remove.
2017-11-28 17:18:20 +00:00
Mike FABIAN 22c69b6ad6 Add the Changelog entry for “cs_CZ locale: Base collation on iso14651_t1 [BZ #22336]” 2017-11-28 16:46:11 +01:00
Siddhesh Poyarekar 8d7d3ba8c5 localedata: Remove duplicate cs_CZ from LOCALES
The LOCALES variable in the localedata had two instances of cs_CZ
which generated the following warning:

../gen-locales.mk:11: target '/opt/build/localedata/cs_CZ.UTF-8/LC_CTYPE' given more than once in the same rule

Dropped the duplicate entry.
2017-11-28 20:04:31 +05:30
Victor Rodriguez 0422ed1e84 benchtests: Enable BENCHSET to run subset of tests
This patch adds BENCHSET variable to benchtests/Makefile in order to
provide the capability to run a list of subsets of benchmark tests, ie;

    make bench BENCHSET="bench-pthread bench-math malloc-thread"

This helps users to benchmark specific glibc area

ChangeLog:

        * benchtests/Makefile:Add BENCHSET to allow subsets of
        benchmarks to be run.
        * benchtests/README: Add documentation for: Running subsets of
        benchmarks.

Signed-off-by: Victor Rodriguez <victor.rodriguez.bahena@intel.com>
Signed-off-by: Icarus Sparry <icarus.w.sparry@intel.com>
Reviewed-By: Siddhesh Poyarekar <siddhesh@sourceware.org>
2017-11-28 19:57:46 +05:30
Victor Rodriguez d5090db30e benchtests: Expand range of tests names in schema.json
When executing bench-math the benchmark output is invalid with this
error msg:

    Invalid benchmark output: 'workload-spec2006.wrf' does not match any of
    the regexes: '^[_a-zA-Z0-9]*$¹ or Invalid benchmark output: Additional
    properties are not allowed ('workload-spec2006.wrf' was unexpected)

The error was seen when running the test:
workload-spec2006.wrf, 'stack=1024,guard=1' and 'stack=1024,guard=2'.
The problem is that the current regex's do not accept the hyphen, dot, equal
and comma in the output.

This patch changes the regex in benchout.schema.json to accept symbols in
benchmark tests names.

ChangeLog:

        * benchtests/scripts/benchout.schema.json: Fix regex to accept a
        wider range of tests names.

Signed-off-by: Victor Rodriguez <victor.rodriguez.bahena@intel.com>
Reviewed-By: Siddhesh Poyarekar <siddhesh@sourceware.org>
2017-11-28 19:52:57 +05:30
Victor Rodriguez 0595e36034 benchtests: Adjust valid and accepted properties
Benchmark workload-spec2006.wrf does not produce max, min or mean
results but instead produce throughput. This is represented in
benchtests/bench-skeleton.c. This patch adjust benchout.schema.json to consider
bench.out from bench-math benchmarks as valid

ChangeLog:

	* benchtests/scripts/benchout.schema.json: Add throughput as accepted
	result from property and remove "max", min" and "mean" from required
	properties based on benchtests/bench-skeleton.c.

Signed-off-by: Victor Rodriguez <victor.rodriguez.bahena@intel.com>
Reviewed-By: Siddhesh Poyarekar <siddhesh@sourceware.org>
2017-11-28 19:49:59 +05:30
Florian Weimer b4c645c2f5 posix: Make tst-getaddrinfo[45] xtests due to DNS dependency [BZ #20826]
These tests need a working Internet connection with DNS.

We have additional coverage of getaddrinfo through the resolv tests, so
the loss of default test coverage seems acceptable.
2017-11-28 12:20:01 +01:00
Adhemerval Zanella 6905656404 sparc: Implement memset/bzero ifunc selection in C
This patch refactor the SPARC64 ifunc selector to a C implementation.
No functional change is expected, including ifunc resolution rules.

Checked on sparc64-linux-gnu, sparcv9-linux-gnu and x86_64-linux-gnu.

	* sysdeps/sparc/sparc32/sparcv9/multiarch/Makefile
	[$(subdir) = string] (sysdep_routines): Add memset-ultra1.
	* sysdeps/sparc/sparc64/multiarch/Makefile [$(subdir) = string]
	(sysdep_routines): Add memset-ultra1.
	* sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S: New
	file.
	* sysdeps/sparc/sparc32/sparcv9/multiarch/memset.c: Likewise.
	* sysdeps/sparc/sparc32/sparcv9/multiarch/bzero.c: Likewise.
	* sysdeps/sparc/sparc64/multiarch/ifunc-memset.h: Likewise.
	* sysdeps/sparc/sparc64/multiarch/memset-ultra1.S: Likewise.
	* sysdeps/sparc/sparc64/multiarch/memset.c: Likewise.
	* sysdeps/sparc/sparc64/multiarch/bzero.c: Likewise.
	* sysdeps/sparc/sparc32/sparcv9/multiarch/memset.S: Remove file.
	* sysdeps/sparc/sparc64/multiarch/memset.S: Likewise.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-11-28 08:53:15 -02:00
Adhemerval Zanella 88684de7a6 sparc: Implement memcpy/mempcpy ifunc selection in C
This patch refactor the SPARC64 ifunc selector to a C implementation.
The x86_64 implementation is used as default, which resulted in common
definitions (ifunc-init.h) used on both architectures.  No functional
change is expected, including ifunc resolution rules.

Checked on sparc64-linux-gnu, sparcv9-linux-gnu and x86_64-linux-gnu.

	* sysdeps/sparc/sparc32/sparcv9/multiarch/memcpy-ultra1.S: New
	file.
	* sysdeps/sparc/sparc32/sparcv9/multiarch/memcpy.c: Likewise.
	* sysdeps/sparc/sparc32/sparcv9/multiarch/mempcpy.c: Likewise.
	* sysdeps/sparc/sparc64/multiarch/ifunc-memcpy.h: Likewise.
	* sysdeps/sparc/sparc64/multiarch/memcpy-ultra1.S: Likewise.
	* sysdeps/sparc/sparc64/multiarch/memcpy.c: Likewise.
	* sysdeps/sparc/sparc64/multiarch/mempcpy.c: Likewise.
	* sysdeps/sparc/sparc-ifunc.h (sparc_libc_ifunc_redirected): New
	macro.
	* sysdeps/sparc/sparc32/sparcv9/multiarch/Makefile
	[$(subdir) = string] (sysdep_routines): Add memcpy-ultra1.
	* sysdeps/sparc/sparc64/multiarch/Makefile [$(subdir) = string]
	(sysdep_routines): Add memcpy-ultra1.
	* sysdeps/sparc/sparc64/multiarch/memcpy.S: Remove file.
	* sysdeps/sparc/sparc32/sparcv9/multiarch/memcpy.S: Likewise.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-11-28 08:53:15 -02:00
Joseph Myers f433d0b3bb Use libm_alias_float for alpha.
Continuing the preparation for additional _FloatN / _FloatNx function
aliases, this patch makes alpha libm function implementations use
libm_alias_float macros to define function aliases.  In the case of
the ABI compatibility for complex functions, libm_alias_float_other is
used, with the cfloat_versions macro adjusted to take a function name
argument without the trailing 'f' to facilitate this, and
cfloat_versions dealing with calling libm_alias_float_other (except
for clog10f, which doesn't use that macro because of the complexity
associated with __clog10f also being exported).

Tested with build-many-glibcs.py for alpha-linux-gnu that installed
stripped shared libraries are unchanged by the patch.

	* sysdeps/alpha/fpu/cfloat-compat.h: Include <libm-alias-float.h>.
	(cfloat_versions): Take function argument without trailing 'f'.
	Call libm_alias_float_other.
	* sysdeps/alpha/fpu/cabsf.c: Update call to cfloat_versions.
	* sysdeps/alpha/fpu/cargf.c: Likewise.
	* sysdeps/alpha/fpu/cimagf.c: Likewise.
	* sysdeps/alpha/fpu/conjf.c: Likewise.
	* sysdeps/alpha/fpu/crealf.c: Likewise.
	* sysdeps/alpha/fpu/s_cacosf.c: Likewise.
	* sysdeps/alpha/fpu/s_cacoshf.c: Likewise.
	* sysdeps/alpha/fpu/s_casinf.c: Likewise.
	* sysdeps/alpha/fpu/s_casinhf.c: Likewise.
	* sysdeps/alpha/fpu/s_catanf.c: Likewise.
	* sysdeps/alpha/fpu/s_catanhf.c: Likewise.
	* sysdeps/alpha/fpu/s_ccosf.c: Likewise.
	* sysdeps/alpha/fpu/s_ccoshf.c: Likewise.
	* sysdeps/alpha/fpu/s_cexpf.c: Likewise.
	* sysdeps/alpha/fpu/s_clogf.c: Likewise.
	* sysdeps/alpha/fpu/s_cpowf.c: Likewise.
	* sysdeps/alpha/fpu/s_cprojf.c: Likewise.
	* sysdeps/alpha/fpu/s_csinf.c: Likewise.
	* sysdeps/alpha/fpu/s_csinhf.c: Likewise.
	* sysdeps/alpha/fpu/s_csqrtf.c: Likewise.
	* sysdeps/alpha/fpu/s_ctanf.c: Likewise.
	* sysdeps/alpha/fpu/s_ctanhf.c: Likewise.
	* sysdeps/alpha/fpu/s_clog10f.c: Include <libm-alias-float.h>.
	(clog10f): Use libm_alias_float_other.
	* sysdeps/alpha/fpu/s_ceilf.c: Include <libm-alias-float.h>.
	(ceilf): Define using libm_alias_float.
	* sysdeps/alpha/fpu/s_copysignf.c: Include <libm-alias-float.h>.
	(copysignf): Define using libm_alias_float.
	* sysdeps/alpha/fpu/s_fabsf.c: Include <libm-alias-float.h>.
	(fabsf): Define using libm_alias_float.
	* sysdeps/alpha/fpu/s_floorf.c: Include <libm-alias-float.h>.
	(floorf): Define using libm_alias_float.
	* sysdeps/alpha/fpu/s_fmax.S: Include <libm-alias-float.h>.
	(fmaxf): Define using libm_alias_float.
	* sysdeps/alpha/fpu/s_fmin.S: Include <libm-alias-float.h>.
	(fminf): Define using libm_alias_float.
	* sysdeps/alpha/fpu/s_lrintf.c: Include <libm-alias-float.h>.
	(lrintf): Define using libm_alias_float.
	(llrintf): Likewise.
	* sysdeps/alpha/fpu/s_lroundf.c: Include <libm-alias-float.h>.
	(lroundf): Define using libm_alias_float.
	(llroundf): Likewise.
	* sysdeps/alpha/fpu/s_rintf.c: Include <libm-alias-float.h>.
	(rintf): Define using libm_alias_float.
	* sysdeps/alpha/fpu/s_truncf.c: Include <libm-alias-float.h>.
	(truncf): Define using libm_alias_float.
2017-11-28 01:19:03 +00:00
Joseph Myers 15ff490014 Use libm_alias_float for aarch64.
Continuing the preparation for additional _FloatN / _FloatNx function
aliases, this patch makes aarch64 libm function implementations use
libm_alias_float to define function aliases.

Tested with build-many-glibcs.py for aarch64-linux-gnu that installed
stripped shared libraries are unchanged by the patch.

	* sysdeps/aarch64/fpu/s_ceilf.c: Include <libm-alias-float.h>.
	(ceilf): Define using libm_alias_float.
	* sysdeps/aarch64/fpu/s_floorf.c: Include <libm-alias-float.h>.
	(floorf): Define using libm_alias_float.
	* sysdeps/aarch64/fpu/s_fmaf.c: Include <libm-alias-float.h>.
	(fmaf): Define using libm_alias_float.
	* sysdeps/aarch64/fpu/s_fmaxf.c: Include <libm-alias-float.h>.
	(fmaxf): Define using libm_alias_float.
	* sysdeps/aarch64/fpu/s_fminf.c: Include <libm-alias-float.h>.
	(fminf): Define using libm_alias_float.
	* sysdeps/aarch64/fpu/s_llrintf.c: Include <libm-alias-float.h>.
	(llrintf): Define using libm_alias_float.
	* sysdeps/aarch64/fpu/s_llroundf.c: Include <libm-alias-float.h>.
	(llroundf): Define using libm_alias_float.
	* sysdeps/aarch64/fpu/s_lrintf.c: Include <libm-alias-float.h>.
	(lrintf): Define using libm_alias_float.
	* sysdeps/aarch64/fpu/s_lroundf.c: Include <libm-alias-float.h>.
	(lroundf): Define using libm_alias_float.
	* sysdeps/aarch64/fpu/s_nearbyintf.c: Include
	<libm-alias-float.h>.
	(nearbyintf): Define using libm_alias_float.
	* sysdeps/aarch64/fpu/s_rintf.c: Include <libm-alias-float.h>.
	(rintf): Define using libm_alias_float.
	* sysdeps/aarch64/fpu/s_roundf.c: Include <libm-alias-float.h>.
	(roundf): Define using libm_alias_float.
	* sysdeps/aarch64/fpu/s_truncf.c: Include <libm-alias-float.h>.
	(truncf): Define using libm_alias_float.
2017-11-28 00:55:42 +00:00
Joseph Myers 5de606387b Use libm_alias_double for alpha.
Continuing the preparation for additional _FloatN / _FloatNx function
aliases, this patch makes alpha libm function implementations use
libm_alias_double to define function aliases.  This also simplifies
the code because the compatibility for long double = double is handled
by libm_alias_double instead of locally in each source file.

Tested with build-many-glibcs.py for alpha-linux-gnu that installed
stripped shared libraries are unchanged by the patch.

	* sysdeps/alpha/fpu/s_ceil.c: Include <libm-alias-double.h>.
	(ceil): Define using libm_alias_double.
	* sysdeps/alpha/fpu/s_copysign.c: Include <libm-alias-double.h>.
	(copysign): Define using libm_alias_double.
	* sysdeps/alpha/fpu/s_fabs.c: Include <libm-alias-double.h>.
	(fabs): Define using libm_alias_double.
	* sysdeps/alpha/fpu/s_floor.c: Include <libm-alias-double.h>.
	(floor): Define using libm_alias_double.
	* sysdeps/alpha/fpu/s_fmax.S: Include <libm-alias-double.h>.
	(fmax): Define using libm_alias_double.
	* sysdeps/alpha/fpu/s_fmin.S: Include <libm-alias-double.h>.
	(fmin): Define using libm_alias_double.
	* sysdeps/alpha/fpu/s_lrint.c: Include <libm-alias-double.h>.
	(lrint): Define using libm_alias_double.
	(llrint): Likewise.
	* sysdeps/alpha/fpu/s_lround.c: Include <libm-alias-double.h>.
	(lround): Define using libm_alias_double.
	(llround): Likewise.
	* sysdeps/alpha/fpu/s_rint.c: Include <libm-alias-double.h>.
	(rint): Define using libm_alias_double.
	* sysdeps/alpha/fpu/s_trunc.c: Include <libm-alias-double.h>.
	(trunc): Define using libm_alias_double.
2017-11-28 00:07:56 +00:00
Joseph Myers d812486444 Support ldbl-opt libm_alias_double use from .S files.
This patch makes the ldbl-opt libm_alias_double implementation support
use from .S sources, by adding a semicolon after its use of
weak_alias.

Tested (compilation only) with build-many-glibcs.py for
alpha-linux-gnu, in conjunction with a patch introducing uses of
libm_alias_double in alpha .S files.

	* sysdeps/ieee754/ldbl-opt/libm-alias-double.h
	(libm_alias_double_r): Add semicolon after weak_alias call.
2017-11-28 00:01:11 +00:00
Joseph Myers f07d2ec8c0 Use libm_alias_double for aarch64.
Continuing the preparation for additional _FloatN / _FloatNx function
aliases, this patch makes aarch64 libm function implementations use
libm_alias_double to define function aliases.

Tested with build-many-glibcs.py for aarch64-linux-gnu that installed
stripped shared libraries are unchanged by the patch.

	* sysdeps/aarch64/fpu/s_ceil.c: Include <libm-alias-double.h>.
	(ceil): Define using libm_alias_double.
	* sysdeps/aarch64/fpu/s_floor.c: Include <libm-alias-double.h>.
	(floor): Define using libm_alias_double.
	* sysdeps/aarch64/fpu/s_fma.c: Include <libm-alias-double.h>.
	(fma): Define using libm_alias_double.
	* sysdeps/aarch64/fpu/s_fmax.c: Include <libm-alias-double.h>.
	(fmax): Define using libm_alias_double.
	* sysdeps/aarch64/fpu/s_fmin.c: Include <libm-alias-double.h>.
	(fmin): Define using libm_alias_double.
	* sysdeps/aarch64/fpu/s_llrint.c: Include <libm-alias-double.h>.
	(llrint): Define using libm_alias_double.
	* sysdeps/aarch64/fpu/s_llround.c: Include <libm-alias-double.h>.
	(llround): Define using libm_alias_double.
	* sysdeps/aarch64/fpu/s_lrint.c: Include <libm-alias-double.h>.
	(lrint): Define using libm_alias_double.
	* sysdeps/aarch64/fpu/s_lround.c: Include <libm-alias-double.h>.
	(lround): Define using libm_alias_double.
	* sysdeps/aarch64/fpu/s_nearbyint.c: Include <libm-alias-double.h>.
	(nearbyint): Define using libm_alias_double.
	* sysdeps/aarch64/fpu/s_rint.c: Include <libm-alias-double.h>.
	(rint): Define using libm_alias_double.
	* sysdeps/aarch64/fpu/s_round.c: Include <libm-alias-double.h>.
	(round): Define using libm_alias_double.
	* sysdeps/aarch64/fpu/s_trunc.c: Include <libm-alias-double.h>.
	(trunc): Define using libm_alias_double.
2017-11-27 23:54:32 +00:00
Florian Weimer 4bab02240e Implement the mlock2 function
Fallback using mlock is provided if the flags argument is zero.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-11-27 17:14:29 +01:00
Joseph Myers a23aa5b727 Add _Float64x function aliases.
This patch continues filling out TS 18661-3 support by adding *f64x
function aliases on platforms with _Float64x support.  (It so happens
the set of such platforms is exactly the same as the set of platforms
with _Float128 support, although on x86_64, x86 and ia32 the _Float64x
format is Intel extended rather than binary128.)  The API provided
corresponds exactly to that provided for _Float128, mostly coming from
TS 18661-3.  As these functions always alias those for another type
(long double, _Float128 or both), __* function names are not provided,
as in other cases of alias types.

Given the preparation done in previous patches, this one just enables
the feature via Makeconfig and bits/floatn.h, adds symbol versions,
and updates documentation and ABI baselines.  The symbol versions are
present unconditionally as GLIBC_2.27 in the relevant Versions files,
as it's OK for those to specify versions for functions that may not be
present in some configurations; no additional complexity is needed
unless in future some configuration gains support for this type that
didn't have such support in 2.27.  The Makeconfig additions for ia64
and x86 aren't strictly needed, as those configurations also get
float64x-alias-fcts definitions from
sysdeps/ieee754/float128/Makeconfig, but still seem appropriate given
that _Float64x is not _Float128 for those configurations.

A libm-test-ulps update for x86 is included.  This is because
bits/mathinline.h does not have _Float64x support added and for two
functions the use of out-of-line functions results in increased ulps
(ifloat64x shares ulps with ildouble / ifloat128 as appropriate).
Given that we'd like generally to eliminate bits/mathinline.h
optimizations, preferring to have such optimizations in GCC instead,
it seems reasonable not to add such support there for new types.  GCC
support for _FloatN / _FloatNx built-in functions is limited, but has
been improved in GCC 8, and at some point I hope the full set of libm
built-in functions in GCC, and other optimizations with
per-floating-type aspects, will be enabled for all _FloatN / _FloatNx
types.

Tested for x86_64 and x86, and with build-many-glibcs.py, with both
GCC 6 and GCC 7.

	* sysdeps/ia64/Makeconfig (float64x-alias-fcts): New variable.
	* sysdeps/ieee754/float128/Makeconfig (float64x-alias-fcts):
	Likewise.
	* sysdeps/ieee754/ldbl-128/Makeconfig (float64x-alias-fcts):
	Likewise.
	* sysdeps/x86/Makeconfig: New file.
	* bits/floatn-common.h (__HAVE_FLOAT64X): Remove macro.
	(__HAVE_FLOAT64X_LONG_DOUBLE): Likewise.
	* bits/floatn.h (__HAVE_FLOAT64X): New macro.
	(__HAVE_FLOAT64X_LONG_DOUBLE): Likewise.
	* sysdeps/ia64/bits/floatn.h (__HAVE_FLOAT64X): Likewise.
	(__HAVE_FLOAT64X_LONG_DOUBLE): Likewise.
	* sysdeps/ieee754/ldbl-128/bits/floatn.h (__HAVE_FLOAT64X):
	Likewise.
	(__HAVE_FLOAT64X_LONG_DOUBLE): Likewise.
	* sysdeps/mips/ieee754/bits/floatn.h (__HAVE_FLOAT64X): Likewise.
	(__HAVE_FLOAT64X_LONG_DOUBLE): Likewise.
	* sysdeps/powerpc/bits/floatn.h (__HAVE_FLOAT64X): Likewise.
	(__HAVE_FLOAT64X_LONG_DOUBLE): Likewise.
	* sysdeps/x86/bits/floatn.h (__HAVE_FLOAT64X): Likewise.
	(__HAVE_FLOAT64X_LONG_DOUBLE): Likewise.
	* manual/math.texi (Mathematics): Document support for _Float64x.
	* math/Versions (GLIBC_2.27): Add _Float64x functions.
	* stdlib/Versions (GLIBC_2.27): Likewise.
	* wcsmbs/Versions (GLIBC_2.27): Likewise.
	* sysdeps/unix/sysv/linux/aarch64/libc.abilist: Update.
	* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/alpha/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/i386/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/ia64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
	* sysdeps/i386/fpu/libm-test-ulps: Likewise.
	* sysdeps/i386/i686/fpu/multiarch/libm-test-ulps: Likewise.
2017-11-27 14:16:47 +00:00
Andreas Schwab c2c299fd24 Consolidate link map sorting
Combine the four places where link maps are sorted into a single function.
This also moves the logic to skip the first map (representing the main
binary) to the callers.
2017-11-27 11:37:19 +01:00
Joseph Myers de61465c04 Use libm_alias_float128 more in sysdeps/ieee754/float128.
This patch uses libm_alias_float128 in place of weak_alias more in
sysdeps/ieee754/float128, in preparation for defining _Float64x
aliases when appropriate.

Tested for x86_64, and for powerpc64le (compilation only) with
build-many-glibcs.py in conjunction with _Float64x support patches.

	* sysdeps/ieee754/float128/s_fromfpf128.c (fromfpf128): Define
	using libm_alias_float128.
	* sysdeps/ieee754/float128/s_fromfpxf128.c (fromfpxf128):
	Likewise.
	* sysdeps/ieee754/float128/s_setpayloadf128.c (setpayloadf128):
	Likewise.
	* sysdeps/ieee754/float128/s_setpayloadsigf128.c
	(setpayloadsigf128): Likewise.
	* sysdeps/ieee754/float128/s_ufromfpf128.c (ufromfpf128):
	Likewise.
	* sysdeps/ieee754/float128/s_ufromfpxf128.c (ufromfpxf128):
	Likewise.
2017-11-24 23:53:54 +00:00
Joseph Myers 9ae6d171bc Use -mfloat128 for _Float64x tests for powerpc64le.
Supporting _Float64x on powerpc64le means that tests of that type need
to use -mfloat128 just like tests of _Float128.  This patch adds the
necessary uses of that option.

Tested (compilation only) for powerpc64le with build-many-glibcs.py,
in conjunction with _Float64x support patches.

	* sysdeps/powerpc/powerpc64le/Makefile ($(foreach
	suf,$(all-object-suffixes),$(objpfx)test-float64x%$(suf))): Add
	-mfloat128 to CFLAGS.
	($(foreach
	suf,$(all-object-suffixes),$(objpfx)test-ifloat64x%$(suf))):
	Likewise.
	(CFLAGS-libm-test-support-float64x.c): New variable.
	($(objpfx)test-float64x% $(objpfx)test-ifloat64x%): Add
	$(f128-loader-link) to gnulib-tests.
2017-11-24 23:38:51 +00:00
Joseph Myers 6e70d156c7 Support _Float64x in libm_alias macros.
This patch adds support for libm_alias_ldouble and libm_alias_float128
to create *f64x function aliases when appropriate.

Making such aliases work for functions defined in assembly sources
requires adding some semicolons after weak_alias calls in alias macro
definitions.  For C, semicolons are already present in the macros
called when required, but a GNU C extension allows excess semicolons
at file scope in a source file (and glibc already uses this), so it is
OK to have extra semicolons present in the macro definitions.  For
assembly sources, making multiple alias macro calls from a single
macro expansion means there are no newlines between the calls, so an
explicit separator is needed.  If hppa were to have .S sources in
libm, a more complicated approach would be needed that used
ASM_LINE_SEP when building assembly sources but not for C, but right
now there are no such sources so just using a semicolon (as already
present unconditionally in some such macro expansions) suffices.

Tested for x86_64, including in conjunction with _Float64x support
patches.

	* sysdeps/generic/libm-alias-float128.h: Include <bits/floatn.h>.
	(libm_alias_float128_other_r): If
	[__HAVE_FLOAT64X && !__HAVE_FLOAT64X_LONG_DOUBLE], define f64x
	alias.
	(libm_alias_float128_r): Add semicolon after weak_alias call.
	* sysdeps/generic/libm-alias-ldouble.h
	(libm_alias_ldouble_other_r_f128): New macro.
	(libm_alias_ldouble_other_r_f64x): Likewise.
	(libm_alias_ldouble_other_r): Use libm_alias_ldouble_other_r_f128
	and libm_alias_ldouble_other_r_f64x.
	(libm_alias_ldouble_r): Add semicolon after weak_alias call.
	* sysdeps/ieee754/ldbl-opt/libm-alias-ldouble.h
	(libm_alias_ldouble_other_r_f128): New macro.
	(libm_alias_ldouble_other_r_f64x): Likewise.
	(libm_alias_ldouble_other_r): Use libm_alias_ldouble_other_r_f128
	and libm_alias_ldouble_other_r_f64x.
2017-11-24 23:33:14 +00:00
Joseph Myers df2806cdb5 Support strfromf64x alias.
This patch adds support for defining strfromf64x as a function alias
(of strfroml or strfromf128, as appropriate) when _Float64x is
supported.

Tested for x86_64, including in conjunction with _Float64x support
patches, and also tested build for other configurations (in
conjunction with _Float64x support patches) with build-many-glibcs.py
to cover the various different files needing updating to define these
aliases.

	* stdlib/strfroml.c: Always include <stdlib.h>.
	[__HAVE_FLOAT64X_LONG_DOUBLE] (strfromf64x): Define and later
	undefine as macro and define as weak alias.
	* sysdeps/ieee754/float128/strfromf128.c: Include <bits/floatn.h>.
	[__HAVE_FLOAT64X && !__HAVE_FLOAT64X_LONG_DOUBLE]: Include
	<stdlib.h>.
	[__HAVE_FLOAT64X && !__HAVE_FLOAT64X_LONG_DOUBLE] (strfromf64x):
	Define and later undefine as macro and define as weak alias.
2017-11-24 23:12:30 +00:00
Joseph Myers 0df4fe3557 Support strtof64x, wcstof64x aliases.
This patch adds support for defining strtof64x, strtof64x_l, wcstof64
and wcstof64x_l function aliases when _Float64x is supported.

Tested for x86_64, including in conjunction with _Float64x support
patches, and also tested build for other configurations (in
conjunction with _Float64x support patches) with build-many-glibcs.py
to cover the various different files needing updating to define these
aliases.

	* stdlib/strtold.c [__HAVE_FLOAT64X_LONG_DOUBLE] (strtof64x):
	Define and later undefine as macro.  Define as weak alias if
	[!USE_WIDE_CHAR].
	[__HAVE_FLOAT64X_LONG_DOUBLE] (wcstof64x): Define and later
	undefine as macro.  Define as weak alias if [USE_WIDE_CHAR].
	* sysdeps/ieee754/float128/strtof128.c: Include <bits/floatn.h>.
	[__HAVE_FLOAT64X && !__HAVE_FLOAT64X_LONG_DOUBLE] (strtof64x):
	Define and later undefine as macro.  Define as weak alias if
	[!USE_WIDE_CHAR].
	[__HAVE_FLOAT64X && !__HAVE_FLOAT64X_LONG_DOUBLE] (wcstof64x):
	Define and later undefine as macro.  Define as weak alias if
	[USE_WIDE_CHAR].
	* sysdeps/ieee754/float128/strtof128_l.c
	[__HAVE_FLOAT64X && !__HAVE_FLOAT64X_LONG_DOUBLE] (strtof64x_l):
	Define and later undefine as macro.  Define as weak alias if
	[!USE_WIDE_CHAR].
	[__HAVE_FLOAT64X && !__HAVE_FLOAT64X_LONG_DOUBLE] (wcstof64x_l):
	Define and later undefine as macro.  Define as weak alias if
	[USE_WIDE_CHAR].
	* sysdeps/ieee754/ldbl-128/strtold_l.c
	[__HAVE_FLOAT64X_LONG_DOUBLE] (strtof64x_l): Define and later
	undefine as macro.  Define as weak alias if [!USE_WIDE_CHAR].
	[__HAVE_FLOAT64X_LONG_DOUBLE] (wcstof64x_l): Define and later
	undefine as macro.  Define as weak alias if [USE_WIDE_CHAR].
	* sysdeps/ieee754/ldbl-64-128/strtold_l.c
	[__HAVE_FLOAT64X_LONG_DOUBLE] (strtof64x_l): Define and later
	undefine as macro.  Define as weak alias if [!USE_WIDE_CHAR].
	[__HAVE_FLOAT64X_LONG_DOUBLE] (wcstof64x_l): Define and later
	undefine as macro.  Define as weak alias if [USE_WIDE_CHAR].
	* sysdeps/ieee754/ldbl-96/strtold_l.c
	[__HAVE_FLOAT64X_LONG_DOUBLE] (strtof64x_l): Define and later
	undefine as macro.  Define as weak alias if [!USE_WIDE_CHAR].
	[__HAVE_FLOAT64X_LONG_DOUBLE] (wcstof64x_l): Define and later
	undefine as macro.  Define as weak alias if [USE_WIDE_CHAR].
2017-11-24 22:51:53 +00:00
Joseph Myers ae7207d033 Support testing _Float64x libm functions.
This patch adds support for testing _Float64x libm functions.  A
configuration with such functions sets float64x-alias-fcts = yes in a
sysdeps Makeconfig file; until such settings are added, this test
support is inactive.

Tested for x86_64, including in conjunction with _Float64x support
patches.

	* math/test-float64x.h: New file.
	* math/Makefile (type-float64x-yes): New variable.
	(test-types): Add $(type-float64x-$(float64x-alias-fcts)).
2017-11-24 22:25:03 +00:00
Joseph Myers 9596fc69b1 Make min_of_type_ macros function-like.
math_private.h uses __MATH_TG in defining the min_of_type macro used
within libm, with min_of_type_<suffix> macros for each type.  This
runs into problems with __MATH_TG expansions used with additional
_FloatN and _FloatNx type support, because those can end up
macro-expanding the FUNC argument to __MATH_TG before it gets
concatenated with a suffix - meaning that min_of_type_ can't
simultaneously be the macro name for double, and a prefix to other
macro names, since the latter case requires such premature macro
expansion not to occur.  (This is not a problem for the uses of
__MATH_TG in installed headers because FUNC there is a function name
in the implementation namespace, and the suffixes themselves don't get
macro-expanded.)

This patch fixes the problem by making min_of_type_<suffix> macros
function-like, so no macro expansion occurs when min_of_type_ is
expanded on its own as a macro argument, only later when followed by
() after expansion.

Tested for x86_64, including in conjunction with _Float64x support
patches.

	* sysdeps/generic/math_private.h (min_of_type_f): Make into a
	function-like macro.
	(min_of_type_): Likewise.
	(min_of_type_l): Likewise.
	(min_of_type_f128): Likewise.
	(min_of_type): Pass () as last argument of __MATH_TG.
2017-11-24 22:03:35 +00:00
Joseph Myers 46453c3cda Define __STDC_WANT_IEC_60559_TYPES_EXT__ in tst-strtod-round-skeleton.c.
The tst-strtod-round-skeleton.c conditionals relating to handling of
_Float64x require associated <float.h> macros, which requires
__STDC_WANT_IEC_60559_TYPES_EXT__ to be defined before <float.h> is
included if _Float64x is supported.  This patch adds the necessary
definition.

Tested for x86_64, including in conjunction with _Float64x support
patches.

	* stdlib/tst-strtod-round-skeleton.c
	(__STDC_WANT_IEC_60559_TYPES_EXT__): Define before including
	headers.
2017-11-24 21:42:55 +00:00
Joseph Myers 01e659e711 Fix gen-tgmath-tests.py for _Float64, _Float64x testing.
math/gen-tgmath-tests.py was missing a create_type argument when
creating the internal types for combinations of long double with
_Float64 and _Float64x, so resulting in output that did not compile
when glibc support for those types was enabled.  This patch adds the
missing argument so that the tests properly compile in that case.

Tested for x86_64, including in conjunction with _Float64x support
patches.

	* math/gen-tgmath-tests.py (Type.init_types): Pass suffix argument
	for combinations of long double with _Float64 and _Float64x.
2017-11-24 21:22:34 +00:00
Joseph Myers 5c60afdd67 Handle more _FloatN, _FloatNx types in bits/libm-simd-decl-stubs.h.
This patch adds the macro definitions to bits/libm-simd-decl-stubs.h
required to handle additional _FloatN and _FloatNx types.

Tested for x86_64, including in conjunction with _Float64x support
patches.

	* bits/libm-simd-decl-stubs.h (__DECL_SIMD_cosf16): New macro.
	(__DECL_SIMD_cosf32): Likewise.
	(__DECL_SIMD_cosf64): Likewise.
	(__DECL_SIMD_cosf32x): Likewise.
	(__DECL_SIMD_cosf64x): Likewise.
	(__DECL_SIMD_cosf128x): Likewise.
	(__DECL_SIMD_sinf16): Likewise.
	(__DECL_SIMD_sinf32): Likewise.
	(__DECL_SIMD_sinf64): Likewise.
	(__DECL_SIMD_sinf32x): Likewise.
	(__DECL_SIMD_sinf64x): Likewise.
	(__DECL_SIMD_sinf128x): Likewise.
	(__DECL_SIMD_sincosf16): Likewise.
	(__DECL_SIMD_sincosf32): Likewise.
	(__DECL_SIMD_sincosf64): Likewise.
	(__DECL_SIMD_sincosf32x): Likewise.
	(__DECL_SIMD_sincosf64x): Likewise.
	(__DECL_SIMD_sincosf128x): Likewise.
	(__DECL_SIMD_logf16): Likewise.
	(__DECL_SIMD_logf32): Likewise.
	(__DECL_SIMD_logf64): Likewise.
	(__DECL_SIMD_logf32x): Likewise.
	(__DECL_SIMD_logf64x): Likewise.
	(__DECL_SIMD_logf128x): Likewise.
	(__DECL_SIMD_expf16): Likewise.
	(__DECL_SIMD_expf32): Likewise.
	(__DECL_SIMD_expf64): Likewise.
	(__DECL_SIMD_expf32x): Likewise.
	(__DECL_SIMD_expf64x): Likewise.
	(__DECL_SIMD_expf128x): Likewise.
	(__DECL_SIMD_powf16): Likewise.
	(__DECL_SIMD_powf32): Likewise.
	(__DECL_SIMD_powf64): Likewise.
	(__DECL_SIMD_powf32x): Likewise.
	(__DECL_SIMD_powf64x): Likewise.
	(__DECL_SIMD_powf128x): Likewise.
2017-11-24 21:11:37 +00:00
Joseph Myers 9d4b01173c Move wcstof128 symbol versions to wcsmbs/Versions.
This patch moves wcstof128 and wcstof128_l Versions file entries from
stdlib/Versions to wcsmbs/Versions, which is a more appropriate place
for them.

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

	* stdlib/Versions (libc): Move entries for wcstof128 and
	wcstof128_l to ....
	* wcsmbs/Versions (libc): ... here.
	Include <float128-abi.h>.
2017-11-24 18:38:45 +00:00
Florian Weimer 7911dd47da Linux: Introduce <bits/mman-shared.h>
This header file enables sharing of portable declarations and
definitions across all Linux architectures, including hppa (which does
not use <bits/mman-linux.h>).

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2017-11-24 17:55:59 +01:00
Adhemerval Zanella c45d78aac4 posix: Fix generic p{read,write}v buffer allocation (BZ#22457)
As described in BZ#22457 an interpose malloc can free an invalid
pointer for fallback preadv implementation.  Fortunately this is
just and issue on microblaze-linux-gnu running kernels older than
3.15.  This patch fixes it by calling mmap/unmap instead of
posix_memalign/ free.

Checked on microblaze-linux-gnu check with run-built-tests=no and
by using the sysdeps/posix implementation on x86_64-linux-gnu (just
for sanity test where it shown no regression).

	[BZ #22457]
	* sysdeps/posix/preadv_common.c (PREADV): Use mmap/munmap instead of
	posix_memalign/free.
	* sysdeps/posix/pwritev_common.c (PWRITEV): Likewise.
2017-11-24 12:16:15 -02:00
Mike FABIAN 3ffc4cc1ad pl_PL locale: Base collation on iso14651_t1
[BZ #22469]
	* localedata/locales/pl_PL (LC_COLLATE): Use “copy "iso14651_t1"”
	and implement the collation rules for pl from CLDR on top of that.
	* Makefile: Add pl_PL.UTF-8 to test-input and to the list
	of locales to be built for testing.
	* pl_PL.UTF-8.in: New file with test data to test the Polish sorting.
2017-11-24 10:07:05 +05:30
Joseph Myers 3a327316ad Use libm_alias_ldouble macros in sysdeps/ia64/fpu.
Continuing the preparation for additional _FloatN / _FloatNx aliases,
this patch makes long double functions in sysdeps/ia64/fpu use
libm_alias_ldouble macros, so that they can have _Float64x aliases
added in future.

Most ia64 libm functions are defined using ia64-specific macros in
libm-symbols.h.  These are left unchanged, with libm-alias-ldouble.h
included from libm-symbols.h (and the expectation that other
libm-alias-*.h headers will be included from there as well in future),
and libm_alias_ldouble_other then being used in most cases to define
aliases for any additional types (currently the empty set).  Functions
that used weak_alias are converted to use libm_alias_ldouble.

Tested (compilation only) with build-many-glibcs.py for ia64,
including that installed stripped shared libraries are unchanged by
the patch.

	* sysdeps/ia64/fpu/libm-symbols.h: Include <libm-alias-ldouble.h>.
	* sysdeps/ia64/fpu/e_acoshl.S (acoshl): Use
	libm_alias_ldouble_other.
	* sysdeps/ia64/fpu/e_acosl.S (acosl): Likewise.
	* sysdeps/ia64/fpu/e_asinl.S (asinl): Likewise.
	* sysdeps/ia64/fpu/e_atanhl.S (atanhl): Likewise.
	* sysdeps/ia64/fpu/e_coshl.S (coshl): Likewise.
	* sysdeps/ia64/fpu/e_exp10l.S (exp10l): Likewise.
	* sysdeps/ia64/fpu/e_exp2l.S (exp2l): Likewise.
	* sysdeps/ia64/fpu/e_fmodl.S (fmodl): Likewise.
	* sysdeps/ia64/fpu/e_hypotl.S (hypotl): Likewise.
	* sysdeps/ia64/fpu/e_lgammal_r.c (lgammal_r): Define using
	libm_alias_ldouble_r.
	* sysdeps/ia64/fpu/e_log2l.S (log2l): Use
	libm_alias_ldouble_other.
	* sysdeps/ia64/fpu/e_logl.S (logl): Likewise.
	(log10l): Likewise.
	* sysdeps/ia64/fpu/e_powl.S (powl): Likewise.
	* sysdeps/ia64/fpu/e_remainderl.S (remainderl): Likewise.
	* sysdeps/ia64/fpu/e_sinhl.S (sinhl): Likewise.
	* sysdeps/ia64/fpu/e_sqrtl.S (sqrtl): Likewise.
	* sysdeps/ia64/fpu/libm_sincosl.S (sincosl): Likewise.
	* sysdeps/ia64/fpu/s_asinhl.S (asinhl): Likewise.
	* sysdeps/ia64/fpu/s_atanl.S (atanl): Likewise.
	(atan2l): Likewise.
	* sysdeps/ia64/fpu/s_cbrtl.S (cbrtl): Likewise.
	* sysdeps/ia64/fpu/s_ceill.S (ceill): Likewise.
	* sysdeps/ia64/fpu/s_copysign.S (copysignl): Define using
	libm_alias_ldouble.
	* sysdeps/ia64/fpu/s_cosl.S (sinl): Use libm_alias_ldouble_other.
	(cosl): Likewise.
	* sysdeps/ia64/fpu/s_erfcl.S (erfcl): Likewise.
	* sysdeps/ia64/fpu/s_erfl.S (erfl): Likewise.
	* sysdeps/ia64/fpu/s_expm1l.S (expm1l): Likewise.
	(expl): Likewise.
	* sysdeps/ia64/fpu/s_fabsl.S (fabsl): Likewise.
	* sysdeps/ia64/fpu/s_fdiml.S (fdiml): Likewise.
	* sysdeps/ia64/fpu/s_floorl.S (floorl): Likewise.
	* sysdeps/ia64/fpu/s_fmal.S (fmal): Likewise.
	* sysdeps/ia64/fpu/s_fmaxl.S (fmaxl): Likewise.
	* sysdeps/ia64/fpu/s_frexpl.c (frexpl): Likewise.
	* sysdeps/ia64/fpu/s_ldexpl.c (ldexpl): Likewise.
	* sysdeps/ia64/fpu/s_log1pl.S (log1pl): Likewise.
	* sysdeps/ia64/fpu/s_logbl.S (logbl): Likewise.
	* sysdeps/ia64/fpu/s_modfl.S (modfl): Likewise.
	* sysdeps/ia64/fpu/s_nearbyintl.S (nearbyintl): Define using
	libm_alias_ldouble.
	* sysdeps/ia64/fpu/s_nextafterl.S (nextafterl): Use
	libm_alias_ldouble_other.
	* sysdeps/ia64/fpu/s_rintl.S (rintl): Likewise.
	* sysdeps/ia64/fpu/s_roundl.S (roundl): Likewise.
	* sysdeps/ia64/fpu/s_scalbnl.c (scalbnl): Define using
	libm_alias_ldouble.
	* sysdeps/ia64/fpu/s_tanhl.S (tanhl): Use
	libm_alias_ldouble_other.
	* sysdeps/ia64/fpu/s_tanl.S (tanl): Likewise.
	* sysdeps/ia64/fpu/s_truncl.S (truncl): Likewise.
	* sysdeps/ia64/fpu/w_lgammal_main.c
	[BUILD_LGAMMA && !USE_AS_COMPAT] (lgammal): Likewise.
	* sysdeps/ia64/fpu/w_tgammal_compat.S (tgammal): Likewise.
2017-11-23 23:34:54 +00:00
Florian Weimer 0a947e061d malloc: Call tcache destructor in arena_thread_freeres
It does not make sense to register separate cleanup functions for arena
and tcache since they're always going to be called together.  Call the
tcache cleanup function from within arena_thread_freeres since it at
least makes the order of those cleanups clear in the code.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2017-11-23 14:47:31 +01:00
Florian Weimer 67f36c7922 nss: Export nscd hash function as __nss_hash [BZ #22459] 2017-11-23 14:08:11 +01:00
Florian Weimer cccb6d4e87 sigwait: Do not fail with EINTR and return error code [BZ #22478]
Since

commit 8b0e795aaa
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Wed Nov 1 11:49:05 2017 -0200

    Simplify Linux sig{timed}wait{info} implementations

sigwait can fail with EINTR.  Applications do not expect that, and the
error code is not documented in POSIX or the manual pages.

This commit restores the previous behavior by retrying the system call
on EINTR.  It also returns the error code, not -1, on the remaing
errors.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-11-23 11:20:53 +01:00
Florian Weimer 59d2cbb1fe Linux: Add memfd_create system call wrapper
The system call is somewhat obscure because it is closely related
to file descriptor sealing.  However, it is also the recommended
way to create alias mappings, which is why it has more general use.

No emulation is provided.  Except for the name of the
/proc/self/fd links, it would be possible to implement an
approximation using O_TMPFILE and tmpfs, but this does not appear
to be worth the added complexity.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-23 10:00:40 +01:00
Joseph Myers 0a9d1d62b3 Fix typo in variable name in gen-locale.sh.
* localedata/gen-locale.sh: Fix typo in variable name.
2017-11-22 23:42:40 +00:00
Joseph Myers 754034c429 Obsolete p_secstodate.
This patch, relative to a tree with
<https://sourceware.org/ml/libc-alpha/2017-11/msg00797.html> (pending
review) applied, obsoletes p_secstodate, making the underlying
function __p_secstodate into a compat symbol not available for new
binaries or ports.  The calls in ns_print.c (part of incomplete
handling of TKEY) are changed to use %lu to print times instead of
trying to pretty-print the times any more.

Tested for x86_64.

	* resolv/res_debug.c (p_secstodate): Condition definition on
	[SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_27)].  Define
	directly as __p_secstodate, and as a compat symbol.  Do not use
	libresolv_hidden_def.
	* resolv/resolv.h (p_secstodate): Remove macro and function
	declaration.
	* resolv/ns_print.c (ns_sprintrrf): Print times with %lu, not
	using p_secstodate.
	* include/resolv.h (__p_secstodate): Do not use
	libresolv_hidden_proto.
	* resolv/Makefile (tests): Move tst-p_secstodate to ....
	(tests-internal): ... here.
	* resolv/tst-p_secstodate.c: Include <shlib-compat.h>.  Condition
	all contents on [TEST_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_27)]
	and declare and use __p_secstodate and use compat_symbol_reference
	in that case.
	[!TEST_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_27)] (do_test): Add
	implementation returning 77.
2017-11-22 22:21:10 +00:00
Joseph Myers f120cda607 Fix p_secstodate overflow handling (bug 22463).
The resolv/res_debug.c function p_secstodate (which is a public
function exported from libresolv, taking an unsigned long argument)
does:

        struct tm timebuf;
        time = __gmtime_r(&clock, &timebuf);
        time->tm_year += 1900;
        time->tm_mon += 1;
        sprintf(output, "%04d%02d%02d%02d%02d%02d",
                time->tm_year, time->tm_mon, time->tm_mday,
                time->tm_hour, time->tm_min, time->tm_sec);

If __gmtime_r returns NULL (because the year overflows the range of
int), this will dereference a null pointer.  Otherwise, if the
computed year does not fit in four characters, this will cause a
buffer overrun of the fixed-size 15-byte buffer.  With current GCC
mainline, there is a compilation failure because of the possible
buffer overrun.

I couldn't find a specification for how this function is meant to
behave, but Paul pointed to RFC 4034 as relevant to the cases where
this function is called from within glibc.  The function's interface
is inherently problematic when dates beyond Y2038 might be involved,
because of the ambiguity in how to interpret 32-bit timestamps as such
dates (the RFC suggests interpreting times as being within 68 years of
the present date, which would mean some kind of interface whose
behavior depends on the present date).

This patch works on the basis of making a minimal fix in preparation
for obsoleting the function.  The function is made to handle times in
the interval [0, 0x7fffffff] only, on all platforms, with <overflow>
used as the output string in other cases (and errno set to EOVERFLOW
in such cases).  This seems to be a reasonable state for the function
to be in when made a compat symbol by a future patch, being compatible
with any existing uses for existing timestamps without trying to work
for later timestamps.  Results independent of the range of time_t also
simplify the testcase.

I couldn't persuade GCC to recognize the ranges of the struct tm
fields by adding explicit range checks with a call to
__builtin_unreachable if outside the range (this looks similar to
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80776>), so having added
a range check on the input, this patch then disables the
-Wformat-overflow= warning for the sprintf call (I prefer that to the
use of strftime, as being more transparently correct without knowing
what each of %m and %M etc. is).

I do not know why this build failure should be new with mainline GCC
(that is, I don't know what GCC change might have introduced it, when
the basic functionality for such warnings was already in GCC 7).

I do not know if this is a security issue (that is, if there are
plausible ways in which a date before -999 or after 9999 from an
untrusted source might end up in this function).  The system clock is
arguably an untrusted source (in that e.g. NTP is insecure), but
probably not to that extent (NTP can't communicate such wild
timestamps), and uses from within glibc are limited to 32-bit inputs.

Tested with build-many-glibcs.py that this restores the build for arm
with yesterday's mainline GCC.  Also tested for x86_64 and x86.

	[BZ #22463]
	* resolv/res_debug.c: Include <libc-diag.h>.
	(p_secstodate): Assert time_t at least as wide as u_long.  On
	overflow, use integer seconds since the epoch as output, or use
	"<overflow>" as output and set errno to EOVERFLOW if integer
	seconds since the epoch would be 14 or more characters.
	(p_secstodate) [__GNUC_PREREQ (7, 0)]: Disable -Wformat-overflow=
	for sprintf call.
	* resolv/tst-p_secstodate.c: New file.
	* resolv/Makefile (tests): Add tst-p_secstodate.
	($(objpfx)tst-p_secstodate): Depend on $(objpfx)libresolv.so.
2017-11-22 22:12:07 +00:00
Joseph Myers a90d1ac2d2 Remove unused sparc64/soft-fp libm function implementations.
sysdeps/sparc/sparc64/soft-fp has files s_frexpl.c, s_scalblnl.c and
s_scalbnl.c that are never used because the ldbl-128 versions always
come first in the sysdeps directory ordering.  This patch removes the
unused files.

Tested with build-many-glibcs.py that installed stripped shared
libraries are unchanged by this patch.

	* sysdeps/sparc/sparc64/soft-fp/s_frexpl.c: Remove file.
	* sysdeps/sparc/sparc64/soft-fp/s_scalblnl.c: Likewise.
	* sysdeps/sparc/sparc64/soft-fp/s_scalbnl.c: Likewise.
2017-11-22 21:11:00 +00:00
Paul Eggert 0285e6bdf2 * posix/regcomp.c (init_word_char): Add comments. 2017-11-22 11:22:30 -08:00
Joseph Myers 4bae615022 Avoid use of strlen in getlogin_r (bug 22447).
Building glibc with current mainline GCC fails, among other reasons,
because of an error for use of strlen on the nonstring ut_user field.
This patch changes the problem code in getlogin_r to use __strnlen
instead.  It also needs to set the trailing NUL byte of the result
explicitly, because of the case where ut_user does not have such a
trailing NUL byte (but the result should always have one).

Tested for x86_64.  Also tested that, in conjunction with
<https://sourceware.org/ml/libc-alpha/2017-11/msg00797.html>, it fixes
the build for arm with mainline GCC.

	[BZ #22447]
	* sysdeps/unix/getlogin_r.c (__getlogin_r): Use __strnlen not
	strlen to compute length of ut_user and set trailing NUL byte of
	result explicitly.
2017-11-22 18:44:23 +00:00
Mike FABIAN 4b7af5fca7 lv_LV locale: fix collation [BZ #15537]
[BZ #15537]
	* localedata/locales/lv_LV (LC_COLLATE): Fix collation by
	using “copy "iso14651_t1"” and then implementing the
	collation rules for lv from CLDR on top of that.
	* Makefile: Add lv_LV.UTF-8 to test-input and to the list
	of locales to be built for testing.
	* lv_LV.UTF-8.in: New file with test data to test the Latvian
	sorting.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2017-11-22 10:31:47 +05:30
Joseph Myers 922bb78c0c Update hppa bits/mman.h from Linux 4.14.
This patch updates the hppa bits/mman.h based on Linux 4.14.  Some
MADV_* macros are removed in Linux 4.14 as unused/unimplemented, so
this patch removes them from glibc, while adding two new macros added
in Linux 4.14.

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

	* sysdeps/unix/sysv/linux/hppa/bits/mman.h
	[__USE_MISC] (MADV_SPACEAVAIL): Remove macro.
	[__USE_MISC] (MADV_VPS_PURGE): Likewise.
	[__USE_MISC] (MADV_VPS_INHERIT): Likewise.
	[__USE_MISC] (MADV_HWPOISON): New macro.
	[__USE_MISC] (MADV_SOFT_OFFLINE): Likewise.
2017-11-21 22:21:23 +00:00
Adhemerval Zanella a3aaa59816 nptl: Add workaround for ASSERT_PTHREAD_INTERNAL_SIZE with GCC 4.9
GCC 4.9 (the minimum current supported) emits an warning for universal
zero initializer ({0}) on ASSERT_PTHREAD_INTERNAL_SIZE:

pthread_attr_init.c: In function ‘__pthread_attr_init_2_1’:
pthread_attr_init.c:37:3: error: missing braces around initializer [-Werror=missing-braces]
   ASSERT_PTHREAD_INTERNAL_SIZE (pthread_attr_t, struct pthread_attr);
   ^
pthread_attr_init.c:37:3: error: (near initialization for ‘(anonymous).__size’) [-Werror=missing-braces]

It is fact GCC BZ#53119 [1] fixed in later version (GCC5+).  Since
current branch is closed and there is no indication it will be backports
(comment #20 in same bug report) this patch fixes by using a double
bracket to zero initialize the struct.

Checked on x86_64-linux-gnu with GCC 7 and GCC 4.9.

	* nptl/pthreadP.h (ASSERT_PTHREAD_INTERNAL_SIZE): Add workarond for
	-Wmissing-braces on GCC 4.9.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-11-21 10:19:56 -02:00
Stefan Liebler 8beba15d53 S390: Add cfi information for start routines in order to stop unwinding.
GDB failed to detect the outermost frame while showing the backtrace
within a thread:
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Before this patch, the start routines like thread_start had no cfi information.
GDB is then using the prologue unwinder if no cfi information is available.
This unwinder tries to unwind r15 and stops e.g. if r15 was updated or
on some jump-instructions.

On older glibc-versions (before commit "Remove cached PID/TID in clone"
c579f48edb), the thread_start function used
such a jump-instruction and GDB did not fail with an error.

This patch adds cfi information for _start, thread_start and __makecontext_ret
and marks r14 as undefined which marks the frame as outermost frame and GDB
stops the backtrace. Also tested different gcc versions in order to test
_Unwind_Backtrace() in libgcc as this is used by backtrace() in glibc.

ChangeLog:

	* sysdeps/s390/s390-64/start.S (_start): Add cfi information for r14.
	* sysdeps/s390/s390-32/start.S: (_start): Likewise
	* sysdeps/unix/sysv/linux/s390/s390-64/clone.S
	(thread_start): Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/clone.S
	(thread_start): Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/__makecontext_ret.S
	(__makecontext_ret): Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/__makecontext_ret.S
	(__makecontext_ret): Likewise.
2017-11-21 08:45:28 +01:00
Stefan Liebler 80eb52e3a9 Remove attribute_hidden for wchar ifunc symbols.
On s390 (31bit) various debug/tst-*chk* testcases are failing as the tests
are ending with a segmentation fault.

One test is e.g. calling wcsnrtombs in debug/tst-chk1.c:1549.
The function wcsnrtombs itself calls __wcsnlen. This function is called via
PLT! The PLT-stub itself loads the address from GOT (r12 is assumed to be
the GOT-pointer). In this case the loaded address is zero and the following
branch leads to the segmentation fault.

Due to the attribute_hidden in commit 44af8a32c3
"Mark internal wchar functions with attribute_hidden [BZ #18822]"
for e.g. the __wcsnlen function, r12 is not loaded with the GOT-pointer
in wcsnrtombs.

On s390x (64bit), this __wcsnlen call is also using the PLT-stub. But it is
not failing as the GOT-pointer is setup with larl-instruction by the PLT-stub
itself.
Note: On s390x/s390, __wcsnlen is an IFUNC symbol.

On x86_64, __wcsnlen is also an IFUNC symbol and is called via PLT, too.

Further IFUNC symbols on s390 which were marked as hidden by the mentioned
commit are: __wcscat, __wcsncpy, __wcpncpy, __wcschrnul.

This patch removes the attribute_hidden in wchar.h.
Then the compiler setups e.g. r12 on s390 in order to call __wcsnlen via PLT.

ChangeLog:

	* include/wchar.h (__wcsnlen, __wcscat, __wcsncpy, __wcpncpy,
	__wcschrnul): Remove attribute_hidden.
2017-11-21 08:43:23 +01:00
Paul Eggert 567d8c1f68 regex: don't assume uint64_t or uint32_t
This avoids -Werror=overflow errors for 32-bit systems in
the 64-bit case.  Problem reported by Joseph Myers in:
https://sourceware.org/ml/libc-alpha/2017-11/msg00694.html
Also, when this code is used in Gnulib it ports to platforms
that lack uint64_t and uint32_t.  The C standard doesn't guarantee
them, and on some 32-bit compilers there is no uint64_t.
Problem reported by Gianluigi Tiesi in:
http://lists.gnu.org/archive/html/bug-gnulib/2012-03/msg00154.html
* posix/regcomp.c (init_word_char): Don't assume that the types
uint64_t and uint32_t exist.  Adapted from Gnulib patch
2012-05-27T06:40:00!eggert@cs.ucla.edu.  See:
https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=252b52457da7887667c036d18cc5169777615bb0
2017-11-20 20:40:17 -08:00
Siddhesh Poyarekar 5a67c4fa01 aarch64: Optimized memset for falkor
The generic memset reads dczid_el0 on every memset.  This has a
significant impact on falkor for a range of sizes because reading
dczid_el0 is slow.

The DZP bit in the dczid_el0 register does not change dynamically, so
it is safe to read once during program startup.  With this patch
dczid_el0 is read once during startup and zva_size is cached.  This is
used to invoke the falkor-specific memset; the generic memset routine
remains unchanged.

The gains due to this are significant for falkor, with run time
reductions as high as 48%.  Here's a sample from the falkor tests:

Function: memset
Variant: walk
                      simple_memset	__memset_falkor	__memset_generic
=====================================================================
length=256, char=0:   139.96 (-698.28%)	   9.07 ( 48.26%)  17.53
length=257, char=0:   140.50 (-699.03%)	   9.53 ( 45.80%)  17.58
length=258, char=0:   140.96 (-703.95%)	   9.58 ( 45.36%)  17.53
length=259, char=0:   141.56 (-705.16%)	   9.53 ( 45.79%)  17.58
length=260, char=0:   142.15 (-710.76%)	   9.57 ( 45.39%)  17.53
length=261, char=0:   142.50 (-710.39%)	   9.53 ( 45.78%)  17.58
length=262, char=0:   142.97 (-715.09%)	   9.57 ( 45.42%)  17.54
length=263, char=0:   143.51 (-716.18%)	   9.53 ( 45.80%)  17.58
length=264, char=0:   143.93 (-720.55%)	   9.58 ( 45.39%)  17.54
length=265, char=0:   144.56 (-722.07%)	   9.53 ( 45.80%)  17.59
length=266, char=0:   144.98 (-726.42%)	   9.58 ( 45.42%)  17.54
length=267, char=0:   145.53 (-727.53%)	   9.53 ( 45.80%)  17.59
length=268, char=0:   146.25 (-731.81%)	   9.53 ( 45.79%)  17.58
length=269, char=0:   146.52 (-735.39%)	   9.53 ( 45.66%)  17.54
length=270, char=0:   146.97 (-735.81%)	   9.53 ( 45.80%)  17.58
length=271, char=0:   147.54 (-741.08%)	   9.58 ( 45.38%)  17.54
length=512, char=0:   268.26 (-1307.85%)  12.06 ( 36.71%)  19.05
length=513, char=0:   268.73 (-1273.89%)  13.56 ( 30.68%)  19.56
length=514, char=0:   269.31 (-1276.89%)  13.56 ( 30.68%)  19.56
length=515, char=0:   269.73 (-1279.05%)  13.56 ( 30.68%)  19.56
length=516, char=0:   270.34 (-1282.24%)  13.56 ( 30.67%)  19.56
length=517, char=0:   270.83 (-1284.71%)  13.56 ( 30.66%)  19.56
length=518, char=0:   271.20 (-1286.54%)  13.56 ( 30.67%)  19.56
length=519, char=0:   271.67 (-1288.67%)  13.65 ( 30.24%)  19.56
length=520, char=0:   272.14 (-1291.04%)  13.65 ( 30.22%)  19.56
length=521, char=0:   272.66 (-1293.69%)  13.65 ( 30.23%)  19.56
length=522, char=0:   273.14 (-1296.13%)  13.65 ( 30.20%)  19.56
length=523, char=0:   273.64 (-1298.75%)  13.65 ( 30.23%)  19.56
length=524, char=0:   274.34 (-1302.16%)  13.66 ( 30.20%)  19.57
length=525, char=0:   274.64 (-1297.78%)  13.56 ( 30.99%)  19.65
length=526, char=0:   275.20 (-1300.04%)  13.56 ( 31.01%)  19.66
length=527, char=0:   275.66 (-1302.86%)  13.56 ( 30.99%)  19.65
length=1024, char=0:  524.46 (-2169.75%)  20.12 ( 12.92%)  23.11
length=1025, char=0:  525.14 (-2124.63%)  21.62 (  8.40%)  23.61
length=1026, char=0:  525.59 (-2125.36%)  21.88 (  7.37%)  23.62
length=1027, char=0:  525.98 (-2127.14%)  21.62 (  8.46%)  23.62
length=1028, char=0:  526.68 (-2131.10%)  21.62 (  8.42%)  23.61
length=1029, char=0:  527.10 (-2131.70%)  21.79 (  7.73%)  23.62
length=1030, char=0:  527.54 (-2118.51%)  21.62 (  9.10%)  23.78
length=1031, char=0:  527.98 (-2136.37%)  21.62 (  8.43%)  23.61
length=1032, char=0:  528.70 (-2139.38%)  21.62 (  8.43%)  23.61
length=1033, char=0:  529.25 (-2124.37%)  21.62 (  9.11%)  23.79
length=1034, char=0:  529.48 (-2142.95%)  21.62 (  8.43%)  23.61
length=1035, char=0:  530.11 (-2145.13%)  21.62 (  8.44%)  23.61
length=1036, char=0:  530.76 (-2147.10%)  21.79 (  7.73%)  23.62
length=1037, char=0:  531.03 (-2149.45%)  21.62 (  8.42%)  23.61
length=1038, char=0:  531.64 (-2151.87%)  21.62 (  8.42%)  23.61
length=1039, char=0:  531.99 (-2151.63%)  21.80 (  7.75%)  23.63

	* sysdeps/aarch64/memset-reg.h: New file.
	* sysdeps/aarch64/memset.S: Use it.
	(__memset): Rename to MEMSET macro.
	[ZVA_MACRO]: Use zva_macro.
	* sysdeps/aarch64/multiarch/Makefile (sysdep_routines):
	Add memset_generic and memset_falkor.
	* sysdeps/aarch64/multiarch/ifunc-impl-list.c
	(__libc_ifunc_impl_list): Add memset ifuncs.
	* sysdeps/aarch64/multiarch/init-arch.h (INIT_ARCH): New
	local variable zva_size.
	* sysdeps/aarch64/multiarch/memset.c: New file.
	* sysdeps/aarch64/multiarch/memset_generic.S: New file.
	* sysdeps/aarch64/multiarch/memset_falkor.S: New file.
	* sysdeps/aarch64/multiarch/rtld-memset.S: New file.
	* sysdeps/unix/sysv/linux/aarch64/cpu-features.c
	(DCZID_DZP_MASK): New macro.
	(DCZID_BS_MASK): Likewise.
	(init_cpu_features): Read and set zva_size.
	* sysdeps/unix/sysv/linux/aarch64/cpu-features.h
	(struct cpu_features): New member zva_size.
2017-11-20 18:25:04 +05:30
Siddhesh Poyarekar eb332f9feb benchtests: Bump start size since smaller sizes are noisy
Numbers for very small sizes (< 128B) are much noisier for non-cached
benchmarks like the walk benchmarks, so don't include them.

	* benchtests/bench-memcpy-walk.c (START_SIZE): Set to 128.
	* benchtests/bench-memmove-walk.c (START_SIZE): Likewise.
	* benchtests/bench-memset-walk.c (START_SIZE): Likewise.
2017-11-20 18:03:32 +05:30
Siddhesh Poyarekar 4d7632ff68 benchtests: Fix walking sizes and directions for *-walk benchmarks
Make the walking benchmarks walk only backwards since copying both
ways is biased in favour of implementations that use non-temporal
stores for larger sizes; falkor is one of them.  This also fixes up
bugs in computation of the result which ended up multiplying the
length with the timing result unnecessarily.

	* benchtests/bench-memcpy-walk.c (do_one_test): Copy only
	backwards.  Fix timing computation.
	* benchtests/bench-memmove-walk.c (do_one_test): Likewise.
	* benchtests/bench-memset-walk.c (do_one_test): Walk backwards
	on memset by N at a time.  Fix timing computation.
2017-11-20 18:03:32 +05:30
Florian Weimer a465b89ee8 manual: Document the MAP_HUGETLB, MADV_HUGEPAGE, MADV_NOHUGEPAGE flags 2017-11-20 13:23:17 +01:00
Florian Weimer 0f74bbf513 manual: Document mprotect and introduce section on memory protection 2017-11-19 11:27:59 +01:00
Florian Weimer f6e965ee94 manual: Move preadv/writev variants to Scatter-Gather section
Also remove a comment about performance.  fwrite vs writev performance
is a very complex topic and cannot be reduced to a simple advice based
on transfer size.
2017-11-19 08:58:31 +01:00
Christian Brauner 5f9d19490b
support_become_root: Fix comment style 2017-11-18 17:54:24 +01:00
Christian Brauner ea69a5c874
support_become_root: Don't fail when /proc/<pid/setgroups is missing
The requirement to write "deny" to /proc/<pid>/setgroups for a given user
namespace before being able to write a gid mapping was introduced in Linux
3.19.  Before that this requirement including the file did not exist.
So don't fail when errno == ENOENT.
2017-11-18 16:23:01 +01:00
Florian Weimer 8db7f48cb7 tst-ttyname: Fix namespace setup for Fedora
On Fedora, the previous initialization sequence did not work and
resulted in failures like:

info:  entering chroot 1
info:    testcase: basic smoketest
info:      ttyname: PASS {name="/dev/pts/5", errno=0}
info:      ttyname_r: PASS {name="/dev/pts/5", ret=0, errno=0}
error: ../sysdeps/unix/sysv/linux/tst-ttyname.c:122: write (setroups, "deny"): Operation not permitted
info:  entering chroot 2
error: ../sysdeps/unix/sysv/linux/tst-ttyname.c:122: write (setroups, "deny"): Operation not permitted
error: 2 test failures

Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-18 14:34:46 +01:00
Florian Weimer 273a0c4983 support_enter_mount_namespace: Unshare with mount --make-rprivate
System defaults vary, and a mere unshare (CLONE_NEWNS) (which is part of
support_become_root) is no longer sufficient.

Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-18 14:30:20 +01:00
Florian Weimer 8adfb0eeff support_create_temp_directory: Align behavior with create_temp_file
create_temp_file automatically supplies the test directory and the
XXXXXX suffix.  support_create_temp_directory required the caller to
specify them, which was confusing.

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
2017-11-18 14:11:09 +01:00
Tulio Magno Quites Machado Filho df0c40ee3a powerpc: Update AT_HWCAP2 bits
Linux commit ID cba6ac4869e45cc93ac5497024d1d49576e82666 reserved a new
bit for a scenario where transactional memory is available, but the
suspended state is disabled.

	* sysdeps/powerpc/bits/hwcap.h (PPC_FEATURE2_HTM_NO_SUSPEND): New
	macro.
	* sysdeps/powerpc/dl-procinfo.c (_dl_powerpc_cap_flags): Add
	htm-no-suspend.

Signed-off-by: Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
2017-11-17 21:49:02 -02:00
Joseph Myers f58e5f4809 Use libm_alias_ldouble in sysdeps/x86_64/fpu.
This patch continues the preparation for additional _FloatN / _FloatNx
function aliases by using libm_alias_ldouble for sysdeps/x86_64/fpu
long double functions, so that they can have _Float64x aliases added
in future.

Tested for x86_64, including build-many-glibcs.py tests that installed
stripped shared libraries are unchanged by the patch.

	* sysdeps/x86_64/fpu/e_expl.S: Include <libm-alias-ldouble.h>.
	[USE_AS_EXPM1L] (expm1l): Define using libm_alias_ldouble.
	* sysdeps/x86_64/fpu/s_ceill.S: Include <libm-alias-ldouble.h>.
	(ceill): Define using libm_alias_ldouble.
	* sysdeps/x86_64/fpu/s_copysignl.S: Include
	<libm-alias-ldouble.h>.
	(copysignl): Define using libm_alias_ldouble.
	* sysdeps/x86_64/fpu/s_fabsl.S: Include <libm-alias-ldouble.h>.
	(fabsl): Define using libm_alias_ldouble.
	* sysdeps/x86_64/fpu/s_floorl.S: Include <libm-alias-ldouble.h>.
	(floorl): Define using libm_alias_ldouble.
	* sysdeps/x86_64/fpu/s_fmaxl.S: Include <libm-alias-ldouble.h>.
	(fmaxl): Define using libm_alias_ldouble.
	* sysdeps/x86_64/fpu/s_fminl.S: Include <libm-alias-ldouble.h>.
	(fminl): Define using libm_alias_ldouble.
	* sysdeps/x86_64/fpu/s_llrintl.S: Include <libm-alias-ldouble.h>.
	(llrintl): Define using libm_alias_ldouble.
	(lrintl): Likewise.
	* sysdeps/x86_64/fpu/s_nearbyintl.S: Include
	<libm-alias-ldouble.h>.
	(nearbyintl): Define using libm_alias_ldouble.
	* sysdeps/x86_64/fpu/s_truncl.S: Include <libm-alias-ldouble.h>.
	(truncl): Define using libm_alias_ldouble.
	* sysdeps/x86_64/x32/fpu/s_lrintl.S: Include
	<libm-alias-ldouble.h>.
	(lrintl): Define using libm_alias_ldouble.
2017-11-17 23:39:11 +00:00
Joseph Myers 2ce30701e6 Use libm_alias_ldouble in sysdeps/i386/fpu.
This patch continues the preparation for additional _FloatN / _FloatNx
function aliases by using libm_alias_ldouble for sysdeps/i386/fpu long
double functions, so that they can have _Float64x aliases added in
future.

Tested for x86_64 (which includes some of these implementations) and
x86, including build-many-glibcs.py tests that installed stripped
shared libraries are unchanged by the patch.

	* sysdeps/i386/fpu/e_expl.S: Include <libm-alias-ldouble.h>.
	[USE_AS_EXPM1L] (expm1l): Define using libm_alias_ldouble.
	* sysdeps/i386/fpu/s_asinhl.S: Include <libm-alias-ldouble.h>.
	(asinhl): Define using libm_alias_ldouble.
	* sysdeps/i386/fpu/s_atanl.c: Include <libm-alias-ldouble.h>.
	(atanl): Define using libm_alias_ldouble.
	* sysdeps/i386/fpu/s_cbrtl.S: Include <libm-alias-ldouble.h>.
	(cbrtl): Define using libm_alias_ldouble.
	* sysdeps/i386/fpu/s_ceill.S: Include <libm-alias-ldouble.h>.
	(ceill): Define using libm_alias_ldouble.
	* sysdeps/i386/fpu/s_copysignl.S: Include <libm-alias-ldouble.h>.
	(copysignl): Define using libm_alias_ldouble.
	* sysdeps/i386/fpu/s_fabsl.S: Include <libm-alias-ldouble.h>.
	(fabsl): Define using libm_alias_ldouble.
	* sysdeps/i386/fpu/s_floorl.S: Include <libm-alias-ldouble.h>.
	(floorl): Define using libm_alias_ldouble.
	* sysdeps/i386/fpu/s_fmaxl.S: Include <libm-alias-ldouble.h>.
	(fmaxl): Define using libm_alias_ldouble.
	* sysdeps/i386/fpu/s_fminl.S: Include <libm-alias-ldouble.h>.
	(fminl): Define using libm_alias_ldouble.
	* sysdeps/i386/fpu/s_frexpl.S: Include <libm-alias-ldouble.h>.
	(frexpl): Define using libm_alias_ldouble.
	* sysdeps/i386/fpu/s_llrintl.S: Include <libm-alias-ldouble.h>.
	(llrintl): Define using libm_alias_ldouble.
	* sysdeps/i386/fpu/s_logbl.c: Include <libm-alias-ldouble.h>.
	(logbl): Define using libm_alias_ldouble.
	* sysdeps/i386/fpu/s_lrintl.S: Include <libm-alias-ldouble.h>.
	(lrintl): Define using libm_alias_ldouble.
	* sysdeps/i386/fpu/s_nearbyintl.S: Include <libm-alias-ldouble.h>.
	(nearbyintl): Define using libm_alias_ldouble.
	* sysdeps/i386/fpu/s_nextafterl.c: Include <libm-alias-ldouble.h>.
	(nextafterl): Define using libm_alias_ldouble.
	* sysdeps/i386/fpu/s_remquol.S: Include <libm-alias-ldouble.h>.
	(remquol): Define using libm_alias_ldouble.
	* sysdeps/i386/fpu/s_rintl.c: Include <libm-alias-ldouble.h>.
	(rintl): Define using libm_alias_ldouble.
	* sysdeps/i386/fpu/s_truncl.S: Include <libm-alias-ldouble.h>.
	(truncl): Define using libm_alias_ldouble.
	* sysdeps/i386/i686/fpu/s_fmaxl.S: Include <libm-alias-ldouble.h>.
	(fmaxl): Define using libm_alias_ldouble.
	* sysdeps/i386/i686/fpu/s_fminl.S: Include <libm-alias-ldouble.h>.
	(fminl): Define using libm_alias_ldouble.
2017-11-17 22:54:39 +00:00
Joseph Myers 015c6dc288 Support bits/floatn.h inclusion from .S files.
Further _FloatN / _FloatNx type alias support will involve making
architecture-specific .S files use the common macros for libm function
aliases.  Making them use those macros will also serve to simplify
existing code for aliases / symbol versions in various cases, similar
to such simplifications for ldbl-opt code.

The libm-alias-*.h files sometimes need to include <bits/floatn.h> to
determine which aliases they should define.  At present, this does not
work for inclusion from .S files because <bits/floatn.h> can define
typedefs for old compilers.  This patch changes all the
<bits/floatn.h> and <bits/floatn-common.h> headers to include
__ASSEMBLER__ conditionals.  Those conditionals disable everything
related to C syntax in the __ASSEMBLER__ case, not just the problem
typedefs, as that seemed cleanest.  The __HAVE_* definitions remain in
the __ASSEMBLER__ case, as those provide information that is required
to define the correct set of aliases.

Tested with build-many-glibcs.py for a representative set of
configurations (x86_64-linux-gnu i686-linux-gnu ia64-linux-gnu
powerpc64le-linux-gnu mips64-linux-gnu-n64 sparc64-linux-gnu) with GCC
6.  Also tested with GCC 6 for i686-linux-gnu in conjunction with
changes to use alias macros in .S files.

	* bits/floatn-common.h [!__ASSEMBLER]: Disable everything related
	to C syntax instead of availability and properties of types.
	* bits/floatn.h [!__ASSEMBLER]: Likewise.
	* sysdeps/ia64/bits/floatn.h [!__ASSEMBLER]: Likewise.
	* sysdeps/ieee754/ldbl-128/bits/floatn.h [!__ASSEMBLER]: Likewise.
	* sysdeps/mips/ieee754/bits/floatn.h [!__ASSEMBLER]: Likewise.
	* sysdeps/powerpc/bits/floatn.h [!__ASSEMBLER]: Likewise.
	* sysdeps/x86/bits/floatn.h [!__ASSEMBLER]: Likewise.
2017-11-17 22:01:43 +00:00
Florian Weimer ce003e5d4c support_become_root: Enable file creation in user namespaces
Without UID/GID maps, file creation will file with EOVERFLOW.

This patch is based on DJ Delorie's work on container testing.

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
2017-11-17 22:11:28 +01:00
Joseph Myers e7df6c5c79 Add AArch64 HWCAP_DCPOP from Linux 4.14.
This patch adds the HWCAP_DCPOP macro from Linux 4.14 to the AArch64
bits/hwcap.h.

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

	* sysdeps/unix/sysv/linux/aarch64/bits/hwcap.h (HWCAP_DCPOP): New
	macro.
2017-11-17 14:03:04 +00:00
Adhemerval Zanella 58a813bf6e aarch64: Fix f{max,min}{f} build for GCC 4.9 and 5
GCC 4.9 and 5 do not generate a correct f{max,min}nm instruction for
__builtin_{fmax,fmin}{f} without -ffinite-math-only.  It is clear a
compiler issue since the instruction can handle NaN and Inf correctly
and GCC6+ does not show this issue.

We can backport a fix to GCC 5, raise the minimum required GCC version
for aarch64 (since GCC 4.9 branch is now closed [1]) and/or add
configure check to check for this issue.  However I think
-ffinite-math-only should be safe for these specific implementations
and it is a simpler solution.

Checked on aarch64-linux-gnu with GCC 5.3.1.

	* sysdeps/aarch64/fpu/Makefile (CFLAGS-s_fmax.c, CFLAGS-s_fmaxf.c,
	CFLAGS-s_fmin.c, CFLAGS-s_fminf.c): New rule: add -ffinite-math-only.

[1] https://gcc.gnu.org/ml/gcc/2016-08/msg00010.html

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
2017-11-17 09:23:07 -02:00