]> sourceware.org Git - glibc.git/log
glibc.git
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.

7 years agoMake errno-setting libm templates include errno.h.
Joseph Myers [Thu, 22 Jun 2017 22:39:48 +0000 (22:39 +0000)]
Make errno-setting libm templates include errno.h.

Various type-generic libm wrapper templates, as used for float128, set
errno but do not include errno.h.  I presume they must get an implicit
include from some internal header on powerpc64le; they don't get such
an implicit include on x86_64.  This patch adds the missing includes
of errno.h to each such wrapper.

Tested for x86_64 (in conjunction with float128 patches).

* math/w_acos_template.c [__USE_WRAPPER_TEMPLATE]: Include
<errno.h>.
* math/w_acosh_template.c [__USE_WRAPPER_TEMPLATE]: Likewise.
* math/w_asin_template.c [__USE_WRAPPER_TEMPLATE]: Likewise.
* math/w_atanh_template.c [__USE_WRAPPER_TEMPLATE]: Likewise.
* math/w_cosh_template.c [__USE_WRAPPER_TEMPLATE]: Likewise.
* math/w_exp10_template.c [__USE_WRAPPER_TEMPLATE]: Likewise.
* math/w_exp2_template.c [__USE_WRAPPER_TEMPLATE]: Likewise.
* math/w_exp_template.c [__USE_WRAPPER_TEMPLATE]: Likewise.
* math/w_fmod_template.c [__USE_WRAPPER_TEMPLATE]: Likewise.
* math/w_hypot_template.c [__USE_WRAPPER_TEMPLATE]: Likewise.
* math/w_j0_template.c [__USE_WRAPPER_TEMPLATE]: Likewise.
* math/w_j1_template.c [__USE_WRAPPER_TEMPLATE]: Likewise.
* math/w_jn_template.c [__USE_WRAPPER_TEMPLATE]: Likewise.
* math/w_lgamma_r_template.c [__USE_WRAPPER_TEMPLATE]: Likewise.
* math/w_lgamma_template.c [__USE_WRAPPER_TEMPLATE]: Likewise.
* math/w_log10_template.c [__USE_WRAPPER_TEMPLATE]: Likewise.
* math/w_log2_template.c [__USE_WRAPPER_TEMPLATE]: Likewise.
* math/w_log_template.c [__USE_WRAPPER_TEMPLATE]: Likewise.
* math/w_pow_template.c [__USE_WRAPPER_TEMPLATE]: Likewise.
* math/w_remainder_template.c [__USE_WRAPPER_TEMPLATE]: Likewise.
* math/w_sinh_template.c [__USE_WRAPPER_TEMPLATE]: Likewise.
* math/w_sqrt_template.c [__USE_WRAPPER_TEMPLATE]: Likewise.
* math/w_tgamma_template.c [__USE_WRAPPER_TEMPLATE]: Likewise.

7 years agoFix float128 uses of xlocale.h.
Joseph Myers [Thu, 22 Jun 2017 22:34:49 +0000 (22:34 +0000)]
Fix float128 uses of xlocale.h.

Three float128 files still include xlocale.h after it was removed.  I
don't know why this didn't cause problems for powerpc64le float128
testing; it did cause problems for my x86_64 float128 testing.  This
patch changes the includes to use bits/types/locale_t.h.

Tested for x86_64 (in conjunction with float128 patches).

* sysdeps/ieee754/float128/strtof128_l.c: Include
<bits/types/locale_t.h> instead of <xlocale.h>.
* sysdeps/ieee754/float128/wcstof128.c: Likewise.
* sysdeps/ieee754/float128/wcstof128_l.c: Likewise.

7 years agoAdd ChangeLog entries for the last 3 commits
Siddhesh Poyarekar [Thu, 22 Jun 2017 18:19:15 +0000 (23:49 +0530)]
Add ChangeLog entries for the last 3 commits

I forgot to add ChangeLog entries for my last three commits.

7 years agobenchtests: New script to parse memcpy results
Siddhesh Poyarekar [Thu, 22 Jun 2017 18:14:50 +0000 (23:44 +0530)]
benchtests: New script to parse memcpy results

Read the memcpy results in json and print out the results in tabular
form, in addition to generating a graph of the results to compare all
of the implementations.

The format of the output is extensible enough to allow this kind of
analysis to be done on other string functions as well.

* benchtests/scripts/benchout_strings.schema.json: New file.
* benchtests/scripts/compare_strings.py: New file.

7 years agobenchtests: Make memcpy benchmarks print results in json
Siddhesh Poyarekar [Thu, 22 Jun 2017 18:14:19 +0000 (23:44 +0530)]
benchtests: Make memcpy benchmarks print results in json

Print the benchmark output for various memcpy benchmarks in json so
that it can be predictably parsed and analyzed.

* benchtests/bench-memcpy-large.c: Include json-lib.h.
(do_one_test): Print json.
(do_test): Likewise.
(test_main): Likewise.
* benchtests/bench-memcpy-random.c: Include json-lib.h.
(do_one_test): Print json.
(do_test): Likewise.
(test_main): Likewise.
* benchtests/bench-memcpy.c: Include json-lib.h.
(do_one_test): Print json.
(do_test): Likewise.
(test_main): Likewise.

7 years agobenchtests: Print string array elements, int and uint in json
Siddhesh Poyarekar [Thu, 22 Jun 2017 18:14:12 +0000 (23:44 +0530)]
benchtests: Print string array elements, int and uint in json

Enhance the json module in benchtests to print signed and unsigned
integers and string array elements.

* benchtests/json-lib.h: Include inttypes.h.
(json_attr_int, json_attr_int, json_element_string,
json_element_int, json_element_uint): New functions.
* benchtests/json-lib.c: (json_attr_int, json_attr_int,
json_element_string, json_element_int, json_element_uint): New
functions.

7 years agoDescribe remainder as primary and drem as alternative in the manual
Gabriel F. T. Gomes [Tue, 20 Jun 2017 18:00:16 +0000 (15:00 -0300)]
Describe remainder as primary and drem as alternative in the manual

In preparation for the documentation of _FloatN and _FloatNx variants of
the remainder function, this patch changes the descriptions of remainder
and drem, so that remainder is described as primary and drem as an
alternative name for the same functionality.

