]> sourceware.org Git - glibc.git/log
glibc.git
7 years agoUse __builtin_popcount in __sched_cpucount [BZ #21696]
H.J. Lu [Sat, 1 Jul 2017 14:29:19 +0000 (07:29 -0700)]
Use __builtin_popcount in __sched_cpucount [BZ #21696]

posix/sched_cpucount.c assumes that size of __cpu_mask == size of long,
which is incorrect for x32.  This patch uses __builtin_popcount, which
is availabe in GCC 4.9, in posix/sched_cpucount.c.

Tested on i686, x86-64 and x32 with multi-arch disabled.

[BZ #21696]
* posix/sched_cpucount.c: Don't include <limits.h>.
(__sched_cpucount): Use __builtin_popcount.

7 years agoFix typo in glibc.tune.cpu name
Siddhesh Poyarekar [Sat, 1 Jul 2017 14:21:44 +0000 (19:51 +0530)]
Fix typo in glibc.tune.cpu name

7 years agofloat128: Add signbit alternative for old compilers
Gabriel F. T. Gomes [Thu, 29 Jun 2017 18:34:05 +0000 (15:34 -0300)]
float128: Add signbit alternative for old compilers

In math/math.h, __MATH_TG will expand signbit to __builtin_signbit*,
e.g.: __builtin_signbitf128, before GCC 6.  However, there has never
been a __builtin_signbitf128 in GCC and the type-generic builtin is
only available since GCC 6.  For older GCC, this patch defines
__builtin_signbitf128 to __signbitf128, so that the internal function
is used instead of the non-existent builtin.

This patch also changes the implementation of __signbitf128, because
it was reusing the implementation of __signbitl from ldbl-128, which
calls __builtin_signbitl.  Using the long double version of the
builtin is not correct on machines where _Float128 is ABI-distinct
from long double (i.e.: ia64, powerpc64le, x86, x86_84).  The new
implementation does not rely on builtins when being built with GCC
versions older than 6.0.

The new code does not currently affect powerpc64le builds, because
only GCC 6.2 fulfills the requirements from configure.  It might
affect powerpc64le builds if those requirements are backported to
older versions of the compiler.  The new code affects x86_64 builds,
since glibc is supposed to build correctly with older versions of GCC.

Tested for powerpc64le and x86_64.

* include/math.h (__signbitf128): Define as hidden.
* sysdeps/ieee754/float128/s_signbitf128.c (__signbitf128):
Reimplement without builtins.
* sysdeps/ia64/bits/floatn.h [!__GNUC_PREREQ (6, 0)]
(__builtin_signbitf128): Define to __signbitf128.
* sysdeps/powerpc/bits/floatn.h: Likewise.
* sysdeps/x86/bits/floatn.h: Likewise.

7 years agoConsolidate Linux fcntl implementation
Adhemerval Zanella [Mon, 28 Nov 2016 17:18:22 +0000 (15:18 -0200)]
Consolidate Linux fcntl implementation

This patch consolidates the fcntl Linux syscall generation on
sysdeps/unix/sysv/linux/fcntl.c.  It basically removes all the
architecture specific implementations.

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

* sysdeps/unix/sysv/linux/arm/fcntl.c: Remove file.
* sysdeps/unix/sysv/linux/generic/wordsize-32/fcntl.c: Likewise.
* sysdeps/unix/sysv/linux/hppa/fcntl.c: Likewise.
* sysdeps/unix/sysv/linux/i386/fcntl.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/fcntl.c: Likewise.
* sysdeps/unix/sysv/linux/microblaze/fcntl.c: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/fcntl.c: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n32/fcntl.c: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fcntl.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/fcntl.c: Likewise.
* sysdeps/unix/sysv/linux/sh/fcntl.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/fcntl.c: Likewise.
* sysdeps/unix/sysv/linux/fcntl.c: New file.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/fcntl.c: Refactor to
use default implementation.

7 years agotunables, aarch64: New tunable to override cpu
Siddhesh Poyarekar [Fri, 30 Jun 2017 17:28:39 +0000 (22:58 +0530)]
tunables, aarch64: New tunable to override cpu

Add a new tunable (glibc.tune.cpu) to override CPU identification on
aarch64.  This is useful in two cases: one where it is desirable to
pretend to be another CPU for purposes of testing or because routines
written for that CPU are beneficial for specific workloads and second
where the underlying kernel does not support emulation of MRS to get
the MIDR of the CPU.

* elf/dl-tunables.h (tunable_is_name): Move from...
* elf/dl-tunables.c (is_name): ... here.
(parse_tunables, __tunables_init): Adjust.
* manual/tunables.texi: Document glibc.tune.cpu.
* sysdeps/aarch64/dl-tunables.list: New file.
* sysdeps/unix/sysv/linux/aarch64/cpu-features.c (struct
cpu_list): New type.
(cpu_list): New list of CPU names and their MIDR.
(get_midr_from_mcpu): New function.
(init_cpu_features): Override MIDR if necessary.

7 years agoaarch64: Call all string function implementations in tests
Siddhesh Poyarekar [Fri, 30 Jun 2017 17:27:12 +0000 (22:57 +0530)]
aarch64: Call all string function implementations in tests

The string function implementations implemented so far do not use any
instructions that may deviate from standard aarch64, so it is possible
for all routines to run on all armv8 hardware.  Select all
implementations in the benchmarks and tests.

* sysdeps/aarch64/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Unconditionally select thunderx
routine for testing.

7 years agoi386: Increase MALLOC_ALIGNMENT to 16 [BZ #21120]
H.J. Lu [Fri, 30 Jun 2017 16:11:08 +0000 (09:11 -0700)]
i386: Increase MALLOC_ALIGNMENT to 16 [BZ #21120]

GCC 7 changed the definition of max_align_t on i386:

https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=9b5c49ef97e63cc63f1ffa13baf771368105ebe2

As a result, glibc malloc no longer returns memory blocks which are as
aligned as max_align_t requires.

This causes malloc/tst-malloc-thread-fail to fail with an error like this
one:

error: allocation function 0, size 144 not aligned to 16

This patch moves the MALLOC_ALIGNMENT definition to <malloc-alignment.h>
and increases the malloc alignment to 16 for i386.

[BZ #21120]
* malloc/malloc-internal.h (MALLOC_ALIGNMENT): Moved to ...
* sysdeps/generic/malloc-alignment.h: Here.  New file.
* sysdeps/i386/malloc-alignment.h: Likewise.
* sysdeps/generic/malloc-machine.h: Include <malloc-alignment.h>.

7 years agoresolv: Improve debugging output from tst-resolv-res_init
Florian Weimer [Fri, 30 Jun 2017 16:02:11 +0000 (18:02 +0200)]
resolv: Improve debugging output from tst-resolv-res_init

7 years agoresolv: Remove source argument fron res_options
Florian Weimer [Fri, 30 Jun 2017 09:32:19 +0000 (11:32 +0200)]
resolv: Remove source argument fron res_options

7 years agoresolv: Remove DEBUG from resolv/res_query.c
Florian Weimer [Fri, 30 Jun 2017 09:32:12 +0000 (11:32 +0200)]
resolv: Remove DEBUG from resolv/res_query.c

7 years agoresolv: Reformat resolv/res_data.c to GNU style
Florian Weimer [Fri, 30 Jun 2017 09:32:04 +0000 (11:32 +0200)]
resolv: Reformat resolv/res_data.c to GNU style

7 years agoresolv: Move res_query, res_search res_querydomain, hostalias
Florian Weimer [Fri, 30 Jun 2017 09:31:54 +0000 (11:31 +0200)]
resolv: Move res_query, res_search res_querydomain, hostalias

From res_data.c to query.c

7 years agoresolv: Move res_isourserver, res_send from res_data.c to res_send.c
Florian Weimer [Fri, 30 Jun 2017 09:31:47 +0000 (11:31 +0200)]
resolv: Move res_isourserver, res_send from res_data.c to res_send.c

7 years agoresolv: Turn _res_opcodes into a compatibility symbol
Florian Weimer [Fri, 30 Jun 2017 09:31:41 +0000 (11:31 +0200)]
resolv: Turn _res_opcodes into a compatibility symbol

7 years agoresolv: Move fp_nquery, fp_query, p_query, _res_opcodes
Florian Weimer [Fri, 30 Jun 2017 09:31:35 +0000 (11:31 +0200)]
resolv: Move fp_nquery, fp_query, p_query, _res_opcodes

From res_data.c to res_debug.c.

Also drop the unnecessary _res initialization from fp_nquery.

7 years agoresolv: Remove unused resolv/res_debug.h header file
Florian Weimer [Fri, 30 Jun 2017 09:31:29 +0000 (11:31 +0200)]
resolv: Remove unused resolv/res_debug.h header file

7 years agoresolv: Remove DEBUG from resolv/res_send.c
Florian Weimer [Fri, 30 Jun 2017 09:31:23 +0000 (11:31 +0200)]
resolv: Remove DEBUG from resolv/res_send.c

7 years agoresolv: Move the res_mkquery function to the resolv/mk_query.c file
Florian Weimer [Fri, 30 Jun 2017 09:31:18 +0000 (11:31 +0200)]
resolv: Move the res_mkquery function to the resolv/mk_query.c file

7 years agoresolv: Reformat resolv/res_mkquery.c to GNU style
Florian Weimer [Fri, 30 Jun 2017 09:31:12 +0000 (11:31 +0200)]
resolv: Reformat resolv/res_mkquery.c to GNU style

7 years agoresolv: Remove DEBUG macro from resolv/res_mkquery.c
Florian Weimer [Fri, 30 Jun 2017 09:31:02 +0000 (11:31 +0200)]
resolv: Remove DEBUG macro from resolv/res_mkquery.c

7 years agosupport: Report actual exit status in support_capture_subprocess_check
Florian Weimer [Fri, 30 Jun 2017 09:30:48 +0000 (11:30 +0200)]
support: Report actual exit status in support_capture_subprocess_check

7 years agoresolv: Make RES_ROTATE start with a random name server [BZ #19570]
Florian Weimer [Fri, 30 Jun 2017 08:43:33 +0000 (10:43 +0200)]
resolv: Make RES_ROTATE start with a random name server [BZ #19570]

Do not copy the actual name server addresses to rotate them.  Use a
global rotation offset instead.

7 years agolocaledata: CLDRv29: update LC_ADDRESS.lang_name translations
Mike Frysinger [Mon, 18 Apr 2016 05:32:55 +0000 (01:32 -0400)]
localedata: CLDRv29: update LC_ADDRESS.lang_name translations

This updates a bunch of locales based on CLDR v29 data:
  az_AZ: changing Azərbaycanca to azərbaycan dili
  be_BY: changing беларуская мова to беларуская
  bem_ZM: changing iciBemba to Ichibemba
  bg_BG: changing български език to български
  bo_CN: changing པོད་སྐད་ to བོད་སྐད་
  bo_IN: changing པོད་སྐད་ to བོད་སྐད་
  br_FR: changing Brezhoneg to brezhoneg
  brx_IN: lang_name: setting to बड़ो
  ce_RU: changing нохчийн мотт to нохчийн
  cs_CZ: changing Čeština to čeština
  dz_BT: changing (རྫོང་ཁ to རྫོང་ཁ
  el_CY: changing ελληνικά to Ελληνικά
  el_GR: changing ελληνικά to Ελληνικά
  es_AR: changing Español to español
  es_BO: changing Español to español
  es_CL: changing Español to español
  es_CO: changing Español to español
  es_CR: changing Español to español
  es_CU: changing Español to español
  es_DO: changing Español to español
  es_EC: changing Español to español
  es_ES: changing Español to español
  es_GT: changing Español to español
  es_HN: changing Español to español
  es_MX: changing Español to español
  es_NI: changing Español to español
  es_PA: changing Español to español
  es_PE: changing Español to español
  es_PR: changing Español to español
  es_PY: changing Español to español
  es_SV: changing Español to español
  es_US: changing Español to español
  es_UY: changing Español to español
  es_VE: changing Español to español
  et_EE: changing eesti keel to eesti
  eu_ES: changing Euskara to euskara
  fr_BE: changing Français to français
  fr_CA: changing Français to français
  fr_CH: changing Français to français
  fr_FR: changing Français to français
  fr_LU: changing Français to français
  fur_IT: changing Furlan to furlan
  fy_NL: changing Frysk to West-Frysk
  gl_ES: changing Galego to galego
  gv_GB: changing y Ghaelg to Gaelg
  he_IL: lang_name: setting to עברית
  hsb_DE: changing Hornjoserbšćina to hornjoserbšćina
  hy_AM: changing Հայերեն to հայերեն
  id_ID: changing Bahasa Indonesia to Bahasa Indonesia
  it_CH: changing Italiano to italiano
  it_IT: changing Italiano to italiano
  kl_GL: changing Kalaallisut to kalaallisut
  km_KH: changing ភាសាខ្មែរ to ខ្មែរ
  ko_KR: changing 한국말 to 한국어
  ks_IN: changing kạ̄šur to کٲشُر
  kw_GB: changing Kernowek to kernewek
  ky_KG: changing Кыргызча to кыргызча
  lg_UG: changing Oluganda to Luganda
  lt_LT: changing lietuvių kalba to lietuvių
  lv_LV: changing latviešu valoda to latviešu
  mk_MK: changing македонск/и јазик to македонски
  mn_MN: changing Монгол хэл to монгол
  nb_NO: changing Bokmål to norsk bokmål
  nn_NO: changing Nynorsk to nynorsk
  os_RU: lang_name: setting to ирон
  ru_RU: lang_name: setting to русский
  ru_UA: lang_name: setting to русский
  se_NO: changing Davvisámegiella to davvisámegiella
  sk_SK: lang_name: setting to slovenčina
  ta_IN: lang_name: setting to தமிழ்
  ta_LK: lang_name: setting to தமிழ்
  tk_TM: changing Türkmençe to türkmençe
  tr_CY: changing Turkish to Türkçe
  tr_TR: changing Turkish to Türkçe
  ur_IN: lang_name: setting to {اردو}
  ur_PK: lang_name: setting to {اردو}
  vi_VN: changing Việt ngữ to Tiếng Việt
  yo_NG: changing Yorùbá to Èdè Yorùbá
  zu_ZA: changing IsiZulu to isiZulu

Most of these are simple case changes, but they match the CLDR db.
A search for a few of the others suggests they're also correct.

7 years agoSPARC sys/ucontext.h namespace fixes (bug 21457).
Joseph Myers [Thu, 29 Jun 2017 19:44:43 +0000 (19:44 +0000)]
SPARC sys/ucontext.h namespace fixes (bug 21457).

This patch fixes various miscellaneous namespace issues in the SPARC
sys/ucontext.h header.  These are similar to changes made previous to
other sys/ucontext.h headers, where the SPARC header was excluded from
those previous patches because of its complexity.

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

[BZ #21457]
* sysdeps/unix/sysv/linux/sparc/sys/ucontext.h (__ctx): New macro.
[__WORDSIZE == 64] (MC_TSTATE): Define only for [__USE_MISC].
[__WORDSIZE == 64] (MC_PC): Likewise.
[__WORDSIZE == 64] (MC_NPC): Likewise.
[__WORDSIZE == 64] (MC_Y): Likewise.
[__WORDSIZE == 64] (MC_G1): Likewise.
[__WORDSIZE == 64] (MC_G2): Likewise.
[__WORDSIZE == 64] (MC_G3): Likewise.
[__WORDSIZE == 64] (MC_G4): Likewise.
[__WORDSIZE == 64] (MC_G5): Likewise.
[__WORDSIZE == 64] (MC_G6): Likewise.
[__WORDSIZE == 64] (MC_G7): Likewise.
[__WORDSIZE == 64] (MC_O0): Likewise.
[__WORDSIZE == 64] (MC_O1): Likewise.
[__WORDSIZE == 64] (MC_O2): Likewise.
[__WORDSIZE == 64] (MC_O3): Likewise.
[__WORDSIZE == 64] (MC_O4): Likewise.
[__WORDSIZE == 64] (MC_O5): Likewise.
[__WORDSIZE == 64] (MC_O6): Likewise.
[__WORDSIZE == 64] (MC_O7): Likewise.
[__WORDSIZE == 64] (MC_NGREG): Rename to __MC_NGREG and define to
__MC_NGREG if [__USE_MISC].
[__WORDSIZE == 64] (MC_MAXFPQ): Define only for [__USE_MISC].
[__WORDSIZE == 64] (mc_gregset_t): Define using __MC_NGREG.
[__WORDSIZE == 64] (struct mc_fq): Rename to struct __mc_fq.
Define fields using __ctx.
[__WORDSIZE == 64] (mc_fpu_t): Remove struct tag.  Define fields
using __ctx.
[__WORDSIZE == 64] (mcontext_t): Define fields using __ctx.
(REG_PSR): Define only for [__USE_MISC].
(REG_PC): Likewise.
(REG_nPC): Likewise.
(REG_Y): Likewise.
(REG_G1): Likewise.
(REG_G2): Likewise.
(REG_G3): Likewise.
(REG_G4): Likewise.
(REG_G5): Likewise.
(REG_G6): Likewise.
(REG_G7): Likewise.
(REG_O0): Likewise.
(REG_O1): Likewise.
(REG_O2): Likewise.
(REG_O3): Likewise.
(REG_O4): Likewise.
(REG_O5): Likewise.
(REG_O6): Likewise.
(REG_O7): Likewise.
[__WORDSIZE == 64] (REG_ASI): Define only for [__USE_MISC].
[__WORDSIZE == 64] (REG_FPRS): Likewise.
(NGREG): Rename to __NGREG and define to __NGREG if [__USE_MISC].
(gregset_t): Define using __NGREG.
(SPARC_MAXREGWINDOW): Rename to __SPARC_MAXREGWINDOW and define to
__SPARC_MAXREGWINDOW if [__USE_MISC].
(struct rwindow): Rename to struct __rwindow.  Define fields using
__ctx.
(rw_fp): Define only for [__USE_MISC].
(rw_rtn): Likewise.
(gwindows_t): Remove struct tag.  Define fields using __ctx and
__SPARC_MAXREGWINDOW.
(MAXFPQ): Define only for [__USE_MISC].
(struct fpq): Rename to struct __fpq.  Define fields using __ctx.
(struct fq): Rename to struct __fq.  Define fields using __ctx.
(FPU_REGS_TYPE): Define only for [__USE_MISC].
(FPU_DREGS_TYPE): Likewise.
(V7_FPU_FSR_TYPE): Likewise.
(V9_FPU_FSR_TYPE): Likewise.
(V9_FPU_FPRS_TYPE): Likewise.
[__WORDSIZE == 64] (fpregset_t): Remove struct tag.  Define fields
using __ctx.
[__WORDSIZE != 64] (fpregset_t): Likewise.
[__WORDSIZE != 64] (xrs_t): Define fields using __ctx.
[__WORDSIZE != 64] (XRS_ID): Define only for [__USE_MISC].
[__WORDSIZE != 64] (mcontext_t): Define fields using __ctx.
Rename field filler to __glibc_reserved1.
* sysdeps/unix/sysv/linux/sparc/sparc32/ucontext_i.sym
(MC_FILLER): Remove.

7 years agovfprintf: Fix tst-vfprintf-mbs-prec and tst-vfprintf-user-type
Florian Weimer [Thu, 29 Jun 2017 11:32:39 +0000 (13:32 +0200)]
vfprintf: Fix tst-vfprintf-mbs-prec and tst-vfprintf-user-type

7 years agoposix: Improve default posix_spawn implementation
Adhemerval Zanella [Mon, 24 Apr 2017 18:50:19 +0000 (15:50 -0300)]
posix: Improve default posix_spawn implementation

This patch improves the default posix implementation of posix_spawn{p}
and align with Linux one.  The main idea is to fix some issues already
fixed in Linux code, and deprecated vfork internal usage (source of
various bug reports).  In a short:

   - It moves POSIX_SPAWN_USEVFORK usage and sets it a no-op.  Since
     the process that actually spawn the new process do not share
     memory with parent (with vfork), it fixes BZ#14750 for this
     implementation.

   - It uses a pipe to correctly obtain the return upon failure
     of execution (BZ#18433).

   - It correctly enable/disable asynchronous cancellation (checked
     on ptl/tst-exec5.c).

   - It correctly disable/enable signal handling.

Using this version instead of Linux shows only one regression,
posix/tst-spawn3, because of pipe2 usage which increase total
number of file descriptor.

* sysdeps/posix/spawni.c (__spawni_child): New function.
(__spawni): Rename to __spawnix.

7 years agovfprintf: Reuse work_buffer in group_number
Florian Weimer [Thu, 29 Jun 2017 07:37:13 +0000 (09:37 +0200)]
vfprintf: Reuse work_buffer in group_number

7 years agovfprintf: Use struct scratch_buffer for positional arguments allocation
Florian Weimer [Thu, 29 Jun 2017 07:37:04 +0000 (09:37 +0200)]
vfprintf: Use struct scratch_buffer for positional arguments allocation

7 years ago_i18n_number_rewrite: Use struct scratch_buffer
Florian Weimer [Thu, 29 Jun 2017 07:34:45 +0000 (09:34 +0200)]
_i18n_number_rewrite: Use struct scratch_buffer

7 years agovfprintf: Reduce WORK_BUFFER_SIZE for wchar_t builds
Florian Weimer [Thu, 29 Jun 2017 07:34:22 +0000 (09:34 +0200)]
vfprintf: Reduce WORK_BUFFER_SIZE for wchar_t builds

7 years agovfprintf: Add test case for multi-byte/wide strings and precision
Florian Weimer [Thu, 29 Jun 2017 07:33:43 +0000 (09:33 +0200)]
vfprintf: Add test case for multi-byte/wide strings and precision

7 years agovfprintf: Add test case for user-defined types and format specifiers
Florian Weimer [Thu, 29 Jun 2017 07:33:09 +0000 (09:33 +0200)]
vfprintf: Add test case for user-defined types and format specifiers

7 years agoposix: Adapt tst-spawn{2,3} to use libsupport.
Adhemerval Zanella [Mon, 24 Apr 2017 18:48:01 +0000 (15:48 -0300)]
posix: Adapt tst-spawn{2,3} to use libsupport.

Checked on x86_64-linux-gnu.

* posix/tst-spawn2.c (do_test): Use libsupport.
* posix/tst-spawn3.c (do_test): Likewise.

7 years agoFix gen-tgmath-tests.py output for GCC 7 <float.h>.
Joseph Myers [Wed, 28 Jun 2017 19:42:14 +0000 (19:42 +0000)]
Fix gen-tgmath-tests.py output for GCC 7 <float.h>.

* math/gen-tgmath-tests.py (Tests.__init__): Define
__STDC_WANT_IEC_60559_TYPES_EXT__ at start of generated file.

7 years agoSupport _Float128 in tgmath.h.
Joseph Myers [Wed, 28 Jun 2017 17:53:46 +0000 (17:53 +0000)]
Support _Float128 in tgmath.h.

This patch adds tgmath.h support for _Float128, so eliminating the
awkward caveat in NEWS about the type not being supported there.  This
does inevitably increase the size of macro expansions (which grows
particularly fast when you have nested calls to tgmath.h macros), but
only when _Float128 is supported and the declarations of _Float128
interfaces are visible; otherwise the expansions are unchanged.

Tested for x86_64 and arm.

* math/tgmath.h: Include <bits/libc-header-start.h> and
<bits/floatn.h>.
(__TGMATH_F128): New macro.
(__TGMATH_CF128): Likewise.
(__TGMATH_UNARY_REAL_ONLY): Use __TGMATH_F128.
(__TGMATH_UNARY_REAL_RET_ONLY): Likewise.
(__TGMATH_BINARY_FIRST_REAL_ONLY): Likewise.
(__TGMATH_BINARY_FIRST_REAL_STD_ONLY): New macro.
(__TGMATH_BINARY_REAL_ONLY): Use __TGMATH_F128.
(__TGMATH_BINARY_REAL_STD_ONLY): New macro.
(__TGMATH_BINARY_REAL_RET_ONLY): Use __TGMATH_F128.
(__TGMATH_TERNARY_FIRST_SECOND_REAL_ONLY): Likewise.
(__TGMATH_TERNARY_REAL_ONLY): Likewise.
(__TGMATH_TERNARY_FIRST_REAL_RET_ONLY): Likewise.
(__TGMATH_UNARY_REAL_IMAG): Use __TGMATH_CF128.
(__TGMATH_UNARY_IMAG): Use __TGMATH_F128.
(__TGMATH_UNARY_REAL_IMAG_RET_REAL): Use __TGMATH_CF128.
(__TGMATH_BINARY_REAL_IMAG): Likewise.
(nexttoward): Use __TGMATH_BINARY_FIRST_REAL_STD_ONLY.
[__USE_MISC] (scalb): Use __TGMATH_BINARY_REAL_STD_ONLY.
* math/gen-tgmath-tests.py (Type.init_types): Enable _FloatN and
_FloatNx types if the corresponding HUGE_VAL macros are defined.

7 years agoUse clog10 not __clog10 in tgmath.h log10 macro.
Joseph Myers [Wed, 28 Jun 2017 16:43:50 +0000 (16:43 +0000)]
Use clog10 not __clog10 in tgmath.h log10 macro.

As a GNU extension, for _GNU_SOURCE glibc's complex.h provides a
clog10 function and tgmath.h supports complex arguments to the log10
macro.  However, tgmath.h uses __clog10 not clog10 in defining the
macro.

There is no namespace reason (ignoring the block-scope namespace
issues that would apply equally to *every* function called by tgmath.h
macros) for using __clog10 here, since this is only for _GNU_SOURCE so
clog10 is always visible when this macro definition is used.
Furthermore, __clog10f128 is not exported, so supporting _Float128 in
tgmath.h implies using clog10 not __clog10 there.  (__clog10 and
clog10 aren't used in libstdc++ either, although that library would
have a good case for using the __clog10 reserved-namespace export: the
standard C++ library includes log10 of a complex number.)  This patch
duly changes the header to use clog10, and enables tests of the macro
for complex arguments.

Tested for x86_64.

* math/tgmath.h [__USE_GNU] (log10): Use clog10 not __clog10.
* math/gen-tgmath-tests.py (Tests.add_all_tests): Test log10 for
complex arguments.

7 years agoFix tgmath.h totalorder, totalordermag return type (bug 21687).
Joseph Myers [Wed, 28 Jun 2017 16:31:10 +0000 (16:31 +0000)]
Fix tgmath.h totalorder, totalordermag return type (bug 21687).

The tgmath.h totalorder and totalordermag macros wrongly return a
floating-point type.  They should return int, like the underlying
functions.  This patch fixes them accordingly, updating tests
including enabling tests of those functions from gen-tgmath-tests.py.

Tested for x86_64.

[BZ #21687]
* math/tgmath.h (__TGMATH_BINARY_REAL_RET_ONLY): New macro.
(totalorder): Use it.
(totalordermag): Likewise.
* math/gen-tgmath-tests.py (Tests.add_all_tests): Enable tests of
totalorder and totalordermag.
* math/test-tgmath.c (F(compile_test)): Do not call totalorder or
totalordermag in arguments of calls to those functions.
(NCALLS): Change to 134.

7 years agoSimplify tgmath.h for integer return types.
Joseph Myers [Wed, 28 Jun 2017 16:19:47 +0000 (16:19 +0000)]
Simplify tgmath.h for integer return types.

The tgmath.h macros for function with integer return types generate
unnecessary casts to the return type.  Since in those cases the return
type does not depend on the argument type, all the cases in the
conditional expressions already have the right type, and no casts are
needed; this patch removes them.

Tested for x86_64.

* math/tgmath.h (__TGMATH_UNARY_REAL_RET_ONLY): Do not take or
cast to return type argument.
(__TGMATH_TERNARY_FIRST_REAL_RET_ONLY): Likewise.
(lrint): Update call to __TGMATH_UNARY_REAL_RET_ONLY.
(llrint): Likewise.
(lround): Likewise.
(llround): Likewise.
(ilogb): Likewise.
(llogb): Likewise.
(fromfp): Update call to __TGMATH_TERNARY_FIRST_REAL_RET_ONLY.
(ufromfp): Likewise.
(fromfpx): Likewise.
(ufromfpx): Likewise.

7 years agoRemove NO_LONG_DOUBLE conditionals in libm tests (bug 21607).
Joseph Myers [Wed, 28 Jun 2017 16:01:20 +0000 (16:01 +0000)]
Remove NO_LONG_DOUBLE conditionals in libm tests (bug 21607).

As noted in bug 21607, NO_LONG_DOUBLE conditionals in libm tests are
no longer effective.  For most this is harmless - they were only
present because of long double functions not being declared with _LIBC
defined, and _LIBC is no longer defined for building most tests.  For
the few where this is actually relevant to the test, testing
LDBL_MANT_DIG > DBL_MANT_DIG is more appropriate as that limits the
test to public APIs.  This patch fixes the tests accordingly.

Tested for x86_64 and arm.

[BZ #21607]
* math/basic-test.c [!NO_LONG_DOUBLE]: Change conditionals to
[LDBL_MANT_DIG > DBL_MANT_DIG].
* math/bug-nextafter.c [!NO_LONG_DOUBLE]: Remove conditionals.
* math/bug-nexttoward.c [!NO_LONG_DOUBLE]: Likewise.
* math/test-math-isinff.cc [!NO_LONG_DOUBLE]: Likewise.
* math/test-math-iszero.cc [!NO_LONG_DOUBLE]: Likewise.
* math/test-nan-overflow.c [!NO_LONG_DOUBLE]: Likewise.
* math/test-nan-payload.c [!NO_LONG_DOUBLE]: Likewise.
* math/test-nearbyint-except-2.c [!NO_LONG_DOUBLE]: Likewise.
* math/test-nearbyint-except.c [!NO_LONG_DOUBLE]: Likewise.
* math/test-powl.c [!NO_LONG_DOUBLE]: Likewise.
* math/test-signgam-finite-c99.c [!NO_LONG_DOUBLE]: Likewise.
* math/test-signgam-finite.c [!NO_LONG_DOUBLE]: Likewise.
* math/test-signgam-main.c [!NO_LONG_DOUBLE]: Likewise.
* math/test-snan.c [!NO_LONG_DOUBLE]: Likewise.
* math/test-tgmath-ret.c [!NO_LONG_DOUBLE]: Likewise.
* math/test-tgmath.c: Include <float.h>.
[!NO_LONG_DOUBLE]: Change conditionals to [LDBL_MANT_DIG >
DBL_MANT_DIG].
* math/test-tgmath2.c: Include <float.h>.
[!NO_LONG_DOUBLE]: Change conditionals to [LDBL_MANT_DIG >
DBL_MANT_DIG].

7 years agoAdd more thorough generated tgmath.h test.
Joseph Myers [Wed, 28 Jun 2017 14:20:21 +0000 (14:20 +0000)]
Add more thorough generated tgmath.h test.

This patch adds a more thorough test of tgmath.h macros, verifying
both the return type and the function called for all the cases of
valid argument types.  (Cases with current problems - I've just filed
four bugs - are disabled or omitted pending fixing those problems.)
The test uses a Python generator (works with both Python 2 and 3) to
generate a C file which is then built and run as a test in the usual
way (and that C file includes its own dummy definitions of libm
functions similar to existing tgmath.h tests).  The motivation is to
make it easier to add tests of tgmath.h for _Float128 when adding
tgmath.h support for that type; the _FloatN / _FloatNx support is
present in the script, but disabled until the tgmath.h support is
written.

Tested for x86_64, and for arm to check things in the long double =
double case.  (In that case, it's OK to call either double or long
double functions when the selected type is double or long double, as
long as the return type of the macro is exactly correct.)

* math/gen-tgmath-tests.py: New file.
* math/Makefile [PYTHON] (tests): Add test-tgmath3.
[PYTHON] (generated): Add test-tgmath3.c.
[PYTHON] (CFLAGS-test-tgmath3.c): New variable.
[PYTHON] ($(objpfx)test-tgmath3.c): New rule.

7 years agoRequire binutils 2.25 or later to build glibc.
Joseph Myers [Wed, 28 Jun 2017 11:31:50 +0000 (11:31 +0000)]
Require binutils 2.25 or later to build glibc.

This patch implements a requirement of binutils >= 2.25 (up from 2.22)
to build glibc.  Tests for 2.24 or later on x86_64 and s390 are
removed.  It was already the case, as indicated by buildbot results,
that 2.24 was too old for building tests for 32-bit x86 (produced
internal linker errors linking elf/tst-gnu2-tls1mod.so).  I don't know
if any configure tests for binutils features are obsolete given the
increased version requirement.

Tested for x86_64.

* configure.ac (AS): Require binutils 2.25 or later.
(LD): Likewise.
* configure: Regenerated.
* sysdeps/s390/configure.ac (AS): Remove version check.
* sysdeps/s390/configure: Regenerated.
* sysdeps/x86_64/configure.ac (AS): Remove version check.
* sysdeps/x86_64/configure: Regenerated.
* manual/install.texi (Tools for Compilation): Document
requirement for binutils 2.25 or later.
* INSTALL: Regenerated.

7 years agoSupport building glibc with gold 1.14 or above [BZ #14995]
H.J. Lu [Wed, 28 Jun 2017 11:03:57 +0000 (04:03 -0700)]
Support building glibc with gold 1.14 or above [BZ #14995]

This patch changes configure.ac to allow gold 1.14 or above to be used
to configire glibc so that gold glibc bugs can be fixed.  Tested with

CC="gcc -fuse-ld=gold" CXX="g++ -fuse-ld=gold"

on Fedora 25 with gold 1.14 (20170623).  Gold 1.14 was first released
in binutils 2.28.

On x86-64, for "make check", I got

Error in `/export/build/gnu/glibc-gold/build-x86_64-linux/elf/constload1': double free or corruption (fasttop): 0x00000000008755f0 ***
======= Backtrace: =========
/export/build/gnu/glibc-gold/build-x86_64-linux/libc.so.6(+0x772fb)[0x7f85225b52fb]
/export/build/gnu/glibc-gold/build-x86_64-linux/libc.so.6(+0x7d6c6)[0x7f85225bb6c6]
/export/build/gnu/glibc-gold/build-x86_64-linux/libc.so.6(+0x7df0e)[0x7f85225bbf0e]
/export/build/gnu/glibc-gold/build-x86_64-linux/dlfcn/libdl.so.2(+0x182d)[0x7f85226e682d]
/export/build/gnu/glibc-gold/build-x86_64-linux/dlfcn/libdl.so.2(dlclose+0x1f)[0x7f85226e623f]
/export/build/gnu/glibc-gold/build-x86_64-linux/elf/constload2.so(+0x933)[0x7f8522539933]
/export/build/gnu/glibc-gold/build-x86_64-linux/elf/ld.so(+0xfd1a)[0x7f85226fbd1a]
/export/build/gnu/glibc-gold/build-x86_64-linux/libc.so.6(+0x3c5e0)[0x7f852257a5e0]
/export/build/gnu/glibc-gold/build-x86_64-linux/libc.so.6(+0x3c63a)[0x7f852257a63a]
/export/build/gnu/glibc-gold/build-x86_64-linux/elf/constload2.so(+0x9aa)[0x7f85225399aa]
/export/build/gnu/glibc-gold/build-x86_64-linux/elf/ld.so(+0xf74a)[0x7f85226fb74a]
/export/build/gnu/glibc-gold/build-x86_64-linux/elf/ld.so(+0xf85b)[0x7f85226fb85b]
/export/build/gnu/glibc-gold/build-x86_64-linux/elf/ld.so(+0x13e98)[0x7f85226ffe98]
/export/build/gnu/glibc-gold/build-x86_64-linux/libc.so.6(_dl_catch_error+0x71)[0x7f85226643c1]
/export/build/gnu/glibc-gold/build-x86_64-linux/elf/ld.so(+0x13639)[0x7f85226ff639]
/export/build/gnu/glibc-gold/build-x86_64-linux/dlfcn/libdl.so.2(+0x1156)[0x7f85226e6156]
/export/build/gnu/glibc-gold/build-x86_64-linux/libc.so.6(_dl_catch_error+0x71)[0x7f85226643c1]
/export/build/gnu/glibc-gold/build-x86_64-linux/dlfcn/libdl.so.2(+0x1789)[0x7f85226e6789]
/export/build/gnu/glibc-gold/build-x86_64-linux/dlfcn/libdl.so.2(dlopen+0x32)[0x7f85226e61e2]
/export/build/gnu/glibc-gold/build-x86_64-linux/elf/constload1[0x4009ca]
/export/build/gnu/glibc-gold/build-x86_64-linux/libc.so.6(__libc_start_main+0xf1)[0x7f8522565231]
/export/build/gnu/glibc-gold/build-x86_64-linux/elf/constload1[0x400a5a]
======= Memory map: ========
00400000-00401000 r-xp 00000000 08:11 26334965                           /export/build/gnu/glibc-gold/build-x86_64-linux/elf/constload1
00401000-00402000 r--p 00000000 08:11 26334965                           /export/build/gnu/glibc-gold/build-x86_64-linux/elf/constload1
00402000-00403000 rw-p 00001000 08:11 26334965                           /export/build/gnu/glibc-gold/build-x86_64-linux/elf/constload1
00875000-00896000 rw-p 00000000 00:00 0                                  [heap]
7f851c000000-7f851c021000 rw-p 00000000 00:00 0
7f851c021000-7f8520000000 ---p 00000000 00:00 0
7f85222f3000-7f8522309000 r-xp 00000000 08:02 136658                     /usr/lib64/libgcc_s-6.3.1-20170216.so.1
7f8522309000-7f8522508000 ---p 00016000 08:02 136658                     /usr/lib64/libgcc_s-6.3.1-20170216.so.1
7f8522508000-7f8522509000 r--p 00015000 08:02 136658                     /usr/lib64/libgcc_s-6.3.1-20170216.so.1
7f8522509000-7f852250a000 rw-p 00016000 08:02 136658                     /usr/lib64/libgcc_s-6.3.1-20170216.so.1
7f8522539000-7f852253a000 r-xp 00000000 08:11 26334619                   /export/build/gnu/glibc-gold/build-x86_64-linux/elf/constload2.so
7f852253a000-7f852253b000 r--p 00000000 08:11 26334619                   /export/build/gnu/glibc-gold/build-x86_64-linux/elf/constload2.so
7f852253b000-7f852253c000 rw-p 00001000 08:11 26334619                   /export/build/gnu/glibc-gold/build-x86_64-linux/elf/constload2.so
7f852253c000-7f852253e000 rw-p 00000000 00:00 0
7f852253e000-7f85226da000 r-xp 00000000 08:11 26309973                   /export/build/gnu/glibc-gold/build-x86_64-linux/libc.so
7f85226da000-7f85226db000 ---p 0019c000 08:11 26309973                   /export/build/gnu/glibc-gold/build-x86_64-linux/libc.so
7f85226db000-7f85226de000 r--p 0019c000 08:11 26309973                   /export/build/gnu/glibc-gold/build-x86_64-linux/libc.so
7f85226de000-7f85226e1000 rw-p 0019f000 08:11 26309973                   /export/build/gnu/glibc-gold/build-x86_64-linux/libc.so
7f85226e1000-7f85226e5000 rw-p 00000000 00:00 0
7f85226e5000-7f85226e8000 r-xp 00000000 08:11 26313777                   /export/build/gnu/glibc-gold/build-x86_64-linux/dlfcn/libdl.so
7f85226e8000-7f85226e9000 r--p 00002000 08:11 26313777                   /export/build/gnu/glibc-gold/build-x86_64-linux/dlfcn/libdl.so
7f85226e9000-7f85226ea000 rw-p 00003000 08:11 26313777                   /export/build/gnu/glibc-gold/build-x86_64-linux/dlfcn/libdl.so
7f85226ea000-7f85226ec000 rw-p 00000000 00:00 0
7f85226ec000-7f8522711000 r-xp 00000000 08:11 26309972                   /export/build/gnu/glibc-gold/build-x86_64-linux/elf/ld.so
7f8522711000-7f8522712000 rw-p 00000000 00:00 0
7f8522712000-7f8522713000 r--p 00025000 08:11 26309972                   /export/build/gnu/glibc-gold/build-x86_64-linux/elf/ld.so
7f8522713000-7f8522714000 rw-p 00026000 08:11 26309972                   /export/build/gnu/glibc-gold/build-x86_64-linux/elf/ld.so
7f8522714000-7f8522715000 rw-p 00000000 00:00 0
7ffc5a2bd000-7ffc5a2df000 rw-p 00000000 00:00 0                          [stack]
7ffc5a32c000-7ffc5a32e000 r--p 00000000 00:00 0                          [vvar]
7ffc5a32e000-7ffc5a330000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]

and

make[4]: *** [/export/build/gnu/glibc-gold/build-x86_64-linux/elf/vismain] Error 1

This is because gold doesn't support protected data symbols:

configure:5672: checking linker support for protected data symbol
configure:5682: gcc -fuse-ld=gold -nostdlib -nostartfiles -fno-stack-protector -fPIC -shared conftest.c -o conftest.so
configure:5685: $? = 0
configure:5692: gcc -fuse-ld=gold -nostdlib -nostartfiles -fno-stack-protector conftest.c -o conftest conftest.so
/usr/local/bin/ld.gold: error: /tmp/ccXWoofs.o: cannot make copy relocation for protected symbol 'bar', defined in conftest.so
collect2: error: ld returned 1 exit status

make[4]: *** [/export/build/gnu/glibc-gold/build-x86_64-linux/elf/tst-split-dynreloc] Error 1

This is because gold doesn't support INSERT in linker script:

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

The total failures are

FAIL: dlfcn/bug-dl-leaf
FAIL: elf/constload1
FAIL: elf/global
FAIL: elf/ifuncmain1
FAIL: elf/ifuncmain1pic
FAIL: elf/ifuncmain1pie
FAIL: elf/ifuncmain1vis
FAIL: elf/ifuncmain1vispic
FAIL: elf/ifuncmain1vispie
FAIL: elf/ifuncmain3
FAIL: elf/initfirst
FAIL: elf/preloadtest
FAIL: elf/tst-audit11
FAIL: elf/tst-audit12
FAIL: elf/tst-audit4
FAIL: elf/tst-audit5
FAIL: elf/tst-audit6
FAIL: elf/tst-audit7
FAIL: elf/tst-dlmodcount
FAIL: elf/tst-dlmopen1
FAIL: elf/tst-dlmopen3
FAIL: elf/tst-dlopenrpath
FAIL: elf/tst-latepthread
FAIL: elf/tst-leaks1-mem
FAIL: elf/tst-nodelete-dlclose
FAIL: elf/unload6
FAIL: nss/test-netdb
FAIL: nss/tst-nss-test1
FAIL: posix/tst-getaddrinfo5

[BZ #14995]
* configure.ac: Allow gold 1.14 or above to configire glibc
* configure: Regenerated.

7 years agoMiscellaneous sys/ucontext.h namespace fixes (bug 21457).
Joseph Myers [Wed, 28 Jun 2017 10:33:23 +0000 (10:33 +0000)]
Miscellaneous sys/ucontext.h namespace fixes (bug 21457).

This patch fixes various miscellaneous namespace issues in
sys/ucontext.h headers.

Some struct tags are removed where the structs also have *_t typedef
names, while other struct tags without such names are renamed to start
__; the changes are noted in NEWS as they can affect C++ name mangling
(although there seems to be little if any external use of these types,
at least based on checking codesearch.debian.net).  For powerpc,
pointers to struct pt_regs (not defined in this header) are changed to
point to struct __ctx(pt_regs), so in the __USE_MISC case those struct
fields continue to point to the existing struct pt_regs type for
maximum compatibility, while when that's a namespace issue they point
to a struct __pt_regs type which is always an incomplete struct.

Tested for affected architectures with build-many-glibcs.py.

[BZ #21457]
* sysdeps/unix/sysv/linux/m68k/sys/ucontext.h (fpregset_t): Remove
struct tag.
* sysdeps/unix/sysv/linux/mips/sys/ucontext.h (fpregset_t):
Likewise.
* sysdeps/unix/sysv/linux/nios2/sys/ucontext.h (mcontext_t):
Likewise.
* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h (pt_regs):
Declare struct type with __ctx.
[__WORDSIZE != 32] (mcontext_t): Use __ctx with pt_regs struct
tag.
(ucontext_t) [__WORDSIZE == 32]: Use __ctx with pt_regs struct tag
and regs field name.

7 years agoFix elf/loadtest.c build with GCC 8.
Joseph Myers [Tue, 27 Jun 2017 17:52:42 +0000 (17:52 +0000)]
Fix elf/loadtest.c build with GCC 8.

Building the testsuite with current GCC mainline fails with:

loadtest.c: In function 'main':
loadtest.c:76:3: error: macro expands to multiple statements [-Werror=multistatement-macros]
   for (map = MAPS; map != NULL; map = map->l_next)        \
   ^
loadtest.c:165:2: note: in expansion of macro 'OUT'
  OUT;
  ^~~
loadtest.c:164:7: note: some parts of macro expansion are not guarded by this 'if' clause
       if (debug)
       ^~

This seems like a genuine bug, although fairly harmless; it means the
fflush call in the OUT macro is unconditional instead of being inside
the conditional as presumably intended.  This patch makes this macro
use do { } while (0) to avoid the problem.

Tested for x86_64 (testsuite), and with build-many-glibcs.py for
aarch64-linux-gnu with GCC mainline.

* elf/loadtest.c (OUT): Define using do { } while (0).

7 years agoFix strftime build with GCC 8.
Joseph Myers [Tue, 27 Jun 2017 17:12:13 +0000 (17:12 +0000)]
Fix strftime build with GCC 8.

Building with current GCC mainline fails with:

strftime_l.c: In function '__strftime_internal':
strftime_l.c:719:4: error: macro expands to multiple statements [-Werror=multistatement-macros]
    digits = d > width ? d : width;          \
    ^
strftime_l.c:1260:6: note: in expansion of macro 'DO_NUMBER'
      DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE);
      ^~~~~~~~~
strftime_l.c:1259:4: note: some parts of macro expansion are not guarded by this 'else' clause
    else
    ^~~~

In fact this particular instance is harmless; the code looks like:

          if (modifier == L_('O'))
            goto bad_format;
          else
            DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE);

and because of the goto, it doesn't matter that part of the expansion
isn't under the "else" conditional.  But it's also clearly bad style
to rely on that.  This patch changes DO_NUMBER and DO_NUMBER_SPACEPAD
to use do { } while (0) to avoid such problems.

Tested (full testsuite) for x86_64 (GCC 6), and with
build-many-glibcs.py with GCC mainline, in conjunction with my libgcc
patch <https://gcc.gnu.org/ml/gcc-patches/2017-06/msg02032.html>.

* time/strftime_l.c (DO_NUMBER): Define using do { } while (0).
(DO_NUMBER_SPACEPAD): Likewise.

7 years ago[ARM] Optimise memchr for NEON-enabled processors
Prakhar Bahuguna [Tue, 27 Jun 2017 15:43:50 +0000 (15:43 +0000)]
[ARM] Optimise memchr for NEON-enabled processors

This patch provides an optimised implementation of memchr using NEON
instructions to improve its performance, especially with longer search regions.
This gave an improvement in performance against the Thumb2+DSP optimised code,
with more significant gains for larger inputs. The NEON code also wins in cases
where the input is small (less than 8 bytes) by defaulting to a simple
byte-by-byte search. This avoids the overhead imposed by filling two quadword
registers from memory.

* sysdeps/arm/armv7/multiarch/Makefile: Add memchr_neon to
sysdep_routines.
* sysdeps/arm/armv7/multiarch/ifunc-impl-list.c: Add define for
__memchr_neon.
Add ifunc definitions for __memchr_neon and __memchr_noneon.
* sysdeps/arm/armv7/multiarch/memchr.S: New file.
* sysdeps/arm/armv7/multiarch/memchr_impl.S: Likewise.
* sysdeps/arm/armv7/multiarch/memchr_neon.S: Likewise.

Testing done: Ran regression tests for arm-none-linux-gnueabihf as well as a
full toolchain bootstrap. Benchmark tests were ran on ARMv7-A and ARMv8-A
hardware targets.

7 years agoS390: Use cu21 instruction for converting from utf16 to utf8.
Stefan Liebler [Tue, 27 Jun 2017 15:09:43 +0000 (17:09 +0200)]
S390: Use cu21 instruction for converting from utf16 to utf8.

This patch adds an ifunc variant to use the cu instruction on arch12 CPUs.
This new ifunc variant can be built if binutils support z13 vector
instructions.  At runtime, HWCAP_S390_VXE decides if we can use the
cu21 instruction.

ChangeLog:

* sysdeps/s390/utf8-utf16-z9.c (__to_utf8_loop_vx_cu):
Use vector and cu21 instruction.
* sysdeps/s390/multiarch/utf8-utf16-z9.c:
Add __to_utf8_loop_vx_cu in ifunc resolver.

7 years agoS390: Use cu24 instruction for converting from utf16 to utf32.
Stefan Liebler [Tue, 27 Jun 2017 15:09:43 +0000 (17:09 +0200)]
S390: Use cu24 instruction for converting from utf16 to utf32.

This patch adds an ifunc variant to use the cu instruction on arch12 CPUs.
This new ifunc variant can be built if binutils support z13 vector
instructions.  At runtime, HWCAP_S390_VXE decides if we can use the
cu24 instruction.

ChangeLog:

* sysdeps/s390/utf16-utf32-z9.c (__from_utf16_loop_vx_cu):
Use vector and cu24 instruction.
     * sysdeps/s390/multiarch/utf16-utf32-z9.c:
     Add __from_utf16_loop_vx_cu in ifunc resolver.

7 years agoS390: Use cu42 instruction for converting from utf32 to utf16.
Stefan Liebler [Tue, 27 Jun 2017 15:09:43 +0000 (17:09 +0200)]
S390: Use cu42 instruction for converting from utf32 to utf16.

This patch adds an ifunc variant to use the cu instruction on arch12 CPUs.
This new ifunc variant can be built if binutils support z13 vector
instructions.  At runtime, HWCAP_S390_VXE decides if we can use the
cu42 instruction.

ChangeLog:

* sysdeps/s390/utf16-utf32-z9.c (__to_utf16_loop_vx_cu):
Use vector and cu42 instruction.
* sysdeps/s390/multiarch/utf16-utf32-z9.c:
Add __to_utf16_loop_vx_cu in ifunc resolver.

7 years agoS390: Use cu41 instruction for converting from utf32 to utf8.
Stefan Liebler [Tue, 27 Jun 2017 15:09:42 +0000 (17:09 +0200)]
S390: Use cu41 instruction for converting from utf32 to utf8.

This patch adds an ifunc variant to use the cu instruction on arch12 CPUs.
This new ifunc variant can be built if binutils support z13 vector
instructions.  At runtime, HWCAP_S390_VXE decides if we can use the
cu41 instruction.

ChangeLog:

* sysdeps/s390/utf8-utf32-z9.c (__to_utf8_loop_vx_cu):
Use vector and cu41 instruction.
* sysdeps/s390/multiarch/utf8-utf32-z9.c: Add __to_utf8_loop_vx_cu
in ifunc resolver.

7 years agoS390: Add new hwcap values for new cpu architecture - arch12.
Stefan Liebler [Tue, 27 Jun 2017 15:09:42 +0000 (17:09 +0200)]
S390: Add new hwcap values for new cpu architecture - arch12.

The new hwcap values indicate support for:
- Vector packed decimal facility
- Vector enhancements facility 1
- Guarded storage facility

Note: arch12 is NOT the official name of the new CPU.
It refers to the edition number of the Principle of Operations manual.

ChangeLog:

* sysdeps/s390/dl-procinfo.c (_dl_s390_cap_flags):
Add vxd, vxe, gs flag.
* sysdeps/s390/dl-procinfo.h: Add HWCAP_S390_VXD, HWCAP_S390_VXE,
HWCAP_S390_GS capability.
* sysdeps/unix/sysv/linux/s390/bits/hwcap.h
(HWCAP_S390_VXD, HWCAP_S390_VXE, HWCAP_S390_GS): Define.

7 years agox86-64: Optimize memcmp-avx2-movbe.S for short difference
H.J. Lu [Tue, 27 Jun 2017 14:55:00 +0000 (07:55 -0700)]
x86-64: Optimize memcmp-avx2-movbe.S for short difference

Check the first 32 bytes before checking size when size >= 32 bytes
to avoid unnecessary branch if the difference is in the first 32 bytes.
Replace vpmovmskb/subl/jnz with vptest/jnc.

On Haswell, the new version is as fast as the previous one.  On Skylake,
the new version is a little bit faster.

* sysdeps/x86_64/multiarch/memcmp-avx2-movbe.S (MEMCMP): Check
the first 32 bytes before checking size when size >= 32 bytes.
Replace vpmovmskb/subl/jnz with vptest/jnc.

7 years agoAdd ChangeLog entries for the last 6 commits
Mike FABIAN [Tue, 27 Jun 2017 14:27:21 +0000 (16:27 +0200)]
Add ChangeLog entries for the last 6 commits

7 years agolocaledata: Months updated from CLDR - other scripts [BZ #21217]
Rafal Luzynski [Thu, 9 Mar 2017 00:14:54 +0000 (01:14 +0100)]
localedata: Months updated from CLDR - other scripts [BZ #21217]

* localedata/locales/am_ET (mon): Updated from CLDR.
* localedata/locales/km_KH (mon): Likewise.
* localedata/locales/lo_LA (mon): Likewise.
* localedata/locales/si_LK (mon): Likewise.
* localedata/locales/yi_US (mon): Likewise.
* localedata/locales/yue_HK (mon): Likewise.

7 years agolocaledata: Months updated from CLDR - other Indic scripts [BZ #21217]
Rafal Luzynski [Wed, 8 Mar 2017 23:40:35 +0000 (00:40 +0100)]
localedata: Months updated from CLDR - other Indic scripts [BZ #21217]

* localedata/locales/gu_IN (mon): Updated from CLDR.
* localedata/locales/kn_IN (mon): Likewise.
* localedata/locales/ml_IN (mon): Likewise.
* localedata/locales/pa_IN (mon): Likewise.
* localedata/locales/te_IN (mon): Likewise.

7 years agolocaledata: Months updated from CLDR - Devanagari scripts [BZ #21217]
Rafal Luzynski [Wed, 8 Mar 2017 23:28:34 +0000 (00:28 +0100)]
localedata: Months updated from CLDR - Devanagari scripts [BZ #21217]

* localedata/locales/brx_IN (mon): Updated from CLDR.
* localedata/locales/hi_IN (mon): Likewise.
* localedata/locales/kok_IN (mon): Likewise.
* localedata/locales/mr_IN (mon): Likewise.
* localedata/locales/ne_NP (mon): Likewise.

7 years agolocaledata: Months updated from CLDR - Bengali scripts [BZ #21217]
Rafal Luzynski [Wed, 8 Mar 2017 23:19:07 +0000 (00:19 +0100)]
localedata: Months updated from CLDR - Bengali scripts [BZ #21217]

* localedata/locales/as_IN (mon): Updated from CLDR.
* localedata/locales/bn_BD (mon): Likewise.
* localedata/locales/bn_IN (mon): Likewise.

7 years agolocaledata: Months updated from CLDR - Arabic scripts [BZ #21217]
Rafal Luzynski [Wed, 8 Mar 2017 22:29:17 +0000 (23:29 +0100)]
localedata: Months updated from CLDR - Arabic scripts [BZ #21217]

* localedata/locales/ar_DZ (mon): Updated from CLDR.
* localedata/locales/ar_IQ (mon): Likewise.
* localedata/locales/ar_JO (mon): Likewise.
* localedata/locales/ar_LB (mon): Likewise.
* localedata/locales/ar_MA (mon): Likewise.
* localedata/locales/ar_SA (mon): Likewise.
* localedata/locales/ar_SY (mon): Likewise.
* localedata/locales/ar_TN (mon): Likewise.
* localedata/locales/ks_IN (mon): Likewise.
* localedata/locales/ps_AF (mon): Likewise.
* localedata/locales/ug_CN (mon): Likewise.
* localedata/locales/ur_IN (mon): Likewise.
* localedata/locales/ur_PK (mon): Likewise.

7 years agolocaledata: More months updated from CLDR-31 [BZ #21217]
Rafal Luzynski [Tue, 7 Mar 2017 01:24:48 +0000 (02:24 +0100)]
localedata: More months updated from CLDR-31 [BZ #21217]

[BZ #21217]
* localedata/locales/ln_CD (mon): Months imported from CLDR, all changed:
"Yanwáli" to "sánzá ya yambo", "Febwáli" to "sánzá ya míbalé" and so on.

* locales/mn_MN (mon): reworded "Хулгана сарын" to "Нэгдүгээр сар",
"Үхэр сарын" to "Хоёрдугаар сар", and so on.

* locales/vi_VN (mon): reworded "Tháng một" to "Tháng 1", "Tháng hai"
to "Tháng 2", "Tháng ba" to "Tháng 3", and so on.

* locales/yo_NG (mon): reworded "Jánúárì" to "Oṣù Ṣẹ́rẹ́", "Fẹ́búárì"
to "Oṣù Èrèlè", "Máàṣì" to "Oṣù Ẹrẹ̀nà", and so on.

* locales/zu_ZA (mon): reworded "uMasingana" to "Januwari",
"uNhlolanja" to "Februwari", "uNdasa" to "Mashi", and so on.

7 years agolocaledata: Month names updated from CLDR-31 [BZ #21217]
Rafal Luzynski [Fri, 24 Feb 2017 02:13:14 +0000 (03:13 +0100)]
localedata: Month names updated from CLDR-31 [BZ #21217]

[BZ #21217]
* localedata/locales/be_BY (mon, abmon): Reworded "Травень" ("travyen'")
and abbreviated "Тра" ("tra") to "Май" ("may").

* localedata/locales/be_BY@latin (mon, abmon): Likewise, "Travień"
and abbreviated "Tra" reworded to "Maj".

* localedata/locales/br_FR (day, abmon, mon, d_t_fmt): Use the proper
Unicode apostrophe (Cʼhwevrer, mercʼher, Dʼar).

* localedata/locales/es_PE (mon, abmon): Reworded "septiembre" to
"setiembre" and abbreviated "sep" to "set".
* localedata/locales/es_UY: Likewise.

* localedata/locales/fil_PH (mon): Reworded "Septiyembre" to "Setyembre"
and "Nobiyembre" to "Nobyembre".

* localedata/locales/fur_IT (mon, abmon): Reworded "Decembar" to
"Dicembar" and abbreviated "Dec" to "Dic".

* localedata/locales/fy_NL (mon): Reworded "Janaris" to "Jannewaris".

* localedata/locales/ha_NG (mon, abmon): Reworded "Fabrairu" to
"Faburairu" and "Afrilu" to "Afirilu", also abbreviated "Afr" to "Afi".

* localedata/locales/ig_NG (mon, abmon): All months begin with
uppercase.  Reworded: "febụrụwarị" to "Febrụwarị", "epreel" to "Eprel",
"ọgọstụ" to "Ọgọọst", "nọvemba" to "Novemba", "nọv" to "Nov".

* localedata/locales/kw_GB (mon): Months imported from CLDR, many
changes: all "Mys" to "mis", "Mys Whevrel" to "mis Hwevrer", "Mys Merth"
to "mis Meurth", "Mys Evan" to "mis Metheven", and so on.
  (abmon): "Whe>" to "Hwe", "Mer" to "Meu", "Evn" to "Met".

* localedata/locales/lg_UG (mon): Reworded "Julaai" to "Julaayi".

* localedata/locales/ln_CD (mon): Months imported from CLDR, all changed:
"Yanwáli" to "sánzá ya yambo", "Febwáli" to "sánzá ya míbalé" and so on.

* localedata/locales/mg_MG (mon, abmon): All months now begin with
uppercase.

* localedata/locales/se_NO (mon): Months imported from CLDR, all
suffixes changed from "mánu" to "mánnu".

* localedata/locales/sr_RS@latin (mon): Reworded "juni" to "jun" and
"juli" to "jul".

* localedata/locales/uz_UZ (mon): Reworded "Sentyabr" to "Sentabr"
and "Oktyabr" to "Oktabr".
* localedata/locales/uz_UZ@cyrillic (mon): Most of the names reworded,
no longer end with a soft sign.

* localedata/locales/wae_CH (mon): reworded "Bráchet" to "Bráčet",
"Öigschte" to "Öigšte", "Herbschtmánet" to "Herbštmánet",
"Chrischtmánet" to "Chrištmánet".

7 years agoS390: Save and restore r12 in TLS_IE macro.
Stefan Liebler [Tue, 27 Jun 2017 13:23:43 +0000 (15:23 +0200)]
S390: Save and restore r12 in TLS_IE macro.

The testcases elf/tst-tls1-static and elf/tst-tls2-static
are failing on s390 if gcc is configured with --enable-default-pie.

According to binutils, there are only four valid cases for IE -> LE transition:
lg %rx,(0,%ry)    -> sllg %rx,%ry,0
lg %rx,(%ry,0)    -> sllg %rx,%ry,0
lg %rx,(%ry,%r12) -> sllg %rx,%ry,0
lg %rx,(%r12,%ry) -> sllg %rx,%ry,0

Thus I've adjusted the TLS_IE macro in s390 tls-macros.h files in PIC case
in order to use r12 for the address of global offset table.
The adjusted macro definition is not used if gcc is not configured with
--enable-default-pie.

ChangeLog:

* sysdeps/s390/s390-32/tls-macros.h (TLS_IE): Use r12 for GOT address.
* sysdeps/s390/s390-64/tls-macros.h (TLS_IE): Likewise.

7 years agoresolv: Avoid timeouts in test-resolv-res-init, test-resolv-res_init-thread
Florian Weimer [Tue, 27 Jun 2017 08:21:34 +0000 (10:21 +0200)]
resolv: Avoid timeouts in test-resolv-res-init, test-resolv-res_init-thread

Some Linux kernels have very aggressive ICMP rate limiting on the
loopback interface.  This commit introduces a minimal echoing DNS server
inside the network namespace, so that there is no need for ICMP error
messages anymore.

7 years agoresolv: Call _res_hconf_init from __res_vinit
Florian Weimer [Tue, 27 Jun 2017 07:26:46 +0000 (09:26 +0200)]
resolv: Call _res_hconf_init from __res_vinit

Many callers of __res_maybe_init also call _res_hconf_init.
Additional calls to the latter do not hurt because the function
does its work only once.  (/etc/hosts.conf is not reloaded or
even checked for changes.)  This means that we can simplify the
code by calling _res_hconf_init directly from __res_vinit.

7 years agoAdd float128 support for ia64.
Joseph Myers [Mon, 26 Jun 2017 22:50:45 +0000 (22:50 +0000)]
Add float128 support for ia64.

This patch enables float128 support for ia64, so that all the
configurations where GCC supports _Float128 / __float128 as an
ABI-distinct type now have glibc support as well.  bits/floatn.h
declares the support to be available for GCC 4.4 and later, which is
when the libgcc support was added.  The removal of
sysdeps/ia64/fpu/k_rem_pio2.c is because the generic k_rem_pio2.c
defines a function required by the float128 code.

Tested (compilation only) with build-many-glibcs.py for ia64 (GCC 6
and GCC 7).

Given how long it is since libm-test-ulps has been updated for ia64, I
think truncating the file and regenerating it from scratch would be a
good idea when doing a regeneration to add float128 ulps.  I expect
various ia64 libm issues (at least some already filed in Bugzilla) to
result in test failures even after ulps regeneration, but hopefully
the float128 code will pass tests as it's the same as used on other
architectures.

* sysdeps/ia64/Implies: Add ieee754/float128.
* sysdeps/ia64/bits/floatn.h: New file.
* sysdeps/ia64/float128-abi.h: Likewise.
* manual/math.texi (Mathematics): Document support for _Float128
on ia64.
* sysdeps/ia64/Makefile [$(subdir) = math] (CPPFLAGS): Append to
Makefile variable.
* sysdeps/ia64/fpu/e_sqrtf128.c: New file.
* sysdeps/ia64/fpu/k_rem_pio2.c: Remove file.
* sysdeps/ia64/fpu/sfp-machine.h: New file.  Based on libgcc.
* sysdeps/ia64/math-tests.h: New file.
* math/libm-test-support.h (XFAIL_FLOAT128_PAYLOAD): Also define
based on TEST_COND_binary128 for [__ia64__].
* sysdeps/unix/sysv/linux/ia64/libc.abilist: Update.
* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise,

7 years agoRename struct ucontext tag (bug 21457).
Joseph Myers [Mon, 26 Jun 2017 22:03:58 +0000 (22:03 +0000)]
Rename struct ucontext tag (bug 21457).

The ucontext_t type has a tag struct ucontext.  As with previous such
issues for siginfo_t and stack_t, this tag is not permitted by POSIX
(is not in a reserved namespace), and so namespace conformance means
breaking C++ name mangling for this type.

In this case, the type does need to have some tag rather than just a
typedef name, because it includes a pointer to itself.  This patch
uses struct ucontext_t as the new tag, so the type is mangled as
ucontext_t (the POSIX *_t reservation applies in all namespaces, not
just the namespace of ordinary identifiers).  Another reserved name
such as struct __ucontext could of course be used.

Because of other namespace issues, this patch does not by itself fix
bug 21457 or allow any XFAILs to be removed.

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

[BZ #21457]
* sysdeps/arm/sys/ucontext.h (struct ucontext): Rename to struct
ucontext_t.
* sysdeps/generic/sys/ucontext.h (struct ucontext): Likewise.
* sysdeps/i386/sys/ucontext.h (struct ucontext): Likewise.
* sysdeps/m68k/sys/ucontext.h (struct ucontext): Likewise.
* sysdeps/mips/sys/ucontext.h (struct ucontext): Likewise.
* sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h (struct
ucontext): Likewise.
* sysdeps/unix/sysv/linux/alpha/sys/ucontext.h (struct ucontext):
Likewise.
* sysdeps/unix/sysv/linux/arm/sys/ucontext.h (struct ucontext):
Likewise.
* sysdeps/unix/sysv/linux/hppa/sys/ucontext.h (struct ucontext):
Likewise.
* sysdeps/unix/sysv/linux/ia64/sys/ucontext.h (struct ucontext):
Likewise.
* sysdeps/unix/sysv/linux/m68k/sys/ucontext.h (struct ucontext):
Likewise.
* sysdeps/unix/sysv/linux/mips/sys/ucontext.h (struct ucontext):
Likewise.
* sysdeps/unix/sysv/linux/nios2/sys/ucontext.h (struct ucontext):
Likewise.
* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h (struct
ucontext): Likewise.
* sysdeps/unix/sysv/linux/s390/sys/ucontext.h (struct ucontext):
Likewise.
* sysdeps/unix/sysv/linux/sh/sys/ucontext.h (struct ucontext):
Likewise.
* sysdeps/unix/sysv/linux/sparc/sys/ucontext.h (struct ucontext):
Likewise.
* sysdeps/unix/sysv/linux/tile/sys/ucontext.h (struct ucontext):
Likewise.
* sysdeps/unix/sysv/linux/x86/sys/ucontext.h (struct ucontext):
Likewise.
* sysdeps/powerpc/powerpc32/backtrace.c (struct
rt_signal_frame_32): Likewise.
* sysdeps/powerpc/powerpc64/backtrace.c (struct signal_frame_64):
Likewise.
* sysdeps/unix/sysv/linux/aarch64/kernel_rt_sigframe.h (struct
kernel_rt_sigframe): Likewise.
* sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h (SIGCONTEXT):
Likewise.
* sysdeps/unix/sysv/linux/arm/register-dump.h (register_dump):
Likewise.
* sysdeps/unix/sysv/linux/arm/sigcontextinfo.h (SIGCONTEXT):
Likewise.
* sysdeps/unix/sysv/linux/hppa/profil-counter.h
(__profil_counter): Likewise.
* sysdeps/unix/sysv/linux/microblaze/sigcontextinfo.h
(SIGCONTEXT): Likewise.
* sysdeps/unix/sysv/linux/mips/kernel_rt_sigframe.h (struct
kernel_rt_sigframe): Likewise.
* sysdeps/unix/sysv/linux/nios2/kernel_rt_sigframe.h (struct
kernel_rt_sigframe): Likewise.
* sysdeps/unix/sysv/linux/nios2/sigcontextinfo.h (SIGCONTEXT):
Likewise.
* sysdeps/unix/sysv/linux/sh/makecontext.S (__makecontext):
Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/makecontext.c
(__start_context): Likewise.
* sysdeps/unix/sysv/linux/tile/sigcontextinfo.h (SIGCONTEXT):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/register-dump.h (register_dump):
Likewise.
* sysdeps/unix/sysv/linux/x86_64/sigcontextinfo.h (SIGCONTEXT):
Likewise.

7 years agoAdd float128 support for x86_64, x86.
Joseph Myers [Mon, 26 Jun 2017 22:01:27 +0000 (22:01 +0000)]
Add float128 support for x86_64, x86.

This patch enables float128 support for x86_64 and x86.  All GCC
versions that can build glibc provide the required support, but since
GCC 6 and before don't provide __builtin_nanq / __builtin_nansq, sNaN
tests and some tests of NaN payloads need to be disabled with such
compilers (this does not affect the generated glibc binaries at all,
just the tests).  bits/floatn.h declares float128 support to be
available for GCC versions that provide the required libgcc support
(4.3 for x86_64, 4.4 for i386 GNU/Linux, 4.5 for i386 GNU/Hurd);
compilation-only support was present some time before then, but not
really useful without the libgcc functions.

fenv_private.h needed updating to avoid trying to put _Float128 values
in registers.  I make no assertion of optimality of the
math_opt_barrier / math_force_eval definitions for this case; they are
simply intended to be sufficient to work correctly.

Tested for x86_64 and x86, with GCC 7 and GCC 6.  (Testing for x32 was
compilation tests only with build-many-glibcs.py to verify the ABI
baseline updates.  I have not done any testing for Hurd, although the
float128 support is enabled there as for GNU/Linux.)

* sysdeps/i386/Implies: Add ieee754/float128.
* sysdeps/x86_64/Implies: Likewise.
* sysdeps/x86/bits/floatn.h: New file.
* sysdeps/x86/float128-abi.h: Likewise.
* manual/math.texi (Mathematics): Document support for _Float128
on x86_64 and x86.
* sysdeps/i386/fpu/fenv_private.h: Include <bits/floatn.h>.
(math_opt_barrier): Do not put _Float128 values in floating-point
registers.
(math_force_eval): Likewise.
[__x86_64__] (SET_RESTORE_ROUNDF128): New macro.
* sysdeps/x86/fpu/Makefile [$(subdir) = math] (CPPFLAGS): Append
to Makefile variable.
* sysdeps/x86/fpu/e_sqrtf128.c: New file.
* sysdeps/x86/fpu/sfp-machine.h: Likewise.  Based on libgcc.
* sysdeps/x86/math-tests.h: New file.
* math/libm-test-support.h (XFAIL_FLOAT128_PAYLOAD): New macro.
* math/libm-test-getpayload.inc (getpayload_test_data): Use
XFAIL_FLOAT128_PAYLOAD.
* math/libm-test-setpayload.inc (setpayload_test_data): Likewise.
* math/libm-test-totalorder.inc (totalorder_test_data): Likewise.
* math/libm-test-totalordermag.inc (totalordermag_test_data):
Likewise.
* sysdeps/unix/sysv/linux/i386/libc.abilist: Update.
* sysdeps/unix/sysv/linux/i386/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.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.

7 years agoCall exit directly in clone (BZ #21512)
Adhemerval Zanella [Thu, 22 Jun 2017 11:49:34 +0000 (08:49 -0300)]
Call exit directly in clone (BZ #21512)

On aarch64, alpha, arm, hppa, mips, nios2, powerpc, sh, sparc, tile,
and x86_64 the clone syscall jumps to _exit after the child execution
and the function ends the process execution by calling exit_group.
This behavior have a small issue where threads created with
CLONE_THREAD using clone syscall directly will eventually exit the
whole group altogether instead of just the thread created.  Also,
s390, microblaze, ia64, i386, and m68k differs by calling exit
syscall directly.

This patch changes all architectures to call the exit syscall
directly, as for s390, microblaze, ia64, i386, and m68k.  This do not
have change glibc internal behavior in any sort, since the only
usage of clone implementation in posix_spawn calls _exit directly
in the created child (fork uses a direct call to clone).

Checked on x86_64-linux-gnu, i686-linux-gnu, aarch64-linux-gnu,
powerpc-linux-gnu, powerpc64le-linux-gnu, sparc64-linux-gnu,
and sparcv9-linux-gnu.

[BZ #21512]
* sysdeps/unix/sysv/linux/aarch64/clone.S (__clone): Call exit
syscall instead of jump to _exit.
(CLONE_VM_BIT): Remove unused define.
(CLONE_VM): Likewise.
(CLONE_THREAD_BIT): Likewise.
(CLONE_THREAD): Likewise.
* sysdeps/unix/sysv/linux/alpha/clone.S (__clone): Likewise.
(CLONE_VM): Remove unused define.
* sysdeps/unix/sysv/linux/arm/clone.S (__clone): Likewise.
(CLONE_VM): Remove unused define.
(CLONE_THREAD): Likewise.
* sysdeps/unix/sysv/linux/i386/clone.S (CLONE_VM): Likewise.
* sysdeps/unix/sysv/linux/ia64/clone2.S (__clone2): Call exit
syscall instead of jump to _exit.
* sysdeps/unix/sysv/linux/hppa/clone.S (__clone): Likewise.
* sysdeps/unix/sysv/linux/mips/clone.S (__clone): Likewise.
(CLONE_VM): Remove unused define.
(CLONE_THREAD): Likewise.
* sysdeps/unix/sysv/linux/nios2/clone.S (__clone): Likewise.
(CLONE_VM): Remove unused define.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S (__clone):
Likewise.
(CLONE_VM): Remove unused define.
(CLONE_THREAD): Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S (__clone):
Likewise.
(CLONE_VM): Remove unused define.
(CLONE_THREAD): Likewise.
* sysdeps/unix/sysv/linux/sh/clone.S  (__clone): Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/clone.S (__clone): Likewise.
(CLONE_VM): Remove unused define.
* sysdeps/unix/sysv/linux/sparc/sparc64/clone.S (__clone): Likewise.
(CLONE_VM): Remove unused define.
* sysdeps/unix/sysv/linux/tile/clone.S (__clone): Likewise.
* sysdeps/unix/sysv/linux/x86_64/clone.S (__clone): Likewise.
(CLONE_VM): Remove unused define.
* sysdeps/unix/sysv/linux/Makefile (tests): Add tst-clone3.
* sysdeps/unix/sysv/linux/tst-clone3.c: New file.

Fix

7 years agopowerpc64le: Enable float128
Paul E. Murphy [Tue, 9 Aug 2016 21:48:54 +0000 (16:48 -0500)]
powerpc64le: Enable float128

This patch adds ULPs for the float128 type, updates the abilist for libc
and libm, and adds the files bits/floatn.h and float128-abi.h, in order to
enable the new type for powerpc64le.

This patch also adds the implementation of sqrtf128 for powerpc64le, since
it is not implemented in libgcc.  The sfp-machine.h header is taken from
libgcc.

Tested for powerpc64le (GCC 6.2 and GCC 7.1), powerpc64 and s390x.

* manual/math.texi (Mathematics): Mention the enabling of float128
for powerpc64le.
* sysdeps/powerpc/bits/floatn.h: New file.
* sysdeps/powerpc/fpu/libm-test-ulps: Regenerated.
* sysdeps/powerpc/fpu/math_private.h:
(__ieee754_sqrtf128): New inline override.
* sysdeps/powerpc/powerpc64le/Implies-before: New file.
* sysdeps/powerpc/powerpc64le/Makefile: New file.
* sysdeps/powerpc/powerpc64le/fpu/e_sqrtf128.c: New file.
* sysdeps/powerpc/powerpc64le/fpu/sfp-machine.h: New file.
* sysdeps/powerpc/powerpc64le/power9/fpu/e_sqrtf128.c: New file.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist:
Updated.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64le/float128-abi.h:
New file.

7 years agopowerpc64le: Require at least POWER8 for powerpc64le
Gabriel F. T. Gomes [Mon, 5 Jun 2017 19:18:54 +0000 (16:18 -0300)]
powerpc64le: Require at least POWER8 for powerpc64le

Support for powerpc64le requires POWER8 or newer processors.  Builds for
older processors are not tested.  Require at least POWER8 to avoid
unintentional builds.

* sysdeps/powerpc/powerpc64le/configure.ac: Check for POWER8.
* sysdeps/powerpc/powerpc64le/configure: Update.

7 years agopowerpc64le: Check for compiler features for float128
Gabriel F. T. Gomes [Tue, 11 Oct 2016 16:50:19 +0000 (13:50 -0300)]
powerpc64le: Check for compiler features for float128

On powerpc64le, support for float128 will be enabled, which requires some
compiler features to be present.  This patch adds a configure test to check
for such features, which are provided for powerpc64le since GCC 6.2.

Tested for powerpc64 and powerpc64le.

* INSTALL: Regenerate.
* manual/install.texi (Recommended Tools for Compilation): Mention
the powerpc64le-specific requirement in the manual.
* sysdeps/powerpc/powerpc64le/configure.ac: New file with checks
for the compiler features required for building float128.
* sysdeps/powerpc/powerpc64le/configure: New, auto-generated file.

7 years agoPrevent an implicit int promotion in malloc/tst-alloc_buffer.c
Tulio Magno Quites Machado Filho [Mon, 26 Jun 2017 12:55:41 +0000 (09:55 -0300)]
Prevent an implicit int promotion in malloc/tst-alloc_buffer.c

According to ISO C11, section 6.5.3.3 "Unary arithmetic operators", the
result of the ~ operator is the bitwise complement of its (promoted)
operand.
This can lead to a comparison of a char with another integer type.

Tested on powerpc, powerpc64 and powerpc64le.

* malloc/tst-alloc_buffer.c (test_misaligned): Cast to char
before comparing with another char.

7 years agomanual: Fix a minor grammatical error.
Rical Jasan [Mon, 26 Jun 2017 04:31:16 +0000 (21:31 -0700)]
manual: Fix a minor grammatical error.

* manual/math.texi: Fix a grammatical error.

7 years agoresolv/tst-resolv-basic: Add test cases for bug 21295
Florian Weimer [Sat, 24 Jun 2017 14:51:31 +0000 (16:51 +0200)]
resolv/tst-resolv-basic: Add test cases for bug 21295

7 years agogetaddrinfo: Merge IPv6 addresses and IPv4 addresses [BZ #21295]
Dmitry Bilunov [Sat, 24 Jun 2017 14:49:34 +0000 (16:49 +0200)]
getaddrinfo: Merge IPv6 addresses and IPv4 addresses [BZ #21295]

7 years agoAvoid .symver on common symbols [BZ #21666]
H.J. Lu [Fri, 23 Jun 2017 21:38:46 +0000 (14:38 -0700)]
Avoid .symver on common symbols [BZ #21666]

The .symver directive on common symbol just creates a new common symbol,
not an alias and the newer assembler with the bug fix for

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

will issue an error.  Before the fix, we got

$ readelf -sW libc.so | grep "loc[12s]"
  5109: 00000000003a0608     8 OBJECT  LOCAL  DEFAULT   36 loc1
  5188: 00000000003a0610     8 OBJECT  LOCAL  DEFAULT   36 loc2
  5455: 00000000003a0618     8 OBJECT  LOCAL  DEFAULT   36 locs
  6575: 00000000003a05f0     8 OBJECT  GLOBAL DEFAULT   36 locs@GLIBC_2.2.5
  7156: 00000000003a05f8     8 OBJECT  GLOBAL DEFAULT   36 loc1@GLIBC_2.2.5
  7312: 00000000003a0600     8 OBJECT  GLOBAL DEFAULT   36 loc2@GLIBC_2.2.5

in libc.so.  The versioned loc1, loc2 and locs have the wrong addresses.
After the fix, we got

$ readelf -sW libc.so | grep "loc[12s]"
  6570: 000000000039e3b8     8 OBJECT  GLOBAL DEFAULT   34 locs@GLIBC_2.2.5
  7151: 000000000039e3c8     8 OBJECT  GLOBAL DEFAULT   34 loc1@GLIBC_2.2.5
  7307: 000000000039e3c0     8 OBJECT  GLOBAL DEFAULT   34 loc2@GLIBC_2.2.5

[BZ #21666]
* misc/regexp.c (loc1): Add __attribute__ ((nocommon));
(loc2): Likewise.
(locs): Likewise.

7 years agoinet_pton: Reject IPv6 addresses with many leading zeros [BZ #16637]
Florian Weimer [Fri, 23 Jun 2017 20:51:00 +0000 (22:51 +0200)]
inet_pton: Reject IPv6 addresses with many leading zeros [BZ #16637]

2001:db8:00001::f is not a valid IPv6 address according to RFC 2373.

7 years agoClean pthread functions namespaces for C11 threads
Adhemerval Zanella [Fri, 2 Dec 2016 18:32:28 +0000 (16:32 -0200)]
Clean pthread functions namespaces for C11 threads

This patch adds internal definition (through {libc_}hidden_{proto,def}) and
also change some strong to weak alias for symbols that might be used by C11
threads implementations.

The patchset should not change libc/libpthread functional, although object
changes are expected (since now internal symbols are used instead) and final
exported symbols through GLIBC_PRIVATE is also expanded (to cover libpthread
usage of __mmap{64}, __munmap, __mprotect).

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

* include/sched.h (__sched_get_priority_max): Add libc hidden proto.
(__sched_get_prioriry_min): Likewise.
* include/sys/mman.h (__mmap): Likewise.
(__mmap64): Likewise.
(__munmap): Likewise.
(__mprotect): Likewise.
* include/termios.h (__tcsetattr): Likewise.
* include/time.h (__nanosleep): Use hidden_proto instead of
libc_hidden_proto.
* posix/nanosleep.c (__nanosleep): Likewise.
* misc/Versions (libc): Export __mmap, __munmap, __mprotect,
__sched_get_priority_min, and __sched_get_priority_max under
GLIBC_PRIVATE.
* nptl/allocatestack.c (__free_stacks): Use internal definition for
libc symbols.
(change_stack_perm): Likewise.
(allocate_stack): Likewise.
* sysdeps/posix/gethostname.c: Likewise.
* nptl/tpp.c (__init_sched_fifo_prio): Likewise.
* sysdeps/unix/sysv/linux/i386/smp.h (is_smp_system): Likewise.
* sysdeps/unix/sysv/linux/powerpc/ioctl.c (__ioctl): Likewise.
* nptl/pthreadP.h (__pthread_mutex_timedlock): Add definition.
(__pthread_key_delete): Likewise.
(__pthread_detach): Likewise.
(__pthread_cancel): Likewise.
(__pthread_mutex_trylock): Likewise.
(__pthread_mutexattr_init): Likewise.
(__pthread_mutexattr_settype): Likewise.
* nptl/pthread_cancel.c (pthread_cancel): Change to internal name and
create alias for exported one.
* nptl/pthread_join.c (pthread_join): Likewise.
* nptl/pthread_detach.c (pthread_detach): Likewise.
* nptl/pthread_key_delete.c (pthread_key_delete): Likewise.
* nptl/pthread_mutex_timedlock.c (pthread_mutex_timedlock): Likewise.
* nptl/pthread_create.c: Change static requirements for pthread
symbols.
* nptl/pthread_equal.c (__pthread_equal): Change strong alias to weak
for internal definition.
* nptl/pthread_exit.c (__pthread_exit): Likewise.
* nptl/pthread_getspecific.c (__pthread_getspecific): Likewise.
* nptl/pthread_key_create.c (__pthread_key_create): Likewise.
* nptl/pthread_mutex_destroy.c (__pthread_mutex_destroy): Likewise.
* nptl/pthread_mutex_init.c (__pthread_mutex_init): Likewise.
* nptl/pthread_mutex_lock.c (__pthread_mutex_lock): Likewise.
* nptl/pthread_mutex_trylock.c (__pthread_mutex_trylock): Likewise.
* nptl/pthread_mutex_unlock.c (__pthread_mutex_unlock): Likewise.
* nptl/pthread_mutexattr_init.c (__pthread_mutexattr_init): Likwise.
* nptl/pthread_mutexattr_settype.c (__pthread_mutexattr_settype):
Likewise.
* nptl/pthread_self.c (__pthread_self): Likewise.
* nptl/pthread_setspecific.c (__pthread_setspecific): Likewise.
* sysdeps/unix/sysv/linux/tcsetattr.c (tcsetattr): Likewise.
* misc/mmap.c (__mmap): Add internal symbol definition.
* misc/mmap.c (__mmap64): Likewise.
* sysdeps/unix/sysv/linux/mmap.c (__mmap): Likewise.
* sysdeps/unix/sysv/linux/mmap64.c (__mmap): Likewise.
(__mmap64): Likewise.
* sysdeps/unix/sysv/linux/i386/Versions (libc) [GLIBC_PRIVATE):
Add __uname.

7 years agoUpdate x86 ulps for GCC 7.
Joseph Myers [Fri, 23 Jun 2017 20:23:26 +0000 (20:23 +0000)]
Update x86 ulps for GCC 7.

Testing with GCC 7 for 32-bit x86 showed some ulps differences,
presumably from variation in when values with excess precision get
spilled to the stack and so lose that precision.  This patch updates
the libm-test-ulps files accordingly.

* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/i386/i686/fpu/multiarch/libm-test-ulps: Likewise.

7 years agoMake libm-test-support code clear exceptions after each test.
Joseph Myers [Fri, 23 Jun 2017 20:10:45 +0000 (20:10 +0000)]
Make libm-test-support code clear exceptions after each test.

The libm-test-support code clears exceptions at the end of
test_exceptions.  However, it's possible that exceptions get raised as
part of the subsequent checks on the results of the function being
tested, and such exceptions then carry through to the next test run
and can cause that to fail spuriously.  In particular, it's possible
for the ulps calculation to raise exceptions in some cases.  This
patch puts exception clearing at the end of each of the check_*
functions, alongside errno clearing, to avoid one test affecting the
next in that way.

Tested for x86_64 (in conjunction with float128 patches).

* libm-test-support.c (check_float_internal): Clear exceptions at
end of function.
(check_int): Likewise.
(check_long): Likewise.
(check_bool): Likewise.
(check_longlong): Likewise.
(check_intmax_t): Likewise.
(check_uintmax_t): Likewise.

7 years agoAvoid localplt issues from x86 fereaiseexcept inline.
Joseph Myers [Fri, 23 Jun 2017 20:04:23 +0000 (20:04 +0000)]
Avoid localplt issues from x86 fereaiseexcept inline.

Building for x86_64 with float128 support, I get a localplt test
failure from lrintf128 calling feraiseexcept.

The problem is that an inline optimized version of feraiseexcept calls
__feraiseexcept_renamed in cases where it doesn't completely expand
inline, and that in turn is redirected to feraiseexcept for a library
call, so meaning the redirection of feraiseexcept to
__GI_feraiseexcept inside libm is lost for that call.

This patch fixes the problem by moving the redirect to an internal
header in the _LIBC case, with the internal header using
__GI_feraiseexcept where appropriate.

Tested for x86_64 (in conjunction with float128 patches).

* sysdeps/x86/fpu/bits/fenv.h [_LIBC] (__feraiseexcept_renamed):
Do not declare.
* sysdeps/x86/fpu/include/bits/fenv.h [_LIBC &&
__USE_EXTERN_INLINES] (__feraiseexcept_renamed): Declare here,
redirected to __GI_feraiseexcept if [SHARED && IS_IN (libm)].

7 years agox86-64: Optimize L(between_2_3) in memcmp-avx2-movbe.S
H.J. Lu [Fri, 23 Jun 2017 19:45:57 +0000 (12:45 -0700)]
x86-64: Optimize L(between_2_3) in memcmp-avx2-movbe.S

Turn

movzbl -1(%rdi, %rdx), %edi
movzbl -1(%rsi, %rdx), %esi
orl %edi, %eax
orl %esi, %ecx

into

movb -1(%rdi, %rdx), %al
movb -1(%rsi, %rdx), %cl

* sysdeps/x86_64/multiarch/memcmp-avx2-movbe.S (between_2_3):
Replace movzbl and orl with movb.

7 years agoDocument _FloatN and _FloatNx versions of math functions
Gabriel F. T. Gomes [Mon, 12 Jun 2017 12:30:38 +0000 (09:30 -0300)]
Document _FloatN and _FloatNx versions of math functions

The functions defined in ISO/IEC TS 18661-3 take floating-point arguments
and return floating-point numbers of _FloatN and _FloatNx types.  Apart
from the type, these functions behave the same as their float, double, and
long double counterparts.  This patch adds the newer functions to the
manual.

* manual/arith.texi (Infinity and NaN): Document SNANFN and SNANFNx.
(Error Reporting by Mathematical Functions): Document HUGE_VAL_FN
and HUGE_VAL_FNx.
(Absolute Value): Document fabsfN, fabsfNx, cabsfN, cabsfNx.
Rephrase the paragraph that mentions that fabs, fabsf, and fabsl
are in math.h, to avoid having to list the _FloatN and _FloatNx
variants as well.  Likewise for the cabs functions.
(Normalization Functions): Document frexpfN, frexpfNx, ldexpfN,
ldexpfNx, scalbnfN, scalbnfNx, scalblnfN, scalblnfNx.
Mention that _FloatN and _FloatNx variants of scalbn and scalbln
come from TS 18661-3, since this section explicitly states that
these functions come from BSD.
(Rounding Functions): Document ceilfN, ceilfNx, floorfN, floorfNx,
truncfN, truncfNx, rintfN, rintfNx, nearbyintfN, nearbyintfNx,
roundfN, roundfNx, roundevenfN, roundevenfNx, lrintfN, lrintfNx,
llrintfN, llrintfNx, lroundfN, lroundfNx, llroundfN, llroundfNx,
fromfpfN, fromfpfNx, ufromfpfN, ufromfpfNx, fromfpxfN, fromfpxfNx,
ufromfpxfN, ufromfpxfNx, modffN, modffNx.
(Remainder Functions): Document fmodfN, fmodfNx, remainderfN,
remainderfNx.
(Setting and modifying single bits of FP values): Document
copysignfN, copysignfNx, nextafterfN, nextafterfNx, nextupfN,
nextupfNx, nextdownfN, nextdownfNx, nanfN, nanfNx, canonicalizefN,
canonicalizefNx, getpayloadfN, getpayloadfNx, setpayloadfN,
setpayloadfNx, setpayloadsigfN, setpayloadsigfNx.
(Floating-Point Comparison Functions): Document totalorderfN,
totalorderfNx, totalordermagfN, totalordermagfNx.
(Miscellaneous FP arithmetic functions): Document fminfN, fminfNx,
fmaxfN, fmaxfNx, fminmagfN, fminmagfNx, fmaxmagfN, fmaxmagfNx,
fdimfN, fdimfNx, fmafN, fmafNx.
(Complex Numbers): Document the complex types: _FloatN complex and
_FloatNx complex.
(rojections, Conjugates, and Decomposing of Complex Numbers):
Document crealfN, crealfNx, cimagfN, cimagfNx, conjfN, conjfNx,
cargfN, cargfNx, cprojfN, cprojfNx.
* manual/math.texi (Mathematics): Mention that the _FloatN and
_FloatNx variants of the math functions come from TS 18661-3,
unless otherwise stated.
(Predefined Mathematical Constants): Document the _FloatN and
_FloatNx variants of the macros prefixed with M_.
(Trigonometric Functions): Document sinfN, sinfNx, cosfN, cosfNx,
tanfN, tanfNx, sincosfN, sincosfNx, csinfN, csinfNx, ccosfN,
ccosfNx, ctanfN, ctanfNx.
(Inverse Trigonometric Functions): Document asinfN, asinfNx,
acosfN, acosfNx, atanfN, atanfNx, atan2fN, atan2fNx.
(Exponentiation and Logarithms): Document expfN, expfNx, exp2fN,
exp2fNx, exp10fN, exp10fNx, logfN, logfNx, log10fN, log10fNx,
log2fN, log2fNx, logbfN, logbfNx, ilogbfN, ilogbfNx, llogbfN,
llogbfNx, powfN, powfNx, sqrtfN, sqrtfNx, cbrtfN, cbrtfNx, hypotfN,
hypotfNx, expm1fN, expm1fNx, log1pfN, log1pfNx, cexpfN, cexpfNx,
clogfN, clogfNx, clog10fN, clog10fNx, csqrtfN, csqrtfNx, cpowfN,
cpowfNx.
(Hyperbolic Functions): sinhfN, sinhfNx, coshfN, coshfNx, tanhfN,
tanhfNx, csinhfN, csinhfNx, ccoshfN, ccoshfNx, ctanhfN, ctanhfNx,
asinhfN, asinhfNx, acoshfN, acoshfNx, atanhfN, atanhfNx, casinhfN,
casinhfNx, cacoshfN, cacoshfNx, catanhfN, catanhfNx.
(Special Functions): Document erffN, erffNx, erfcfN, erfcfNx,
lgammafN, lgammafNx, lgammarfN_r, lgammafNx_r, tgammafN, tgammafNx,
j0fN, j0fNx, j1fN, j1fNx, jnfN, jnfNx, y0fN, y0fNx, y1fN, y1fNx,
ynfN, ynfNx.

7 years agox86-64: Fix comment typo in memcmp-avx2-movbe.S
Florian Weimer [Fri, 23 Jun 2017 17:00:58 +0000 (19:00 +0200)]
x86-64: Fix comment typo in memcmp-avx2-movbe.S

7 years agoresolv/res_libc.c: Reformat to GNU style
Florian Weimer [Fri, 23 Jun 2017 16:10:41 +0000 (18:10 +0200)]
resolv/res_libc.c: Reformat to GNU style

7 years agoresolv: Clean up declarations of the __res_initstamp variable
Florian Weimer [Fri, 23 Jun 2017 15:52:55 +0000 (17:52 +0200)]
resolv: Clean up declarations of the __res_initstamp variable

7 years agox86-64: memcmp-avx2-movbe.S needs saturating subtraction [BZ #21662]
Florian Weimer [Fri, 23 Jun 2017 15:23:44 +0000 (17:23 +0200)]
x86-64: memcmp-avx2-movbe.S needs saturating subtraction [BZ #21662]

This code:

L(between_2_3):
/* Load as big endian with overlapping loads and bswap to avoid
   branches.  */
movzwl -2(%rdi, %rdx), %eax
movzwl -2(%rsi, %rdx), %ecx
shll $16, %eax
shll $16, %ecx
movzwl (%rdi), %edi
movzwl (%rsi), %esi
orl %edi, %eax
orl %esi, %ecx
bswap %eax
bswap %ecx
subl %ecx, %eax
ret

needs a saturating subtract because the full register is used.
With this commit, only the lower 24 bits of the register are used,
so a regular subtraction suffices.

The test case change adds coverage for these kinds of bugs.

7 years agoAdd libio-mtsafe flags to the build of strfromf128
Gabriel F. T. Gomes [Thu, 22 Jun 2017 18:47:16 +0000 (15:47 -0300)]
Add libio-mtsafe flags to the build of strfromf128

Similar to the other functions in the strfrom class, strfromf128 calls
__printf_fp in order to convert the floating-point value to characters.
This requires the value of IO_MTSAFE_IO.

Tested for powerpc64le and s390x.

* sysdeps/ieee754/float128/Makefile (CFLAGS-strfromf128.c): Add
$(libio-mtsafe) to get the value of IO_MTSAFE_IO.

7 years agoPrepare the manual to display math errors for float128 functions
Gabriel F. T. Gomes [Thu, 22 Jun 2017 13:07:04 +0000 (10:07 -0300)]
Prepare the manual to display math errors for float128 functions

When float128 support gets enabled for powerpc64le, the ULP errors for
float128 functions need to be presented in the manual.  This patch adds
support for displaying them.

Tested for powerpc64le and s390x.

* manual/libm-err-tab.pl (@all_floats, %suffices, parse_ulps):
Enable generation of float128 entries on the error table.

7 years agoInclude libc-header-start.h in include/float.h
Gabriel F. T. Gomes [Thu, 22 Jun 2017 12:45:32 +0000 (09:45 -0300)]
Include libc-header-start.h in include/float.h

The file include/float.h uses the macro __GLIBC_USE to test for TS 18661-3
support.  Such macro is provided by bits/libc-header-start.h, so include it
to get the definition.

Tested for powerpc64le and s390x.

* include/float.h: Include libc-header-start.h to get the
definition of __GLIBC_USE.

7 years agoOptimized version of powf()
Paul Clarke [Fri, 23 Jun 2017 12:10:32 +0000 (09:10 -0300)]
Optimized version of powf()

Most significant changes are code simplification and use of doubles for
intermediate values.  Also, some rearrangement to move early
non-dependent code later, out of the faster paths.

* sysdeps/ieee754/flt-32/e_powf.c: Optimized implementation utilizing
rearranged code and doubles float types.

7 years agopowerpc: Fix sinf() IFUNC fallback.
Rogerio A. Cardoso [Fri, 23 Jun 2017 12:10:32 +0000 (09:10 -0300)]
powerpc: Fix sinf() IFUNC fallback.

sysdeps/powerpc/powerpc64/fpu/multiarch/s_sinf-ppc64.c should fall back to
sysdeps/powerpc/fpu/s_sinf.c not to sysdeps/ieee754/flt-32/s_sinf.c.

* sysdeps/powerpc/powerpc64/fpu/multiarch/s_sinf-ppc64.c: Change
s_sinf.c from sysdeps/ieee754/flt-32/ to sysdeps/powerpc/fpu/.

7 years agopowerpc: fix sysconf support for cache geometries
Paul Clarke [Fri, 23 Jun 2017 12:10:32 +0000 (09:10 -0300)]
powerpc: fix sysconf support for cache geometries

Commit cdfbe5037f2f67bf5f560b73732b69d0fabe2314 added sysconf support
for cache geometries on powerpc, but mishandled errno.  For valid input
parameters, sysconf() should not set errno.

* sysdeps/unix/sysv/linux/powerpc/sysconf.c: Remove references
to errno, and simplify remaining related code.

7 years agopowerpc: Update AT_HWCAP[2] bits
Tulio Magno Quites Machado Filho [Fri, 23 Jun 2017 12:10:32 +0000 (09:10 -0300)]
powerpc: Update AT_HWCAP[2] bits

Linux commit ID a4700a26107241cc7b9ac8528b2c6714ff99983d reserved 2 more
bits for the instructions darn (Deliver a Random Number) and scv (System
Call Vectored).

Linux commit ID 6997e57d693b07289694239e52a10d2f02c3a46f reserved
another bit for internal usage.

* sysdeps/powerpc/bits/hwcap.h: Add PPC_FEATURE2_DARN and
PPC_FEATURE2_SCV.
* sysdeps/powerpc/dl-procinfo.c (_dl_powerpc_cap_flags): Add scv
and darn.

7 years agopowerpc: refactor strrchr IFUNC
Rajalakshmi Srinivasaraghavan [Fri, 23 Jun 2017 05:54:30 +0000 (11:24 +0530)]
powerpc: refactor strrchr IFUNC

As done in commit 6d15a5c2e9450a1e926d5b4991759e1cfa50fccf
clean up IFUNC implementation for power8 in order to remove
unneeded macro definitions.

7 years agopowerpc: Add optimized version of [l]lroundf
Rajalakshmi Srinivasaraghavan [Fri, 23 Jun 2017 05:13:31 +0000 (10:43 +0530)]
powerpc: Add optimized version of [l]lroundf

This patch makes use of optimized double version of llround for single
precision as both the versions return [long] long type.

7 years agoSupport _Float128 in ldbl-96 bits/iscanonical.h.
Joseph Myers [Thu, 22 Jun 2017 23:06:41 +0000 (23:06 +0000)]
Support _Float128 in ldbl-96 bits/iscanonical.h.

This patch adds _Float128 support to the ldbl-96 bits/iscanonical.h,
as needed for x86_64 / x86 / ia64 support of _Float128.

Tested for x86_64 (in conjunction with float128 patches).

* sysdeps/ieee754/ldbl-96/bits/iscanonical.h
[__HAVE_DISTINCT_FLOAT128] (__iscanonicalf128): New macro.

7 years agoSupport _Float128 in math-tests.h.
Joseph Myers [Thu, 22 Jun 2017 23:03:38 +0000 (23:03 +0000)]
Support _Float128 in math-tests.h.

This patch makes math-tests.h, as used to describe support of given
floating-point types for sNaNs, rounding modes and exceptions, handle
distinguishing _Float128 from long double.  This is needed for x86_64,
where if building with GCC 6 or earlier there is no __builtin_nansq,
so no way to get a signaling NaN of _Float128 type, so associated
tests cannot be run (although glibc itself works fine, as there is
never any need to create such an sNaN with a built-in function inside
glibc).

Tested for x86_64 (in conjunction with float128 patches).

* sysdeps/generic/math-tests.h: Include <bits/floatn.h>.
(MATH_TESTS_TG): New macro.
(SNAN_TESTS_float128): Likewise.
(ROUNDING_TESTS_float128): Likewise.
(EXCEPTION_TESTS_float128): Likewise.
(SNAN_TESTS): Define using MATH_TESTS_TG.
(ROUNDING_TESTS): Likewise.
(EXCEPTION_TESTS): Likewise.

7 years agoFix float128_private.h redefinition of SET_RESTORE_ROUNDL.
Joseph Myers [Thu, 22 Jun 2017 22:57:28 +0000 (22:57 +0000)]
Fix float128_private.h redefinition of SET_RESTORE_ROUNDL.

As with other long double identifiers, float128_private.h has a
redefinition of SET_RESTORE_ROUNDL.  However, that redefinition is
broken, since this is a macro with one argument being defined to take
no arguments.  This patch fixes the redefinition.  (x86_64 needs the
redefinition because SET_RESTORE_ROUNDL only changes the x87 rounding
mode, whereas _Float128 arithmetic uses the SSE rounding mode instead
on x86_64.)

Tested for x86_64 (in conjunction with float128 patches).

* sysdeps/ieee754/float128/float128_private.h
[SET_RESTORE_ROUNDF128] (SET_RESTORE_ROUNDL): Take an argument and
pass it to SET_RESTORE_ROUNDF128.

7 years agoMake float128_private.h work with generic ieee754.h.
Joseph Myers [Thu, 22 Jun 2017 22:53:01 +0000 (22:53 +0000)]
Make float128_private.h work with generic ieee754.h.

float128_private.h redefines ieee754.h identifiers ieee854_long_double
and IEEE854_LONG_DOUBLE_BIAS to map them to identifiers from
ieee754_float128.h.

This causes problems when ieee754.h is included after
float128_private.h and it's a version of ieee754.h that also defines
those identifiers; specifically, sysdeps/ieee754/ieee754.h, which
defines those identifiers for the x86 extended format.  This patch
fixes this by ensuring an include of ieee754.h from float128_private.h
before the redefinitions.

Tested for x86_64 (in conjunction with float128 patches).

* sysdeps/ieee754/float128/float128_private.h: Include
<ieee754.h>.

7 years agoCorrect min_of_type handling of _Float128.
Joseph Myers [Thu, 22 Jun 2017 22:46:27 +0000 (22:46 +0000)]
Correct min_of_type handling of _Float128.

The math_private.h macro min_of_type has broken _Float128 handling:
instead of passing its type argument to the key __EXPR_FLT128 macro,
it passes x, which is not a macro argument but whatever variable
called x happens to be visible in the calling function.  If that
variable has the wrong type, the wrong one of long double and
_Float128 can get chosen.  In particular, this applies to some
_Complex long double functions (where x happens to have type _Complex
long double, resulting in min_of_type returning a _Float128 value when
it should return a long double value).  For some reason, this only
caused test failures for me on x86_64 with GCC 6 but not GCC 7 (I
suspect it triggers known bugs in conversions from x86 long double to
_Float128 that are present in GCC 6's soft-fp).

Tested for x86_64 (in conjunction with float128 patches).

* sysdeps/generic/math_private.h (__EXPR_FLT128): Do not apply
typeof to argument passed to __builtin_types_compatible_p.
(min_of_type): Pass type argument, not x, to __EXPR_FLT128.

This page took 0.11206 seconds and 5 git commands to generate.