Commit Graph

33308 Commits

Author SHA1 Message Date
Mike FABIAN ce6636b06b 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.
2018-02-27 17:01:57 +01:00
Mike FABIAN ac3a3b4b0d 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.
2018-02-27 17:00:21 +01:00
Mike FABIAN 770cbe147c 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.
2018-02-27 16:58:44 +01:00
Mike FABIAN 0fc355d9a7 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.
2018-02-27 16:56:25 +01:00
Mike FABIAN 43f3893f4b 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.
2018-02-27 16:54:31 +01:00
Mike FABIAN df74ef786f 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.
2018-02-27 16:52:54 +01:00
Mike FABIAN d5adfbadd4 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.
2018-02-27 16:50:30 +01:00
Mike FABIAN 5f5a961091 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.
2018-02-27 16:47:22 +01:00
Mike FABIAN 8a97e9002f 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.
2018-02-27 16:45:30 +01:00
Mike FABIAN bbdd2fba7d 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
2018-02-27 16:44:03 +01:00
Mike FABIAN 1569e551af 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.
2018-02-27 16:42:14 +01:00
Mike FABIAN 9479b6d5e0 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).
2018-02-27 16:36:31 +01:00
Samuel Thibault 93d260ddda hurd: fix timer_routines.c build
* sysdeps/pthread/timer_routines.c: Include <timer_routines.h>
	instead of <internaltypes.h>.
2018-02-27 01:15:39 +01:00
Samuel Thibault 7211eba676 hurd: fix gai_misc build
* sysdeps/mach/hurd/gai_misc.h: New file.
2018-02-27 01:11:08 +01:00
Samuel Thibault eb937a5285 hurd: fix timer_routines.c build
* sysdeps/pthread/timer_routines.c: [!defined DELAYTIMER_MAX]
        (DELAYTIMER_MAX): Define to INT_MAX.
2018-02-27 00:55:59 +01:00
Samuel Thibault 03b540b368 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.
2018-02-27 00:48:24 +01:00
Joseph Myers f54d8f735a 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.
2018-02-26 18:38:01 +00:00
Joseph Myers 20602c72fa 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.
2018-02-26 18:17:47 +00:00
Dmitry V. Levin f5f473a9d0 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.
2018-02-26 13:46:31 +00:00
Tulio Magno Quites Machado Filho 398c6fddaf 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>
2018-02-26 10:40:34 -03:00
H.J. Lu d863cd712e Fix a typo in ChangeLog (bit_cpu_BIT -> bit_cpu_IBT) 2018-02-26 04:54:14 -08:00
DJ Delorie 7e04eb2932 Update ChangeLog for BZ 22884 - riscv fmax/fmin 2018-02-23 16:08:08 -05:00
H.J. Lu f5d1f629c6 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>.
2018-02-23 11:29:39 -08:00
Joseph Myers 54412d2061 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.
2018-02-23 13:54:53 +00:00
Mike FABIAN 81be4b5e38 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
2018-02-23 09:51:56 +01:00
Mike FABIAN 9d5cfd8e83 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
2018-02-23 09:50:29 +01:00
Mike FABIAN 6c7269f31d 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".
2018-02-23 09:49:03 +01:00
Adhemerval Zanella 4cdc25a4a1 Update sparc ulps
* sysdeps/sparc/fpu/libm-test-ulps: Update.
2018-02-22 16:44:58 -03:00
Adhemerval Zanella 27761a1042 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.
2018-02-22 16:43:59 -03:00
Adhemerval Zanella 92aabad9b2 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.
2018-02-22 16:43:59 -03:00
Andrew Waterman fdcc625376 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.
2018-02-22 14:31:54 -05:00
DJ Delorie 8090720a87 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.
2018-02-22 14:28:47 -05:00
Siddhesh Poyarekar 6ca24c4348 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.
2018-02-22 23:48:14 +05:30
Steve Ellcey e9537dddc7 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.
2018-02-22 08:38:47 -08:00
Rical Jasan da81ae645d Add [BZ #16335] annotation to ChangeLog entry.
Commit 6a3962c4a4 unwittingly fixed a
bug, so update the ChangeLog entry accordingly.
2018-02-22 06:15:32 -08:00
Stefan Liebler 6e33647646 S390: Regenerate ULPs.
After regenerating ULPs from scratch in
commit 8e7196c875, I've missed
to test it with multiple gcc versions.  Hence, here is a further update.

ChangeLog:

	* sysdeps/s390/fpu/libm-test-ulps: Regenerated.
2018-02-22 09:19:49 +01:00
Samuel Thibault 315304d24a hurd: Add sysdep-cancel.h 2018-02-21 23:32:59 +01:00
Zack Weinberg 30bfee2630 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.
2018-02-21 14:39:54 -05:00
Zack Weinberg df6c012b99 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.
2018-02-21 14:22:50 -05:00
Zack Weinberg 177aad3ff6 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.
2018-02-21 14:13:21 -05:00
Zack Weinberg 9964a14579 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.
2018-02-21 14:11:05 -05:00
Zack Weinberg 349579047d 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.
2018-02-21 14:04:18 -05:00
Joseph Myers 039c721a30 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.
2018-02-21 18:02:24 +00:00
Joseph Myers 30ac923dbe 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.
2018-02-21 18:01:11 +00:00
Mike FABIAN 7ec5f9465e Add missing “reorder-end” in LC_COLLATE of et_EE [BZ #22517]
[BZ #22517]
	* localedata/locales/et_EE (LC_COLLATE): add missing “reorder-end”
2018-02-21 16:36:39 +01:00
Rical Jasan 0d217f4082 Fix a typo in a comment.
* io/fcntl.h: Fix a typo in a comment.
2018-02-21 04:00:03 -08:00
Rical Jasan 862b45026f 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.
2018-02-21 02:38:42 -08:00
Florian Weimer 999a6dab3e 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).
2018-02-21 10:42:48 +01:00
Florian Weimer 52a01100ad 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.
2018-02-21 10:37:22 +01:00
Samuel Thibault b5bf62e40c hurd: fix build
* sysdeps/mach/hurd/dl-sysdep.c (_dl_random): New variable.
2018-02-21 01:17:29 +01:00