]> sourceware.org Git - glibc.git/log
glibc.git
6 years agoSeparate out error_t definition
Samuel Thibault [Sun, 4 Mar 2018 02:15:49 +0000 (03:15 +0100)]
Separate out error_t definition

so interfaces needing it can get it.

* stdlib/errno.h (error_t): Move definition to...
* bits/types/error_t.h: ... new header.
* stdlib/Makefile (headers): Add bits/types/error_t.h.
* sysdeps/mach/hurd/bits/errno.h (error_t): Move definition to...
* sysdeps/mach/hurd/bits/types/error_t.h: ... new header.
* sysdeps/mach/hurd/errnos.awk (error_t): Likewise.
* hurd/hurd.h: Include <bits/types/error_t.h>
* hurd/hurd/fd.h: Include <bits/types/error_t.h>
* hurd/hurd/id.h: Include <errno.h> and <bits/types/error_t.h>
* hurd/hurd/lookup.h: Include <errno.h> and <bits/types/error_t.h>
* hurd/hurd/resource.h: Include <bits/types/error_t.h>
* hurd/hurd/signal.h: Include <bits/types/error_t.h>
* hurd/hurd/sigpreempt.h: Include <bits/types/error_t.h>

6 years agohurd: Make almost all hurd headers includable in all standards
Samuel Thibault [Sun, 4 Mar 2018 02:44:14 +0000 (03:44 +0100)]
hurd: Make almost all hurd headers includable in all standards

* hurd/hurd.h: Include <bits/types/sigset_t.h>
* hurd/hurd/fd.h: Include <sys/select.h> and <bits/types/sigset_t.h>
(_hurd_fd_read, _hurd_fd_write): Use __loff_t instead of loff_t.
* hurd/hurd/signal.h: Include <bits/types/stack_t.h> and
<bits/types/sigset_t.h>.
[!defined __USE_GNU]: Do not #error out.
(struct hurd_sigstate): Use _NSIG instead of NSIG.
* hurd/hurd/sigpreempt.h (__need_size_t): Define.
Include <stddef.h> and <bits/types/sigset_t.h>
(struct hurd_signal_preemptor, hurd_catch_signal): Use __sighandler_t
instead of sighandler_t.

6 years agohurd: Fix inclusion of mach headers in all standards
Samuel Thibault [Sun, 4 Mar 2018 01:49:44 +0000 (02:49 +0100)]
hurd: Fix inclusion of mach headers in all standards

mig_support does not actually inline the stpncpy any more.

* mach/mach/mig_support.h [defined __USE_GNU]: Do not #error out.
* scripts/check-installed-headers.sh: Do not ignore Hurd and Mach
headers.

6 years agohurd: Avoid using ino64_t and loff_t in headers
Samuel Thibault [Sun, 4 Mar 2018 01:11:46 +0000 (02:11 +0100)]
hurd: Avoid using ino64_t and loff_t in headers