* manual/arith.texi (Remainder Functions): Describe remainder as
primary and drem as an alternative name.  Change the comment on
remainder to ISO, since it is defined in ISO C99.

7 years agoProvide an additional macro expansion for F128 in stdlib/tst-strtod.h
Gabriel F. T. Gomes [Wed, 21 Jun 2017 12:20:39 +0000 (09:20 -0300)]
Provide an additional macro expansion for F128 in stdlib/tst-strtod.h

The macro F128 in stdlib/tst-strtod.h is defined to provide the literal
suffix for _Float128 constants.  It uses the macro __f128 (), which is
defined in bits/floatn.h to provide the correct literal suffix depending on
what is provided by the compiler.

However, F128 was not being expanded and only worked correctly, when
compiling with GCC 7 (or greater), since F128 is the literal suffix itself.
This patch adds an additional macro expansion so that the macro F128
expands to the correct literal suffix on older compilers.

* stdlib/tst-strtod.h (MMFUNC): New macro to provide an addition
macro expansion.
(GEN_TEST_STRTOD_FOREACH): Use MMFUNC for _Float128.

7 years agolocaledata: fur_IT: Fix spelling of Wednesday (Miercus)
Rafal Luzynski [Thu, 22 Jun 2017 09:53:02 +0000 (11:53 +0200)]
localedata: fur_IT: Fix spelling of Wednesday (Miercus)

* localedata/locales/fur_IT (day, abday): reworded "Miarcus" to
  "Miercus" and abbreviated "Mia" to "Mie".

7 years agoBug 21533: Update to Unicode 10.0.0
Mike FABIAN [Wed, 31 May 2017 09:10:25 +0000 (11:10 +0200)]
Bug 21533: Update to Unicode 10.0.0

* Unicode 10.0.0 Support: Character encoding, character type info, and
  transliteration tables are all updated to Unicode 10.0.0, using
  generator scripts contributed by Mike FABIAN (Red Hat).

