platform/upstream/glibc.git
7 years agoCompile tst-ssp-1.c with -fstack-protector-all
H.J. Lu [Tue, 11 Jul 2017 20:40:56 +0000 (13:40 -0700)]
Compile tst-ssp-1.c with -fstack-protector-all

Compile tst-ssp-1.c with -fstack-protector-all in case the the stack
protector heuristics do not instrument a thirty-byte array.

* debug/Makefile (CFLAGS-tst-ssp-1.c): Set to
-fstack-protector-all.

7 years agoNew locale for agr_PE.
Chris Leonard [Mon, 22 Aug 2016 23:26:41 +0000 (19:26 -0400)]
New locale for agr_PE.

[BZ #20496]
* locale/iso-639.def: Add Awajún / Aguaruna (agr).

[BZ #20496]
* SUPPORTED: Add agr_PE.
* locales/agr_PE: New file, Awajún / Aguaruna locale for Peru.

7 years agoAdded Samoan language locale for Samoa
Akhilesh Kumar [Tue, 11 Jul 2017 10:52:29 +0000 (16:22 +0530)]
Added Samoan language locale for Samoa

[BZ #21710]
* locales/sm_WS: New file.
* SUPPORTED: Add sm_WS/UTF-8.

7 years agopowerpc64le: Iterate over all object suffixes when appending -mfloat128
Gabriel F. T. Gomes [Tue, 27 Jun 2017 18:41:12 +0000 (15:41 -0300)]
powerpc64le: Iterate over all object suffixes when appending -mfloat128

On powerpc64le, the compilation of the files related to float128 support
requires the option -mfloat128 to be passed to gcc.  However, not all
possible object suffixes were covered in the Makefile.  This patch uses
$(all-object-suffixes) in all remaining rules.

Tested for powerpc64le.

* sysdeps/powerpc/powerpc64le/Makefile: Use $(all-object-suffixes)
to iterate over all possible object suffixes.  Add a comment
explaining the use of sysdep-CFLAGS instead of CFLAGS.

7 years agoAvoid backtrace from __stack_chk_fail [BZ #12189]
H.J. Lu [Tue, 11 Jul 2017 14:44:01 +0000 (07:44 -0700)]
Avoid backtrace from __stack_chk_fail [BZ #12189]

__stack_chk_fail is called on corrupted stack.  Stack backtrace is very
unreliable against corrupted stack.  __libc_message is changed to accept
enum __libc_message_action and call BEFORE_ABORT only if action includes
do_backtrace.  __fortify_fail_abort is added to avoid backtrace from
__stack_chk_fail.

[BZ #12189]
* debug/Makefile (CFLAGS-tst-ssp-1.c): New.
(tests): Add tst-ssp-1 if -fstack-protector works.
* debug/fortify_fail.c: Include <stdbool.h>.
(_fortify_fail_abort): New function.
(__fortify_fail): Call _fortify_fail_abort.
(__fortify_fail_abort): Add a hidden definition.
* debug/stack_chk_fail.c: Include <stdbool.h>.
(__stack_chk_fail): Call __fortify_fail_abort, instead of
__fortify_fail.
* debug/tst-ssp-1.c: New file.
* include/stdio.h (__libc_message_action): New enum.
(__libc_message): Replace int with enum __libc_message_action.
(__fortify_fail_abort): New hidden prototype.
* malloc/malloc.c (malloc_printerr): Update __libc_message calls.
* sysdeps/posix/libc_fatal.c (__libc_message): Replace int
with enum __libc_message_action.  Call BEFORE_ABORT only if
action includes do_backtrace.
(__libc_fatal): Update __libc_message call.

7 years agoposix: Add p{read,write}v2 RWF_NOWAIT flag (BZ#21738)
Adhemerval Zanella [Mon, 10 Jul 2017 18:53:32 +0000 (15:53 -0300)]
posix: Add p{read,write}v2 RWF_NOWAIT flag (BZ#21738)

Linux 4.12 (b745fafaf70c0a98a2e1e7ac8cb14542889ceb0e) adds a new
p{read,write}v2 flag RWF_NOWAIT.  This patch adds it for linux
uio-ext.h header.

Checked on x86_64-linux-gnu (on a 4.10 kernel).

[BZ #21738]
* manual/llio.texi (RWF_NOWAIT): New item.
* misc/tst-preadvwritev2-common.c (do_test_with_invalid_flags):
Add RWF_NOWAIT check.
* sysdeps/unix/sysv/linux/bits/uio-ext.h (RWF_NOWAIT): New flag.

7 years agoFixed abday for ar_JO/ar_LB/ar_SY
Akhilesh Kumar [Tue, 11 Jul 2017 08:19:17 +0000 (13:49 +0530)]
Fixed abday for ar_JO/ar_LB/ar_SY

[BZ #21749]
* locales/ar_JO (LC_TIME): Fix abday
* locales/ar_LB (LC_TIME): Fix abday
* locales/ar_SY (LC_TIME): Fix abday

7 years agoFix abday for ar_SA
Akhilesh Kumar [Tue, 11 Jul 2017 10:46:39 +0000 (12:46 +0200)]
Fix abday for ar_SA

[BZ #21748, BZ #19066]
        * locales/ar_SA (LC_TIME): Fix abday

7 years agoS390: Fix tst-ptrace-singleblock if kernel does not support PTRACE_SINGLEBLOCK.
Stefan Liebler [Tue, 11 Jul 2017 08:37:03 +0000 (10:37 +0200)]
S390: Fix tst-ptrace-singleblock if kernel does not support PTRACE_SINGLEBLOCK.

The request PTRACE_SINGLEBLOCK was introduced in Linux 3.15.  Thus the ptrace call
will fail on older kernels.
Thus the test is now testing PTRACE_SINGLEBLOCK with data argument pointing to a
buffer on stack which is assumed to fail.  If the request would be interpreted as
PTRACE_GETREGS, then the ptrace call will not fail and the regs are written to buf.

If we run with a kernel with support for PTRACE_SINGLEBLOCK a ptrace call with
data=NULL, returns zero with no error.  If we run with a kernel without support for
PTRACE_SINGLEBLOCK a ptrace call with data=NULL reports an error.
In the latter case, the test is just continuing with PTRACE_CONT.

ChangeLog:

* sysdeps/unix/sysv/linux/s390/tst-ptrace-singleblock.c:
Support running on kernels without PTRACE_SINGLEBLOCK.

7 years agolocaledata: da_DK: set date_fmt [BZ #17297]
Eyolf Østrem [Fri, 10 Jun 2016 16:11:04 +0000 (12:11 -0400)]
localedata: da_DK: set date_fmt [BZ #17297]

The default setting is slightly off for Danish users -- the day and
month displays should be swapped: "Jun 10" -> "10 Jun".

7 years agoAdded yesstr and nostr to zh_HK locale
Akhilesh Kumar [Mon, 10 Jul 2017 03:41:56 +0000 (09:11 +0530)]
Added yesstr and nostr to zh_HK locale

yesstr and nostr  are missing for zh_HK language locale

[BZ #21733]
* locales/zh_HK (LC_MESSAGES): add yesstr and nostr

7 years agoFix abday strings for ks_IN@devanagari to match the day strings
Akhilesh Kumar [Mon, 10 Jul 2017 03:27:28 +0000 (08:57 +0530)]
Fix abday strings for ks_IN@devanagari to match the day strings

Hindi language is similar to Kashmiri(devanagari) language.

[BZ #21743]
* locales/ks_IN@devanagari (LC_TIME): Fixed abday strings

7 years agoDon't include _dl_resolve_conflicts in libc.a [BZ #21742]
H.J. Lu [Sun, 9 Jul 2017 18:52:33 +0000 (11:52 -0700)]
Don't include _dl_resolve_conflicts in libc.a [BZ #21742]

Since _dl_resolve_conflicts is only used in elf/rtld.c, don't include
it in libc.a.

[BZ #21742]
* elf/Makefile (dl-routines): Move dl-conflict to ...
(rtld-routines): Here.

7 years agox86-64: Test memmove_chk and memset_chk only in libc.so [BZ #21741]
H.J. Lu [Mon, 10 Jul 2017 11:44:24 +0000 (04:44 -0700)]
x86-64: Test memmove_chk and memset_chk only in libc.so [BZ #21741]

Since there are no multiarch versions of memmove_chk and memset_chk,
test multiarch versions of memmove_chk and memset_chk only in libc.so.

[BZ #21741]
* sysdeps/x86_64/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Test memmove_chk and memset_chk only
in libc.so.

7 years agoAdd iI and eE to yesexpr and noexpr respectively for ts_ZA
Mike FABIAN [Mon, 10 Jul 2017 07:00:45 +0000 (09:00 +0200)]
Add iI and eE to  yesexpr and noexpr respectively for ts_ZA

7 years agoUpdate hppa ulps.
John David Anglin [Sun, 9 Jul 2017 19:22:41 +0000 (15:22 -0400)]
Update hppa ulps.

7 years agoUse generic pthread support on hppa.
John David Anglin [Sun, 9 Jul 2017 19:01:11 +0000 (15:01 -0400)]
Use generic pthread support on hppa.

7 years agox86-64: Update comments in IFUNC selectors
H.J. Lu [Sun, 9 Jul 2017 18:42:50 +0000 (11:42 -0700)]
x86-64: Update comments in IFUNC selectors

* sysdeps/x86_64/multiarch/memcmp.c: Update comments.
* sysdeps/x86_64/multiarch/memmove.c: Likewise.
* sysdeps/x86_64/multiarch/memrchr.c: Likewise.
* sysdeps/x86_64/multiarch/memset.c: Likewise.
* sysdeps/x86_64/multiarch/rawmemchr.c: Likewise.
* sysdeps/x86_64/multiarch/strchrnul.c: Likewise.
* sysdeps/x86_64/multiarch/strlen.c: Likewise.
* sysdeps/x86_64/multiarch/strnlen.c: Likewise.
* sysdeps/x86_64/multiarch/wcschr.c: Likewise.
* sysdeps/x86_64/multiarch/wcscpy.c: Likewise.
* sysdeps/x86_64/multiarch/wcslen.c: Likewise.
* sysdeps/x86_64/multiarch/wcsnlen.c: Likewise.
* sysdeps/x86_64/multiarch/wmemchr.c: Likewise.
* sysdeps/x86_64/multiarch/wmemcmp.c: Likewise.
* sysdeps/x86_64/multiarch/wmemset.c: Likewise.
* sysdeps/x86_64/multiarch/wmemset_chk.c: Likewise.

7 years agox86-64: Update comments in ifunc-impl-list.c
H.J. Lu [Sun, 9 Jul 2017 18:38:37 +0000 (11:38 -0700)]
x86-64: Update comments in ifunc-impl-list.c

All x86-64 IFUNC selectors are written in C now.  Update comments to
reflect it.

* sysdeps/x86_64/multiarch/ifunc-impl-list.c: Update comments.

7 years agoFix BZ #21049.
John David Anglin [Sun, 9 Jul 2017 17:48:04 +0000 (13:48 -0400)]
Fix BZ #21049.

7 years agobuild-many-glibcs.py: also build profiled objects
Andreas Schwab [Sat, 8 Jul 2017 19:08:34 +0000 (21:08 +0200)]
build-many-glibcs.py: also build profiled objects

7 years agoAdded yesstr/nostr for kw_GB
Akhilesh Kumar [Fri, 7 Jul 2017 12:31:49 +0000 (18:01 +0530)]
Added yesstr/nostr for kw_GB

[BZ #21734]
* locales/kw_GB (LC_MESSAGES): add yesstr and nostr

7 years agoAdded missing yesstr and nostr for Tsonga language locale [LC_MESSAGES]
Akhilesh Kumar [Fri, 7 Jul 2017 03:58:53 +0000 (09:28 +0530)]
Added  missing yesstr and nostr for Tsonga language locale [LC_MESSAGES]

[BZ #21727]
* locales/ts_ZA(LC_MESSAGES): add yesstr and nostr

Signed-off-by: Akhilesh Kumar <akhilesh.k@samsung.com>
7 years agoFix LC_NAME for hi_IN
Akhilesh Kumar [Fri, 7 Jul 2017 07:24:22 +0000 (12:54 +0530)]
Fix LC_NAME for hi_IN

During Hindi Locale review I found many fields are incorrect

[BZ #21729]
* locales/hi_IN (LC_NAME): Fix name_mr, name_mrs, name_miss, name_ms

Signed-off-by: Akhilesh Kumar <akhilesh.k@samsung.com>
7 years agoyesstr/nostr missing for Xhosa language locale
Akhilesh Kumar [Thu, 6 Jul 2017 09:31:17 +0000 (15:01 +0530)]
yesstr/nostr missing for Xhosa language locale

During Locale verification I observed that
yesstr and nostr  are missing for Xhosa language locale
for South Africa

[BZ #21724]
* locales/xh_ZA (LC_MESSAGES): add yesstr and nostr

Signed-off-by: Akhilesh Kumar <akhilesh.k@samsung.com>
7 years agoAdd yesstr and nostr to zh_CN locale
Peng Wu [Thu, 6 Jul 2017 09:03:56 +0000 (14:33 +0530)]
Add yesstr and nostr to zh_CN locale

[BZ #21723]
* locales/zh_CN (LC_MESSAGES): add yesstr and nostr

7 years agoIncorrect Full Weekday names for ks_IN@devanagari
Akhilesh Kumar [Thu, 6 Jul 2017 08:06:35 +0000 (13:36 +0530)]
Incorrect Full Weekday names for ks_IN@devanagari

During Locale verification I observed that
Incorrect Full Weekday names for ks_IN@devanagari
Reference is taken from
http://www.mkraina.com/PDF/3-Self-authored%20Works%20(English)/15.pdf

And kashmiri devanagari travel book and other sources

[BZ #21721]
* locales/ks_IN@devanagari: Full weekday name Fix.

Signed-off-by: Akhilesh Kumar <akhilesh.k@samsung.com>
7 years ago* manual/tunables.texi: Add missing @end deftp.
DJ Delorie [Thu, 6 Jul 2017 23:54:13 +0000 (19:54 -0400)]
* manual/tunables.texi: Add missing @end deftp.

7 years agoresolv: Deal with non-deterministic address order in tst-resolv-basic
Florian Weimer [Thu, 6 Jul 2017 12:03:39 +0000 (14:03 +0200)]
resolv: Deal with non-deterministic address order in tst-resolv-basic

7 years agoAdd per-thread cache to malloc
DJ Delorie [Thu, 6 Jul 2017 17:37:30 +0000 (13:37 -0400)]
Add per-thread cache to malloc

* config.make.in: Enable experimental malloc option.
* configure.ac: Likewise.
* configure: Regenerate.
* manual/install.texi: Document it.
* INSTALL: Regenerate.
* malloc/Makefile: Likewise.
* malloc/malloc.c: Add per-thread cache (tcache).
(tcache_put): New.
(tcache_get): New.
(tcache_thread_freeres): New.
(tcache_init): New.
(__libc_malloc): Use cached chunks if available.
(__libc_free): Initialize tcache if needed.
(__libc_realloc): Likewise.
(__libc_calloc): Likewise.
(_int_malloc): Prefill tcache when appropriate.
(_int_free): Likewise.
(do_set_tcache_max): New.
(do_set_tcache_count): New.
(do_set_tcache_unsorted_limit): New.
* manual/probes.texi: Document new probes.
* malloc/arena.c: Add new tcache tunables.
* elf/dl-tunables.list: Likewise.
* manual/tunables.texi: Document them.
* NEWS: Mention the per-thread cache.

7 years agoIncrease some test timeouts.
Joseph Myers [Thu, 6 Jul 2017 17:01:03 +0000 (17:01 +0000)]
Increase some test timeouts.

This patch increases the timeouts for some tests that I've seen timing
out on slow systems in my 2.26 release testing.  (In the case of
tst-tsearch.c, increasing the timeout means removing a setting of 10
that was put there before the default timeout was increased to 20
seconds, so putting the default into effect.)

* iconvdata/tst-loading.c (TIMEOUT): Define to 30.
* misc/tst-tsearch.c (TIMEOUT): Remove.
* nptl/tst-create-detached.c (TIMEOUT): Define to 100.
* nptl/tst-robust-fork.c (TIMEOUT): Likewise.
* nptl/tst-rwlock19.c (TIMEOUT): Likewise.
* string/tst-cmp.c (TIMEOUT): Define to 600.

7 years agoArabic scripts: More fixes after the recent import.
Rafal Luzynski [Sat, 1 Jul 2017 00:22:37 +0000 (02:22 +0200)]
Arabic scripts: More fixes after the recent import.

After the recent import of month names from CLDRv31 (bug 21217,
commit c853f14) more imports are also needed, mostly abbreviated month
names.

This patch also updates May (full month name) in ps_AF which was
skipped in the previous patch.

Incidentally, this import fixes bug 17225 (ar_SY) and partially
bug 19066 (ar_SA).

CLDR currently has a bug in the full month name for October for ar_IQ, see
http://unicode.org/cldr/trac/ticket/10460

* localedata/locales/ar_DZ (abmon): Full import from CLDR, abmon
is no longer abbreviated.
* localedata/locales/ar_IQ (abmon): Likewise.
* localedata/locales/ar_MA (abmon): Likewise.
* localedata/locales/ar_TN (abmon): Likewise.
* localedata/locales/ps_AF (abmon): Likewise.
* localedata/locales/ug_CN (abmon): Likewise.
* localedata/locales/ar_SA (abmon): Likewise, partially
fixes bug 19066.
* localedata/locales/ks_IN (abmon): A copy of mon.
* localedata/locales/ur_IN (abmon): Oct reworded "اكتوبر" to
"اکتوبر" (same change as mon).
* localedata/locales/ur_PK (abmon): Same changes as mon applied.

* localedata/locales/ps_AF (mon): May reworded "می" to "مۍ".

[BZ #17225]
* localedata/locales/ar_SY (abmon): May reworded "نوار" to
"أيار", this closes bug 17225.
* localedata/locales/ar_JO (abmon): Likewise.
* localedata/locales/ar_LB (abmon): Likewise.

7 years agonptl: Fix typo on __have_pthread_attr_t (BZ#21715)
Matthew Krupcale [Thu, 6 Jul 2017 13:22:20 +0000 (10:22 -0300)]
nptl: Fix typo on __have_pthread_attr_t (BZ#21715)

This patch fixes some build issues when including types/sigevent_t.h
along with bits/pthreadtypes.h.

Checked on x86_64-linux-gnu and on a build on supported major ABIs.

[BZ #21715]
* sysdeps/nptl/bits/pthreadtypes.h (__have_pthread_attr_t): Fix typo
on definition.

7 years agox86-64: Align the stack in __tls_get_addr [BZ #21609]
H.J. Lu [Thu, 6 Jul 2017 11:43:06 +0000 (04:43 -0700)]
x86-64: Align the stack in __tls_get_addr [BZ #21609]

This change forces realignment of the stack pointer in __tls_get_addr, so
that binaries compiled by GCCs older than GCC 4.9:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58066

continue to work even if vector instructions are used in glibc which
require the ABI stack realignment.

__tls_get_addr_slow is added to handle the slow paths in the default
implementation of__tls_get_addr in elf/dl-tls.c.  The new __tls_get_addr
calls __tls_get_addr_slow after realigning the stack.  Internal calls
within ld.so go directly to the default implementation of __tls_get_addr
because they do not need stack realignment.

[BZ #21609]
* sysdeps/x86_64/Makefile (sysdep-dl-routines): Add tls_get_addr.
(gen-as-const-headers): Add rtld-offsets.sym.
* sysdeps/x86_64/dl-tls.c: New file.
* sysdeps/x86_64/rtld-offsets.sym: Likwise.
* sysdeps/x86_64/tls_get_addr.S: Likewise.
* sysdeps/x86_64/dl-tls.h: Add multiple inclusion guards.
* sysdeps/x86_64/tlsdesc.sym (TI_MODULE_OFFSET): New.
(TI_OFFSET_OFFSET): Likwise.

7 years agoPashto yesstr/nostr locale are missing
Akhilesh Kumar [Wed, 5 Jul 2017 06:47:26 +0000 (12:17 +0530)]
Pashto yesstr/nostr locale are missing

[BZ #21711]
During Locale verification I observed that

yesstr and nostr are missing for Pashto [LC_MESSAGES] Locale

For Afghanistan reference google translate and Pashto travel book.

7 years agoposix: Fix default posix_spawn return value
Adhemerval Zanella [Thu, 29 Jun 2017 15:05:01 +0000 (12:05 -0300)]
posix: Fix default posix_spawn return value

This patch fix the return value for error conditions for default
posix_spawn (where the errno is expected).  It also avoid clobber
errno on fork call.

Checked on x86_64 (with Linux implementation removed).

[BZ# 21697]
* sysdeps/posix/spawni.c (__spawni_child): Fix return value.
(__spawnix): Do not clober errno.

7 years agoFixup localedata/ChangeLog.
Carlos O'Donell [Wed, 5 Jul 2017 18:14:44 +0000 (14:14 -0400)]
Fixup localedata/ChangeLog.

- Rewrite recent entry to follow GNU ChangeLog format.
- Convert spaces to tabs in one case.

7 years agoEdit and shorten float128 NEWS item.
Joseph Myers [Wed, 5 Jul 2017 17:43:58 +0000 (17:43 +0000)]
Edit and shorten float128 NEWS item.

7 years agosupport: Add resolver testing mode which does not patch _res
Florian Weimer [Wed, 5 Jul 2017 15:39:33 +0000 (17:39 +0200)]
support: Add resolver testing mode which does not patch _res

7 years agosupport: Add support_chroot_create and support_chroot_free
Florian Weimer [Wed, 5 Jul 2017 13:38:42 +0000 (15:38 +0200)]
support: Add support_chroot_create and support_chroot_free

7 years agosupport: Check isolation of loopback addresses in tst-support-namespace
Florian Weimer [Wed, 5 Jul 2017 10:53:14 +0000 (12:53 +0200)]
support: Check isolation of loopback addresses in tst-support-namespace

7 years agoAdded Tok-Pisin locale.
Akhilesh Kumar [Wed, 5 Jul 2017 11:52:43 +0000 (17:22 +0530)]
Added Tok-Pisin locale.

[BZ #21694]
Added tok-pisin language locale for Papua New Guinea.

Signed-off-by: Akhilesh Kumar <akhilesh.k@samsung.com>
7 years agoConsistently say "GNU C Library" in NEWS, not "glibc".
Joseph Myers [Wed, 5 Jul 2017 13:46:57 +0000 (13:46 +0000)]
Consistently say "GNU C Library" in NEWS, not "glibc".

7 years agoReorganize and revise NEWS for 2.26.
Zack Weinberg [Wed, 5 Jul 2017 13:03:00 +0000 (09:03 -0400)]
Reorganize and revise NEWS for 2.26.

7 years agoFor Breton yesstr/nostr locale are missing
Akhilesh Kumar [Tue, 4 Jul 2017 05:24:08 +0000 (10:54 +0530)]
For Breton yesstr/nostr locale are missing

[BZ #21706]
During Locale verification i observed that
yesstr and nostr  are missing for Breton [LC_MESSAGES] locale

Signed-off-by: Akhilesh Kumar <akhilesh.k@samsung.com>
7 years agoSingle threaded stdio optimization
Szabolcs Nagy [Tue, 4 Jul 2017 15:05:12 +0000 (16:05 +0100)]
Single threaded stdio optimization

Locking overhead can be significant in some stdio operations
that are common in single threaded applications.

This patch adds the _IO_FLAGS2_NEED_LOCK flag to indicate if
an _IO_FILE object needs to be locked and some of the stdio
functions just jump to their _unlocked variant when not.  The
flag is set on all _IO_FILE objects when the first thread is
created.  A new GLIBC_PRIVATE libc symbol, _IO_enable_locks,
was added to do this from libpthread.

The optimization can be applied to more stdio functions,
currently it is only applied to single flag check or single
non-wide-char standard operations.  The flag should probably
be never set for files with _IO_USER_LOCK, but that's just a
further optimization, not a correctness requirement.

The optimization is valid in a single thread because stdio
operations are non-as-safe (so lock state is not observable
from a signal handler) and stdio locks are recursive (so lock
state is not observable via deadlock).  The optimization is not
valid if a thread may be created while an stdio lock is taken
and thus it should be disabled if any user code may run during
an stdio operation (interposed malloc, printf hooks, etc).
This makes the optimization more complicated for some stdio
operations (e.g. printf), but those are bigger and thus less
important to optimize so this patch does not try to do that.

* libio/libio.h (_IO_FLAGS2_NEED_LOCK, _IO_need_lock): Define.
* libio/libioP.h (_IO_enable_locks): Declare.
* libio/Versions (_IO_enable_locks): New symbol.
* libio/genops.c (_IO_enable_locks): Define.
(_IO_old_init): Initialize flags2.
* libio/feof.c.c (_IO_feof): Avoid locking when not needed.
* libio/ferror.c (_IO_ferror): Likewise.
* libio/fputc.c (fputc): Likewise.
* libio/putc.c (_IO_putc): Likewise.
* libio/getc.c (_IO_getc): Likewise.
* libio/getchar.c (getchar): Likewise.
* libio/ioungetc.c (_IO_ungetc): Likewise.
* nptl/pthread_create.c (__pthread_create_2_1): Enable stdio locks.
* libio/iofopncook.c (_IO_fopencookie): Enable locking for the file.
* sysdeps/pthread/flockfile.c (__flockfile): Likewise.

7 years agosysconf: Use conservative default for _SC_NPROCESSORS_ONLN [BZ #21542]
Florian Weimer [Tue, 4 Jul 2017 14:12:46 +0000 (16:12 +0200)]
sysconf: Use conservative default for _SC_NPROCESSORS_ONLN [BZ #21542]

7 years agoresolv: Fix resolv_conf _res matching
Florian Weimer [Tue, 4 Jul 2017 12:47:29 +0000 (14:47 +0200)]
resolv: Fix resolv_conf _res matching

A dot-less host name without an /etc/resolv.conf file caused an
assertion failure in update_from_conf because the function would not
deal correctly with the empty search list case.

Thanks to Andreas Schwab for debugging assistence.

7 years agoUpdate versions in build-many-glibcs.py.
Joseph Myers [Tue, 4 Jul 2017 10:32:54 +0000 (10:32 +0000)]
Update versions in build-many-glibcs.py.

This patch updates build-many-glibcs.py to use the current release
branch of binutils and current releases of GMP and the Linux kernel.

* scripts/build-many-glibcs.py (Context.checkout): Default
binutils version to 2.29 branch, GMP version to 6.1.2 and Linux
kernel version to 4.12.

7 years agoresolv: Fix improper assert in __resolv_conf_attach
Florian Weimer [Tue, 4 Jul 2017 09:18:34 +0000 (11:18 +0200)]
resolv: Fix improper assert in __resolv_conf_attach

7 years agoresolv: Introduce free list for resolv_conf index slosts
Florian Weimer [Mon, 3 Jul 2017 13:01:34 +0000 (15:01 +0200)]
resolv: Introduce free list for resolv_conf index slosts

7 years agoresolv: Automatically reload a changed /etc/resolv.conf file [BZ #984]
Florian Weimer [Mon, 3 Jul 2017 19:06:23 +0000 (21:06 +0200)]
resolv: Automatically reload a changed /etc/resolv.conf file [BZ #984]

This commit enhances the stub resolver to reload the configuration
in the per-thread _res object if the /etc/resolv.conf file has
changed.  The resolver checks whether the application has modified
_res and will not overwrite the _res object in that case.

The struct resolv_context mechanism is used to check the
configuration file only once per name lookup.

7 years agoresolv: Mirror the entire resolver configuration in struct resolv_conf
Florian Weimer [Fri, 30 Jun 2017 18:19:10 +0000 (20:19 +0200)]
resolv: Mirror the entire resolver configuration in struct resolv_conf

This commit adds the remaining unchanging members (which are loaded
from /etc/resolv.conf) to struct resolv_conf.

The extended name server list is currently not used by the stub
resolver.  The switch depends on a cleanup: The _u._ext.nssocks
array stores just a single socket, and needs to be replaced with
a single socket value.

(The compatibility gethostname implementation does not use the
extended addres sort list, either.  Updating the compat code is
not worthwhile.)

7 years agoresolv: Lift domain search list limits [BZ #19569] [BZ #21475]
Florian Weimer [Fri, 30 Jun 2017 22:53:05 +0000 (00:53 +0200)]
resolv: Lift domain search list limits [BZ #19569] [BZ #21475]

This change uses the extended resolver state in struct resolv_conf to
store the search list.  If applications have not patched the _res
object directly, this extended search list will be used by the stub
resolver during name resolution.

7 years agoresolv: Introduce struct resolv_conf with extended resolver state
Florian Weimer [Mon, 3 Jul 2017 18:31:23 +0000 (20:31 +0200)]
resolv: Introduce struct resolv_conf with extended resolver state

This change provides additional resolver configuration state which
is not exposed through the _res ABI.  It reuses the existing
initstamp field in the supposedly-private part of _res.  Some effort
is undertaken to avoid memory safety issues introduced by applications
which directly patch the _res object.

With this commit, only the initstamp field is moved into struct
resolv_conf.  Additional members will be added later, eventually
migrating the entire resolver configuration.

7 years agoresolv: Introduce struct resolv_context [BZ #21668]
Florian Weimer [Fri, 30 Jun 2017 19:10:23 +0000 (21:10 +0200)]
resolv: Introduce struct resolv_context [BZ #21668]

struct resolv_context objects provide a temporary resolver context
which does not change during a name lookup operation.  Only when the
outmost context is created, the stub resolver configuration is
verified to be current (at present, only against previous res_init
calls).  Subsequent attempts to obtain the context will reuse the
result of the initial verification operation.

struct resolv_context can also be extended in the future to store
data which needs to be deallocated during thread cancellation.

7 years agoresolv: Add preinit tests to resolv/tst-resolv-res_init-skeleton.c
Florian Weimer [Mon, 3 Jul 2017 15:41:19 +0000 (17:41 +0200)]
resolv: Add preinit tests to resolv/tst-resolv-res_init-skeleton.c

7 years agoMore fixes after the recent import from CLDR-31
Rafal Luzynski [Thu, 29 Jun 2017 00:23:28 +0000 (02:23 +0200)]
More fixes after the recent import from CLDR-31

After the recent import of month names from CLDR (bug 21217) more
imports are also needed, mostly abbreviated month names.

* localedata/locales/br_FR (abmon): Reworded "Eve " to "Mezh".

* localedata/locales/fy_NL (abmon): Reworded "Maa" (March) to
"Mrt" and "Maa" (May) to "Mai".

* localedata/locales/lg_UG (abmon): Reworded "Jun" to "Juu".

* localedata/locales/ln_CD (abmon): "yan", "fbl", "msi",
and so on.

* localedata/locales/mn_MN (abmon): "1-р сар", "2-р сар",
"3-р сар", and so on.

* localedata/locales/vi_VN (abmon): Reworded "Th01" to "Thg 1",
"Th02" to "Thg 2" and so on.

* localedata/locales/yo_NG (abday): "Àìkú", "Ajé", "Ìsẹ́gun",
and so on, also comment updated to match the new content.
(day): "Ọjọ́ Àìkú", "Ọjọ́ Ajé", "Ọjọ́ Ìsẹ́gun", and so on.
(abmon): "Ṣẹ́rẹ́", "Èrèlè", "Ẹrẹ̀nà", and so on.
(mon): Comment updated to match the actual content.
(d_t_fmt): Changed "%A" to "%a" and "%B" to "%b".

* localedata/locales/zu_ZA (abmon): "Jan", "Feb", "Mas",
and so on, also comment updated to match the new content.
(mon): comment updated to match the actual content.

7 years agopowerpc: Clean up strlen and strnlen for power8
Rajalakshmi Srinivasaraghavan [Mon, 3 Jul 2017 05:16:13 +0000 (10:46 +0530)]
powerpc: Clean up strlen and strnlen for power8

To align a quadword aligned address to 64 bytes, maximum of three
16 bytes load is needed for worst case instead of loading four times.

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.