* mach/Machrules ($(patsubst %,$(objpfx)%.h,$(user-interfaces)):
Process mig output through $(migheaderpipe).
* hurd/Makefile (migheaderpipe): Define variable.

6 years agohurd: Add missing include
Samuel Thibault [Sun, 4 Mar 2018 00:59:30 +0000 (01:59 +0100)]
hurd: Add missing include

* sysdeps/mach/hurd/dl-sysdep.c: Include <mach/machine/vm_param.h>.

6 years agohurd: fix header conformity
Samuel Thibault [Sun, 4 Mar 2018 00:35:12 +0000 (01:35 +0100)]
hurd: fix header conformity

* hurd/hurd/fd.h (_hurd_fd_error): Fix struct initializer to be
trivial, for C++ conformity.

6 years agohurd: avoid including hurd/signal.h when not needed
Samuel Thibault [Sun, 4 Mar 2018 00:28:55 +0000 (01:28 +0100)]
hurd: avoid including hurd/signal.h when not needed

thus making <hurd/port.h> and <hurd/userlink.h> includable without
_GNU_SOURCE.

* hurd/hurd/port.h: Do not include <hurd/signal.h>.
* hurd/hurd/userlink.h [!defined __USE_EXTERN_INLINES ||
!defined _LIBC || !IS_IN (libc)]: Do not include <hurd/signal.h>.

6 years agohurd: Move mach/param.h to bits/mach/param.h
Samuel Thibault [Sat, 3 Mar 2018 23:42:20 +0000 (00:42 +0100)]
hurd: Move mach/param.h to bits/mach/param.h

* mach/Makefile (headers): Move mach/param.h to bits/mach/param.h.
* sysdeps/mach/i386/mach/param.h: Move file to ...
* sysdeps/mach/i386/bits/mach/param.h: ... here.  Update path in #error.
* sysdeps/mach/hurd/bits/param.h: Include <bits/mach/param.h> instead
of <mach/param.h>.

6 years agohurd: Add missing includes
Samuel Thibault [Sat, 3 Mar 2018 23:13:47 +0000 (00:13 +0100)]
hurd: Add missing includes

* mach/Makefile ($(objpfx)mach-shortcuts.h): Make it include
<mach/mach_types.h> and <mach/message.h>.

6 years agohurd: Add missing includes
Samuel Thibault [Sat, 3 Mar 2018 22:58:51 +0000 (23:58 +0100)]
hurd: Add missing includes

* hurd/hurd/id.h: Include <hurd/hurd_types.h>
* hurd/hurd/ioctl.h: Include <mach/port.h>
* hurd/hurd/lookup.h: Include <hurd/hurd_types.h>

6 years agohurd: do not check Mach and Hurd headers
Samuel Thibault [Sat, 3 Mar 2018 19:06:04 +0000 (20:06 +0100)]
hurd: do not check Mach and Hurd headers

as they are not standard.

* scripts/check-installed-headers.sh: Ignore Hurd and Mach headers.

6 years agoFix multiple definitions of __nss_*_database (bug 22918)
Andreas Schwab [Fri, 2 Mar 2018 22:07:14 +0000 (23:07 +0100)]
Fix multiple definitions of __nss_*_database (bug 22918)

6 years agoFix powerpc ifunc-sel.h build for -Os.
Joseph Myers [Fri, 2 Mar 2018 22:27:56 +0000 (22:27 +0000)]
Fix powerpc ifunc-sel.h build for -Os.

Compiling the testsuite for powerpc (multi-arch configurations) with
-Os with GCC 7 fails with:

In file included from ifuncmod1.c:7:0,
                 from ifuncdep1.c:3:
../sysdeps/powerpc/ifunc-sel.h: In function 'ifunc_sel':
../sysdeps/powerpc/ifunc-sel.h:12:3: error: asm operand 2 probably doesn't match constraints [-Werror]
   __asm__ ("mflr 12\n\t"
   ^~~~~~~
../sysdeps/powerpc/ifunc-sel.h:12:3: error: asm operand 3 probably doesn't match constraints [-Werror]
../sysdeps/powerpc/ifunc-sel.h:12:3: error: asm operand 4 probably doesn't match constraints [-Werror]
../sysdeps/powerpc/ifunc-sel.h:12:3: error: impossible constraint in 'asm'

The "i" constraints on function pointers require the function call to
be inlined so the compiler can see the constant function pointer
arguments passed to the asm.  This patch marks the relevant functions
as always_inline accordingly.

Tested that this fixes the -Os testsuite build for
powerpc-linux-gnu-power4, powerpc64-linux-gnu, powerpc64le-linux-gnu
with build-many-glibcs.py.

* sysdeps/powerpc/ifunc-sel.h (ifunc_sel): Make always_inline.
(ifunc_one): Likewise.

6 years ago[BZ #22342] Fix netgroup cache keys.
DJ Delorie [Fri, 2 Mar 2018 04:20:45 +0000 (23:20 -0500)]
[BZ #22342] Fix netgroup cache keys.

Unlike other nscd caches, the netgroup cache contains two types of
records - those for "iterate through a netgroup" (i.e. setnetgrent())
and those for "is this user in this netgroup" (i.e. innetgr()),
i.e. full and partial records.  The timeout code assumes these records
have the same key for the group name, so that the collection of records
that is "this netgroup" can be expired as a unit.

However, the keys are not the same, as the in-netgroup key is generated
by nscd rather than being passed to it from elsewhere, and is generated
without the trailing NUL.  All other keys have the trailing NUL, and as
noted in the linked BZ, debug statements confirm that two keys for the
same netgroup are added to the cache with two different lengths.

The result of this is that as records in the cache expire, the purge
code only cleans out one of the two types of entries, resulting in
stale, possibly incorrect, and possibly inconsistent cache data.

The patch simply includes the existing NUL in the computation for the
key length ('key' points to the char after the NUL, and 'group' to the
first char of the group, so 'key-group' includes the first char to the
NUL, inclusive).

[BZ #22342]
* nscd/netgroupcache.c (addinnetgrX): Include trailing NUL in
key value.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
6 years agonptl_db: Remove stale `match_pid' parameter from `iterate_thread_list'
Maciej W. Rozycki [Thu, 1 Mar 2018 16:10:05 +0000 (16:10 +0000)]
nptl_db: Remove stale `match_pid' parameter from `iterate_thread_list'

Complement commit c579f48edba8 ("Remove cached PID/TID in clone") and
remove the `match_pid' parameter not used by `iterate_thread_list' any
longer.  Update call sites accordingly.

* nptl_db/td_ta_thr_iter.c (iterate_thread_list): Remove
`match_pid' parameter.
(td_ta_thr_iter): Update accordingly.

6 years agonptl: Turn libpthread.so into a symbolic link to the real DSO
Florian Weimer [Thu, 1 Mar 2018 13:38:00 +0000 (14:38 +0100)]
nptl: Turn libpthread.so into a symbolic link to the real DSO

The linker script is no longer needed.

6 years agoan_ES locale: update some locale data [BZ #22896]
Mike FABIAN [Thu, 1 Mar 2018 06:05:01 +0000 (07:05 +0100)]
an_ES locale: update some locale data [BZ #22896]

[BZ #22896]
* localedata/locales/an_ES: update month and day names,
improve d_fmt, improve postal_fmt, add country_post,
add country_isbn

6 years agobg_BG locale: Fix a typo in a comment
Mike FABIAN [Wed, 28 Feb 2018 18:26:29 +0000 (19:26 +0100)]
bg_BG locale: Fix a typo in a comment

* localedata/locales/bg_BG (LC_COLLATE): The comment mentioned
Ukrainian instead of Bulgarian.

6 years agonptl: Drop libpthread_nonshared.a from libpthread.so
Florian Weimer [Thu, 1 Mar 2018 11:53:09 +0000 (12:53 +0100)]
nptl: Drop libpthread_nonshared.a from libpthread.so

Fixes commit bd60ce86520b781ca24b99b2555e2ad389bbfeaa (nptl: Move
pthread_atfork to libc_nonshared.a).

6 years agonptl: Move pthread_atfork to libc_nonshared.a
Florian Weimer [Thu, 1 Mar 2018 07:18:27 +0000 (08:18 +0100)]
nptl: Move pthread_atfork to libc_nonshared.a

libpthread_nonshared.a is unused after this, so remove it from the
build.

There is no ABI impact because pthread_atfork was implemented using
__register_atfork in libc even before this change.

pthread_atfork has to be a weak alias because pthread_* names are not
reserved in libc.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
6 years agoFix i386 fenv_private.h float128 for 32-bit --with-fpmath=sse (bug 22902).
Joseph Myers [Wed, 28 Feb 2018 21:55:51 +0000 (21:55 +0000)]
Fix i386 fenv_private.h float128 for 32-bit --with-fpmath=sse (bug 22902).

As discussed in bug 22902, the i386 fenv_private.h implementation has
problems for float128 for the case of 32-bit glibc built with libgcc
from GCC configured using --with-fpmath=sse.

The optimized floating-point state handling in fenv_private.h needs to
know which floating-point state - x87 or SSE - is used for each
floating-point type, so that only one state needs updating / testing
for libm code using that state internally.  On 32-bit x86, the x87
rounding mode is always used for float128, but the x87 exception flags
are only used when libgcc is built using x87 floating-point
arithmetic; if libgcc is built for SSE arithmetic, the SSE exception
flags are used.

The choice of arithmetic with which libgcc is built is independent of
that with which glibc is built.  Thus, since glibc cannot tell the
choice used in libgcc, the default implementations of
libc_feholdexcept_setroundf128 and libc_feupdateenv_testf128 (which
use the <fenv.h> functions, thus using both x87 and SSE state on
processors that have both) need to be used; this patch updates the
code accordingly.

Tested for 32-bit x86; HJ reports testing in the --with-fpmath=sse
case.

[BZ #22902]
* sysdeps/i386/fpu/fenv_private.h [!__x86_64__]
(libc_feholdexcept_setroundf128): New macro.
[!__x86_64__] (libc_feupdateenv_testf128): Likewise.

6 years agoUse libc_hidden_* for strtoumax (bug 15105).
Joseph Myers [Wed, 28 Feb 2018 14:16:21 +0000 (14:16 +0000)]
Use libc_hidden_* for strtoumax (bug 15105).

On sparc, localplt test failures appear when building with -Os because
of a call to strtoumax from
sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c, and strtoumax
is not inlined when building with -Os.  This patch fixes those
failures by using libc_hidden_proto and libc_hidden_def for strtoumax.

Tested with build-many-glibcs.py for
sparc64-linux-gnu-disable-multi-arch, sparc64-linux-gnu,
sparcv9-linux-gnu-disable-multi-arch, sparcv9-linux-gnu that this
fixes that test failure with -Os.

[BZ #15105]
* sysdeps/wordsize-32/strtoumax.c (strtoumax): Use
libc_hidden_def.
* sysdeps/wordsize-64/strtoumax.c (strtoumax): Likewise.
* include/inttypes.h: New file.

6 years agoFix two more -Os strcoll / wcscoll build failures.
Joseph Myers [Tue, 27 Feb 2018 16:54:14 +0000 (16:54 +0000)]
Fix two more -Os strcoll / wcscoll build failures.

Continuing fixes for -Os build issues shown with build-many-glibcs.py,
this patch adds uses of DIAG_* to disable -Wmaybe-uninitialized in two
more places where code inlined from strcoll / wcscoll is wrongly
diagnosed as possibly using uninitialized structure fields.  (All
these warnings in different places for these functions are I think
essentially the same bug.)

Tested with build-many-glibcs.py for alpha-linux-gnu and
mips-linux-gnu that this fixes the -Os build failures for those
configurations with GCC 7.

* locale/weightwc.h (findidx): Ignore -Wmaybe-uninitialized for
-Os in two more places.

6 years agoRemove the lines from cmn_TW.UTF-8.in which cannot work at the moment.
Mike FABIAN [Thu, 21 Dec 2017 17:56:52 +0000 (18:56 +0100)]
Remove the lines from cmn_TW.UTF-8.in which cannot work at the moment.

See this bug https://sourceware.org/bugzilla/show_bug.cgi?id=22898

These lines don’t yet work because of a glibc bug, not because of
problems in the locale data. No matter what sorting rules one uses,
these characters cannot be sorted at all at the moment.

As soon as that bug is fixed, these lines should be added back to the
test file.

* localedata/cmn_TW.UTF-8.in: Remove the lines which cannot
        be sorted correctly at the moment because of a bug.

6 years agoAdapt collation in several locales to the new iso14651_t1_common file
Mike FABIAN [Mon, 11 Dec 2017 17:26:22 +0000 (18:26 +0100)]
Adapt collation in several locales to the new iso14651_t1_common file

[BZ #22550] - es_ES locale (and other es_* locales): collation should
treat ñ as a primary different character, sync the collation
for Spanish with CLDR
[BZ #21547] - Tibetan script collation broken (Dzongkha and Tibetan)

* localedata/Makefile: Add new test files.
* localedata/lv_LV.UTF-8.in: Adapt test file to new collation order.
* localedata/sv_SE.ISO-8859-1.in: Adapt test file to new collation order.
* localedata/uk_UA.UTF-8.in: Adapt test file to new collation order.
* localedata/am_ET.UTF-8.in: New test file.
* localedata/az_AZ.UTF-8.in: Likewise.
* localedata/be_BY.UTF-8.in: Likewise.
* localedata/ber_DZ.UTF-8.in: Likewise.
* localedata/ber_MA.UTF-8.in: Likewise.
* localedata/bg_BG.UTF-8.in: Likewise.
* localedata/br_FR.UTF-8.in: Likewise.
* localedata/cmn_TW.UTF-8.in: Likewise.
* localedata/crh_UA.UTF-8.in: Likewise.
* localedata/csb_PL.UTF-8.in: Likewise.
* localedata/cv_RU.UTF-8.in: Likewise.
* localedata/cy_GB.UTF-8.in: Likewise.
* localedata/dz_BT.UTF-8.in: Likewise.
* localedata/eo.UTF-8.in: Likewise.
* localedata/es_ES.UTF-8.in: Likewise.
* localedata/fa_IR.UTF-8.in: Likewise.
* localedata/fi_FI.UTF-8.in: Likewise.
* localedata/fil_PH.UTF-8.in: Likewise.
* localedata/fur_IT.UTF-8.in: Likewise.
* localedata/gez_ER.UTF-8@abegede.in: Likewise.
* localedata/ha_NG.UTF-8.in: Likewise.
* localedata/ig_NG.UTF-8.in: Likewise.
* localedata/ik_CA.UTF-8.in: Likewise.
* localedata/kk_KZ.UTF-8.in: Likewise.
* localedata/ku_TR.UTF-8.in: Likewise.
* localedata/ky_KG.UTF-8.in: Likewise.
* localedata/ln_CD.UTF-8.in: Likewise.
* localedata/mi_NZ.UTF-8.in: Likewise.
* localedata/ml_IN.UTF-8.in: Likewise.
* localedata/mn_MN.UTF-8.in: Likewise.
* localedata/mr_IN.UTF-8.in: Likewise.
* localedata/mt_MT.UTF-8.in: Likewise.
* localedata/nb_NO.UTF-8.in: Likewise.
* localedata/om_KE.UTF-8.in: Likewise.
* localedata/os_RU.UTF-8.in: Likewise.
* localedata/ps_AF.UTF-8.in: Likewise.
* localedata/ro_RO.UTF-8.in: Likewise.
* localedata/ru_RU.UTF-8.in: Likewise.
* localedata/sc_IT.UTF-8.in: Likewise.
* localedata/se_NO.UTF-8.in: Likewise.
* localedata/sq_AL.UTF-8.in: Likewise.
* localedata/sv_SE.UTF-8.in: Likewise.
* localedata/szl_PL.UTF-8.in: Likewise.
* localedata/tg_TJ.UTF-8.in: Likewise.
* localedata/tk_TM.UTF-8.in: Likewise.
* localedata/tt_RU.UTF-8.in: Likewise.
* localedata/tt_RU.UTF-8@iqtelif.in: Likewise.
* localedata/ug_CN.UTF-8.in: Likewise.
* localedata/uz_UZ.UTF-8.in: Likewise.
* localedata/vi_VN.UTF-8.in: Likewise.
* localedata/yi_US.UTF-8.in: Likewise.
* localedata/yo_NG.UTF-8.in: Likewise.
* localedata/zh_CN.UTF-8.in: Likewise.
* localedata/locales/am_ET: Adapt collation rules to new iso14651_t1_common
        file and fix bugs in the collation.
* localedata/locales/az_AZ: Likewise.
* localedata/locales/be_BY: Likewise.
* localedata/locales/ber_DZ: Likewise.
* localedata/locales/ber_MA: Likewise.
* localedata/locales/bg_BG: Likewise.
* localedata/locales/br_FR: Likewise.
* localedata/locales/br_FR@euro: Likewise.
* localedata/locales/ca_ES: Likewise.
* localedata/locales/cns11643_stroke: Likewise.
* localedata/locales/crh_UA: Likewise.
* localedata/locales/cs_CZ: Likewise.
* localedata/locales/csb_PL: Likewise.
* localedata/locales/cv_RU: Likewise.
* localedata/locales/cy_GB: Likewise.
* localedata/locales/da_DK: Likewise.
* localedata/locales/dz_BT: Likewise.
* localedata/locales/en_CA: Likewise.
* localedata/locales/eo: Likewise.
* localedata/locales/es_CU: Likewise.
* localedata/locales/es_EC: Likewise.
* localedata/locales/es_ES: Likewise.
* localedata/locales/es_US: Likewise.
* localedata/locales/et_EE: Likewise.
* localedata/locales/fa_IR: Likewise.
* localedata/locales/fi_FI: Likewise.
* localedata/locales/fil_PH: Likewise.
* localedata/locales/fur_IT: Likewise.
* localedata/locales/gez_ER@abegede: Likewise.
* localedata/locales/ha_NG: Likewise.
* localedata/locales/hr_HR: Likewise.
* localedata/locales/hsb_DE: Likewise.
* localedata/locales/hu_HU: Likewise.
* localedata/locales/ig_NG: Likewise.
* localedata/locales/ik_CA: Likewise.
* localedata/locales/is_IS: Likewise.
* localedata/locales/iso14651_t1_pinyin: Likewise.
* localedata/locales/kk_KZ: Likewise.
* localedata/locales/ku_TR: Likewise.
* localedata/locales/ky_KG: Likewise.
* localedata/locales/ln_CD: Likewise.
* localedata/locales/lt_LT: Likewise.
* localedata/locales/lv_LV: Likewise.
* localedata/locales/mi_NZ: Likewise.
* localedata/locales/ml_IN: Likewise.
* localedata/locales/mn_MN: Likewise.
* localedata/locales/mr_IN: Likewise.
* localedata/locales/mt_MT: Likewise.
* localedata/locales/nb_NO: Likewise.
* localedata/locales/om_KE: Likewise.
* localedata/locales/os_RU: Likewise.
* localedata/locales/pl_PL: Likewise.
* localedata/locales/ps_AF: Likewise.
* localedata/locales/ro_RO: Likewise.
* localedata/locales/ru_RU: Likewise.
* localedata/locales/ru_UA: Likewise.
* localedata/locales/sc_IT: Likewise.
* localedata/locales/se_NO: Likewise.
* localedata/locales/si_LK: Likewise.
* localedata/locales/sq_AL: Likewise.
* localedata/locales/sv_FI: Likewise.
* localedata/locales/sv_FI@euro: Likewise.
* localedata/locales/sv_SE: Likewise.
* localedata/locales/szl_PL: Likewise.
* localedata/locales/tg_TJ: Likewise.
* localedata/locales/ti_ER: Likewise.
* localedata/locales/tk_TM: Likewise.
* localedata/locales/tl_PH: Likewise.
* localedata/locales/tr_TR: Likewise.
* localedata/locales/tt_RU: Likewise.
* localedata/locales/tt_RU@iqtelif: Likewise.
* localedata/locales/ug_CN: Likewise.
* localedata/locales/uk_UA: Likewise.
* localedata/locales/uz_UZ: Likewise.
* localedata/locales/uz_UZ@cyrillic: Likewise.
* localedata/locales/vi_VN: Likewise.
* localedata/locales/yi_US: Likewise.
* localedata/locales/yo_NG: Likewise.

6 years agoImprove gen-locales.mk and gen-locale.sh to make test files with @ options work
Mike FABIAN [Mon, 1 Jan 2018 14:33:50 +0000 (15:33 +0100)]
Improve gen-locales.mk and gen-locale.sh to make test files with @ options work

With out this, adding collation test files like localedata/gez_ER.UTF-8@abegede.in
does not work for locales which contain @ modifiers.

* gen-locales.mk: Make test files which contain @ modifiers in their
        name work.
* localedata/gen-locale.sh: Likewise.

6 years agoFix test cases tst-fnmatch and tst-regexloc for the new iso14651_t1_common file.
Mike FABIAN [Tue, 23 Jan 2018 16:29:36 +0000 (17:29 +0100)]
Fix test cases tst-fnmatch and tst-regexloc for the new iso14651_t1_common file.

See:

http://pubs.opengroup.org/onlinepubs/7908799/xbd/re.html

> A range expression represents the set of collating elements that fall
> between two elements in the current collation sequence,
> inclusively. It is expressed as the starting point and the ending
> point separated by a hyphen (-).
>
> Range expressions must not be used in portable applications because
> their behaviour is dependent on the collating sequence. Ranges will be
> treated according to the current collating sequence, and include such
> characters that fall within the range based on that collating
> sequence, regardless of character values. This, however, means that
> the interpretation will differ depending on collating sequence. If,
> for instance, one collating sequence defines ä as a variant of a,
> while another defines it as a letter following z, then the expression
> [ä-z] is valid in the first language and invalid in the second.

Therefore, using [a-z] does not make much sense except in the C/POSIX locale.
The new iso14651_t1_common lists upper case and  lower case Latin characters
in a different order than the old one which causes surprising results
for example in the de_DE locale: [a-z] now includes A because A comes
after a in iso14651_t1_common but does not include Z because that comes
after z in iso14651_t1_common.

* posix/tst-fnmatch.input: Fix results for range expressions
        for non C locales.
* posix/tst-regexloc.c: Do not use a range expression for
        de_DE.ISO-8859-1 locale.

6 years agoFix posix/bug-regex5.c test case, adapt to iso14651_t1_common upate
Mike FABIAN [Fri, 15 Dec 2017 06:19:45 +0000 (07:19 +0100)]
Fix posix/bug-regex5.c test case, adapt to iso14651_t1_common upate

This test case tests how many collating elements are defined in
da_DK.ISO-8859-1 locale. The da_DK locale source defines 4:

collating-element <A-A> from "<U0041><U0041>"
collating-element <A-a> from "<U0041><U0061>"
collating-element <a-A> from "<U0061><U0041>"
collating-element <a-a> from "<U0061><U0061>"

The new iso14651_t1_common file defines more collating elements, two
of them are in the ISO-8859-1 range:

collating-element <U004C_00B7> from "<U004C><U00B7>" % decomposition of LATIN CAPITAL LETTER L WITH MIDDLE DOT
collating-element <U006C_00B7> from "<U006C><U00B7>" % decomposition of LATIN SMALL LETTER L WITH MIDDLE DOT

So the total count is now 6 instead of 4.

* posix/bug-regex5.c: Fix test case because with the new
        iso14651_t1_common file, the da_DK locale now has 6 collating elements
        in the ISO-8859-1 range instead of 4 with the old iso14651_t1_common
        file.

6 years agoCollation order of @-. and space has changed in new iso14651_t1_common file, adapt...
Mike FABIAN [Wed, 13 Dec 2017 13:39:54 +0000 (14:39 +0100)]
Collation order of @-. and space has changed in new iso14651_t1_common file, adapt test files

* localedata/da_DK.ISO-8859-1.in: In the new iso14651_t1_common file
        downloaded from ISO, the collation order of @-. and space has changed.
        Therefore, this test file needed to be adapted.
* localedata/fr_CA.UTF-8.in: Likewise.
* localedata/fr_FR.UTF-8.in: Likewise.
* localedata/uk_UA.UTF-8.in: Likewise.

6 years agoCollation order of ȥ has changed in new iso14651_t1_common file, adapt test files
Mike FABIAN [Tue, 12 Dec 2017 13:39:34 +0000 (14:39 +0100)]
Collation order of ȥ has changed in new iso14651_t1_common file, adapt test files

* localedata/cs_CZ.UTF-8.in: adapt this test file to the collation
        order of ȥ in the new iso14651_t1_common file.
* localedata/pl_PL.UTF-8.in: Likewise.

6 years agoAdd sections for various scripts to the iso14651_t1_common file
Mike FABIAN [Tue, 30 Jan 2018 14:45:05 +0000 (15:45 +0100)]
Add sections for various scripts to the iso14651_t1_common file

* localedata/locales/iso14651_t1_common: Add sections for various
scripts to the iso14651_t1_common file.

6 years agoiso14651_t1_common: make the fourth level the codepoint for characters which are...
Mike FABIAN [Wed, 31 Jan 2018 05:18:47 +0000 (06:18 +0100)]
iso14651_t1_common: make the fourth level the codepoint for characters which are ignorable on all 4 levels

Entries for characters which have “IGNORE” on all 4 levels like:

 <U0001> IGNORE;IGNORE;IGNORE;IGNORE % START OF HEADING (in ISO 6429)

are changed into:

 <U0001> IGNORE;IGNORE;IGNORE;<U0001> % START OF HEADING (in ISO 6429)

i.e. putting the code point of the character into the fourth level
instead of “IGNORE”. Without that change, all such characters
would compare equal which would make a wcscoll test case fail.
It is better to have a clearly defined sort order even for characters
like this so it is good to use the code point as a tie-break.

* localedata/locales/iso14651_t1_common: Use the code point of a
        character in the fourth collation level instead of IGNORE for all
        entries which have IGNORE on all 4 levels.

6 years agoAdd convenience symbols like <AFTER-A>, <BEFORE-A> to iso14651_t1_common
Mike FABIAN [Mon, 11 Dec 2017 19:00:24 +0000 (20:00 +0100)]
Add convenience symbols like <AFTER-A>, <BEFORE-A> to iso14651_t1_common

* localedata/locales/iso14651_t1_common: Add some convenient collation
symbols like <AFTER-A>, <BEFORE-A> to make tailoring easier using
rules similar to those in CLDR.

6 years agoFixing syntax errors after updating the iso14651_t1_common file
Mike FABIAN [Tue, 30 Jan 2018 17:24:47 +0000 (18:24 +0100)]
Fixing syntax errors after updating the iso14651_t1_common file

* localedata/locales/iso14651_t1_common: The new version of this
file downloaded from ISO contained several syntax errors which
are fixed by this patch.

6 years agoiso14651_t1_common: <U\([0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F]\)> → <U000\1>
Mike FABIAN [Tue, 30 Jan 2018 17:07:39 +0000 (18:07 +0100)]
iso14651_t1_common: <U\([0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F]\)> → <U000\1>

* localedata/locales/iso14651_t1_common: replace all <U.....>
with <U000.....> because glibc understands only 4 digit or 8 digit

6 years agoNecessary changes after updating the iso14651_t1_common file
Mike FABIAN [Tue, 30 Jan 2018 17:04:31 +0000 (18:04 +0100)]
Necessary changes after updating the iso14651_t1_common file

* localedata/locales/iso14651_t1_common: Necessary changes
to make the file downloaded from ISO usable by glibc.

6 years agoUpdate iso14651_t1_common file to ISO14651_2016_TABLE1_en.txt [BZ #14095]
Mike FABIAN [Tue, 30 Jan 2018 16:59:00 +0000 (17:59 +0100)]
Update iso14651_t1_common file to ISO14651_2016_TABLE1_en.txt [BZ #14095]

[BZ #14095] - Review / update collation data from Unicode / ISO 14651

File downloaded from:
http://standards.iso.org/iso-iec/14651/ed-4/ISO14651_2016_TABLE1_en.txt

Updating this file alone is not enough, there are problems in the new
file which need to be fixed and the collation rules for many locales
need to be adapted. This is done by the following patches.

This update also fixes the problem that many characters are treated as
identical when sorting because they were not yet in the old
iso14651_t1_common file, see:

https://bugzilla.redhat.com/show_bug.cgi?id=1336308
- Infinite (∞) and empty set (∅) are treated as if they were the same character by sort and uniq

[BZ #14095]
* localedata/locales/iso14651_t1_common: Update file to
latest version from ISO (ISO14651_2016_TABLE1_en.txt).

6 years agohurd: fix timer_routines.c build
Samuel Thibault [Tue, 27 Feb 2018 00:15:09 +0000 (01:15 +0100)]
hurd: fix timer_routines.c build

* sysdeps/pthread/timer_routines.c: Include <timer_routines.h>
instead of <internaltypes.h>.

6 years agohurd: fix gai_misc build
Samuel Thibault [Tue, 27 Feb 2018 00:10:37 +0000 (01:10 +0100)]
hurd: fix gai_misc build

* sysdeps/mach/hurd/gai_misc.h: New file.

6 years agohurd: fix timer_routines.c build
Samuel Thibault [Mon, 26 Feb 2018 23:55:59 +0000 (00:55 +0100)]
hurd: fix timer_routines.c build

        * sysdeps/pthread/timer_routines.c: [!defined DELAYTIMER_MAX]
        (DELAYTIMER_MAX): Define to INT_MAX.

6 years agoMove NPTL-specific code to NPTL-specific header
Samuel Thibault [Sun, 18 Feb 2018 02:00:50 +0000 (03:00 +0100)]
Move NPTL-specific code to NPTL-specific header

* sysdeps/pthread/timer_routines.c: Include <timer_routines.h> instead
of <nptl/pthreadP.h>
(thread_attr_compare): Move function to...
* sysdeps/nptl/timer_routines.h: ... new header.

6 years agoFix another -Os strcoll build issue.
Joseph Myers [Mon, 26 Feb 2018 18:38:01 +0000 (18:38 +0000)]
Fix another -Os strcoll build issue.

While there are now clean -Os build and test results on x86_64 (given
my patch <https://sourceware.org/ml/libc-alpha/2018-02/msg00602.html>,
pending review), testing with -Os with build-many-glibcs.py shows the
build is still failing with -Os everywhere except for x86_64, x86 and
s390x.

There are a variety of different build failures, but the most common
seem to be in strcoll / wcscoll, similar to existing such cases where
DIAG_* are used to disable -Wmaybe-uninitialized.  There are various
different failures even within those functions.  This patch fixes one
particular case that seems quite common, where the warning appears at
the declarations of seq1 and seq2.

Tested with build-many-glibcs.py that this fixes the -Os build for
aarch64-linux-gnu with GCC 7.

* string/strcoll_l.c: Include <libc-diag.h>.
(STRCOLL): Ignore -Wmaybe-uninitialized for -Os around
declarations of seq1 and seq2.

6 years agoUse libc_hidden_* for atoi (bug 15105).
Joseph Myers [Mon, 26 Feb 2018 18:17:47 +0000 (18:17 +0000)]
Use libc_hidden_* for atoi (bug 15105).

Continuing the fixes for localplt test failures with -Os arising from
functions not being inlined in that case, this patch fixes such
failures for atoi by using libc_hidden_proto and libc_hidden_def.

Tested for x86_64 (both that it removes this particular localplt
failure for -Os, and that the testsuite continues to pass without
-Os).

[BZ #15105]
* stdlib/atoi.c (atoi): Use libc_hidden_def.
* include/stdlib.h [!_ISOMAC] (atoi): Use libc_hidden_proto.

6 years agolinux/powerpc: sync sys/ptrace.h with Linux 4.15 [BZ #22433, #22807]
Dmitry V. Levin [Sat, 10 Feb 2018 23:19:32 +0000 (23:19 +0000)]
linux/powerpc: sync sys/ptrace.h with Linux 4.15 [BZ #22433, #22807]

Tested with strace.

* sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h (__ptrace_request): Add
PTRACE_GETREGS, PTRACE_SETREGS, PTRACE_GETFPREGS, PTRACE_SETFPREGS,
PTRACE_GETVRREGS, PTRACE_SETVRREGS, PTRACE_GETEVRREGS,
PTRACE_SETEVRREGS, PTRACE_GETREGS64, PTRACE_SETREGS64,
PTRACE_GET_DEBUGREG, PTRACE_SET_DEBUGREG, PTRACE_GETVSRREGS,
PTRACE_SETVSRREGS, and PTRACE_SINGLEBLOCK.

6 years agopowerpc: Undefine Linux ptrace macros that conflict with __ptrace_request
Tulio Magno Quites Machado Filho [Mon, 26 Feb 2018 13:40:17 +0000 (10:40 -0300)]
powerpc: Undefine Linux ptrace macros that conflict with __ptrace_request

Linux ptrace headers define macros whose tokens conflict with the
constants of enum __ptrace_request causing build errors when
asm/ptrace.h or linux/ptrace.h are included before sys/ptrace.h.

* sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h: Undefine Linux
macros used in __ptrace_request.

Signed-off-by: Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
6 years agoFix a typo in ChangeLog (bit_cpu_BIT -> bit_cpu_IBT)
H.J. Lu [Mon, 26 Feb 2018 12:54:14 +0000 (04:54 -0800)]
Fix a typo in ChangeLog (bit_cpu_BIT -> bit_cpu_IBT)

6 years agoUpdate ChangeLog for BZ 22884 - riscv fmax/fmin
DJ Delorie [Fri, 23 Feb 2018 21:08:08 +0000 (16:08 -0500)]
Update ChangeLog for BZ 22884 - riscv fmax/fmin

6 years agoDefine GEN_AS_CONST_HEADERS when generating header files [BZ #22792]
H.J. Lu [Fri, 23 Feb 2018 19:29:27 +0000 (11:29 -0800)]
Define GEN_AS_CONST_HEADERS when generating header files [BZ #22792]

Glibc build generates header files to define constants from special .sym
files.  If a .sym file includes the same header file which it generates,
it leads to circular dependency which may lead to build hang on a
many-core machine.  Define GEN_AS_CONST_HEADERS when generating header
files to avoid circular dependency.

<tcb-offsets.h> is needed for i686 and it isn't needed for x86-64 at
least since glibc 2.23.

Tested on i686 and x86-64.

[BZ #22792]
* Makerules ($(common-objpfx)%.h): Pass -DGEN_AS_CONST_HEADERS
to $(CC).
* sysdeps/unix/sysv/linux/i386/lowlevellock.h: Include
<tcb-offsets.h> only if GEN_AS_CONST_HEADERS isn't defined.
* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h: Don't include
<tcb-offsets.h>.

6 years agoUse libc_hidden_* for tolower, toupper (bug 15105).
Joseph Myers [Fri, 23 Feb 2018 13:54:53 +0000 (13:54 +0000)]
Use libc_hidden_* for tolower, toupper (bug 15105).

Continuing the fixes for localplt test failures with -Os arising from
functions not being inlined in that case, this patch fixes such
failures for tolower and toupper by using libc_hidden_proto and
libc_hidden_def.

Tested for x86_64 (both that it removes this particular localplt
failure for -Os, and that the testsuite continues to pass without
-Os).

2018-02-22  Joseph Myers  <joseph@codesourcery.com>

[BZ #15105]
* ctype/ctype.c (tolower): Use libc_hidden_def.
(toupper): Likewise.
* include/ctype.h [!_ISOMAC] (tolower): Use libc_hidden_proto.
[!_ISOMAC] (toupper): Likewise.

6 years agoRemove --quiet argument when installing locales
Mike FABIAN [Tue, 20 Feb 2018 17:14:43 +0000 (18:14 +0100)]
Remove --quiet argument when installing locales

Using this argument hides problems. I would like to see when something fails.

* localedata/Makefile: Remove --quiet argument when
installing locales

6 years agoUse / instead of - in d_fmt for pt_BR and pt_PT [BZ #17438]
Mike FABIAN [Wed, 14 Feb 2018 17:17:42 +0000 (18:17 +0100)]
Use / instead of - in d_fmt for pt_BR and pt_PT [BZ #17438]

[BZ #17438]
* localedata/locales/pt_BR (LC_TIME): use / instead of -
in d_fmt.
* localedata/locales/pt_PT (LC_TIME): likewise

6 years agoUse “copy "es_BO"” in LC_TIME of es_CU, es_CL, and es_EC
Mike FABIAN [Tue, 13 Feb 2018 11:03:49 +0000 (12:03 +0100)]
Use “copy "es_BO"” in LC_TIME of es_CU, es_CL, and es_EC

LC_TIME in these 4 locales is identical, using “copy "es_BO"” makes
that more obvious.

[BZ #22646]
* localedata/locales/es_CL (LC_TIME): copy "es_BO".
* localedata/locales/es_CU (LC_TIME): copy "es_BO".
* localedata/locales/es_EC (LC_TIME): copy "es_BO".

6 years agoUpdate sparc ulps
Adhemerval Zanella [Thu, 22 Feb 2018 19:44:58 +0000 (16:44 -0300)]
Update sparc ulps

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

6 years agoRefactor atfork handlers
Adhemerval Zanella [Thu, 1 Feb 2018 19:57:56 +0000 (17:57 -0200)]
Refactor atfork handlers

Current implementation (sysdeps/nptl/fork.c) replicates the atfork
handlers list backward to invoke the child handlers after fork/clone
syscall.

The internal atfork handlers is implemented as a single-linked list
so a lock-free algorithm can be used, trading fork mulithread call
performance for some code complexity and dynamic stack allocation
(since the backwards list should not fail).

This patch refactor it to use a dynarary instead of a linked list.
It simplifies the external variables need to be exported and also
the internal atfork handler member definition.

The downside is a serialization of fork call in multithread, since to
operate on the dynarray the internal lock should be used.  However
as noted by Florian, it already acquires external locks for malloc
and libio so it is already hitting some lock contention.  Besides,
posix_spawn should be faster and more scalable to run external programs
in multithread environments.

Checked on x86_64-linux-gnu.

* nptl/Makefile (routines): Remove unregister-atfork.
* nptl/register-atfork.c (fork_handler_pool): Remove variable.
(fork_handler_alloc): Remove function.
(fork_handlers, fork_handler_init): New variables.
(__fork_lock): Rename to atfork_lock.
(__register_atfork, __unregister_atfork, libc_freeres_fn): Rewrite
to use a dynamic array to add/remove atfork handlers.
* sysdeps/nptl/fork.c (__libc_fork): Likewise.
* sysdeps/nptl/fork.h (__fork_lock, __fork_handlers, __linkin_atfork):
Remove declaration.
(fork_handler): Remove next, refcntr, and need_signal member.
(__run_fork_handler_type): New enum.
(__run_fork_handlers): New prototype.
* sysdeps/nptl/libc-lockP.h (__libc_atfork): Remove declaration.

6 years agoRename nptl-signals.h to internal-signals.h
Adhemerval Zanella [Sat, 4 Nov 2017 00:37:55 +0000 (22:37 -0200)]
Rename nptl-signals.h to internal-signals.h

This patch renames the nptl-signals.h header to internal-signals.h.
On Linux the definitions and functions are not only NPTL related, but
used for other POSIX definitions as well (for instance SIGTIMER for
posix times, SIGSETXID for id functions, and signal block/restore
helpers) and since generic functions will be places and used in generic
implementation it makes more sense to decouple it from NPTL.

Checked on x86_64-linux-gnu.

* sysdeps/nptl/nptl-signals.h: Move to ...
* sysdeps/generic/internal-signals.h: ... here.  Adjust internal
comments.
* sysdeps/unix/sysv/linux/internal-signals.h: Add include guards.
(__nptl_is_internal_signal): Rename to __is_internal_signal.
(__nptl_clear_internal_signals): Rename to __clear_internal_signals.
* sysdeps/unix/sysv/linux/raise.c: Adjust nptl-signal.h to
include-signals.h rename.
* nptl/pthreadP.h: Likewise.
* sysdeps/unix/sysv/linux/spawni.c (__spawni_child): Call
__is_internal_signal instead of __nptl_is_internal_signal.

6 years agoRISC-V: fmax/fmin: Handle signalling NaNs correctly.
Andrew Waterman [Thu, 22 Feb 2018 19:31:54 +0000 (14:31 -0500)]
RISC-V: fmax/fmin: Handle signalling NaNs correctly.

RISC-V's fmax(sNAN,4) returns 4 but glibc expects it to return qNAN.

* sysdeps/riscv/rvd/s_fmax.c (__fmax): Handle sNaNs correctly.
* sysdeps/riscv/rvd/s_fmin.c (__fmin): Likewise.
* sysdeps/riscv/rvf/s_fmaxf.c (__fmaxf): Likewise.
* sysdeps/riscv/rvf/s_fminf.c (__fminf): Likewise.

6 years agoRISC-V: Do not initialize $gp in TLS macros.
DJ Delorie [Thu, 22 Feb 2018 19:28:47 +0000 (14:28 -0500)]
RISC-V: Do not initialize $gp in TLS macros.

RISC-V TLS doesn't require GP to be initialized, and doing so breaks
TLS in a shared object.

6 years agoaarch64/strcmp: fix misaligned loop jump target
Siddhesh Poyarekar [Thu, 22 Feb 2018 18:18:13 +0000 (23:48 +0530)]
aarch64/strcmp: fix misaligned loop jump target

I accidentally set the loop jump back label as misaligned8 instead of
do_misaligned.  The typo is harmless but it's always nice to not have
to unnecessarily execute those two instructions.

* sysdeps/aarch64/strcmp.S (do_misaligned): Jump back to
do_misaligned, not misaligned8.

6 years agoIFUNC for Cavium ThunderX2
Steve Ellcey [Thu, 22 Feb 2018 16:38:47 +0000 (08:38 -0800)]
IFUNC for Cavium ThunderX2

* sysdeps/aarch64/multiarch/Makefile (sysdep_routines):
Add memcpy_thunderx2.
* sysdeps/aarch64/multiarch/ifunc-impl-list.c (MAX_IFUNC):
Increment to 4.
(__libc_ifunc_impl_list): Add __memcpy_thunderx2.
* sysdeps/aarch64/multiarch/memcpy.c (libc_ifunc): Add IS_THUNDERX2
and IS_THUNDERX2PA checks.
* sysdeps/aarch64/multiarch/memcpy_thunderx.S (USE_THUNDERX2):
Use macro to set name appropriately.
(memcpy): Use USE_THUNDERX2 macro to modify prefetches.
* sysdeps/aarch64/multiarch/memcpy_thunderx2.S: New file.
* sysdeps/unix/sysv/linux/aarch64/cpu-features.h (IS_THUNDERX2PA):
New macro.
(IS_THUNDERX2): New macro.

6 years agoAdd [BZ #16335] annotation to ChangeLog entry.
Rical Jasan [Thu, 22 Feb 2018 14:15:32 +0000 (06:15 -0800)]
Add [BZ #16335] annotation to ChangeLog entry.

Commit 6a3962c4a408e8cbc305d2433711196107374e89 unwittingly fixed a
bug, so update the ChangeLog entry accordingly.

6 years agoS390: Regenerate ULPs.
Stefan Liebler [Thu, 22 Feb 2018 08:13:22 +0000 (09:13 +0100)]
S390: Regenerate ULPs.

After regenerating ULPs from scratch in
commit 8e7196c8759287a3e4c882e3c7cf32ddc322df8a, I've missed
to test it with multiple gcc versions.  Hence, here is a further update.

ChangeLog:

* sysdeps/s390/fpu/libm-test-ulps: Regenerated.

6 years agohurd: Add sysdep-cancel.h
Samuel Thibault [Wed, 21 Feb 2018 22:32:46 +0000 (23:32 +0100)]
hurd: Add sysdep-cancel.h

6 years agoRemove miscellaneous debris from libio.
Zack Weinberg [Wed, 21 Feb 2018 19:38:24 +0000 (14:38 -0500)]
Remove miscellaneous debris from libio.

This patch eliminates a number of #if 0 and #ifdef TODO blocks, macros
that are never used, macros that provide portability to substrates that
lack basic things like EINVAL and off_t, and other such debris.

I preserved IO_DEBUG and CHECK_FILE, even though as far as I can tell
IO_DEBUG is never defined and therefore CHECK_FILE never does
anything, because it seems like we might actually want to turn it _on_.

Installed stripped libraries and executables are unchanged, except,
again, that the line number of an assertion changes (this time it's
somewhere in fileops.c).

* libio/libio.h (_IO_pos_BAD, _IO_pos_0, _IO_pos_adjust):
Define here, unconditionally.
* libio/iolibio.h (_IO_pos_BAD): Don't define here.
* libio/libioP.h: Remove #if 0 blocks.
(_IO_pos_BAD, _IO_pos_0, _IO_pos_adjust): Don't define here.
(_IO_va_start, COERCE_FILE, MAYBE_SET_EINVAL): Don't define.
(CHECK_FILE): Don't use MAYBE_SET_EINVAL or COERCE_FILE.  Fix style.

* libio/clearerr.c, libio/fputc.c, libio/getchar.c:
Assume weak_alias is always defined.

* libio/fileops.c, libio/genops.c, libio/oldfileops.c
* libio/oldpclose.c, libio/pclose.c, libio/wfileops.c:
Remove #if 0 and #ifdef TODO blocks.
Assume text_set_element is always defined.

* libio/iofdopen.c, libio/iogetdelim.c, libio/oldiofdopen.c
Use __set_errno (EINVAL) instead of MAYBE_SET_EINVAL.
* libio/tst-mmap-eofsync.c: Make #if 1 block unconditional.

6 years agoRemove _IO_file_flags define.
Zack Weinberg [Thu, 8 Feb 2018 00:41:01 +0000 (19:41 -0500)]
Remove _IO_file_flags define.

This entirely mechanical (except for some indentation fixups) patch
replaces all uses of _IO_file_flags with _flags and removes the #define.

Installed stripped libraries and executables are unchanged by this patch.

* libio/libio.h (_IO_file_flags): Remove macro.
All uses changed to _flags.

6 years agoRemove legacy configuration knobs from libio.
Zack Weinberg [Thu, 8 Feb 2018 00:21:54 +0000 (19:21 -0500)]
Remove legacy configuration knobs from libio.

This patch eliminates the "compatibility defines"
_IO_UNIFIED_JUMPTABLES (always defined to 1, used in a number of #ifs
which are therefore always false), _STDIO_USES_IOSTREAM (unused),
__HAVE_COLUMN (unused), _IO_BE (replaced with __glibc_unlikely), and
yet another redundant definition of EOF.

Installed stripped libraries are unchanged by this patch.

* libio/libio.h (_IO_UNIFIED_JUMPTABLES, _STDIO_USES_IOSTREAM)
(__HAVE_COLUMN, _IO_BE): Don't define.
(_IO_peekc_unlocked, _IO_getwc_unlocked, _IO_putwc_unlocked)
(_IO_fwide_maybe_incompatible): Use __glibc_unlikely.
* libio/libioP.h (EOF): Don't define.
* libio/iofdopen.c, libio/iofopen.c, libio/iopopen.c
* libio/iovdprintf.c, libio/oldiofdopen.c, libio/oldiofopen.c
* libio/oldiopopen.c, debug/vdprintf_chk.c: Remove #if block
testing _IO_UNIFIED_JUMPTABLES.

6 years agoMechanically remove _IO_ name aliases for types and constants.
Zack Weinberg [Wed, 7 Feb 2018 23:42:04 +0000 (18:42 -0500)]
Mechanically remove _IO_ name aliases for types and constants.

This patch mechanically removes all remaining uses, and the
definitions, of the following libio name aliases:

 name                         replaced with
 ----                         -------------
 _IO_FILE                     FILE
 _IO_fpos_t                   __fpos_t
 _IO_fpos64_t                 __fpos64_t
 _IO_size_t                   size_t
 _IO_ssize_t                  ssize_t or __ssize_t
 _IO_off_t                    off_t
 _IO_off64_t                  off64_t
 _IO_pid_t                    pid_t
 _IO_uid_t                    uid_t
 _IO_wint_t                   wint_t
 _IO_va_list                  va_list or __gnuc_va_list
 _IO_BUFSIZ                   BUFSIZ
 _IO_cookie_io_functions_t    cookie_io_functions_t
 __io_read_fn                 cookie_read_function_t
 __io_write_fn                cookie_write_function_t
 __io_seek_fn                 cookie_seek_function_t
 __io_close_fn                cookie_close_function_t

I used __fpos_t and __fpos64_t instead of fpos_t and fpos64_t because
the definitions of fpos_t and fpos64_t depend on the largefile mode.
I used __ssize_t and __gnuc_va_list in a handful of headers where
namespace cleanliness might be relevant even though they're
internal-use-only.  In all other cases, I used the public-namespace
name.

There are a tiny handful of places where I left a use of 'struct _IO_FILE'
alone, because it was being used together with 'struct _IO_FILE_plus'
or 'struct _IO_FILE_complete' in the same arithmetic expression.

Because this patch was almost entirely done with search and replace, I
may have introduced indentation botches.  I did proofread the diff,
but I may have missed something.

The ChangeLog below calls out all of the places where this was not a
pure search-and-replace change.

Installed stripped libraries and executables are unchanged by this patch,
except that some assertions in vfscanf.c change line numbers.

* libio/libio.h (_IO_FILE): Delete; all uses changed to FILE.
(_IO_fpos_t): Delete; all uses changed to __fpos_t.
(_IO_fpos64_t): Delete; all uses changed to __fpos64_t.
(_IO_size_t): Delete; all uses changed to size_t.
(_IO_ssize_t): Delete; all uses changed to ssize_t or __ssize_t.
(_IO_off_t): Delete; all uses changed to off_t.
(_IO_off64_t): Delete; all uses changed to off64_t.
(_IO_pid_t): Delete; all uses changed to pid_t.
(_IO_uid_t): Delete; all uses changed to uid_t.
(_IO_wint_t): Delete; all uses changed to wint_t.
(_IO_va_list): Delete; all uses changed to va_list or __gnuc_va_list.
(_IO_BUFSIZ): Delete; all uses changed to BUFSIZ.
(_IO_cookie_io_functions_t): Delete; all uses changed to
cookie_io_functions_t.
(__io_read_fn): Delete; all uses changed to cookie_read_function_t.
(__io_write_fn): Delete; all uses changed to cookie_write_function_t.
(__io_seek_fn): Delete; all uses changed to cookie_seek_function_t.
(__io_close_fn): Delete: all uses changed to cookie_close_function_t.

* libio/iofopncook.c: Remove unnecessary forward declarations.
* libio/iolibio.h: Correct outdated commentary.
* malloc/malloc.c (__malloc_stats): Remove unnecessary casts.
* stdio-common/fxprintf.c (__fxprintf_nocancel):
Remove unnecessary casts.
* stdio-common/getline.c: Use _IO_getdelim directly.
Don't redefine ssize_t.
* stdio-common/printf_fp.c, stdio_common/printf_fphex.c
* stdio-common/printf_size.c: Don't redefine size_t or FILE.
Remove outdated comments.
* stdio-common/vfscanf.c: Don't redefine va_list.

6 years agoRemove vestiges of external build support from libio headers.
Zack Weinberg [Wed, 7 Feb 2018 21:17:49 +0000 (16:17 -0500)]
Remove vestiges of external build support from libio headers.

As requested by Adhemerval, this patch removes some preprocessor
conditionals from the libio headers that were only relevant when
building libio outside glibc.

Installed stripped libraries and executables are unchanged by this
patch.

* libio/iolibio.h, libio/libioP.h: Remove extern "C".
* libio/libio.h: Remove __BEGIN_DECLS and __END_DECLS.
Remove preprocessor conditionals on _LIBC and __USE_GNU,
which are always true, and __cplusplus, which is always false.

6 years agoFix -Os putc_unlocked, fputc_unlocked linknamespace, localplt issues (bug 15105,...
Joseph Myers [Wed, 21 Feb 2018 18:02:24 +0000 (18:02 +0000)]
Fix -Os putc_unlocked, fputc_unlocked linknamespace, localplt issues (bug 15105, bug 19463).

Continuing the fixes for linknamespace and localplt test failures with
-Os that arise from functions not being inlined in that case, this
patch fixes such failures for putc_unlocked and fputc_unlocked.

libc_hidden_* are used for both functions, while namespace issues are
addressed by making putc_unlocked a weak alias of hidden
__putc_unlocked, which is called in the one place where namespace
issues arise (and defined as an inline function in include/stdio.h).

Tested for x86_64 (both without -Os to make sure that case continues
to work, and with -Os to make sure all the relevant linknamespace and
localplt test failures are resolved).  This completes fixing the -Os
linknamespace failures (at least for x86_64); localplt failures remain
after this patch.

2018-02-19  Joseph Myers  <joseph@codesourcery.com>

[BZ #15105]
[BZ #19463]
* libio/fputc_u.c (fputc_unlocked): Use libc_hidden_def.
* libio/putc_u.c (putc_unlocked): Rename to __putc_unlocked and
define as weak alias of __putc_unlocked.  Use libc_hidden_weak.
* include/stdio.h [!_ISOMAC] (fputc_unlocked): Use
libc_hidden_proto.
[!_ISOMAC] (putc_unlocked): Likewise.
[!_ISOMAC] (__putc_unlocked): Declare as hidden function, and
define inline if [__USE_EXTERN_INLINES].
* misc/syslog.c (__vsyslog_chk): Call __putc_unlocked instead of
putc_unlocked.

6 years agoFix -Os getc_unlocked linknamespace, localplt issues (bug 15105, bug 19463).
Joseph Myers [Wed, 21 Feb 2018 18:01:11 +0000 (18:01 +0000)]
Fix -Os getc_unlocked linknamespace, localplt issues (bug 15105, bug 19463).

Continuing the fixes for linknamespace and localplt test failures with
-Os that arise from functions not being inlined in that case, this
patch fixes such failures for getc_unlocked.

__getc_unlocked already exists; this patch makes it explicitly hidden,
calls it where needed for namespace reasons, adds an inline function
for it when inline functions are used and adds libc_hidden_proto /
libc_hidden_weak for getc_unlocked.

Tested for x86_64 (both without -Os to make sure that case continues
to work, and with -Os to make sure all the relevant linknamespace and
localplt test failures are resolved).  Because of other such failures
that remain after this patch, neither of the bugs can yet be closed.

[BZ #15105]
[BZ #19463]
* libio/getc_u.c (getc_unlocked): Use libc_hidden_weak.
* include/stdio.h [!_ISOMAC] (__getc_unlocked): Use
attribute_hidden, and define inline if [__USE_EXTERN_INLINES].
[!_ISOMAC] (getc_unlocked): Use libc_hidden_proto.
* misc/getttyent.c (__getttyent): Call __getc_unlocked instead of
getc_unlocked.
* time/tzfile.c (__tzfile_read): Likewise.

6 years agoAdd missing “reorder-end” in LC_COLLATE of et_EE [BZ #22517]
Mike FABIAN [Mon, 19 Feb 2018 20:59:30 +0000 (21:59 +0100)]
Add missing “reorder-end” in LC_COLLATE of et_EE [BZ #22517]

[BZ #22517]
* localedata/locales/et_EE (LC_COLLATE): add missing “reorder-end”

6 years agoFix a typo in a comment.
Rical Jasan [Wed, 21 Feb 2018 12:00:03 +0000 (04:00 -0800)]
Fix a typo in a comment.

* io/fcntl.h: Fix a typo in a comment.

6 years agomanual: Update _DEFAULT_SOURCE. [BZ #22862]
Rical Jasan [Mon, 19 Feb 2018 12:37:16 +0000 (04:37 -0800)]
manual: Update _DEFAULT_SOURCE.  [BZ #22862]

The description of the interplay between feature test macros and
compiler options in the description of _DEFAULT_SOURCE is a little
confusing, and dated, so clarify the situation, and don't assume a
specific value for _DEFAULT_SOURCE.

Also, _DEFAULT_SOURCE is supposed to be defined if none of the C/POSIX
feature test macros are defined, but the condition was lacking a test
for _ISOC11_SOURCE, so that is also addressed.

[BZ #22862]
* include/features.h: Add _ISOC11_SOURCE to test for whether
to define _DEFAULT_SOURCE.
* manual/creature.texi (_DEFAULT_SOURCE): Improve
documentation.

6 years agoldconfig: Sync temporary files to disk before renaming them [BZ #20890]
Florian Weimer [Wed, 21 Feb 2018 09:42:48 +0000 (10:42 +0100)]
ldconfig: Sync temporary files to disk before renaming them [BZ #20890]

If the system crashes before the file data has been written to disk, the
file system recovery upon the next mount may restore a partially
rewritten temporary file under the non-temporary (final) name (after the
rename operation).

6 years agoelf: Remove ad-hoc restrictions on dlopen callers [BZ #22787]
Florian Weimer [Wed, 21 Feb 2018 09:37:22 +0000 (10:37 +0100)]
elf: Remove ad-hoc restrictions on dlopen callers [BZ #22787]

This looks like a post-exploitation hardening measure: If an attacker is
able to redirect execution flow, they could use that to load a DSO which
contains additional code (or perhaps make the stack executable).

However, the checks are not in the correct place to be effective: If
they are performed before the critical operation, an attacker with
sufficient control over execution flow could simply jump directly to
the code which performs the operation, bypassing the check.  The check
would have to be executed unconditionally after the operation and
terminate the process in case a caller violation was detected.

Furthermore, in _dl_check_caller, there was a fallback reading global
writable data (GL(dl_rtld_map).l_map_start and
GL(dl_rtld_map).l_text_end), which could conceivably be targeted by an
attacker to disable the check, too.

Other critical functions (such as system) remain completely
unprotected, so the value of these additional checks does not appear
that large.  Therefore this commit removes this functionality.

6 years agohurd: fix build
Samuel Thibault [Wed, 21 Feb 2018 00:17:29 +0000 (01:17 +0100)]
hurd: fix build

* sysdeps/mach/hurd/dl-sysdep.c (_dl_random): New variable.

6 years agomanual: Update the _ISOC99_SOURCE description.
Rical Jasan [Mon, 19 Feb 2018 12:32:35 +0000 (04:32 -0800)]
manual: Update the _ISOC99_SOURCE description.

The current description refers to ISO C99 not being widely adopted,
which it is believed to be now.

* manual/creature.texi (_ISOC99_SOURCE): Update the dated
description.

6 years agomanual: Document missing feature test macros.
Rical Jasan [Mon, 19 Feb 2018 11:30:06 +0000 (03:30 -0800)]
manual: Document missing feature test macros.

Several feature test macros are documented in features.h but absent in
the manual, and some documented macros accept undocumented values.
This commit updates the manual to mention all the accepted macros,
along with any values that hold special meaning.

* manual/creature.texi (_POSIX_C_SOURCE): Document special
values of 199606L, 200112L, and 200809L.
(_XOPEN_SOURCE): Document special values of 600 and 700.
(_ISOC11_SOURCE): Document macro.
(_ATFILE_SOURCE): Likewise.
(_FORTIFY_SOURCE): Likewise.

6 years agoFix -Os ferror_unlocked linknamespace, localplt issues (bug 15105, bug 19463).
Joseph Myers [Mon, 19 Feb 2018 17:32:34 +0000 (17:32 +0000)]
Fix -Os ferror_unlocked linknamespace, localplt issues (bug 15105, bug 19463).

Continuing the fixes for linknamespace and localplt test failures with
-Os that arise from functions not being inlined in that case, this
patch fixes such failures for ferror_unlocked.

The usual approach is followed of adding __ferror_unlocked (inlined
when ferror_unlocked is), making calls use it when required for
namespace reasons (only one such call), and using libc_hidden_proto /
libc_hidden_weak for the ferror_unlocked weak alias when only localplt
but not namespace issues are involved.

Tested for x86_64 (both without -Os to make sure that case continues
to work, and with -Os to make sure all the relevant linknamespace and
localplt test failures are resolved).  Because of other such failures
that remain after this patch, neither of the bugs can yet be closed.

[BZ #15105]
[BZ #19463]
* libio/ferror_u.c (ferror_unlocked): Rename to __ferror_unlocked
and define as weak alias of __ferror_unlocked.  Use
libc_hidden_weak.
* include/stdio.h [!_ISOMAC] (ferror_unlocked): Use
libc_hidden_proto.
[!_ISOMAC] (__ferror_unlocked) New declaration, and inline
function if [__USE_EXTERN_INLINES].
* time/getdate.c (__getdate_r): Call __ferror_unlocked instead of
ferror_unlocked.

6 years agomanual: Improve documentation of get_current_dir_name. [BZ #6889]
Rical Jasan [Fri, 16 Feb 2018 16:47:20 +0000 (08:47 -0800)]
manual: Improve documentation of get_current_dir_name. [BZ #6889]

This is a minor rewording to clarify the behaviour of
get_current_dir_name.  Additionally, the @vindex is moved above the
@deftypefun so that following links give a better result with regard
to context.

[BZ #6889]
* manual/filesys.texi (get_current_dir_name): Clarify
behaviour.

6 years agoFix posix/tst-glob_lstat_compat on alpha [BZ #22818]
Aurelien Jarno [Sun, 18 Feb 2018 17:23:14 +0000 (18:23 +0100)]
Fix posix/tst-glob_lstat_compat on alpha [BZ #22818]

The tst-glob_lstat_compat test needs to run tests on the previous
version of glob. On alpha, there are three versions of glob, GLIBC_2.0,
GLIBC_2.1 and GLIBC_2.27, while on other architectures there are only
the GLIBC_2.0 and GLIBC_2.27 version. Therefore on alpha the previous
version is GLIBC_2.1 and not GLIBC_2.0.

Changelog:
[BZ #22818]
* posix/tst-glob_lstat_compat.c [__alpha__] (glob): Access
the GLIBC_2.1 version.

6 years agointl/tst-gettext: fix failure with newest msgfmt
Aurelien Jarno [Sun, 18 Feb 2018 17:15:47 +0000 (18:15 +0100)]
intl/tst-gettext: fix failure with newest msgfmt

Since upstream gettext commit d13f165b83 (msgfmt: Remove
POT-Creation-Date field from the header in the output.), msgfmt does not
copy the POT-Creation-Date field in the header entry from the po file to
the mo file anymore. This breaks the assumption that we can test gettext
by comparing each message in the po files with the corresponding string
return by gettext. This makes the intl/tst-gettext to fail.

While it would have been possible to modify the po2test.awk script to
also strip the line POT-Creation-Date field when creating the msgs.h
file, it would not work with both the old and new msgfmt.

Instead create a tst-gettext-de.po file from de.po by removing the
POT-Creation-Date line. Another alternative would be to use a static
tst-gettext-de.po file, but I guess the reason for using de.po is to
also catch issues caused by newly added strings.

As tst-catgets also uses msg.h, it should also be updated. Instead of
using the new tst-gettext-de.po file, the patch modifies xopen-msg.awk
to avoid creating a second catgets->intl dependency.

Changelog:
[BZ #21508]
* catgets/xopen-msg.awk: Ignore POT-Creation-Date line.
* intl/Makefile ($(objpfx)tst-gettext-de.po): Generate
intl/tst-gettext-de.po from po/de.po by removing the
POT-Creation-Date line.
($(objpfx)msgs.h): Depend on $(objpfx)tst-gettext-de.po instead of
../po/de.po.
* intl/tst-gettext.sh: Use ${objpfx}tst-gettext-de.po instead of
../po/de.po.

6 years agohurd: Fix build on missing __ptsname_internal function
Samuel Thibault [Sat, 17 Feb 2018 22:26:45 +0000 (23:26 +0100)]
hurd: Fix build on missing __ptsname_internal function

* sysdeps/mach/hurd/ptsname.c: Include <sys/stat.h>.
(__ptsname_r): Move implementation to...
(__ptsname_internal): ... new function.  Add filling the STP
structure.

6 years agohurd: Define EXEC_PAGESIZE
Samuel Thibault [Sat, 17 Feb 2018 21:57:26 +0000 (22:57 +0100)]
hurd: Define EXEC_PAGESIZE

* mach/Makefile (headers): Add mach/param.h.
* sysdeps/mach/hurd/bits/param.h: Include <mach/param.h>.
* sysdeps/mach/i386/mach/param.h: New file, defines EXEC_PAGESIZE

6 years agoFix ulps for pow on hppa.
John David Anglin [Sat, 17 Feb 2018 18:46:50 +0000 (13:46 -0500)]
Fix ulps for pow on hppa.

* sysdeps/hppa/fpu/libm-test-ulps (pow): Increase double and
idouble to 1 ULP.

6 years agomanual: Fix a syntax error.
Rical Jasan [Fri, 16 Feb 2018 16:21:47 +0000 (08:21 -0800)]
manual: Fix a syntax error.

The opening parenthesis for function arguments in an @deftypefun need
to be separated from the function name.  This isn't just a matter of
the GNU coding style---it causes the "(void" (in this case) to be
rendered as a part of the function name, causing a visual defect, and
also results in a warning to the following effect during `make pdf':

  Warning: unbalanced parentheses in @def...)

* manual/platform.texi (__riscv_flush_icache): Fix @deftypefun
syntax.

6 years agoAdd runtime check if mutex will be elided in tst-mutex8 testcases.
Stefan Liebler [Fri, 16 Feb 2018 08:57:30 +0000 (09:57 +0100)]
Add runtime check if mutex will be elided in tst-mutex8 testcases.

An elided mutex don't fail destroy. Elision was disabled for the
test nptl/tst-mutex8 in nptl/Makefile. Thus we can run tests which
destroy a locked mutex.

As elision is only disabled for tst-mutex8, the variants
tst-mutex8-static, tst-mutexpi8 and tst-mutexpi8-static are still
failing if lock elision is enabled.

This patch adds a runtime check, if the checked type of mutex will
be elided. This check is using TUNABLE_GET_FULL to determine if
elision is enabled via the tunables framework.
The pthread_mutex_destroy tests are only run if we dont't assume an
elided mutex.

This way, we can run the whole glibc testsuite with or without enabled
lock elision.

ChangeLog:

* nptl/Makefile (tst-mutex8-ENV): Delete.
* nptl/tst-mutex8.c (check_type):
Add runtime check if mutex will be elided.

6 years agoDocument use of CC and CFLAGS in more detail (bug 20980, bug 21234).
Joseph Myers [Thu, 15 Feb 2018 23:48:47 +0000 (23:48 +0000)]
Document use of CC and CFLAGS in more detail (bug 20980, bug 21234).

There are some bug reports from people setting CFLAGS not including a
-O option and then being confused when the build fails.  This patch
addresses this by documenting the proper use of CC and CFLAGS in more
detail - saying what options should go where and specifying the
requirement to compile with optimization.

The previous text incorrectly used @var markup with CC and CFLAGS.
The correct markup for environment variables is @env, but it's also
the case that passing such variables explicitly on the configure
command line is preferred to passing them in the environment, so this
patch changes the documentation to describe passing them on the
command line (and uses @code).

In many cases putting options in the wrong place may in fact work, but
I believe what I've specified is the correct rule for which options to
put where.

[BZ #20980]
[BZ #21234]
* manual/install.texi (Configuring and compiling): Describe
passing CC and CFLAGS on configure command line, not as
environment variables.  Use @code markup on those variables.
Specify what options go in CC and what go in CFLAGS.  Note the
requirement to compile with optimization.
* INSTALL: Regenerated.

6 years agoFix hppa local PLT entries for sigprocmask (bug 18124).
Joseph Myers [Thu, 15 Feb 2018 21:01:25 +0000 (21:01 +0000)]
Fix hppa local PLT entries for sigprocmask (bug 18124).

When adding/updating localplt.data for various architectures to get
the compilation tests passing everywhere, I generally made it reflect
the existing state of what local PLT entries were actually seen,
rather than an ideal state with as few as possible such entries,
mainly for functions that are intended to be interposable.

This patch eliminates some local PLT entries for hppa by using
__sigprocmask instead of sigprocmask in getcontext and setcontext.
The specific case of sigprocmask called by setcontext is the third of
four items in bug 18124 (the other three have already been fixed for
2.26 or earlier releases).  Note that hppa-specific localplt.data
entries for __sigsetjmp, _IO_funlockfile and __errno_location remain,
but the causes / fixes are less immediately obvious from source
inspection.

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

[BZ #18124]
* sysdeps/hppa/bsd-setjmp.S: Include <sysdep.h>.
(setjmp): Use HIDDEN_JUMPTARGET with __sigsetjmp.
* sysdeps/unix/sysv/linux/hppa/getcontext.S (__getcontext): Call
__sigprocmask instead of sigprocmask.
* sysdeps/unix/sysv/linux/hppa/setcontext.S (__setcontext):
Likewise.
* sysdeps/unix/sysv/linux/hppa/localplt.data: Remove entries for
__sigsetjmp and sigprocmask.

6 years agoUse libc_hidden_* for argz_next, __argz_next (bug 15105).
Joseph Myers [Thu, 15 Feb 2018 21:00:02 +0000 (21:00 +0000)]
Use libc_hidden_* for argz_next, __argz_next (bug 15105).

Among other localplt test failures when building with -Os, there are
libc.so PLT references for argz_next and __argz_next.  This is a
simple case of functions that are inlined for -O2 but not for -Os;
this patch adds libc_hidden_proto / libc_hidden_def for them to avoid
localplt failures even when not inlined.

Tested for x86_64 (both that it removes these particular localplt
failures for -Os - but other such failures remain so the bug can't yet
be closed - and that the testsuite continues to pass without -Os).

[BZ #15105]
* include/argz.h (argz_next): Use libc_hidden_proto.
(__argz_next): Likewise.
* string-argz-next.c (__argz_next): Use libc_hidden_def.
(argz_next): Use libc_hidden_weak.

6 years agoUse libc_hidden_* for __cmsg_nxthdr (bug 15105).
Joseph Myers [Thu, 15 Feb 2018 20:59:12 +0000 (20:59 +0000)]
Use libc_hidden_* for __cmsg_nxthdr (bug 15105).

Among other localplt test failures when building with -Os, there are
libc.so PLT references for __cmsg_nxthdr.  This is a simple case of a
function that is inlined for -O2 but not for -Os; this patch adds
libc_hidden_proto / libc_hidden_def for it to avoid a localplt failure
even when it is not inlined.

Tested for x86_64 (both that it removes this particular localplt
failure for -Os - but other such failures remain so the bug can't yet
be closed - and that the testsuite continues to pass without -Os).

[BZ #15105]
* include/sys/socket.h [!_ISOMAC] (__cmsg_nxthdr): Use
libc_hidden_proto.
* sysdeps/unix/sysv/linux/cmsg_nxthdr.c (__cmsg_nxthdr): Use
libc_hidden_def.

6 years agoUse libc_hidden_* for fputs (bug 15105).
Joseph Myers [Thu, 15 Feb 2018 20:58:16 +0000 (20:58 +0000)]
Use libc_hidden_* for fputs (bug 15105).

Among other localplt test failures when building with -Os, there are
libc.so PLT references for fputs.  fputs calls normally get redirected
to _IO_fputs by a macro in include/stdio.h (and _IO_fputs in turn uses
libc_hidden_proto), but GCC can convert an fprintf call with a
constant string argument into an fputs call, which of course is then
unaffected by the macro redirection.  (I don't know why this issue
only appears with -Os.)

This patch duly adds a use of libc_hidden_proto for fputs.  I see no
obvious reason why the fputs macro redirection is needed at all, but
this patch does not change it.

Tested for x86_64 (both that it removes this particular localplt
failure for -Os - but other such failures remain so the bug can't yet
be closed - and that the testsuite continues to pass without -Os).

[BZ #15105]
* include/stdio.h [!_ISOMAC && IS_IN (libc)] (fputs): Use
libc_hidden_proto.
* libio/iofputs.c (fputs): Use libc_hidden_weak.

6 years agoFix -Os feof_unlocked linknamespace, localplt issues (bug 15105, bug 19463).
Joseph Myers [Thu, 15 Feb 2018 20:57:15 +0000 (20:57 +0000)]
Fix -Os feof_unlocked linknamespace, localplt issues (bug 15105, bug 19463).

Continuing the fixes for linknamespace and localplt test failures with
-Os that arise from functions not being inlined in that case, this
patch fixes such failures for feof_unlocked.

The usual approach is followed of adding __feof_unlocked (inlined when
feof_unlocked is), making calls use it when required for namespace
reasons, and using libc_hidden_proto / libc_hidden_weak for the
feof_unlocked weak alias when only localplt but not namespace issues
are involved.  In the case of getaddrinfo.c, use of __feof_unlocked
needs to be conditional since that code is also used in nscd (where
__feof_unlocked is not available).

Tested for x86_64 (both without -Os to make sure that case continues
to work, and with -Os to make sure all the relevant linknamespace and
localplt test failures are resolved).  Because of other such failures
that remain after this patch, neither of the bugs can yet be closed.

[BZ #15105]
[BZ #19463]
* libio/feof_u.c (feof_unlocked): Rename to __feof_unlocked and
define as weak alias of __feof_unlocked.  Use libc_hidden_weak.
* include/stdio.h (feof_unlocked): Use libc_hidden_proto.
(__feof_unlocked): New declaration, and inline function if
[__USE_EXTERN_INLINES].
* iconv/gconv_conf.c (read_conf_file): Call __feof_unlocked
instead of feof_unlocked.
* intl/localealias.c [_LIBC] (FEOF): Likewise.
* nss/nsswitch.c (nss_parse_file): Likewise.
* sysdeps/unix/sysv/linux/readonly-area.c (__readonly_area):
Likewise.
* time/getdate.c (__getdate_r): Likewise.
* sysdeps/posix/getaddrinfo.c [IS_IN (libc)] (feof_unlocked):
Define as macro to call __feof_unlocked.

6 years ago[AArch64] Fix include.
Wilco Dijkstra [Thu, 15 Feb 2018 12:38:10 +0000 (12:38 +0000)]
[AArch64] Fix include.

Fix include to use <>.

* sysdeps/aarch64/fpu/fpu_control.h: Use <> in include.

6 years agoRemove mplog and mpexp
Wilco Dijkstra [Thu, 15 Feb 2018 12:35:54 +0000 (12:35 +0000)]
Remove mplog and mpexp

Remove the now unused mplog and mpexp files.

* math/Makefile: Remove mpexp.c and mplog.c
* sysdeps/i386/fpu/mpexp.c: Delete file.
* sysdeps/i386/fpu/mplog.c: Likewise.
* sysdeps/ia64/fpu/mpexp.c: Likewise.
* sysdeps/ia64/fpu/mplog.c: Likewise.
* sysdeps/ieee754/dbl-64/e_exp.c: Remove mention of mpexp and mplog.
* sysdeps/ieee754/dbl-64/mpa.h (__pow_mp): Remove unused function.
* sysdeps/ieee754/dbl-64/mpexp.c: Delete file.
* sysdeps/ieee754/dbl-64/mplog.c: Likewise.
* sysdeps/m68k/m680x0/fpu/mpexp.c: Likewise.
* sysdeps/m68k/m680x0/fpu/mplog.c: Likewise.
* sysdeps/x86_64/fpu/multiarch/Makefile: Remove mpexp* and mplog*.
* sysdeps/x86_64/fpu/multiarch/e_log-avx.c: Remove unused defines.
* sysdeps/x86_64/fpu/multiarch/e_log-fma.c: Likewise.
* sysdeps/x86_64/fpu/multiarch/e_log-fma4.c: Likewise.
* sysdeps/x86_64/fpu/multiarch/mpexp-avx.c: Delete file.
* sysdeps/x86_64/fpu/multiarch/mpexp-fma.c: Likewise.
* sysdeps/x86_64/fpu/multiarch/mpexp-fma4.c: Likewise.
* sysdeps/x86_64/fpu/multiarch/mplog-avx.c: Likewise.
* sysdeps/x86_64/fpu/multiarch/mplog-fma.c: Likewise.
* sysdeps/x86_64/fpu/multiarch/mplog-fma4.c: Likewise.

6 years agoS390: Regenerate ULPs.
Stefan Liebler [Thu, 15 Feb 2018 08:06:18 +0000 (09:06 +0100)]
S390: Regenerate ULPs.

Regenerated ulps file from scratch due to recent pow changes.

ChangeLog:

* sysdeps/s390/fpu/libm-test-ulps: Regenerated.

6 years agoUpdate SH libm-tests-ulps
Adhemerval Zanella [Wed, 14 Feb 2018 16:03:13 +0000 (14:03 -0200)]
Update SH libm-tests-ulps

* sysdeps/sh/libm-test-ulps: Update.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
6 years agopowerpc: Update pow() ULPs
Tulio Magno Quites Machado Filho [Mon, 12 Feb 2018 14:10:21 +0000 (12:10 -0200)]
powerpc: Update pow() ULPs

* sysdeps/powerpc/fpu/libm-test-ulps (pow): Increase double and
idouble to 1 ULP.

Signed-off-by: Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
6 years ago[BZ #19239] Don't include sys/sysmacros.h from sys/types.h.
Zack Weinberg [Wed, 7 Feb 2018 20:45:58 +0000 (15:45 -0500)]
[BZ #19239] Don't include sys/sysmacros.h from sys/types.h.

This completes the deprecation and removal of this inclusion, which
was begun in the 2.25 release.

* posix/sys/types.h: Don't include sys/sysmacros.h.
* misc/sys/sysmacros.h: Remove the conditional deprecation
warnings for the macros defined by this header.

6 years agoRemove slow paths from exp
Szabolcs Nagy [Tue, 30 Jan 2018 14:48:22 +0000 (14:48 +0000)]
Remove slow paths from exp

Remove the __slowexp code, so exp is no longer correctly rounded.  The
result is computed to about 70 bits precision so the worst case ulp
error is about 0.500007 in nearest rounding mode.

* manual/probes.texi: Remove slowexp probes.
* math/Makefile: Remove slowexp.
* sysdeps/generic/math_private.h (__slowexp): Remove.
* sysdeps/ieee754/dbl-64/e_exp.c (__ieee754_exp): Remove __slowexp and
document error bounds.
* sysdeps/i386/fpu/slowexp.c: Remove.
* sysdeps/ia64/fpu/slowexp.c: Remove.
* sysdeps/ieee754/dbl-64/slowexp.c: Remove.
* sysdeps/ieee754/dbl-64/uexp.h (err_0): Remove.
* sysdeps/m68k/m680x0/fpu/slowexp.c: Remove.
* sysdeps/powerpc/power4/fpu/Makefile (CPPFLAGS-slowexp.c): Remove.
* sysdeps/x86_64/fpu/multiarch/Makefile: Remove slowexp-fma.
* sysdeps/x86_64/fpu/multiarch/e_exp-avx.c (__slowexp): Remove.
* sysdeps/x86_64/fpu/multiarch/e_exp-fma.c (__slowexp): Remove.
* sysdeps/x86_64/fpu/multiarch/e_exp-fma4.c (__slowexp): Remove.
* sysdeps/x86_64/fpu/multiarch/slowexp-avx.c: Remove.
* sysdeps/x86_64/fpu/multiarch/slowexp-fma.c: Remove.
* sysdeps/x86_64/fpu/multiarch/slowexp-fma4.c: Remove.

6 years agoRemove slow paths from pow
Wilco Dijkstra [Mon, 12 Feb 2018 10:42:42 +0000 (10:42 +0000)]
Remove slow paths from pow

Remove the slow paths from pow.  Like several other double precision math
functions, pow is exactly rounded.  This is not required from math functions
and causes major overheads as it requires multiple fallbacks using higher
precision arithmetic if a result is close to 0.5ULP.  Ridiculous slowdowns
of up to 100000x have been reported when the highest precision path triggers.

All GLIBC math tests pass on AArch64 and x64 (with ULP of pow set to 1).
The worst case error is ~0.506ULP.  A simple test over a few hundred million
values shows pow is 10% faster on average.  This fixes BZ #13932.

[BZ #13932]
* sysdeps/ieee754/dbl-64/uexp.h (err_1): Remove.
* benchtests/pow-inputs: Update comment for slow path cases.
* manual/probes.texi (slowpow_p10): Delete removed probe.
(slowpow_p10): Likewise.
* math/Makefile: Remove halfulp.c and slowpow.c.
* sysdeps/aarch64/libm-test-ulps: Set ULP of pow to 1.
* sysdeps/generic/math_private.h (__exp1): Remove error argument.
(__halfulp): Remove.
(__slowpow): Remove.
* sysdeps/i386/fpu/halfulp.c: Delete file.
* sysdeps/i386/fpu/slowpow.c: Likewise.
* sysdeps/ia64/fpu/halfulp.c: Likewise.
* sysdeps/ia64/fpu/slowpow.c: Likewise.
* sysdeps/ieee754/dbl-64/e_exp.c (__exp1): Remove error argument,
improve comments and add error analysis.
* sysdeps/ieee754/dbl-64/e_pow.c (__ieee754_pow): Add error analysis.
(power1): Remove function:
(log1): Remove error argument, add error analysis.
(my_log2): Remove function.
* sysdeps/ieee754/dbl-64/halfulp.c: Delete file.
* sysdeps/ieee754/dbl-64/slowpow.c: Likewise.
* sysdeps/m68k/m680x0/fpu/halfulp.c: Likewise.
* sysdeps/m68k/m680x0/fpu/slowpow.c: Likewise.
* sysdeps/powerpc/power4/fpu/Makefile: Remove CPPFLAGS-slowpow.c.
* sysdeps/x86_64/fpu/libm-test-ulps: Set ULP of pow to 1.
* sysdeps/x86_64/fpu/multiarch/Makefile: Remove slowpow-fma.c,
slowpow-fma4.c, halfulp-fma.c, halfulp-fma4.c.
* sysdeps/x86_64/fpu/multiarch/e_pow-fma.c (__slowpow): Remove define.
* sysdeps/x86_64/fpu/multiarch/e_pow-fma4.c (__slowpow): Likewise.
* sysdeps/x86_64/fpu/multiarch/halfulp-fma.c: Delete file.
* sysdeps/x86_64/fpu/multiarch/halfulp-fma4.c: Likewise.
* sysdeps/x86_64/fpu/multiarch/slowpow-fma.c: Likewise.
* sysdeps/x86_64/fpu/multiarch/slowpow-fma4.c: Likewise.

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