7 years agoinet: __inet6_scopeid_pton should accept node-local addresses [BZ #21657]
Benjamin Cama [Thu, 22 Jun 2017 13:49:28 +0000 (15:49 +0200)]
inet: __inet6_scopeid_pton should accept node-local addresses [BZ #21657]

7 years ago_nl_load_domain: Use calloc instead of alloca
Florian Weimer [Wed, 21 Jun 2017 20:59:19 +0000 (22:59 +0200)]
_nl_load_domain: Use calloc instead of alloca

7 years agoImplement allocation buffers for internal use
Florian Weimer [Wed, 21 Jun 2017 20:43:57 +0000 (22:43 +0200)]
Implement allocation buffers for internal use

This commit adds fixed-size allocation buffers.  The primary use
case is in NSS modules, where dynamically sized data is stored
in a fixed-size buffer provided by the caller.

Other uses include a replacement of mempcpy cascades (which is
safer due to the size checking inherent to allocation buffers).

7 years agox86-64: Implement strcmp family IFUNC selectors in C
H.J. Lu [Wed, 21 Jun 2017 19:10:50 +0000 (12:10 -0700)]
x86-64: Implement strcmp family IFUNC selectors in C

Implement strcmp family IFUNC selectors in C.

All internal calls within libc.so can use IFUNC on x86-64 since unlike
x86, x86-64 supports PC-relative addressing to access the GOT entry so
that it can call via PLT without using an extra register.  For libc.a,
we can't use IFUNC for functions which are called before IFUNC has been
initialized.  Use IFUNC internally reduces the icache footprint since
libc.so and other codes in the process use the same implementations.
This patch uses IFUNC for strcmp family functions within libc.

* sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add
strcmp-sse2, strcmp-sse4_2, strncmp-sse2, strncmp-sse4_2,
strcasecmp_l-sse2, strcasecmp_l-sse4_2, strcasecmp_l-avx,
strncase_l-sse2, strncase_l-sse4_2 and strncase_l-avx.
* sysdeps/x86_64/multiarch/ifunc-strcasecmp.h: New file.
* sysdeps/x86_64/multiarch/strcasecmp.c: Likewise.
* sysdeps/x86_64/multiarch/strcasecmp_l-avx.S: Likewise.
* sysdeps/x86_64/multiarch/strcasecmp_l-sse2.S: Likewise.
* sysdeps/x86_64/multiarch/strcasecmp_l-sse4_2.S: Likewise.
* sysdeps/x86_64/multiarch/strcasecmp_l.c: Likewise.
* sysdeps/x86_64/multiarch/strcmp-sse2.S: Likewise.
* sysdeps/x86_64/multiarch/strcmp-sse4_2.S: Likewise.
* sysdeps/x86_64/multiarch/strcmp.c: Likewise.
* sysdeps/x86_64/multiarch/strncase.c: Likewise.
* sysdeps/x86_64/multiarch/strncase_l-avx.S : Likewise.
* sysdeps/x86_64/multiarch/strncase_l-sse2.S: Likewise.
* sysdeps/x86_64/multiarch/strncase_l-sse4_2.S: Likewise.
* sysdeps/x86_64/multiarch/strncase_l.c: Likewise.
* sysdeps/x86_64/multiarch/strncmp-sse2.S: Likewise.
* sysdeps/x86_64/multiarch/strncmp-sse4_2.S: Likewise.
* sysdeps/x86_64/multiarch/strncmp.c: Likewise.
* sysdeps/x86_64/multiarch/strcasecmp_l.S: Removed.
* sysdeps/x86_64/multiarch/strcmp.S: Likewise.
* sysdeps/x86_64/multiarch/strncase_l.S: Likewise.
* sysdeps/x86_64/multiarch/strncmp.S: Likewise.
* sysdeps/x86_64/multiarch/strcmp-sse42.S: Include <sysdep.h>.
(STRCMP_SSE42): New.  Defined to __strcmp_sse42 if not defined.
[USE_AS_STRCASECMP_L || USE_AS_STRNCASECMP_L]: Include
"locale-defines.h".
(UPDATE_STRNCMP_COUNTER): New.
(SECTION): Likewise.
(GLABEL): Likewise.
(LABEL): Likewise.
* sysdeps/x86_64/multiarch/strncmp-ssse3.S: Rewrite and enable
for libc.a.

7 years agoFix tile SA_* conditions for POSIX.1:2008 (bug 21622).
Joseph Myers [Wed, 21 Jun 2017 17:35:24 +0000 (17:35 +0000)]
Fix tile SA_* conditions for POSIX.1:2008 (bug 21622).

As shown by conform/ tests once the remaining namespace issues are
fixed, the tile bits/sigaction.h fails to declare SA_RESETHAND,
SA_RESTART and SA_NODEFER for non-XSI POSIX.1:2008 as other versions
do.  Those constants were moved from XSI to Base in the 2008 edition
of POSIX.  This patch fixes the conditions to match other versions of
this header.

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

[BZ #21622]
* sysdeps/unix/sysv/linux/tile/bits/sigaction.h (SA_RESTART):
Define for [__USE_UNIX98 || __USE_XOPEN2K8], not [__USE_UNIX98 ||
__USE_MISC].
(SA_NODEFER): Likewise.
(SA_RESETHAND): Likewise.

7 years agox86: Rename glibc.tune.ifunc to glibc.tune.hwcaps
H.J. Lu [Wed, 21 Jun 2017 17:20:24 +0000 (10:20 -0700)]
x86: Rename glibc.tune.ifunc to glibc.tune.hwcaps

Rename glibc.tune.ifunc to glibc.tune.hwcaps and move it to
sysdeps/x86/dl-tunables.list since it is x86 specicifc.  Also
change type of data_cache_size, data_cache_size and
non_temporal_threshold to unsigned long int to match size_t.
Remove usage DEFAULT_STRLEN from cpu-tunables.c.

* elf/dl-tunables.list (glibc.tune.ifunc): Removed.
* sysdeps/x86/dl-tunables.list (glibc.tune.hwcaps): New.
Remove security_level on all fields.
* manual/tunables.texi: Replace ifunc with hwcaps.
* sysdeps/x86/cpu-features.c (TUNABLE_CALLBACK (set_ifunc)):
Renamed to ..
(TUNABLE_CALLBACK (set_hwcaps)): This.
(init_cpu_features): Updated.
* sysdeps/x86/cpu-features.h (cpu_features): Change type of
data_cache_size, data_cache_size and non_temporal_threshold to
unsigned long int.
* sysdeps/x86/cpu-tunables.c (DEFAULT_STRLEN): Removed.
(TUNABLE_CALLBACK (set_ifunc)): Renamed to ...
(TUNABLE_CALLBACK (set_hwcaps)): This.  Update comments.  Don't
use DEFAULT_STRLEN.

7 years agoDCIGETTEXT: Use getcwd, asprintf to construct absolute pathname
Florian Weimer [Wed, 21 Jun 2017 14:31:31 +0000 (16:31 +0200)]
DCIGETTEXT: Use getcwd, asprintf to construct absolute pathname

7 years ago[AArch64] Add more cfi annotations to tlsdesc entry points
Szabolcs Nagy [Wed, 21 Jun 2017 14:01:18 +0000 (15:01 +0100)]
[AArch64] Add more cfi annotations to tlsdesc entry points

Backtrace through _dl_tlsdesc_resolve_rela was broken because the offset
of x30 from cfa was not in the debug info.

Add enough annotation so backtracing from the dynamic linker through
tlsdesc entry points works and the debugger shows registers correctly.

7 years agoposix: Add invalid flags test for p{write,read}v2
Adhemerval Zanella [Mon, 5 Jun 2017 12:13:49 +0000 (09:13 -0300)]
posix: Add invalid flags test for p{write,read}v2

This patch add an extra test for passing invalid flags and check its
expected failure.  It shows an invalid LO_HI_LONG macro definition for
x86_64 with leads to passing invalid flags on some configurations.

The new tests fails on i686-linux-gnu and potentially on other 32 bits
architecture that uses the compat syscall definition due a kernel bug.
It is intended to be fixed upstream.

Checked on x86_64-linux-gnu

* misc/tst-preadvwritev2-common.c: New file.
* misc/tst-preadvwritev2.c (do_test): Add test for invalid flag.
* misc/tst-preadvwritev64v2.c (do_test): Likewise.

7 years ago[AArch64] Use hidden __GI__dl_argv in rtld startup code
Szabolcs Nagy [Wed, 21 Jun 2017 12:47:07 +0000 (13:47 +0100)]
[AArch64] Use hidden __GI__dl_argv in rtld startup code

We rely on the symbol being locally defined so using extern symbol
is not correct and the linker may complain about the relocations.

7 years agogetaddrinfo: Avoid stack copy of IPv6 address
Florian Weimer [Wed, 21 Jun 2017 11:35:37 +0000 (13:35 +0200)]
getaddrinfo: Avoid stack copy of IPv6 address

7 years ago__inet_pton_length: Implement new internal helper function
Florian Weimer [Wed, 21 Jun 2017 11:09:08 +0000 (13:09 +0200)]
__inet_pton_length: Implement new internal helper function

7 years agoinet: Add IPv6 getaddrinfo coverage to tst-inet6_scopeid_pton.c
Florian Weimer [Wed, 21 Jun 2017 10:51:54 +0000 (12:51 +0200)]
inet: Add IPv6 getaddrinfo coverage to tst-inet6_scopeid_pton.c

7 years agopowerpc: Optimize memchr for power8
Rajalakshmi Srinivasaraghavan [Wed, 21 Jun 2017 05:25:12 +0000 (10:55 +0530)]
powerpc: Optimize memchr for power8

Vectorized loops are used for sizes greater than 32B to improve
performance over power7 optimiztion.

7 years agopowerpc: Add optimized version of [l]lrintf
Rajalakshmi Srinivasaraghavan [Wed, 21 Jun 2017 05:14:18 +0000 (10:44 +0530)]
powerpc: Add optimized version of [l]lrintf

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

7 years agoFactor out shared definitions from bits/signum.h.
Zack Weinberg [Sat, 3 Jun 2017 20:22:24 +0000 (16:22 -0400)]
Factor out shared definitions from bits/signum.h.

Many of the things defined by bits/signum.h are invariant across all
supported operating systems.  This patch factors out all of them to a
new header bits/signum-generic.h, which each bits/signum.h will include
and then override whichever things need adjustment.  Normally that will
mean, at most, adding or changing a few signal numbers.

A user-visible side effect is that the obsolete signal constant SIGUNUSED
(which is an alias for SIGSYS on all platforms that define it) is no
longer exposed by any version of bits/signum.h.

A side effect only relevant to glibc hackers is that _NSIG is now defined
in terms of __SIGRTMAX, instead of the other way around.  This is because
__SIGRTMAX varies from platform to platform, but _NSIG==__SIGRTMAX+1 is
true universally.  If your platform doesn't support realtime signals,
leave __SIGRTMAX equal to __SIGRTMIN.

I also added a Linux-specific test to make sure that our signal constants
match the ones in <asm/signal.h>, since we can't use that header (it's
not even vaguely namespace-clean).

* bits/signum-generic.h: Renamed from bits/signum.h.
Add proper multiple include guard and misuse check.
Define __SIGRTMIN = __SIGRTMAX = 32, and define _NSIG = __SIGRTMAX+1.
Move definition of SIGIO to "archaic names for compatibility" section.
* bits/signum.h: New file which just includes bits/signum-generic.h.
* sysdeps/unix/bsd/bits/signum.h
* sysdeps/unix/sysv/linux/bits/signum.h
* sysdeps/unix/sysv/linux/alpha/bits/signum.h
* sysdeps/unix/sysv/linux/hppa/bits/signum.h
* sysdeps/unix/sysv/linux/mips/bits/signum.h
* sysdeps/unix/sysv/linux/sparc/bits/signum.h
Just include <bits/signum-generic.h> and then add or adjust
signal constants.  Do not define SIGUNUSED, SIGRTMIN, or SIGRTMAX.

* signal/Makefile: Install bits/signum-generic.h.
* signal/signal.h: Define SIGRTMIN and SIGRTMAX here.

* sysdeps/generic/siglist.h: SIGSYS and SIGWINCH are
universal.  Prefer SIGPOLL to SIGIO. Simplify #ifdeffage.

* sysdeps/unix/sysv/linux/tst-signal-numbers.sh: New test.
* sysdeps/unix/sysv/linux/Makefile: Run it.

7 years agoUse locale_t, not __locale_t, throughout glibc
Zack Weinberg [Tue, 20 Jun 2017 13:26:43 +0000 (09:26 -0400)]
Use locale_t, not __locale_t, throughout glibc

<locale.h> is specified to define locale_t in POSIX.1-2008, and so are
all of the headers that define functions that take locale_t arguments.
Under _GNU_SOURCE, the additional headers that define such functions
have also always defined locale_t.  Therefore, there is no need to use
__locale_t in public function prototypes, nor in any internal code.

* ctype/ctype-c99_l.c, ctype/ctype.h, ctype/ctype_l.c
* include/monetary.h, include/stdlib.h, include/time.h
* include/wchar.h, locale/duplocale.c, locale/freelocale.c
* locale/global-locale.c, locale/langinfo.h, locale/locale.h
* locale/localeinfo.h, locale/newlocale.c
* locale/nl_langinfo_l.c, locale/uselocale.c
* localedata/bug-usesetlocale.c, localedata/tst-xlocale2.c
* stdio-common/vfscanf.c, stdlib/monetary.h, stdlib/stdlib.h
* stdlib/strfmon_l.c, stdlib/strtod_l.c, stdlib/strtof_l.c
* stdlib/strtol.c, stdlib/strtol_l.c, stdlib/strtold_l.c
* stdlib/strtoll_l.c, stdlib/strtoul_l.c, stdlib/strtoull_l.c
* string/strcasecmp.c, string/strcoll_l.c, string/string.h
* string/strings.h, string/strncase.c, string/strxfrm_l.c
* sysdeps/ieee754/float128/strtof128_l.c
* sysdeps/ieee754/float128/wcstof128.c
* sysdeps/ieee754/float128/wcstof128_l.c
* sysdeps/ieee754/ldbl-128ibm/strtold_l.c
* sysdeps/ieee754/ldbl-64-128/strtold_l.c
* sysdeps/ieee754/ldbl-opt/nldbl-compat.c
* sysdeps/ieee754/ldbl-opt/nldbl-strfmon_l.c
* sysdeps/ieee754/ldbl-opt/nldbl-strtold_l.c
* sysdeps/ieee754/ldbl-opt/nldbl-wcstold_l.c
* sysdeps/powerpc/powerpc32/power7/strcasecmp.S
* sysdeps/powerpc/powerpc64/power7/strcasecmp.S
* sysdeps/x86_64/strcasecmp_l-nonascii.c
* sysdeps/x86_64/strncase_l-nonascii.c, time/strftime_l.c
* time/strptime_l.c, time/time.h, wcsmbs/mbsrtowcs_l.c
* wcsmbs/wchar.h, wcsmbs/wcscasecmp.c, wcsmbs/wcsncase.c
* wcsmbs/wcstod.c, wcsmbs/wcstod_l.c, wcsmbs/wcstof.c
* wcsmbs/wcstof_l.c, wcsmbs/wcstol_l.c, wcsmbs/wcstold.c
* wcsmbs/wcstold_l.c, wcsmbs/wcstoll_l.c, wcsmbs/wcstoul_l.c
* wcsmbs/wcstoull_l.c, wctype/iswctype_l.c
* wctype/towctrans_l.c, wctype/wcfuncs_l.c
* wctype/wctrans_l.c, wctype/wctype.h, wctype/wctype_l.c:
Change all uses of __locale_t to locale_t.

7 years agoRename xlocale.h to bits/types/__locale_t.h.
Zack Weinberg [Fri, 9 Jun 2017 16:02:06 +0000 (12:02 -0400)]
Rename xlocale.h to bits/types/__locale_t.h.

xlocale.h is already a single-type micro-header, defining struct
__locale_struct and the typedefs __locale_t and locale_t.  This patch
brings it into the bits/types/ scheme: there are now
bits/types/__locale_t.h which defines only __locale_struct and
__locale_t, and bits/types/locale_t.h which defines locale_t as well
as the other two.  None of *our* headers need __locale_t.h, but it
appears to me that libstdc++ could make use of it.

There are a lot of external uses of xlocale.h, but all the uses I
checked had an autoconf test or equivalent for its existence.  It has
never been available from other C libraries, and it has always
contained a comment reading "This file is not standardized, don't rely
on it, it can go away without warning" so I think dropping it is
pretty safe.

I also took the opportunity to clean up comments in various public
header files that still talk about the *_l interfaces as though they
were completely nonstandard.  There are a few of them, notably the
strtoX_l and wcstoX_l families, that haven't been standardized, but
the bulk are in POSIX.1-2008.

        * locale/xlocale.h: Rename to...
* locale/bits/types/__locale_t.h: ...here.  Adjust commentary.
Only define struct __locale_struct and __locale_t, not locale_t.
        * locale/bits/types/locale_t.h: New file; define locale_t here.
        * locale/Makefile (headers): Update to match.

        * include/xlocale.h: Delete wrapper.
        * include/bits/types/__locale_t.h: New wrapper.
        * include/bits/types/locale_t.h: New wrapper.

        * ctype/ctype.h, include/printf.h, include/time.h
        * locale/langinfo.h, locale/locale.h, stdlib/monetary.h
        * stdlib/stdlib.h, string/string.h, string/strings.h, time/time.h
        * wcsmbs/wchar.h, wctype/wctype.h: Use bits/types/locale_t.h.
        Correct outdated comments regarding the standardization status of
        the functions that take locale_t arguments.

        * stdlib/strtod_l.c, stdlib/strtof_l.c, stdlib/strtol_l.c
        * stdlib/strtold_l.c, stdlib/strtoul_l.c, stdlib/strtoull_l.c
        * sysdeps/ieee754/ldbl-128ibm/strtold_l.c
        * sysdeps/ieee754/ldbl-64-128/strtold_l.c
        * wcsmbs/wcstod.c, wcsmbs/wcstod_l.c, wcsmbs/wcstof.c
        * wcsmbs/wcstof_l.c, wcsmbs/wcstold.c, wcsmbs/wcstold_l.c:
        Don't include xlocale.h. If necessary, include locale.h instead.

        * stdlib/strtold_l.c: Unconditionally include wchar.h.

7 years agoConsolidate Linux openat implementation
Adhemerval Zanella [Tue, 20 Jun 2017 18:46:28 +0000 (15:46 -0300)]
Consolidate Linux openat implementation

This patch consolidates the open Linux syscall implementation on
sysdeps/unix/sysv/linux/open{64}.c.  The changes are:

  1. Remove wordsize-64 openat{64}.
  2. For architetures that define __OFF_T_MATCHES_OFF64_T openat64
     will be default one with alias to required symbols.  Otherwise
     openat64 will pass the required O_LARGEFILE flag on syscall.

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

* sysdeps/unix/sysv/linux/openat.c (__libc_openat): Build only
for !__OFF_T_MATCHES_OFF64_T.
* sysdeps/unix/sysv/linux/openat64.c (__libc_openat64): New
implementation based on open64.
* sysdeps/unix/sysv/linux/wordsize-64/openat.c: Remove file.
* sysdeps/unix/sysv/linux/wordsize-64/openat64.c: Likewise.

7 years agoMove x86 specific tunables to x86/dl-tunables.list
H.J. Lu [Tue, 20 Jun 2017 21:03:09 +0000 (14:03 -0700)]
Move x86 specific tunables to x86/dl-tunables.list

* elf/dl-tunables.list: Move x86 specific tunables to ...
* sysdeps/x86/dl-tunables.list: Here.  New file.

7 years agoconformtest: XFAIL uc_mcontext test for powerpc32 (bug 21635).
Joseph Myers [Tue, 20 Jun 2017 17:51:36 +0000 (17:51 +0000)]
conformtest: XFAIL uc_mcontext test for powerpc32 (bug 21635).

This patch XFAILs one test where the powerpc32 ucontext_t has the
wrong type of a field, to allow the conform/ tests as a whole to pass
once the namespace issues are fixed.

Tested with build-many-glibcs.py.

[BZ #21635]
* sysdeps/unix/sysv/linux/powerpc/powerpc32/Makefile
[$(subdir) = conform] (conformtest-xfail-conds): New variable.
* conform/data/signal.h-data (uc_mcontext): XFAIL for
powerpc32-linux.
* conform/data/ucontext.h-data (uc_mcontext): Likewise.

7 years agoconformtest: XFAIL uc_sigmask test for ia64 (bug 21634).
Joseph Myers [Tue, 20 Jun 2017 17:47:32 +0000 (17:47 +0000)]
conformtest: XFAIL uc_sigmask test for ia64 (bug 21634).

This patch XFAILs one test where the ia64 ucontext_t has the wrong
type of a field, to allow the conform/ tests as a whole to pass once
the namespace issues are fixed.

Tested with build-many-glibcs.py.

[BZ #21634]
* sysdeps/unix/sysv/linux/ia64/Makefile [$(subdir) = conform]
(conformtest-xfail-conds): New variable.
* conform/data/signal.h-data (uc_sigmask): XFAIL for ia64-linux.
* conform/data/ucontext.h-data (uc_sigmask): Likewise.

7 years agoAdd powf trace
Wilco Dijkstra [Tue, 20 Jun 2017 15:46:52 +0000 (16:46 +0100)]
Add powf trace

Add a workload for powf.  This is a reduced trace based on 2.3 billion
samples extracted from wrf.  The distribution of values, in particular
frequency of commonly used operands is the same as in the full trace.

    * benchtests/powf-inputs: Add reduced trace from wrf.

7 years agotunables: Add IFUNC selection and cache sizes
H.J. Lu [Tue, 20 Jun 2017 15:33:29 +0000 (08:33 -0700)]
tunables: Add IFUNC selection and cache sizes

The current IFUNC selection is based on microbenchmarks in glibc.  It
should give the best performance for most workloads.  But other choices
may have better performance for a particular workload or on the hardware
which wasn't available at the selection was made.  The environment
variable, GLIBC_TUNABLES=glibc.tune.ifunc=-xxx,yyy,-zzz...., can be used
to enable CPU/ARCH feature yyy, disable CPU/ARCH feature yyy and zzz,
where the feature name is case-sensitive and has to match the ones in
cpu-features.h.  It can be used by glibc developers to override the
IFUNC selection to tune for a new processor or improve performance for
a particular workload.  It isn't intended for normal end users.

NOTE: the IFUNC selection may change over time.  Please check all
multiarch implementations when experimenting.

Also, GLIBC_TUNABLES=glibc.tune.x86_non_temporal_threshold=NUMBER is
provided to set threshold to use non temporal store to NUMBER,
GLIBC_TUNABLES=glibc.tune.x86_data_cache_size=NUMBER to set data cache
size, GLIBC_TUNABLES=glibc.tune.x86_shared_cache_size=NUMBER to set
shared cache size.

* elf/dl-tunables.list (tune): Add ifunc,
x86_non_temporal_threshold,
x86_data_cache_size and x86_shared_cache_size.
* manual/tunables.texi: Document glibc.tune.ifunc,
glibc.tune.x86_data_cache_size, glibc.tune.x86_shared_cache_size
and glibc.tune.x86_non_temporal_threshold.
* sysdeps/unix/sysv/linux/x86/dl-sysdep.c: New file.
* sysdeps/x86/cpu-tunables.c: Likewise.
* sysdeps/x86/cacheinfo.c
(init_cacheinfo): Check and get data cache size, shared cache
size and non temporal threshold from cpu_features.
* sysdeps/x86/cpu-features.c [HAVE_TUNABLES] (TUNABLE_NAMESPACE):
New.
[HAVE_TUNABLES] Include <unistd.h>.
[HAVE_TUNABLES] Include <elf/dl-tunables.h>.
[HAVE_TUNABLES] (TUNABLE_CALLBACK (set_ifunc)): Likewise.
[HAVE_TUNABLES] (init_cpu_features): Use TUNABLE_GET to set
IFUNC selection, data cache size, shared cache size and non
temporal threshold.
* sysdeps/x86/cpu-features.h (cpu_features): Add data_cache_size,
shared_cache_size and non_temporal_threshold.

7 years agoImprove math benchmark infrastructure
Wilco Dijkstra [Tue, 20 Jun 2017 15:26:26 +0000 (16:26 +0100)]
Improve math benchmark infrastructure

Improve support for math function benchmarking.  This patch adds
a feature that allows accurate benchmarking of traces extracted
from real workloads.  This is done by iterating over all samples
rather than repeating each sample many times (which completely
ignores branch prediction and cache effects).  A trace can be
added to existing math function inputs via
"## name: workload-<name>", followed by the trace.

        * benchtests/README: Describe workload feature.
        * benchtests/bench-skeleton.c (main): Add support for
        benchmarking traces from workloads.

7 years agoFix fallout from bits/string.h removal.
Zack Weinberg [Tue, 20 Jun 2017 13:39:08 +0000 (09:39 -0400)]
Fix fallout from bits/string.h removal.

Remove one more string inline that was defined directly in string.h;
in the absence of the rest of the inlines, it broke the build.

Like other ifunc shims for these functions,
x86_64/multiarch/{mem,st}pcpy.c need to define __NO_STRING_INLINES and
NO_MEMPCPY_STPCPY_REDIRECT.

* string/string.h (__mempcpy_inline): Delete.
* sysdeps/x86_64/multiarch/mempcpy.c
* sysdeps/x86_64/multiarch/stpcpy.c:
Define NO_MEMPCPY_STPCPY_REDIRECT and __NO_STRING_INLINES
before including string.h.

7 years agoAdd powf bench tests
Paul Clarke [Tue, 20 Jun 2017 13:14:42 +0000 (10:14 -0300)]
Add powf bench tests

Add powf() bench test with input which covers these cases:
- positive base to positive exponent
- exponent 0
- negative base to even exponent
- exponent 1
- exponent -1
- squared
- squareroot
- 1 to negative exponent
- -1 to negative exponent
- base 0
- -1 to even exponent
- small base
- small exponent

* benchtests/Makefile (bench-math): Add powf.
* benchtests/powf-inputs: New file.

7 years agoMention in NEWS that __(NO|USE)_STRING_INLINES don't do anything anymore.
Zack Weinberg [Tue, 20 Jun 2017 12:31:18 +0000 (08:31 -0400)]
Mention in NEWS that __(NO|USE)_STRING_INLINES don't do anything anymore.

7 years agoRemove bits/string.h.
Zack Weinberg [Thu, 17 Nov 2016 14:26:27 +0000 (09:26 -0500)]
Remove bits/string.h.

These machine-dependent inline string functions have never been on by
default, and even if they were a good idea at the time they were
introduced, they haven't really been touched in ten to fifteen years
and probably aren't a good idea on current-gen processors.  Current
thinking is that this class of optimization is best left to the
compiler.

* bits/string.h, string/bits/string.h
* sysdeps/aarch64/bits/string.h
* sysdeps/m68k/m680x0/m68020/bits/string.h
* sysdeps/s390/bits/string.h, sysdeps/sparc/bits/string.h
* sysdeps/x86/bits/string.h: Delete file.

* string/string.h: Don't include bits/string.h.
* string/bits/string3.h: Rename to bits/string_fortified.h.
No need to undef various symbols that the removed headers
might have defined as macros.
* string/Makefile (headers): Remove bits/string.h, change
bits/string3.h to bits/string_fortified.h.
* string/string-inlines.c: Update commentary.  Remove definitions
of various macros that nothing looks at anymore.  Don't directly
include bits/string.h. Set _STRING_INLINE_unaligned here, based on
compiler-predefined macros.
* string/strncat.c: If STRNCAT is not defined, or STRNCAT_PRIMARY
_is_ defined, provide internal hidden alias __strncat.
* include/string.h: Declare internal hidden alias __strncat.
Only forward __stpcpy to __builtin_stpcpy if __NO_STRING_INLINES is
not defined.
* include/bits/string3.h: Rename to bits/string_fortified.h,
update to match above.

* sysdeps/i386/string-inlines.c: Define compat symbols for
everything formerly defined by sysdeps/x86/bits/string.h.
Make existing definitions into compat symbols as well.
Remove some no-longer-necessary messing around with macros.

* sysdeps/powerpc/powerpc32/power4/multiarch/mempcpy.c
* sysdeps/powerpc/powerpc64/multiarch/mempcpy.c
* sysdeps/powerpc/powerpc64/multiarch/stpcpy.c
* sysdeps/s390/multiarch/mempcpy.c
No need to define _HAVE_STRING_ARCH_mempcpy.
Do define __NO_STRING_INLINES and NO_MEMPCPY_STPCPY_REDIRECT.

* sysdeps/i386/i686/multiarch/strncat-c.c
* sysdeps/s390/multiarch/strncat-c.c
* sysdeps/x86_64/multiarch/strncat-c.c
Define STRNCAT_PRIMARY.  Don't change definition of libc_hidden_def.

7 years agomanual: Complete @standards in lang.texi.
Rical Jasan [Tue, 20 Jun 2017 11:29:33 +0000 (04:29 -0700)]
manual: Complete @standards in lang.texi.

* manual/lang.texi (LDBL_MANT_DIG): Add annotation.
(LDBL_DIG): Likewise.
(LDBL_MIN_EXP): Likewise.
(LDBL_MIN_10_EXP): Likewise.
(LDBL_MAX_EXP): Likewise.
(LDBL_MAX_10_EXP): Likewise.
(LDBL_MAX): Likewise.
(LDBL_MIN): Likewise.
(LDBL_EPSILON): Likewise.
(FLT_ROUNDS): Change standard from ISO to C90.
(FLT_RADIX): Likewise.
(FLT_MANT_DIG, DBL_MANT_DIG): Likewise.
(FLT_DIG, DBL_DIG): Likewise.
(FLT_MIN_EXP, DBL_MIN_EXP): Likewise.
(FLT_MIN_10_EXP, DBL_MIN_10_EXP): Likewise.
(FLT_MAX_EXP, DBL_MAX_EXP): Likewise.
(FLT_MAX_10_EXP, DBL_MAX_10_EXP): Likewise.
(FLT_MAX, DBL_MAX): Likewise.
(FLT_MIN, DBL_MIN): Likewise.
(FLT_EPSILON, DBL_EPSILON): Likewise.

7 years agoRemove pre-GCC-4.9 MIPS code.
Joseph Myers [Mon, 19 Jun 2017 23:24:36 +0000 (23:24 +0000)]
Remove pre-GCC-4.9 MIPS code.

This patch removes some MIPS code in glibc that was conditional on old
GCC versions no longer supported for building glibc.

Tested with build-many-glibcs.py.

* sysdeps/mips/atomic-machine.h (R10K_BEQZ_INSN): Remove.
[__GNUC_PREREQ (4, 8) || __mips16]: Make code unconditional.
[!__GNUC_PREREQ (4, 8) && !__mips16]: Remove conditional code.
* sysdeps/mips/math-tests.h
[_MIPS_SIM != _ABIO32 && !__GNUC_PREREQ (4, 9)]: Remove
conditional code.

7 years agoDCIGETTEXT: Do not make copy of localename
Florian Weimer [Mon, 19 Jun 2017 12:44:33 +0000 (14:44 +0200)]
DCIGETTEXT: Do not make copy of localename

7 years agold.so: Reject overly long LD_AUDIT path elements
Florian Weimer [Mon, 19 Jun 2017 20:32:12 +0000 (22:32 +0200)]
ld.so: Reject overly long LD_AUDIT path elements

Also only process the last LD_AUDIT entry.

7 years agold.so: Reject overly long LD_PRELOAD path elements
Florian Weimer [Mon, 19 Jun 2017 20:31:04 +0000 (22:31 +0200)]
ld.so: Reject overly long LD_PRELOAD path elements

7 years agoFix wait3 namespace (bug 21625).
Joseph Myers [Mon, 19 Jun 2017 16:39:17 +0000 (16:39 +0000)]
Fix wait3 namespace (bug 21625).

The wait3 function was removed in the 2001 edition of POSIX.
sys/wait.h wrongly declares it for the 2001 and 2008 editions of POSIX
when XSI features are enabled.  This patch fixes the conditionals.

Tested for x86_64.

[BZ #21625]
* posix/sys/wait.h (strust rusage forward declaration): Change
[__USE_XOPEN_EXTENDED] conditional to [__USE_XOPEN_EXTENDED &&
!__USE_XOPEN2K].
(wait3): Likewise.

7 years agoRequire GCC 4.9 or later for building glibc.
Joseph Myers [Mon, 19 Jun 2017 16:33:00 +0000 (16:33 +0000)]
Require GCC 4.9 or later for building glibc.

This patch makes configure require GCC 4.9 or later for building
glibc, and documents that requirement.  Requiring GCC 4.9 or later
allows use of _Generic (as in tzcode).  It would allow <stdatomic.h>
and _Atomic to be used as well if desired, although we need to avoid
any libatomic dependencies on any platforms.  This patch is explicitly
the minimum to implement a new version requirement, with any
consequent cleanups of conditional code (not in installed headers or
files shared with gnulib etc.) to be done separately.

Tested for x86_64.

* configure.ac (libc_cv_compiler_ok): Require GCC 4.9 or later.
* configure: Regenerated.
* manual/install.texi (Tools for Compilation): Document
requirement for GCC 4.9 or later.
* INSTALL: Regenerated.

7 years agoCVE-2017-1000366: Ignore LD_LIBRARY_PATH for AT_SECURE=1 programs [BZ #21624]
Florian Weimer [Mon, 19 Jun 2017 15:09:55 +0000 (17:09 +0200)]
CVE-2017-1000366: Ignore LD_LIBRARY_PATH for AT_SECURE=1 programs [BZ #21624]

LD_LIBRARY_PATH can only be used to reorder system search paths, which
is not useful functionality.

This makes an exploitable unbounded alloca in _dl_init_paths unreachable
for AT_SECURE=1 programs.

7 years agoS390: Sync ptrace.h with kernel. [BZ #21539]
Stefan Liebler [Mon, 19 Jun 2017 14:27:25 +0000 (16:27 +0200)]
S390: Sync ptrace.h with kernel. [BZ #21539]

This patch removes PTRACE_GETREGS, PTRACE_SETREGS, PTRACE_GETFPREGS
and PTRACE_SETFPREGS as these requests does not exist on s390 kernel.

But the kernel has support for PTRACE_SINGLEBLOCK,
PTRACE_SECCOMP_GET_FILTER, PTRACE_PEEKUSR_AREA, PTRACE_POKEUSR_AREA,
PTRACE_GET_LAST_BREAK, PTRACE_ENABLE_TE, PTRACE_DISABLE_TE and
PTRACE_TE_ABORT_RAND.  Thus those are defined now.

The current kernel s390 specific ptrace.h file also defines
PTRACE_PEEKTEXT_AREA, PTRACE_PEEKDATA_AREA, PTRACE_POKETEXT_AREA,
PTRACE_POKEDATA_AREA, PTRACE_PEEK_SYSTEM_CALL, PTRACE_POKE_SYSTEM_CALL
and PTRACE_PROT, but those requests are not supported.
Thus those defines are skipped in glibc ptrace.h.

There were old includes of ptrace.h in sysdeps/s390/fpu/fesetenv.c.
The ptrace feature isn't used there anymore, thus I removed the includes.

Before this patch, <glibc>/sysdeps/unix/sysv/linux/s390/sys/ptrace.h
uses ptrace-request 12 for PTRACE_GETREGS,
but <kernel>/include/uapi/linux/ptrace.h uses 12 for PTRACE_SINGLEBLOCK.

The s390 kernel has never had support for PTRACE_GETREGS!
Thus glibc ptrace.h is adjusted to match kernel ptrace.h.

The new s390 specific test ensures, that PTRACE_SINGLEBLOCK defined
in glibc works as expected.  If the kernel would interpret it as
PTRACE_GETREGS, then the testcase will not make any progress
and will time out.

ChangeLog:

[BZ #21539]
* NEWS: Mention s390 ptrace request changes.
* sysdeps/unix/sysv/linux/s390/sys/ptrace.h
(PTRACE_GETREGS, PTRACE_SETREGS, PTRACE_GETFPREGS,
PTRACE_SETFPREGS): Remove enum constant.
(PT_GETREGS, PT_SETREGS, PT_GETFPREGS, T_SETFPREGS):
Remove defines.
(PTRACE_SINGLEBLOCK): New enum constant.
(PT_STEPBLOCK): New define.
(PTRACE_PEEKUSR_AREA, PTRACE_POKEUSR_AREA,
PTRACE_GET_LAST_BREAK, PTRACE_ENABLE_TE, PTRACE_DISABLE_TE,
PTRACE_TE_ABORT_RAND): New enum constant and define.
* sysdeps/s390/fpu/fesetenv.c: Remove ptrace.h includes.
* sysdeps/unix/sysv/linux/s390/tst-ptrace-singleblock.c:
New file.
* sysdeps/unix/sysv/linux/s390/Makefile: Add test.

7 years agoresolv: Use getline for configuration file reading in res_vinit_1
Florian Weimer [Fri, 16 Jun 2017 18:54:43 +0000 (20:54 +0200)]
resolv: Use getline for configuration file reading in res_vinit_1

7 years agoresolv: Report allocation errors in __res_vinit
Florian Weimer [Mon, 19 Jun 2017 12:05:49 +0000 (14:05 +0200)]
resolv: Report allocation errors in __res_vinit

7 years agoresolv: Reformat res_vinit and related functions to GNU style
Florian Weimer [Mon, 19 Jun 2017 11:20:46 +0000 (13:20 +0200)]
resolv: Reformat res_vinit and related functions to GNU style

Also remove some obsolete comments.

7 years agoresolv: Introduce is_sort_mask and call it from res_vinit
Florian Weimer [Mon, 19 Jun 2017 11:19:00 +0000 (13:19 +0200)]
resolv: Introduce is_sort_mask and call it from res_vinit

7 years agoresolv: Remove DEBUG preprocessor conditionals from res_setoptions
Florian Weimer [Mon, 19 Jun 2017 11:18:45 +0000 (13:18 +0200)]
resolv: Remove DEBUG preprocessor conditionals from res_setoptions

7 years agoresolv: Move _res deallocation functions to their own file
Florian Weimer [Mon, 19 Jun 2017 11:17:49 +0000 (13:17 +0200)]
resolv: Move _res deallocation functions to their own file

7 years agoresolv: Move res_randomid to its own file
Florian Weimer [Mon, 19 Jun 2017 11:17:03 +0000 (13:17 +0200)]
resolv: Move res_randomid to its own file

7 years agoresolv: Make __res_vinit hidden
Florian Weimer [Mon, 19 Jun 2017 11:15:11 +0000 (13:15 +0200)]
resolv: Make __res_vinit hidden

And remove unnecessary separate declarations.

7 years agoFix another x86 sys/ucontext.h namespace issue (bug 21457).
Joseph Myers [Mon, 19 Jun 2017 12:21:35 +0000 (12:21 +0000)]
Fix another x86 sys/ucontext.h namespace issue (bug 21457).

This patch fixes a namespace issue for one more field in the x86
sys/ucontext.h that I missed in my previous changes.

Tested for x86_64.

[BZ #21457]
* sysdeps/unix/sysv/linux/x86/sys/ucontext.h [__x86_64__] (struct
_libc_xmmreg): Use __ctx in defining field.

7 years agoFix siginterrupt namespace (bug 21597).
Joseph Myers [Mon, 19 Jun 2017 12:18:46 +0000 (12:18 +0000)]
Fix siginterrupt namespace (bug 21597).

The siginterrupt function is XSI-shaded in POSIX.  glibc wrongly
declares it in <signal.h> for non-XSI POSIX.1:2008.  This patch fixes
the conditionals (moving it into the __USE_XOPEN_EXTENDED ||
__USE_MISC block as the minimum conservative change, although it's not
clear this obsolescent function should be declared by default).

Tested for x86_64.

[BZ #21597]
* signal/signal.h (siginterrupt): Make declaration conditional on
[__USE_XOPEN_EXTENDED || __USE_MISC].

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