Commit Graph

5064 Commits

Author SHA1 Message Date
Adhemerval Zanella a8410a5fc9 Consolidate non cancellable waitpid call
This patch consolidates all the non cancellable waitpid calls to use
the __waitpid_nocancel identifier.  For non cancellable targets it will
be just a macro to call the default respective symbol while on Linux
will be a internal one.

Checked on x86_64-linux-gnu, x86_64-linux-gnu-x32, and i686-linux-gnu.

	* libio/ioopen.c (_IO_waitpid): Replace waitpid_not_cancel with
	__waitpid_nocancel.
	* sysdeps/generic/not-cancel.h (waitpid_not_cancel): Remove macro.
	(__waitpid_nocancel): New macro.
	* sysdeps/unix/sysv/linux/not-cancel.h (waitpid_not_cancel): Remove
	macro.
	(__waitpid_nocancel): Replace macro with a function.
	* sysdeps/unix/sysv/linux/waitpid.c (__waitpid_nocancel): New
	function.
2017-08-21 15:37:45 -03:00
Adhemerval Zanella 7369800c04 Consolidate non cancellable fcntl call
This patch consolidates all the non cancellable fcntl calls to use
the __fcntl_nocancel identifier.  For non cancellable targets it will
be just a macro to call the default respective symbol while on Linux
will be a internal one.

Since its prototype is already defined at internal fcntl.h header, it
is removed from not-cancel.h one.

Checked on x86_64-linux-gnu, x86_64-linux-gnu-x32, and i686-linux-gnu.

	* login/utmp_file.c (timeout_handler): Replace fcntl_not_cancel with
	__fcntl_nocancel.
	* sysdeps/generic/not-cancel.h (fcntl_not_cancel): Remove macro.
	* sysdeps/unix/sysv/linux/not-cancel.h (fcntl_not_cancel): Likewise.
2017-08-21 15:37:45 -03:00
Adhemerval Zanella 19926de954 Consolidate non cancellable writev call
This patch consolidates all the non cancellable writev calls to use
the __writev_nocancel identifier.  For non cancellable targets it will
be just a macro to call the default respective symbol while on Linux
will be a internal one.

Checked on x86_64-linux-gnu, x86_64-linux-gnu-x32, and i686-linux-gnu.

	* gmon/gmon.c (write_hist): Replace writev_not_cancel_no_status with
	__writev_nocancel_nostatus.
	(write_call_graph): Likewise.
	(write_bb_counts): Likewise.
	* resolv/herror.c (herror): Likewise.
	* sysdeps/generic/not-cancel.h (writev_not_cancel_no_status): Remove
	macro.
	(__writev_nocancel_nostatus): New macro.
	* sysdeps/unix/sysv/linux/not-cancel.h (writev_not_cancel_no_status):
	Remove macro.
	(__writev_nocancel_nostatus): New function.
2017-08-21 15:37:45 -03:00
Joseph Myers 831bbd5527 Remove SPARC sqrt wrappers (bug 21973).
This patch removes the SPARC-specific wrappers for sqrt and sqrtf.

These wrappers, by adding architecture-specific uses of _LIB_VERSION
and __kernel_standard, unnecessarily complicate cleanups of libm error
handling.  They also do not serve a useful optimization purpose.  GCC
knows about sqrt as a built-in function, and can generate direct calls
to a hardware square root instruction, either on its own, in the
-fno-math-errno case, or together with an inline check for the
argument being negative and a call to the out-of-line sqrt function
for error handling only in that case (and has been able to do so for a
long time).  Thus in practice the wrapper will only be called only in
the case of negative arguments, which is not a case it is useful to
optimize for.

The removal of the wrappers also uncovers, and fixes, an old bug.
32-bit SPARC libm used (checked with glibc 2.8 binaries) to have a
sqrtl compat symbol, version GLIBC_2.0, for old binaries when sqrtl
was an alias of sqrt (I don't have pre-glibc-2.4 binaries for SPARC to
hand to check for the sqrtl symbol in those).  This disappeared,
probably with:

commit 8847f03770
Author: David S. Miller <davem@davemloft.net>
Date:   Tue Feb 28 22:37:58 2012 -0800

    Add sparc optimized sqrt{,f}.

Removing the wrappers brings back the generic ldbl-opt logic for
creating such compat symbols, and so restores the compat symbol that
should be there.  This could of course also be fixed in the wrappers -
but as noted above, the wrappers are optimizing a case it's not useful
to optimize, so the bug of the missing compat symbol serves to
illustrate the risks involved with the extra complexity of
architecture-specific function versions where not needed.

Tested with build-many-glibcs.py.

	[BZ #21973]
	* sysdeps/sparc/sparc32/fpu/w_sqrt_compat.S: Remove file.
	* sysdeps/sparc/sparc32/fpu/w_sqrtf_compat.S: Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrt_compat-vis3.S:
	Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrt_compat.S:
	Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrtf_compat-vis3.S:
	Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/w_sqrtf_compat.S:
	Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrt_compat.S : Likewise.
	* sysdeps/sparc/sparc32/sparcv9/fpu/w_sqrtf_compat.S: Likewise.
	* sysdeps/sparc/sparc64/fpu/w_sqrt_compat.S: Likewise.
	* sysdeps/sparc/sparc64/fpu/w_sqrtf_compat.S: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Add
	GLIBC_2.0 sqrtl symbol.
2017-08-21 17:46:34 +00:00
H.J. Lu 41e673c1e7 x86-64: Mark internal symbols with attribute_hidden [BZ #18822]
Since __syscall_clock_gettime and __start_context are internal symbols
for Linux/x86-64, mark them with attribute_hidden.

	[BZ #18822]
	* sysdeps/unix/sysv/linux/x86_64/init-first.c
	(__syscall_clock_gettime): Add attribute_hidden.
	* sysdeps/unix/sysv/linux/x86_64/makecontext.c
	(__start_context): Likewise.
2017-08-21 05:58:53 -07:00
H.J. Lu 483d706879 x86: Mark VDSO_SYMBOL(getcpu) with attribute_hidden [BZ #18822]
VDSO_SYMBOL(getcpu) is defined as hidden in Linux/x86_64 init-first.c
and unused for Linux/i386.

	[BZ #18822]
	* sysdeps/unix/sysv/linux/x86/libc-vdso.h (VDSO_SYMBOL(getcpu)):
	Add attribute_hidden.
2017-08-21 05:40:45 -07:00
H.J. Lu 2585d7b839 i386: Hide __old_glob64 [BZ #18822]
Hide internal __old_glob64 function to allow direct access within
libc.so and libc.a without using GOT nor PLT.

	[BZ #18822]
	* sysdeps/unix/sysv/linux/i386/glob64.c (__old_glob64): Add
	libc_hidden_proto and libc_hidden_def.
2017-08-20 10:47:02 -07:00
H.J. Lu c8dfa99c98 i386: Hide __old_readdir64 [BZ #18822]
Hide internal __old_readdir64 function to allow direct access within
libc.so and libc.a without using GOT nor PLT.

	[BZ #18822]
	* sysdeps/unix/sysv/linux/i386/olddirent.h (__old_readdir64):
	Add libc_hidden_proto.
	* sysdeps/unix/sysv/linux/i386/readdir64.c (__old_readdir64):
	Add libc_hidden_def.
2017-08-20 10:46:11 -07:00
Adhemerval Zanella c181840c93 Consolidate non cancellable close call
This patch consolidates all the non cancellable close calls to use
the __close_nocancel{_nostatus} identifier.  For non cancellable targets
it will be just a macro to call the default respective symbol while on Linux
will be a internal one.

Also, since it is used on libcrypto it is also exported in GLIBC_PRIVATE
namespace.

Checked on x86_64-linux-gnu, x86_64-linux-gnu-x32, and i686-linux-gnu.

	* sysdeps/generic/not-cancel.h (close_not_cancel): Remove macro.
	(close_not_cancel_no_status): Likewise.
	(__close_nocancel): New macro.
	(__close_nocancel_no_status): Likewise.
	* sysdeps/unix/sysv/linux/not-cancel.h (__close_nocancel): Remove
	macro.
	(close_not_cancel): Likewise.
	(close_not_cancel_no_status): Likewise.
	(__close_nocancel): New prototype.
	(__close_nocancel_no_status): New function.
	* sysdeps/unix/sysv/linux/close.c (__close_nocancel): New function.
	* catgets/open_catalog.c (__open_catalog): Replace
	close_not_cancel{_no_status) with __close_nocancel{_nostatus}.
	* gmon/gmon.c (write_gmon): Likewise.
	* iconv/gconv_cache.c (__gconv_load_cache): Likewise.
	* intl/loadmsgcat.c (close): Likewise.
	* io/ftw.c (open_dir_stream): Likewise.
	(ftw_startup): Likewise.
	* libio/fileops.c (_IO_file_open): Likewise.
	(_IO_file_close_mmap): Likewise.
	(_IO_file_close): Likewise.
	* libio/iopopen.c (_IO_dup2): Likewise.
	* locale/loadarchive.c (_nl_load_locale_from_archive): Likewise.
	* locale/loadlocale.c (_nl_load_locale): Likewise.
	* login/utmp_file.c (pututline_file): Likewise.
	(endutent_file): Likewise.
	* misc/daemon.c (daemon): Likewise.
	* nscd/nscd_getai.c (__nscd_getai): Likewise.
	* nscd/nscd_getgr_r.c (nscd_getgr_r): Likewise.
	* nscd/nscd_gethst_r.c (nscd_gethst_r): Likewise.
	* nscd/nscd_getpw_r.c (nscd_getpw_r): Likewise.
	* nscd/nscd_getserv_r.c (nscd_getserv_r): Likewise.
	* nscd/nscd_helper.c (open_socket): Likewise.
	(__nscd_open_socket): Likewise.
	* nscd/nscd_initgroups.c (__nscd_getgrouplist): Likewise.
	* nscd/nscd_netgroup.c (__nscd_setnetgrent): Likewise.
	(__nscd_innetgr): Likewise.
	* nss/nss_db/db-open.c (internal_setent): Likewise.
	* resolv/res-close.c (__res_iclose): Likewise.
	* sunrpc/pm_getmaps.c (pmap_getmaps): Likewise.
	* sysdeps/posix/closedir.c (__closedir): Likewise.
	* sysdeps/posix/getaddrinfo.c (getaddrinfo): Likewise.
	* sysdeps/posix/getcwd.c (__getcwd): Likewise.
	* sysdeps/posix/opendir.c (tryopen_o_directory): Likewise.
	(opendir_tail): Likewise.
	* sysdeps/posix/spawni.c (__spawni_child): Likewise.
	* sysdeps/unix/sysv/linux/check_native.c (__check_native): Likewise.
	* sysdeps/unix/sysv/linux/check_pf.c (__check_pf): Likewise.
	* sysdeps/unix/sysv/linux/fips-private.h (fips_enabled_p): Likewise.
	* sysdeps/unix/sysv/linux/gethostid.c (sethostid): Likewise.
	(gethostid): Likewise.
	* sysdeps/unix/sysv/linux/getloadavg.c (getloadavg): Likewise.
	* sysdeps/unix/sysv/linux/getlogin_r.c (__getlogin_r_loginuid):
	Likewise.
	* sysdeps/unix/sysv/linux/getsysstats.c (__get_nprocs): Likewise.
	* sysdeps/unix/sysv/linux/grantpt.c (close_all_fds): Likewise.
	* sysdeps/unix/sysv/linux/i386/smp.h (is_smp_system): Likewise.
	* sysdeps/unix/sysv/linux/ia64/has_cpuclock.c (has_cpuclock):
	Likewise.
	* sysdeps/unix/sysv/linux/if_index.c (__if_nametoindex): Likewise.
	* sysdeps/unix/sysv/linux/libc_fatal.c (backtrace_and_maps): Likewise.
	* sysdeps/unix/sysv/linux/malloc-sysdep.h (check_may_shrink_heap):
	Likewise.
	* sysdeps/unix/sysv/linux/mq_notify.c (init_mq_netlink): Likewise.
	* sysdeps/unix/sysv/linux/pthread_getname.c (pthread_getname_np):
	Likewise.
	* sysdeps/unix/sysv/linux/pthread_setname.c (pthread_setname_np):
	Likewise.
	* sysdeps/unix/sysv/linux/spawni.c (__spawni_child): Likewise.
	* sysdeps/unix/sysv/linux/sysconf.c (__sysconf): Likewise.
2017-08-18 18:38:55 -03:00
Adhemerval Zanella 0bb2fabcb3 Consolidate non cancellable openat call
This patch consolidates all the non cancellable openat{64} calls to use
the __openat{64}_nocancel identifier.  For non cancellable targets it will
be just a macro to call the default respective symbol while on Linux
will be a internal one.

Checked on x86_64-linux-gnu, x86_64-linux-gnu-x32, and i686-linux-gnu.

	* sysdeps/generic/not-cancel.h (openat_not_cancel): Remove macro.
	(openat_not_cancel_3): Likewise.
	(openat64_not_cancel_3): Likewise).
	(openat_not_cancel_3): Likewise).
	* sysdeps/unix/sysv/linux/not-cancel.h (openat_not_cancel): Remove
	macro.
	(openat_not_cancel_3): Likewise.
	(openat64_not_cancel): Likewise.
	(openat64_not_cancel_3): Likewise.
	* sysdeps/unix/sysv/linux/openat.c (__openat_nocancel): New function.
	* sysdeps/unix/sysv/linux/openat64.c (__openat64_nocancel): Likewise.
	* io/ftw.c (open_dir_stream): Replace openat{64}_not_cancel{_3} with
	__open{64}_nocancel.
	* sysdeps/mach/hurd/opendir.c (__opendirat): Likewise.
	* sysdeps/posix/getcwd.c (__getcwd): Likewise.
	* sysdeps/posix/opendir.c (__opendirat): Likewise.
2017-08-18 16:30:05 -03:00
Adhemerval Zanella c647fb885c Consolidate non cancellable write call
This patch consolidates all the non cancellable write calls to use
the __write_nocancel identifier.  For non cancellable targets it will
be just a macro to call the default respective symbol while on Linux
will be a internal one.

Checked on x86_64-linux-gnu, x86_64-linux-gnu-x32, and i686-linux-gnu.

	* sysdeps/generic/not-cancel.h (write_not_cancel): Remove macro.
	(__write_nocancel): New macro.
	* sysdeps/unix/sysv/linux/not-cancel.h (__write_nocancel):
	Rewrite as a function prototype.
	(write_not_cancel): Remove macro.
	* sysdeps/unix/sysv/linux/write.c (__write_nocancel): New function.
	* gmon/gmon.c (ERR): Replace write_not_cancel with __write_nocancel.
	(write_gmon): Likewise.
	* libio/fileops.c (_IO_new_file_write): Likewise.
	* login/utmp_file.c (pututline_file): Likewise.
	(updwtmp_file): Likewise.
	* stdio-common/psiginfo.c (psiginfo): Likewise.
	* sysdeps/posix/spawni.c (__spawni_child): Likewise.
	* sysdeps/unix/sysv/linux/gethostid.c (sethostid): Likewise.
	* sysdeps/unix/sysv/linux/libc_fatal.c (backtrace_and_maps):
	Likewise.
	* sysdeps/unix/sysv/linux/pthread_setname.c (pthread_setname_np):
	Likewise.
2017-08-18 10:53:47 -03:00
Adhemerval Zanella a748eb31c1 Consolidate non cancellable read call
This patch consolidates all the non cancellable read calls to use
the __read_nocancel identifier.  For non cancellable targets it will
be just a macro to call the default respective symbol while on Linux
will be a internal one.

Also, since it is used on libcrypto it is also exported in GLIBC_PRIVATE
namespace.

Checked on x86_64-linux-gnu, x86_64-linux-gnu-x32, and i686-linux-gnu.

	* sysdeps/generic/not-cancel.h (read_not_cancel): Remove macro.
	(__read_nocancel): New macro.
	* sysdeps/unix/sysv/linux/Versions (libc) [GLIBC_PRIVATE]: Add
	__read_nocancel.
	* sysdeps/unix/sysv/linux/not-cancel.h (__read_nocancel): Remove
	macro.
	(__read_nocancel): New prototype.
	* sysdeps/unix/sysv/linux/read.c (__read_nocancel): New function.
	* catgets/open_catalog.c (__open_catalog): Replace read_not_cancel
	with __read_nocancel.
	* intl/loadmsgcat.c (read): Likewise.
	* libio/fileops.c (_IO_file_read): Likewise.
	* locale/loadlocale.c (_nl_load_locale): Likewise.
	* login/utmp_file.c (getutent_r_file): Likewise.
	(internal_getut_r): Likewise.
	(getutline_r_file): Likewise.
	* sysdeps/unix/sysv/linux/fips-private.h (fips_enable_p): Likewise.
	* sysdeps/unix/sysv/linux/gethostid.c (gethostid): Likewise.
	* sysdeps/unix/sysv/linux/getloadavg.c (getloadavg): Likewise.
	* sysdeps/unix/sysv/linux/getlogin_r.c (__getlogin_r_loginuid):
	Likewise.
	* sysdeps/unix/sysv/linux/getsysstats.c (next_line): Likewise.
	* sysdeps/unix/sysv/linux/i386/smp.h (is_smp_system): Likewise.
	* sysdeps/unix/sysv/linux/ia64/has_cpuclock.c (has_cpuclock):
	Likewise.
	* sysdeps/unix/sysv/linux/libc_fatal.c (backtrace_and_maps):
	Likewise.
	* sysdeps/unix/sysv/linux/malloc-sysdep.h (check_may_shrink_heap):
	Likewise.
	* sysdeps/unix/sysv/linux/pthread_getname.c (pthread_getname_np):
	Likewise.
	* sysdeps/unix/sysv/linux/sysconf.c (__sysconf): Likewise.
2017-08-18 10:31:16 -03:00
Adhemerval Zanella c22845744c Consolidate non cancellable open call
This patch consolidates all the non cancellable open calls to use
the __open_nocancel identifier.  For non cancellable targets it will
be just a macro to call the default respective symbol while on Linux
will be a internal one.

To be consistent with the following non cancellable openat call, a
new __open64_nocancel is also added (although not currently used).

Checked on x86_64-linux-gnu, x86_64-linux-gnu-x32, and i686-linux-gnu.

	* sysdeps/generic/not-cancel.h (open_not_cancel): Remove macro.
	(open_not_cancel_2): Likewise.
	(open_nocancel): New macro.
	(open64_nocancel): Likewise.
	* sysdeps/unix/sysv/linux/not-cancel.h (open_not_cancel): Remove macro.
	(open_not_cancel_2): Likewise.
	(__open_nocancel): New prototype.
	(__open64_nocancel): Likewise.
	* sysdeps/unix/sysv/linux/Versions (libc) [GLIBC_PRIVATE]: Add
	__open_nocancel.
	* sysdeps/unix/sysv/linux/open.c (__open_nocancel): New function.
	* sysdeps/unix/sysv/linux/open64.c (__open64_nocancel): Likewise.
	* catgets/open_catalog.c (__open_catalog): Replace open_not_cancel{_2}
	with __open_nocancel.
	* csu/check_fds.c (check_one_fd): Likewise.
	* gmon/gmon.c (write_gmon): Likewise.
	* iconv/gconv_cache.c (__gconv_load_cached): Likewise.
	* intl/loadmsgcat.c (open): Likewise.
	* libio/fileops.c (_IO_file_open): Likewise.
	* locale/loadarchive.c (_nl_load_locale_from_archive): Likewise.
	* locale/loadlocale.c (_nl_load_locale): Likewise.
	* login/utmp_file.c (setutent_file): Likewise.
	* misc/daemon.c (daemon): Likewise.
	* nss/nss_db/db-open.c (internal_setent): Likewise.
	* sysdeps/mach/hurd/opendir.c (__opendirat): Likewise.
	* sysdeps/posix/libc_fatal.c (__libc_message): Likewise.
	* sysdeps/posix/opendir.c (tryopen_o_directory): Likewise.
	(__opendir): Likewise.
	* sysdeps/posix/spawni.c (__spawni_child): Likewise.
	* sysdeps/unix/sysv/linux/fips-private.h (fips_enable_p): Likewise.
	* sysdeps/unix/sysv/linux/gethostid.c (sethostid): Likewise.
	(gethostid): Likewise.
	* sysdeps/unix/sysv/linux/getloadavg.c (getloadavg): Likewise.
	* sysdeps/unix/sysv/linux/getlogin_r.c (__getlogin_r_loginuid):
	Likewise.
	* sysdeps/unix/sysv/linux/getsysstats.c (__get_nprocs): Likewise.
	* sysdeps/unix/sysv/linux/grantpt.c (__close_all_fds): Likewise.
	* sysdeps/unix/sysv/linux/i386/smp.h (is_smp_system): Likewise.
	* sysdeps/unix/sysv/linux/ia64/has_cpuclock.c (has_cpuclock):
	Likewise.
	* sysdeps/unix/sysv/linux/libc_fatal.c (backtrace_and_maps):
	Likewise.
	* sysdeps/unix/sysv/linux/malloc-sysdep.h (check_may_shrink_heap):
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c (__get_clockfreq):
	Likewise.
	* sysdeps/unix/sysv/linux/pthread_getname.c (pthread_getname_np):
	Likewise.
	* sysdeps/unix/sysv/linux/pthread_setname.c (pthread_setname_np):
	Likewise.
	* sysdeps/unix/sysv/linux/spawni.c (__spawni_child): Likewise.
	* sysdeps/unix/sysv/linux/sysconf.c (__sysconf): Likewise.
2017-08-17 16:50:35 -03:00
Florian Weimer 038d1cafaf __opensock: Remove internal_function attribute 2017-08-17 10:18:15 +02:00
Joseph Myers 67f0aff0c6 Fix sigval namespace (bug 21944).
XPG4.2 defines the siginfo_t type, but not union sigval or its
contents (which were added in the 1993 edition of POSIX.1), resulting
in namespace violations for sigval, sival_int and sival_ptr for
signal.h and sys/wait.h for that standard because those headers
incorrectly expose those names in that case.

This patch fixes this problem.  The public type in this case is union
sigval, but various places in the headers use the sigval_t name for
it; direct uses of union sigval are already properly guarded or in
headers not in XPG4.2.  Now, sigval_t, although not a standard name,
does seem to be widely used outside glibc.  The approach taken by this
patch is to make installed headers use the name __sigval_t instead.
__sigval_t is then defined to either union sigval or union __sigval
(where union __sigval has __-prefixed member names as well), depending
on whether there are any namespace issues with the union sigval name
and its members.  In the case where union __sigval is used, sigval_t
is not defined at all, to avoid the problem of sigval_t having a C++
mangled name that depends on feature test macros.  sigval_t is still
defined by signal.h if __USE_MISC (reflecting the nonstandard nature
of that name).

Tested for x86_64.

	[BZ #21944]
	* signal/bits/types/__sigval_t.h: New file.
	* signal/Makefile (headers): Add bits/types/__sigval_t.h.
	* signal/bits/types/sigval_t.h: Include <bits/types/__sigval_t.h>
	and define sigval_t using __sigval_t.
	* include/bits/types/__sigval_t.h: New file.
	* bits/types/sigevent_t.h: Include <bits/types/__sigval_t.h>
	instead of <bits/types/__sigval_t.h>.
	(struct sigevent): Use __sigval_t instead of sigval_t.
	* bits/types/siginfo_t.h: Include <bits/types/__sigval_t.h>
	instead of <bits/types/__sigval_t.h>.
	(siginfo_t): Use __sigval_t instead of sigval_t.
	* sysdeps/unix/sysv/linux/bits/types/sigevent_t.h: Include
	<bits/types/__sigval_t.h> instead of <bits/types/__sigval_t.h>.
	(struct sigevent): Use __sigval_t instead of sigval_t.
	* sysdeps/unix/sysv/linux/bits/types/siginfo_t.h: Include
	<bits/types/__sigval_t.h> instead of <bits/types/__sigval_t.h>.
	(siginfo_t): Use __sigval_t instead of sigval_t.
	* signal/signal.h [__USE_MISC]: Include <bits/types/sigval_t.h>.
2017-08-16 20:33:59 +00:00
Joseph Myers 5047057ffa Allow abort PLT references in libc.so for SH.
Given my patch
<https://gcc.gnu.org/ml/gcc-patches/2017-08/msg00965.html> for the
ICEs building a glibc string function test for SH, the testsuite can
build completely for SH with GCC 7 and mainline.  However, there is a
test failure that does not appear for GCC 6: check-localplt fails
because of an abort PLT reference in libc.so.

Given the lack of a trap insn pattern for SH, it seems unavoidable
that the compiler might sometimes generate abort calls, and such abort
calls (generated from __builtin_trap when there is no trap insn
pattern) will be unaffected by the normal mapping to __GI_abort for
calls within glibc.  Thus, this patch allows (but does not require) an
abort PLT reference in libc.so for SH.

Tested for sh4-linux-gnu with build-many-glibcs.py (GCC 7, with my
patch applied).

	* sysdeps/unix/sysv/linux/sh/localplt.data: Allow abort in
	libc.so.
2017-08-16 17:01:27 +00:00
Adhemerval Zanella 1f14d0c3dd posix: Fix mmap for m68k and ia64 (BZ#21908)
Default semantic for mmap2 syscall is to take the offset in 4096-byte
units.  However m68k and ia64 mmap2 implementation take in the
configured pageunit units and for both architecture it can be
different values.

This patch fixes the m68k runtime discover of mmap2 offset unit
and adds the ia64 definition to find it at runtime.

Checked the basic tst-mmap and tst-mmap-offset on m68k (the system
is configured with 4k, so current code is already passing on this
system) and a sanity check on x86_64-linux-gnu (which should not be
affected by this change).  Sergei also states that ia64 loader now
work correctly with this change.

	Adhemerval Zanella  <adhemerval.zanella@linaro.org>
	Sergei Trofimovich  <slyfox@inbox.ru>

	* sysdeps/unix/sysv/linux/m68k/mmap_internal.h (MMAP2_PAGE_SHIFT):
	Rename to MMAP2_PAGE_UNIT.
	* sysdeps/unix/sysv/linux/mmap.c: Include mmap_internal iff
	__OFF_T_MATCHES_OFF64_T is not defined.
	* sysdeps/unix/sysv/linux/mmap_internal.h (page_unit): Declare as
	uint64_t.
	(MMAP2_PAGE_UNIT) [MMAP2_PAGE_UNIT == -1]: Redefine to page_unit.
	(page_unit) [MMAP2_PAGE_UNIT != -1]: Remove definition.
2017-08-14 10:35:14 -03:00
Florian Weimer e1d2ae8d21 NPTL: Remove internal_function from stack marking functions
These are called across DSO boundaries and therefore should use
the ABI calling convention.
2017-08-13 21:11:38 +02:00
Florian Weimer c4ce038287 __netlink_assert_response: Remove internal_function attribute
This function is called from nscd and should not use a non-standard
calling convention.
2017-08-13 21:11:28 +02:00
Florian Weimer 1b0bfc6946 __fortify_fail: Remove internal_function attribute
__fortify_fail is called across DSO boundaries, so it should not
use a non-standard calling convention.
2017-08-13 21:10:44 +02:00
Florian Weimer 2449ae7b2d ld.so: Introduce struct dl_exception
This commit separates allocating and raising exceptions.  This
simplifies catching and re-raising them because it is no longer
necessary to make a temporary, on-stack copy of the exception message.
2017-08-10 16:54:57 +02:00
Dmitry V. Levin 68dc02d1dc aarch64/sys/ptrace.h: fix typo in comment
* sysdeps/unix/sysv/linux/aarch64/sys/ptrace.h (enum __ptrace_request):
Fix typo in comment.
2017-08-10 01:28:58 +00:00
Dmitry V. Levin 60e2846e26 sys/ptrace.h: remove obsolete Linux PTRACE_SEIZE_DEVEL constant [BZ #21928]
Remove enum __ptrace_flags along with the only constant it contains,
PTRACE_SEIZE_DEVEL, from Linux's sys/ptrace.h files.

This temporary development constant shouldn't have been added to
sys/ptrace.h in the first place.  It was introduced in Linux by commit
v3.1-rc1~308^2~28 as a temporary part of new experimental PTRACE_SEIZE
interface.  Later, as PTRACE_SEIZE stabilized and lost its experimental
status, this flag was removed from Linux by commit v3.4-rc1~109^2~20.

* sysdeps/unix/sysv/linux/sys/ptrace.h (enum __ptrace_flags,
PTRACE_SEIZE_DEVEL): Remove.
* sysdeps/unix/sysv/linux/aarch64/sys/ptrace.h: Likewise.
* sysdeps/unix/sysv/linux/ia64/sys/ptrace.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h: Likewise.
* sysdeps/unix/sysv/linux/s390/sys/ptrace.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/sys/ptrace.h: Likewise.
2017-08-09 22:58:45 +00:00
Joseph Myers 3d452dabd1 Fix uc_* namespace (bug 21457).
The standard members of ucontext_t, in all standard versions with that
type, are uc_link, uc_sigmask, uc_stack and uc_mcontext.

The uc_* namespace is mostly reserved for additions to the structure.
However, in XPG4.2, it's only reserved when <ucontext.h> is included,
not when <signal.h> is included, while <signal.h> is required to
define ucontext_t (but not allowed to make visible other symbols from
<ucontext.h>).  Thus, nonstandard members should avoid uc_* names.
Some already do use __uc_*, but others don't; most architectures (all
except ia64, I think) have a member uc_flags and some have additional
members beyond that.

This patch makes nonstandard members have an __ prefix unless
__USE_MISC is defined.  Members whose names indicate they are solely
padding / reserved for future use are renamed unconditionally to use
the __glibc_reserved1 naming convention.

This is part of the preparation for a revised version of the
mcontext_t / sigcontext patch to be able to eliminate all 13 of the
miscellaneous XFAILs in conform/Makefile, rather than only 11 of them
as at present (at least one further fix on top of this one will be
needed for that as well).

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

	[BZ #21457]
	* sysdeps/arm/sys/ucontext.h (__ctx): Move undefine further down.
	(ucontext_t): Use __ctx with uc_flags.  Rename uc_filler to
	__glibc_reserved1.
	* sysdeps/generic/sys/ucontext.h (__ctx): New macro.
	(ucontext_t): Use __ctx with uc_flags.
	* sysdeps/i386/sys/ucontext.h (__ctx): Move undefine further down.
	(__ctxt): Likewise.
	(ucontext_t): Use __ctx with uc_flags.  Rename uc_filler to
	__glibc_reserved1.
	* sysdeps/m68k/sys/ucontext.h (__ctx): Move undefine further down.
	(ucontext_t): Use __ctx with uc_flags.  Rename uc_filler to
	__glibc_reserved1.
	* sysdeps/mips/sys/ucontext.h (__ctx): Move undefine further down.
	(ucontext_t): Use __ctx with uc_flags.  Rename uc_filler to
	__glibc_reserved1.
	* sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h (__ctx): New
	macro.
	(ucontext_t): Use __ctx with uc_flags.
	* sysdeps/unix/sysv/linux/alpha/sys/ucontext.h (__ctx): New macro.
	(ucontext_t): Use __ctx with uc_flags.
	* sysdeps/unix/sysv/linux/arm/sys/ucontext.h (__ctx): New macro.
	(ucontext_t): Use __ctx with uc_flags and uc_regspace.
	* sysdeps/unix/sysv/linux/hppa/sys/ucontext.h (__ctx): New macro.
	(ucontext_t): Use __ctx with uc_flags.
	* sysdeps/unix/sysv/linux/m68k/sys/ucontext.h (__ctx): Move
	undefine further down.
	(ucontext_t): Use __ctx with uc_flags.  Rename uc_filler to
	__glibc_reserved1.
	* sysdeps/unix/sysv/linux/mips/sys/ucontext.h (__ctx): Move
	undefine further down.
	(ucontext_t): Use __ctx with uc_flags.
	* sysdeps/unix/sysv/linux/nios2/sys/ucontext.h (__ctx): Move
	undefine further down.
	(ucontext_t): Use __ctx with uc_flags.
	* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h (ucontext_t): Use
	__ctx with uc_flags, uc_regs_ptr, uc_regs and uc_reg_space.
	Rename uc_pad to __glibc_reserved1.
	* sysdeps/unix/sysv/linux/s390/sys/ucontext.h (__ctx): Move
	undefine further down.
	(ucontext_t): Use __ctx with uc_flags.
	* sysdeps/unix/sysv/linux/sh/sys/ucontext.h (__ctx): Move undefine
	further down.
	(ucontext_t): Use __ctx with uc_flags.
	* sysdeps/unix/sysv/linux/sparc/sys/ucontext.h (ucontext_t): Use
	__ctx with uc_flags.
	* sysdeps/unix/sysv/linux/tile/sys/ucontext.h (__ctx): New macro.
	(ucontext_t): Use __ctx with uc_flags.
	* sysdeps/unix/sysv/linux/x86/sys/ucontext.h (ucontext_t): Use
	__ctx with uc_flags.
2017-08-09 17:51:26 +00:00
Andreas Schwab 5797b410a8 Fix s390 version of pt-longjmp.c 2017-08-09 10:47:36 +02:00
Siddhesh Poyarekar 36ada5f681 aarch64: Optimized memcpy for Qualcomm Falkor processor
This is an optimized implementation of the memcpy routine that gives a
significant gain in performance for all sizes of copies on the
Qualcomm Falkor processor.  A detailed rationale of the implementation
is written in a comment in the patch.

This implementation improves time for copies up to 128 bytes by up to
15% and for larger copies by up to 35% in the glibc
microbenchmark. The memcpy-random benchmark sees improvements in all
sizes in the range of 13%-18%.

Here are the full numbers extracted from the glibc microbenchmark
using the commands:

../benchtests/scripts/compare_strings.py benchtests/bench-memcpy.out \
		../benchtests/scripts/benchout_strings.schema.json \
		-base=__memcpy_generic length align1 align2

../benchtests/scripts/compare_strings.py benchtests/bench-memcpy-large.out \
		../benchtests/scripts/benchout_strings.schema.json \
		-base=__memcpy_generic length align1 align2

../benchtests/scripts/compare_strings.py benchtests/bench-memcpy-random.out \
		../benchtests/scripts/benchout_strings.schema.json \
		-base=__memcpy_generic max-size

Function: memcpy
__memcpy_thunderx       __memcpy_falkor __memcpy_generic
Variant: default
================================================================================
length=1,align1=0,align2=0:     33.59 (-115.00%)        15.62 (0.00%)   15.62
length=1,align1=0,align2=0:     16.41 (-10.53%) 14.06 (5.26%)   14.84
length=1,align1=0,align2=0:     14.84 (0.00%)   14.84 (0.00%)   14.84
length=1,align1=0,align2=0:     15.62 (-5.26%)  14.06 (5.26%)   14.84
length=2,align1=0,align2=0:     15.62 (-5.26%)  14.06 (5.26%)   14.84
length=2,align1=1,align2=0:     15.62 (-5.26%)  14.06 (5.26%)   14.84
length=2,align1=0,align2=1:     14.84 (0.00%)   14.06 (5.26%)   14.84
length=2,align1=1,align2=1:     14.84 (-5.56%)  14.06 (0.00%)   14.06
length=4,align1=0,align2=0:     14.06 (0.00%)   14.06 (0.00%)   14.06
length=4,align1=2,align2=0:     14.06 (-5.88%)  14.06 (-5.88%)  13.28
length=4,align1=0,align2=2:     14.06 (0.00%)   14.06 (0.00%)   14.06
length=4,align1=2,align2=2:     14.06 (-5.88%)  14.06 (-5.88%)  13.28
length=8,align1=0,align2=0:     14.84 (-5.56%)  13.28 (5.56%)   14.06
length=8,align1=3,align2=0:     14.06 (0.00%)   13.28 (5.56%)   14.06
length=8,align1=0,align2=3:     13.28 (0.00%)   13.28 (0.00%)   13.28
length=8,align1=3,align2=3:     13.28 (-6.25%)  13.28 (-6.25%)  12.50
length=16,align1=0,align2=0:    13.28 (0.00%)   13.28 (0.00%)   13.28
length=16,align1=4,align2=0:    13.28 (0.00%)   12.50 (5.88%)   13.28
length=16,align1=0,align2=4:    13.28 (0.00%)   13.28 (0.00%)   13.28
length=16,align1=4,align2=4:    13.28 (-6.25%)  12.50 (0.00%)   12.50
length=32,align1=0,align2=0:    14.06 (0.00%)   12.50 (11.11%)  14.06
length=32,align1=5,align2=0:    13.28 (0.00%)   12.50 (5.88%)   13.28
length=32,align1=0,align2=5:    14.06 (-5.88%)  12.50 (5.88%)   13.28
length=32,align1=5,align2=5:    14.06 (-5.88%)  12.50 (5.88%)   13.28
length=64,align1=0,align2=0:    14.06 (-5.88%)  13.28 (0.00%)   13.28
length=64,align1=6,align2=0:    13.28 (0.00%)   13.28 (0.00%)   13.28
length=64,align1=0,align2=6:    14.06 (5.26%)   14.06 (5.26%)   14.84
length=64,align1=6,align2=6:    14.84 (-11.77%) 14.06 (-5.88%)  13.28
length=128,align1=0,align2=0:   17.19 (-4.76%)  14.84 (9.52%)   16.41
length=128,align1=7,align2=0:   16.41 (4.55%)   15.62 (9.09%)   17.19
length=128,align1=0,align2=7:   16.41 (0.00%)   14.06 (14.29%)  16.41
length=128,align1=7,align2=7:   16.41 (4.55%)   15.62 (9.09%)   17.19
length=256,align1=0,align2=0:   21.88 (-3.70%)  21.09 (0.00%)   21.09
length=256,align1=8,align2=0:   21.09 (-3.85%)  21.09 (-3.85%)  20.31
length=256,align1=0,align2=8:   20.31 (-4.00%)  20.31 (-4.00%)  19.53
length=256,align1=8,align2=8:   21.88 (-7.69%)  20.31 (0.00%)   20.31
length=512,align1=0,align2=0:   28.91 (-2.78%)  28.91 (-2.78%)  28.12
length=512,align1=9,align2=0:   30.47 (-2.63%)  30.47 (-2.63%)  29.69
length=512,align1=0,align2=9:   29.69 (0.00%)   29.69 (0.00%)   29.69
length=512,align1=9,align2=9:   28.12 (-2.86%)  28.12 (-2.86%)  27.34
length=1024,align1=0,align2=0:  44.53 (0.00%)   44.53 (0.00%)   44.53
length=1024,align1=10,align2=0:         50.00 (0.00%)   50.00 (0.00%)   50.00
length=1024,align1=0,align2=10:         49.22 (1.56%)   50.78 (-1.56%)  50.00
length=1024,align1=10,align2=10:        44.53 (-1.79%)  43.75 (0.00%)   43.75
length=2048,align1=0,align2=0:  77.34 (-1.02%)  76.56 (0.00%)   76.56
length=2048,align1=11,align2=0:         89.84 (0.00%)   89.84 (0.00%)   89.84
length=2048,align1=0,align2=11:         89.84 (0.00%)   89.84 (0.00%)   89.84
length=2048,align1=11,align2=11:        75.78 (0.00%)   75.78 (0.00%)   75.78
length=4096,align1=0,align2=0:  141.41 (-0.56%) 140.62 (0.00%)  140.62
length=4096,align1=12,align2=0:         171.09 (-0.46%) 170.31 (0.00%)  170.31
length=4096,align1=0,align2=12:         170.31 (0.00%)  170.31 (0.00%)  170.31
length=4096,align1=12,align2=12:        140.62 (0.00%)  140.62 (0.00%)  140.62
length=8192,align1=0,align2=0:  278.91 (-0.28%) 275.78 (0.84%)  278.12
length=8192,align1=13,align2=0:         338.28 (0.23%)  335.94 (0.92%)  339.06
length=8192,align1=0,align2=13:         338.28 (0.00%)  455.47 (-34.64%)        338.28
length=8192,align1=13,align2=13:        278.12 (-0.28%) 275.78 (0.56%)  277.34
length=16384,align1=0,align2=0:         535.94 (-0.15%) 531.25 (0.73%)  535.16
length=16384,align1=14,align2=0:        659.38 (0.12%)  659.38 (0.12%)  660.16
length=16384,align1=0,align2=14:        659.38 (0.00%)  657.03 (0.36%)  659.38
length=16384,align1=14,align2=14:       535.16 (0.44%)  532.81 (0.87%)  537.50
length=32768,align1=0,align2=0:         1260.94 (10.68%)        1121.88 (20.53%)        1411.72
length=32768,align1=15,align2=0:        1368.75 (10.02%)        1376.56 (9.50%) 1521.09
length=32768,align1=0,align2=15:        1333.59 (10.91%)        1373.44 (8.25%) 1496.88
length=32768,align1=15,align2=15:       1256.25 (13.96%)        1125.78 (22.90%)        1460.16
length=65536,align1=0,align2=0:         2853.91 (30.11%)        2589.06 (36.60%)        4083.59
length=65536,align1=16,align2=0:        2850.00 (30.14%)        2589.84 (36.52%)        4079.69
length=65536,align1=0,align2=16:        2853.12 (30.60%)        2589.84 (37.00%)        4110.94
length=65536,align1=16,align2=16:       2850.78 (30.07%)        2589.06 (36.49%)        4076.56
length=0,align1=0,align2=0:     15.62 (-5.26%)  16.41 (-10.53%) 14.84
length=0,align1=0,align2=0:     14.84 (-5.56%)  14.84 (-5.56%)  14.06
length=0,align1=0,align2=0:     14.84 (0.00%)   14.84 (0.00%)   14.84
length=0,align1=0,align2=0:     16.41 (-16.67%) 14.84 (-5.56%)  14.06
length=1,align1=0,align2=0:     15.62 (4.76%)   15.62 (4.76%)   16.41
length=1,align1=1,align2=0:     15.62 (0.00%)   14.84 (5.00%)   15.62
length=1,align1=0,align2=1:     14.84 (0.00%)   14.84 (0.00%)   14.84
length=1,align1=1,align2=1:     14.84 (0.00%)   14.06 (5.26%)   14.84
length=2,align1=0,align2=0:     14.84 (0.00%)   14.06 (5.26%)   14.84
length=2,align1=2,align2=0:     14.84 (0.00%)   14.06 (5.26%)   14.84
length=2,align1=0,align2=2:     14.84 (-5.56%)  14.06 (0.00%)   14.06
length=2,align1=2,align2=2:     14.84 (0.00%)   14.06 (5.26%)   14.84
length=3,align1=0,align2=0:     14.84 (0.00%)   14.84 (0.00%)   14.84
length=3,align1=3,align2=0:     14.84 (-5.56%)  14.06 (0.00%)   14.06
length=3,align1=0,align2=3:     15.62 (-11.11%) 14.06 (0.00%)   14.06
length=3,align1=3,align2=3:     14.84 (0.00%)   14.06 (5.26%)   14.84
length=4,align1=0,align2=0:     17.97 (-27.78%) 14.06 (0.00%)   14.06
length=4,align1=4,align2=0:     13.28 (5.56%)   14.06 (0.00%)   14.06
length=4,align1=0,align2=4:     14.06 (0.00%)   13.28 (5.56%)   14.06
length=4,align1=4,align2=4:     13.28 (5.56%)   13.28 (5.56%)   14.06
length=5,align1=0,align2=0:     13.28 (5.56%)   13.28 (5.56%)   14.06
length=5,align1=5,align2=0:     14.06 (0.00%)   14.06 (0.00%)   14.06
length=5,align1=0,align2=5:     14.06 (0.00%)   13.28 (5.56%)   14.06
length=5,align1=5,align2=5:     14.06 (-5.88%)  14.06 (-5.88%)  13.28
length=6,align1=0,align2=0:     14.06 (-5.88%)  14.06 (-5.88%)  13.28
length=6,align1=6,align2=0:     14.06 (0.00%)   14.06 (0.00%)   14.06
length=6,align1=0,align2=6:     14.06 (0.00%)   13.28 (5.56%)   14.06
length=6,align1=6,align2=6:     14.06 (0.00%)   13.28 (5.56%)   14.06
length=7,align1=0,align2=0:     14.84 (-11.77%) 14.06 (-5.88%)  13.28
length=7,align1=7,align2=0:     13.28 (0.00%)   14.06 (-5.88%)  13.28
length=7,align1=0,align2=7:     14.06 (0.00%)   14.06 (0.00%)   14.06
length=7,align1=7,align2=7:     14.06 (0.00%)   14.06 (0.00%)   14.06
length=8,align1=0,align2=0:     14.06 (-5.88%)  13.28 (0.00%)   13.28
length=8,align1=8,align2=0:     14.06 (0.00%)   13.28 (5.56%)   14.06
length=8,align1=0,align2=8:     13.28 (0.00%)   13.28 (0.00%)   13.28
length=8,align1=8,align2=8:     14.06 (-5.88%)  13.28 (0.00%)   13.28
length=9,align1=0,align2=0:     13.28 (0.00%)   13.28 (0.00%)   13.28
length=9,align1=9,align2=0:     13.28 (0.00%)   13.28 (0.00%)   13.28
length=9,align1=0,align2=9:     13.28 (0.00%)   14.06 (-5.88%)  13.28
length=9,align1=9,align2=9:     14.06 (-5.88%)  13.28 (0.00%)   13.28
length=10,align1=0,align2=0:    14.06 (0.00%)   13.28 (5.56%)   14.06
length=10,align1=10,align2=0:   14.06 (-5.88%)  14.06 (-5.88%)  13.28
length=10,align1=0,align2=10:   14.06 (-5.88%)  13.28 (0.00%)   13.28
length=10,align1=10,align2=10:  14.06 (0.00%)   13.28 (5.56%)   14.06
length=11,align1=0,align2=0:    14.06 (-5.88%)  13.28 (0.00%)   13.28
length=11,align1=11,align2=0:   14.06 (-5.88%)  13.28 (0.00%)   13.28
length=11,align1=0,align2=11:   13.28 (0.00%)   13.28 (0.00%)   13.28
length=11,align1=11,align2=11:  13.28 (0.00%)   13.28 (0.00%)   13.28
length=12,align1=0,align2=0:    14.06 (-5.88%)  13.28 (0.00%)   13.28
length=12,align1=12,align2=0:   14.06 (-5.88%)  13.28 (0.00%)   13.28
length=12,align1=0,align2=12:   14.06 (-5.88%)  13.28 (0.00%)   13.28
length=12,align1=12,align2=12:  14.06 (0.00%)   13.28 (5.56%)   14.06
length=13,align1=0,align2=0:    14.06 (-5.88%)  13.28 (0.00%)   13.28
length=13,align1=13,align2=0:   14.06 (-5.88%)  13.28 (0.00%)   13.28
length=13,align1=0,align2=13:   14.06 (-5.88%)  13.28 (0.00%)   13.28
length=13,align1=13,align2=13:  13.28 (0.00%)   13.28 (0.00%)   13.28
length=14,align1=0,align2=0:    13.28 (0.00%)   13.28 (0.00%)   13.28
length=14,align1=14,align2=0:   13.28 (5.56%)   13.28 (5.56%)   14.06
length=14,align1=0,align2=14:   14.06 (-5.88%)  13.28 (0.00%)   13.28
length=14,align1=14,align2=14:  14.06 (-5.88%)  13.28 (0.00%)   13.28
length=15,align1=0,align2=0:    14.06 (-5.88%)  13.28 (0.00%)   13.28
length=15,align1=15,align2=0:   14.06 (-5.88%)  14.06 (-5.88%)  13.28
length=15,align1=0,align2=15:   13.28 (0.00%)   13.28 (0.00%)   13.28
length=15,align1=15,align2=15:  13.28 (0.00%)   14.06 (-5.88%)  13.28
length=16,align1=0,align2=0:    14.06 (-5.88%)  13.28 (0.00%)   13.28
length=16,align1=16,align2=0:   13.28 (5.56%)   14.06 (0.00%)   14.06
length=16,align1=0,align2=16:   14.84 (-11.77%) 13.28 (0.00%)   13.28
length=16,align1=16,align2=16:  13.28 (-6.25%)  12.50 (0.00%)   12.50
length=17,align1=0,align2=0:    14.06 (-5.88%)  12.50 (5.88%)   13.28
length=17,align1=17,align2=0:   14.84 (-11.77%) 12.50 (5.88%)   13.28
length=17,align1=0,align2=17:   14.84 (-5.56%)  12.50 (11.11%)  14.06
length=17,align1=17,align2=17:  14.84 (-11.77%) 12.50 (5.88%)   13.28
length=18,align1=0,align2=0:    14.06 (0.00%)   12.50 (11.11%)  14.06
length=18,align1=18,align2=0:   13.28 (5.56%)   12.50 (11.11%)  14.06
length=18,align1=0,align2=18:   14.06 (-5.88%)  12.50 (5.88%)   13.28
length=18,align1=18,align2=18:  14.06 (0.00%)   12.50 (11.11%)  14.06
length=19,align1=0,align2=0:    14.06 (-5.88%)  13.28 (0.00%)   13.28
length=19,align1=19,align2=0:   14.06 (-5.88%)  13.28 (0.00%)   13.28
length=19,align1=0,align2=19:   14.84 (-5.56%)  12.50 (11.11%)  14.06
length=19,align1=19,align2=19:  14.06 (-5.88%)  12.50 (5.88%)   13.28
length=20,align1=0,align2=0:    14.84 (-11.77%) 12.50 (5.88%)   13.28
length=20,align1=20,align2=0:   14.06 (0.00%)   12.50 (11.11%)  14.06
length=20,align1=0,align2=20:   14.06 (-5.88%)  12.50 (5.88%)   13.28
length=20,align1=20,align2=20:  14.06 (0.00%)   13.28 (5.56%)   14.06
length=21,align1=0,align2=0:    14.84 (-5.56%)  12.50 (11.11%)  14.06
length=21,align1=21,align2=0:   14.06 (-5.88%)  13.28 (0.00%)   13.28
length=21,align1=0,align2=21:   14.84 (-11.77%) 12.50 (5.88%)   13.28
length=21,align1=21,align2=21:  13.28 (5.56%)   13.28 (5.56%)   14.06
length=22,align1=0,align2=0:    14.06 (-5.88%)  12.50 (5.88%)   13.28
length=22,align1=22,align2=0:   14.06 (-5.88%)  13.28 (0.00%)   13.28
length=22,align1=0,align2=22:   14.06 (0.00%)   12.50 (11.11%)  14.06
length=22,align1=22,align2=22:  14.06 (0.00%)   12.50 (11.11%)  14.06
length=23,align1=0,align2=0:    14.06 (-5.88%)  12.50 (5.88%)   13.28
length=23,align1=23,align2=0:   14.06 (-5.88%)  13.28 (0.00%)   13.28
length=23,align1=0,align2=23:   14.06 (-5.88%)  12.50 (5.88%)   13.28
length=23,align1=23,align2=23:  14.06 (-5.88%)  13.28 (0.00%)   13.28
length=24,align1=0,align2=0:    14.06 (-5.88%)  12.50 (5.88%)   13.28
length=24,align1=24,align2=0:   14.06 (0.00%)   13.28 (5.56%)   14.06
length=24,align1=0,align2=24:   14.84 (-11.77%) 12.50 (5.88%)   13.28
length=24,align1=24,align2=24:  14.06 (-5.88%)  13.28 (0.00%)   13.28
length=25,align1=0,align2=0:    14.06 (0.00%)   12.50 (11.11%)  14.06
length=25,align1=25,align2=0:   14.06 (0.00%)   13.28 (5.56%)   14.06
length=25,align1=0,align2=25:   14.06 (0.00%)   12.50 (11.11%)  14.06
length=25,align1=25,align2=25:  13.28 (0.00%)   13.28 (0.00%)   13.28
length=26,align1=0,align2=0:    14.06 (-5.88%)  12.50 (5.88%)   13.28
length=26,align1=26,align2=0:   14.06 (0.00%)   13.28 (5.56%)   14.06
length=26,align1=0,align2=26:   14.06 (-5.88%)  12.50 (5.88%)   13.28
length=26,align1=26,align2=26:  14.06 (0.00%)   13.28 (5.56%)   14.06
length=27,align1=0,align2=0:    14.06 (-5.88%)  12.50 (5.88%)   13.28
length=27,align1=27,align2=0:   14.06 (-5.88%)  12.50 (5.88%)   13.28
length=27,align1=0,align2=27:   14.06 (-5.88%)  12.50 (5.88%)   13.28
length=27,align1=27,align2=27:  14.06 (0.00%)   12.50 (11.11%)  14.06
length=28,align1=0,align2=0:    14.06 (-5.88%)  12.50 (5.88%)   13.28
length=28,align1=28,align2=0:   14.06 (0.00%)   12.50 (11.11%)  14.06
length=28,align1=0,align2=28:   14.06 (0.00%)   12.50 (11.11%)  14.06
length=28,align1=28,align2=28:  14.84 (-11.77%) 13.28 (0.00%)   13.28
length=29,align1=0,align2=0:    14.06 (-5.88%)  12.50 (5.88%)   13.28
length=29,align1=29,align2=0:   13.28 (0.00%)   12.50 (5.88%)   13.28
length=29,align1=0,align2=29:   14.06 (0.00%)   12.50 (11.11%)  14.06
length=29,align1=29,align2=29:  13.28 (5.56%)   12.50 (11.11%)  14.06
length=30,align1=0,align2=0:    14.06 (-5.88%)  12.50 (5.88%)   13.28
length=30,align1=30,align2=0:   13.28 (5.56%)   12.50 (11.11%)  14.06
length=30,align1=0,align2=30:   14.06 (-5.88%)  12.50 (5.88%)   13.28
length=30,align1=30,align2=30:  13.28 (0.00%)   12.50 (5.88%)   13.28
length=31,align1=0,align2=0:    13.28 (0.00%)   12.50 (5.88%)   13.28
length=31,align1=31,align2=0:   14.06 (0.00%)   12.50 (11.11%)  14.06
length=31,align1=0,align2=31:   13.28 (0.00%)   12.50 (5.88%)   13.28
length=31,align1=31,align2=31:  14.06 (0.00%)   12.50 (11.11%)  14.06
length=48,align1=0,align2=0:    14.06 (0.00%)   14.06 (0.00%)   14.06
length=48,align1=3,align2=0:    14.06 (0.00%)   14.06 (0.00%)   14.06
length=48,align1=0,align2=3:    14.06 (-5.88%)  14.06 (-5.88%)  13.28
length=48,align1=3,align2=3:    13.28 (5.56%)   14.06 (0.00%)   14.06
length=80,align1=0,align2=0:    15.62 (-11.11%) 14.84 (-5.56%)  14.06
length=80,align1=5,align2=0:    15.62 (-11.11%) 16.41 (-16.67%) 14.06
length=80,align1=0,align2=5:    14.06 (0.00%)   15.62 (-11.11%) 14.06
length=80,align1=5,align2=5:    15.62 (-5.26%)  17.19 (-15.79%) 14.84
length=96,align1=0,align2=0:    14.06 (0.00%)   14.84 (-5.56%)  14.06
length=96,align1=6,align2=0:    14.84 (-5.56%)  16.41 (-16.67%) 14.06
length=96,align1=0,align2=6:    14.06 (0.00%)   14.84 (-5.56%)  14.06
length=96,align1=6,align2=6:    14.84 (-5.56%)  17.19 (-22.22%) 14.06
length=112,align1=0,align2=0:   17.19 (-4.76%)  14.06 (14.29%)  16.41
length=112,align1=7,align2=0:   17.19 (0.00%)   16.41 (4.55%)   17.19
length=112,align1=0,align2=7:   16.41 (0.00%)   14.84 (9.52%)   16.41
length=112,align1=7,align2=7:   17.19 (0.00%)   17.19 (0.00%)   17.19
length=144,align1=0,align2=0:   17.19 (-10.00%) 17.97 (-15.00%) 15.62
length=144,align1=9,align2=0:   17.19 (-4.76%)  18.75 (-14.29%) 16.41
length=144,align1=0,align2=9:   20.31 (-8.33%)  18.75 (0.00%)   18.75
length=144,align1=9,align2=9:   18.75 (-4.35%)  18.75 (-4.35%)  17.97
length=160,align1=0,align2=0:   18.75 (-4.35%)  17.97 (0.00%)   17.97
length=160,align1=10,align2=0:  18.75 (4.00%)   18.75 (4.00%)   19.53
length=160,align1=0,align2=10:  19.53 (-4.17%)  17.97 (4.17%)   18.75
length=160,align1=10,align2=10:         18.75 (-4.35%)  18.75 (-4.35%)  17.97
length=176,align1=0,align2=0:   18.75 (-4.35%)  17.19 (4.35%)   17.97
length=176,align1=11,align2=0:  19.53 (0.00%)   19.53 (0.00%)   19.53
length=176,align1=0,align2=11:  19.53 (-4.17%)  18.75 (0.00%)   18.75
length=176,align1=11,align2=11:         18.75 (0.00%)   17.97 (4.17%)   18.75
length=192,align1=0,align2=0:   18.75 (0.00%)   17.97 (4.17%)   18.75
length=192,align1=12,align2=0:  21.09 (-8.00%)  18.75 (4.00%)   19.53
length=192,align1=0,align2=12:  18.75 (0.00%)   18.75 (0.00%)   18.75
length=192,align1=12,align2=12:         18.75 (0.00%)   17.97 (4.17%)   18.75
length=208,align1=0,align2=0:   17.97 (0.00%)   20.31 (-13.04%) 17.97
length=208,align1=13,align2=0:  19.53 (7.41%)   21.09 (0.00%)   21.09
length=208,align1=0,align2=13:  23.44 (-11.11%) 21.09 (0.00%)   21.09
length=208,align1=13,align2=13:         21.09 (-3.85%)  21.09 (-3.85%)  20.31
length=224,align1=0,align2=0:   21.09 (-8.00%)  20.31 (-4.00%)  19.53
length=224,align1=14,align2=0:  23.44 (-11.11%) 20.31 (3.70%)   21.09
length=224,align1=0,align2=14:  21.09 (3.57%)   20.31 (7.14%)   21.88
length=224,align1=14,align2=14:         20.31 (0.00%)   19.53 (3.85%)   20.31
length=240,align1=0,align2=0:   20.31 (-4.00%)  19.53 (0.00%)   19.53
length=240,align1=15,align2=0:  22.66 (0.00%)   20.31 (10.34%)  22.66
length=240,align1=0,align2=15:  20.31 (-4.00%)  20.31 (-4.00%)  19.53
length=240,align1=15,align2=15:         21.88 (0.00%)   21.09 (3.57%)   21.88
length=272,align1=0,align2=0:   20.31 (0.00%)   28.12 (-38.46%) 20.31
length=272,align1=17,align2=0:  22.66 (0.00%)   27.34 (-20.69%) 22.66
length=272,align1=0,align2=17:  25.78 (-10.00%) 28.12 (-20.00%) 23.44
length=272,align1=17,align2=17:         22.66 (-3.57%)  27.34 (-25.00%) 21.88
length=288,align1=0,align2=0:   23.44 (-7.14%)  27.34 (-25.00%) 21.88
length=288,align1=18,align2=0:  22.66 (0.00%)   27.34 (-20.69%) 22.66
length=288,align1=0,align2=18:  23.44 (-3.45%)  25.00 (-10.35%) 22.66
length=288,align1=18,align2=18:         22.66 (-3.57%)  21.88 (0.00%)   21.88
length=304,align1=0,align2=0:   21.88 (0.00%)   21.88 (0.00%)   21.88
length=304,align1=19,align2=0:  23.44 (-3.45%)  22.66 (0.00%)   22.66
length=304,align1=0,align2=19:  22.66 (0.00%)   22.66 (0.00%)   22.66
length=304,align1=19,align2=19:         22.66 (-3.57%)  21.88 (0.00%)   21.88
length=320,align1=0,align2=0:   22.66 (-3.57%)  21.88 (0.00%)   21.88
length=320,align1=20,align2=0:  22.66 (0.00%)   22.66 (0.00%)   22.66
length=320,align1=0,align2=20:  22.66 (0.00%)   22.66 (0.00%)   22.66
length=320,align1=20,align2=20:         22.66 (-3.57%)  21.88 (0.00%)   21.88
length=336,align1=0,align2=0:   21.88 (0.00%)   24.22 (-10.71%) 21.88
length=336,align1=21,align2=0:  22.66 (0.00%)   25.00 (-10.35%) 22.66
length=336,align1=0,align2=21:  25.78 (0.00%)   25.00 (3.03%)   25.78
length=336,align1=21,align2=21:         25.00 (0.00%)   23.44 (6.25%)   25.00
length=352,align1=0,align2=0:   24.22 (0.00%)   24.22 (0.00%)   24.22
length=352,align1=22,align2=0:  25.00 (0.00%)   25.00 (0.00%)   25.00
length=352,align1=0,align2=22:  25.00 (-3.23%)  25.00 (-3.23%)  24.22
length=352,align1=22,align2=22:         25.00 (-3.23%)  24.22 (0.00%)   24.22
length=368,align1=0,align2=0:   25.00 (-3.23%)  23.44 (3.23%)   24.22
length=368,align1=23,align2=0:  25.00 (0.00%)   24.22 (3.12%)   25.00
length=368,align1=0,align2=23:  25.00 (-3.23%)  25.00 (-3.23%)  24.22
length=368,align1=23,align2=23:         25.00 (-6.67%)  23.44 (0.00%)   23.44
length=384,align1=0,align2=0:   24.22 (0.00%)   24.22 (0.00%)   24.22
length=384,align1=24,align2=0:  25.00 (0.00%)   24.22 (3.12%)   25.00
length=384,align1=0,align2=24:  25.00 (0.00%)   25.78 (-3.12%)  25.00
length=384,align1=24,align2=24:         24.22 (-3.33%)  23.44 (0.00%)   23.44
length=400,align1=0,align2=0:   25.00 (-3.23%)  26.56 (-9.68%)  24.22
length=400,align1=25,align2=0:  25.78 (-3.12%)  27.34 (-9.38%)  25.00
length=400,align1=0,align2=25:  27.34 (0.00%)   27.34 (0.00%)   27.34
length=400,align1=25,align2=25:         26.56 (0.00%)   25.78 (2.94%)   26.56
length=416,align1=0,align2=0:   26.56 (-3.03%)  25.78 (0.00%)   25.78
length=416,align1=26,align2=0:  28.12 (-2.86%)  27.34 (0.00%)   27.34
length=416,align1=0,align2=26:  27.34 (-2.94%)  28.12 (-5.88%)  26.56
length=416,align1=26,align2=26:         25.78 (0.00%)   26.56 (-3.03%)  25.78
length=432,align1=0,align2=0:   27.34 (-2.94%)  25.78 (2.94%)   26.56
length=432,align1=27,align2=0:  28.12 (-2.86%)  27.34 (0.00%)   27.34
length=432,align1=0,align2=27:  27.34 (0.00%)   28.12 (-2.86%)  27.34
length=432,align1=27,align2=27:         25.78 (0.00%)   25.78 (0.00%)   25.78
length=448,align1=0,align2=0:   26.56 (-3.03%)  25.78 (0.00%)   25.78
length=448,align1=28,align2=0:  27.34 (0.00%)   27.34 (0.00%)   27.34
length=448,align1=0,align2=28:  27.34 (0.00%)   28.12 (-2.86%)  27.34
length=448,align1=28,align2=28:         25.78 (0.00%)   25.78 (0.00%)   25.78
length=464,align1=0,align2=0:   25.78 (0.00%)   28.12 (-9.09%)  25.78
length=464,align1=29,align2=0:  28.12 (-2.86%)  29.69 (-8.57%)  27.34
length=464,align1=0,align2=29:  30.47 (0.00%)   30.47 (0.00%)   30.47
length=464,align1=29,align2=29:         28.12 (0.00%)   27.34 (2.78%)   28.12
length=480,align1=0,align2=0:   29.69 (-5.56%)  28.12 (0.00%)   28.12
length=480,align1=30,align2=0:  31.25 (-2.56%)  29.69 (2.56%)   30.47
length=480,align1=0,align2=30:  29.69 (0.00%)   30.47 (-2.63%)  29.69
length=480,align1=30,align2=30:         28.12 (0.00%)   28.12 (0.00%)   28.12
length=496,align1=0,align2=0:   28.12 (0.00%)   27.34 (2.78%)   28.12
length=496,align1=31,align2=0:  30.47 (-2.63%)  29.69 (0.00%)   29.69
length=496,align1=0,align2=31:  29.69 (0.00%)   30.47 (-2.63%)  29.69
length=496,align1=31,align2=31:         28.12 (-2.86%)  28.12 (-2.86%)  27.34
length=1024,align1=0,align2=0:  44.53 (0.00%)   44.53 (0.00%)   44.53
length=1024,align1=32,align2=0:         44.53 (-1.79%)  44.53 (-1.79%)  43.75
length=1024,align1=0,align2=32:         44.53 (-1.79%)  43.75 (0.00%)   43.75
length=1024,align1=32,align2=32:        43.75 (1.75%)   43.75 (1.75%)   44.53
length=1056,align1=0,align2=0:  46.88 (-1.69%)  46.88 (-1.69%)  46.09
length=1056,align1=33,align2=0:         53.12 (0.00%)   52.34 (1.47%)   53.12
length=1056,align1=0,align2=33:         52.34 (0.00%)   53.12 (-1.49%)  52.34
length=1056,align1=33,align2=33:        46.09 (0.00%)   46.88 (-1.69%)  46.09
length=1088,align1=0,align2=0:  46.88 (-1.69%)  46.09 (0.00%)   46.09
length=1088,align1=34,align2=0:         52.34 (0.00%)   52.34 (0.00%)   52.34
length=1088,align1=0,align2=34:         53.12 (-3.03%)  53.12 (-3.03%)  51.56
length=1088,align1=34,align2=34:        46.09 (0.00%)   46.88 (-1.69%)  46.09
length=1120,align1=0,align2=0:  49.22 (-1.61%)  48.44 (0.00%)   48.44
length=1120,align1=35,align2=0:         54.69 (1.41%)   55.47 (0.00%)   55.47
length=1120,align1=0,align2=35:         57.03 (0.00%)   55.47 (2.74%)   57.03
length=1120,align1=35,align2=35:        48.44 (0.00%)   49.22 (-1.61%)  48.44
length=1152,align1=0,align2=0:  47.66 (1.61%)   48.44 (0.00%)   48.44
length=1152,align1=36,align2=0:         55.47 (-1.43%)  55.47 (-1.43%)  54.69
length=1152,align1=0,align2=36:         58.59 (-1.35%)  55.47 (4.05%)   57.81
length=1152,align1=36,align2=36:        48.44 (0.00%)   49.22 (-1.61%)  48.44
length=1184,align1=0,align2=0:  53.12 (-3.03%)  50.78 (1.52%)   51.56
length=1184,align1=37,align2=0:         61.72 (-2.60%)  57.03 (5.19%)   60.16
length=1184,align1=0,align2=37:         62.50 (-1.27%)  57.03 (7.60%)   61.72
length=1184,align1=37,align2=37:        53.12 (-1.49%)  50.78 (2.99%)   52.34
length=1216,align1=0,align2=0:  53.91 (-4.55%)  50.78 (1.52%)   51.56
length=1216,align1=38,align2=0:         60.94 (0.00%)   57.03 (6.41%)   60.94
length=1216,align1=0,align2=38:         60.16 (0.00%)   57.81 (3.90%)   60.16
length=1216,align1=38,align2=38:        52.34 (-1.52%)  50.00 (3.03%)   51.56
length=1248,align1=0,align2=0:  54.69 (-2.94%)  53.12 (0.00%)   53.12
length=1248,align1=39,align2=0:         64.06 (-1.23%)  60.16 (4.94%)   63.28
length=1248,align1=0,align2=39:         60.94 (-2.63%)  60.16 (-1.32%)  59.38
length=1248,align1=39,align2=39:        53.12 (0.00%)   52.34 (1.47%)   53.12
length=1280,align1=0,align2=0:  52.34 (-1.52%)  52.34 (-1.52%)  51.56
length=1280,align1=40,align2=0:         61.72 (3.66%)   59.38 (7.32%)   64.06
length=1280,align1=0,align2=40:         60.94 (-2.63%)  60.16 (-1.32%)  59.38
length=1280,align1=40,align2=40:        52.34 (-1.52%)  52.34 (-1.52%)  51.56
length=1312,align1=0,align2=0:  54.69 (-1.45%)  55.47 (-2.90%)  53.91
length=1312,align1=41,align2=0:         63.28 (0.00%)   62.50 (1.23%)   63.28
length=1312,align1=0,align2=41:         62.50 (0.00%)   62.50 (0.00%)   62.50
length=1312,align1=41,align2=41:        53.91 (0.00%)   54.69 (-1.45%)  53.91
length=1344,align1=0,align2=0:  54.69 (0.00%)   54.69 (0.00%)   54.69
length=1344,align1=42,align2=0:         62.50 (0.00%)   62.50 (0.00%)   62.50
length=1344,align1=0,align2=42:         62.50 (-1.27%)  62.50 (-1.27%)  61.72
length=1344,align1=42,align2=42:        53.91 (0.00%)   53.91 (0.00%)   53.91
length=1376,align1=0,align2=0:  65.62 (-16.67%) 68.75 (-22.22%) 56.25
length=1376,align1=43,align2=0:         71.88 (-9.52%)  73.44 (-11.90%) 65.62
length=1376,align1=0,align2=43:         72.66 (-12.05%) 74.22 (-14.46%) 64.84
length=1376,align1=43,align2=43:        64.06 (-13.89%) 67.97 (-20.83%) 56.25
length=1408,align1=0,align2=0:  57.03 (-1.39%)  68.75 (-22.22%) 56.25
length=1408,align1=44,align2=0:         65.62 (-1.20%)  73.44 (-13.25%) 64.84
length=1408,align1=0,align2=44:         64.84 (0.00%)   74.22 (-14.46%) 64.84
length=1408,align1=44,align2=44:        56.25 (-1.41%)  68.75 (-23.94%) 55.47
length=1440,align1=0,align2=0:  67.97 (-14.47%) 64.84 (-9.21%)  59.38
length=1440,align1=45,align2=0:         74.22 (-10.47%) 68.75 (-2.33%)  67.19
length=1440,align1=0,align2=45:         72.66 (-6.90%)  69.53 (-2.30%)  67.97
length=1440,align1=45,align2=45:        65.62 (-13.51%) 58.59 (-1.35%)  57.81
length=1472,align1=0,align2=0:  66.41 (-14.86%) 58.59 (-1.35%)  57.81
length=1472,align1=46,align2=0:         73.44 (-9.30%)  67.19 (0.00%)   67.19
length=1472,align1=0,align2=46:         70.31 (-4.65%)  67.97 (-1.16%)  67.19
length=1472,align1=46,align2=46:        57.81 (0.00%)   58.59 (-1.35%)  57.81
length=1504,align1=0,align2=0:  60.94 (0.00%)   60.94 (0.00%)   60.94
length=1504,align1=47,align2=0:         71.09 (-1.11%)  70.31 (0.00%)   70.31
length=1504,align1=0,align2=47:         70.31 (-1.12%)  70.31 (-1.12%)  69.53
length=1504,align1=47,align2=47:        60.94 (-1.30%)  60.16 (0.00%)   60.16
length=1536,align1=0,align2=0:  62.50 (-3.90%)  60.16 (0.00%)   60.16
length=1536,align1=48,align2=0:         60.94 (-1.30%)  60.16 (0.00%)   60.16
length=1536,align1=0,align2=48:         61.72 (-3.95%)  60.16 (-1.32%)  59.38
length=1536,align1=48,align2=48:        60.94 (-1.30%)  60.16 (0.00%)   60.16
length=1568,align1=0,align2=0:  80.47 (-27.16%) 63.28 (0.00%)   63.28
length=1568,align1=49,align2=0:         86.72 (-18.09%) 72.66 (1.06%)   73.44
length=1568,align1=0,align2=49:         74.22 (-3.26%)  74.22 (-3.26%)  71.88
length=1568,align1=49,align2=49:        62.50 (0.00%)   61.72 (1.25%)   62.50
length=1600,align1=0,align2=0:  62.50 (-1.27%)  62.50 (-1.27%)  61.72
length=1600,align1=50,align2=0:         73.44 (0.00%)   71.88 (2.13%)   73.44
length=1600,align1=0,align2=50:         72.66 (0.00%)   73.44 (-1.08%)  72.66
length=1600,align1=50,align2=50:        62.50 (-1.27%)  62.50 (-1.27%)  61.72
length=1632,align1=0,align2=0:  64.84 (0.00%)   64.84 (0.00%)   64.84
length=1632,align1=51,align2=0:         75.78 (0.00%)   75.00 (1.03%)   75.78
length=1632,align1=0,align2=51:         78.91 (0.00%)   75.78 (3.96%)   78.91
length=1632,align1=51,align2=51:        64.84 (-2.47%)  64.84 (-2.47%)  63.28
length=1664,align1=0,align2=0:  64.84 (-1.22%)  64.84 (-1.22%)  64.06
length=1664,align1=52,align2=0:         75.78 (0.00%)   75.00 (1.03%)   75.78
length=1664,align1=0,align2=52:         80.47 (-0.98%)  75.78 (4.90%)   79.69
length=1664,align1=52,align2=52:        64.06 (-1.23%)  65.62 (-3.70%)  63.28
length=1696,align1=0,align2=0:  69.53 (-3.49%)  72.66 (-8.14%)  67.19
length=1696,align1=53,align2=0:         80.47 (-0.98%)  82.03 (-2.94%)  79.69
length=1696,align1=0,align2=53:         80.47 (0.96%)   82.03 (-0.96%)  81.25
length=1696,align1=53,align2=53:        68.75 (-2.33%)  72.66 (-8.14%)  67.19
length=1728,align1=0,align2=0:  67.97 (0.00%)   72.66 (-6.90%)  67.97
length=1728,align1=54,align2=0:         80.47 (-0.98%)  82.81 (-3.92%)  79.69
length=1728,align1=0,align2=54:         78.91 (-1.00%)  82.03 (-5.00%)  78.12
length=1728,align1=54,align2=54:        68.75 (0.00%)   72.66 (-5.68%)  68.75
length=1760,align1=0,align2=0:  77.34 (-12.50%) 68.75 (0.00%)   68.75
length=1760,align1=55,align2=0:         91.41 (-8.33%)  79.69 (5.56%)   84.38
length=1760,align1=0,align2=55:         88.28 (-10.78%) 80.47 (-0.98%)  79.69
length=1760,align1=55,align2=55:        77.34 (-11.24%) 68.75 (1.12%)   69.53
length=1792,align1=0,align2=0:  78.12 (-14.94%) 68.75 (-1.15%)  67.97
length=1792,align1=56,align2=0:         88.28 (-4.63%)  79.69 (5.56%)   84.38
length=1792,align1=0,align2=56:         88.28 (-9.71%)  80.47 (0.00%)   80.47
length=1792,align1=56,align2=56:        77.34 (-11.24%) 68.75 (1.12%)   69.53
length=1824,align1=0,align2=0:  72.66 (7.92%)   70.31 (10.89%)  78.91
length=1824,align1=57,align2=0:         85.94 (5.17%)   82.03 (9.48%)   90.62
length=1824,align1=0,align2=57:         82.03 (3.67%)   82.81 (2.75%)   85.16
length=1824,align1=57,align2=57:        70.31 (-1.12%)  70.31 (-1.12%)  69.53
length=1856,align1=0,align2=0:  70.31 (-1.12%)  70.31 (-1.12%)  69.53
length=1856,align1=58,align2=0:         83.59 (-0.94%)  82.03 (0.94%)   82.81
length=1856,align1=0,align2=58:         178.12 (-115.09%)       82.81 (0.00%)   82.81
length=1856,align1=58,align2=58:        70.31 (-1.12%)  70.31 (-1.12%)  69.53
length=1888,align1=0,align2=0:  73.44 (-1.08%)  78.91 (-8.60%)  72.66
length=1888,align1=59,align2=0:         85.94 (0.00%)   89.84 (-4.55%)  85.94
length=1888,align1=0,align2=59:         84.38 (0.00%)   89.06 (-5.56%)  84.38
length=1888,align1=59,align2=59:        72.66 (-1.09%)  78.12 (-8.70%)  71.88
length=1920,align1=0,align2=0:  72.66 (-1.09%)  78.12 (-8.70%)  71.88
length=1920,align1=60,align2=0:         85.94 (0.00%)   89.84 (-4.55%)  85.94
length=1920,align1=0,align2=60:         85.16 (0.00%)   89.06 (-4.59%)  85.16
length=1920,align1=60,align2=60:        72.66 (-1.09%)  78.91 (-9.78%)  71.88
length=1952,align1=0,align2=0:  75.00 (-1.05%)  75.00 (-1.05%)  74.22
length=1952,align1=61,align2=0:         88.28 (0.00%)   87.50 (0.88%)   88.28
length=1952,align1=0,align2=61:         87.50 (0.00%)   88.28 (-0.89%)  87.50
length=1952,align1=61,align2=61:        74.22 (0.00%)   74.22 (0.00%)   74.22
length=1984,align1=0,align2=0:  75.00 (-1.05%)  73.44 (1.05%)   74.22
length=1984,align1=62,align2=0:         89.06 (-0.89%)  87.50 (0.88%)   88.28
length=1984,align1=0,align2=62:         87.50 (0.00%)   88.28 (-0.89%)  87.50
length=1984,align1=62,align2=62:        74.22 (0.00%)   74.22 (0.00%)   74.22
length=2016,align1=0,align2=0:  77.34 (-1.02%)  76.56 (0.00%)   76.56
length=2016,align1=63,align2=0:         91.41 (-0.86%)  90.62 (0.00%)   90.62
length=2016,align1=0,align2=63:         89.84 (0.00%)   90.62 (-0.87%)  89.84
length=2016,align1=63,align2=63:        77.34 (-1.02%)  76.56 (0.00%)   76.56
length=4096,align1=0,align2=0:  141.41 (-0.56%) 146.88 (-4.44%) 140.62

Function: memcpy
__memcpy_thunderx       __memcpy_falkor __memcpy_generic
Variant: large
================================================================================
length=65543,align1=0,align2=0:         4018.75 (3.09%) 2634.38 (36.47%)        4146.88
length=65551,align1=0,align2=3:         4425.00 (-6.47%)        3134.38 (24.59%)        4156.25
length=65567,align1=3,align2=0:         2909.38 (29.95%)        3134.38 (24.53%)        4153.12
length=65599,align1=3,align2=5:         4415.62 (-6.16%)        3134.38 (24.64%)        4159.38
length=131079,align1=0,align2=0:        5765.62 (30.38%)        5240.62 (36.72%)        8281.25
length=131087,align1=0,align2=3:        8831.25 (-6.56%)        6271.88 (24.32%)        8287.50
length=131103,align1=3,align2=0:        5793.75 (29.05%)        6268.75 (23.23%)        8165.62
length=131135,align1=3,align2=5:        5806.25 (29.97%)        6259.38 (24.50%)        8290.62
length=262151,align1=0,align2=0:        11850.00 (28.91%)       10762.50 (35.43%)       16668.80
length=262159,align1=0,align2=3:        12043.80 (27.72%)       12700.00 (23.78%)       16662.50
length=262175,align1=3,align2=0:        12046.90 (27.90%)       12687.50 (24.07%)       16709.40
length=262207,align1=3,align2=5:        11984.40 (28.08%)       12678.10 (23.91%)       16662.50
length=524295,align1=0,align2=0:        24825.00 (25.00%)       24268.80 (27.34%)       33400.00
length=524303,align1=0,align2=3:        35731.20 (-6.53%)       25678.10 (23.44%)       33540.60
length=524319,align1=3,align2=0:        25893.80 (22.71%)       25725.00 (23.22%)       33503.10
length=524351,align1=3,align2=5:        25887.50 (22.86%)       25690.60 (23.45%)       33559.40
length=1048583,align1=0,align2=0:       50621.90 (0.30%)        50600.00 (0.34%)        50771.90
length=1048591,align1=0,align2=3:       53206.20 (0.54%)        51081.20 (4.51%)        53493.80
length=1048607,align1=3,align2=0:       53221.90 (0.32%)        51975.00 (2.66%)        53393.80
length=1048639,align1=3,align2=5:       53240.60 (0.36%)        51953.10 (2.77%)        53431.20
length=2097159,align1=0,align2=0:       103744.00 (-2.00%)      102447.00 (-1.00%)      102425.00
length=2097167,align1=0,align2=3:       108588.00 (-1.00%)      105159.00 (2.00%)       107606.00
length=2097183,align1=3,align2=0:       107678.00 (0.00%)       105250.00 (2.00%)       108125.00
length=2097215,align1=3,align2=5:       107906.00 (1.00%)       105841.00 (3.00%)       109475.00
length=4194311,align1=0,align2=0:       202994.00 (0.00%)       202500.00 (1.00%)       204809.00
length=4194319,align1=0,align2=3:       213350.00 (0.00%)       205997.00 (3.00%)       213384.00
length=4194335,align1=3,align2=0:       212653.00 (0.00%)       206444.00 (3.00%)       212900.00
length=4194367,align1=3,align2=5:       213044.00 (0.00%)       206084.00 (3.00%)       213847.00
length=8388615,align1=0,align2=0:       401294.00 (0.00%)       401231.00 (0.00%)       401944.00
length=8388623,align1=0,align2=3:       480872.00 (-14.00%)     406444.00 (3.00%)       422900.00
length=8388639,align1=3,align2=0:       422147.00 (0.00%)       407750.00 (3.00%)       422803.00
length=8388671,align1=3,align2=5:       442003.00 (-5.00%)      407125.00 (3.00%)       423509.00
length=16777223,align1=0,align2=0:      799809.00 (0.00%)       800000.00 (0.00%)       801756.00
length=16777231,align1=0,align2=3:      841184.00 (0.00%)       808525.00 (4.00%)       843775.00
length=16777247,align1=3,align2=0:      841166.00 (0.00%)       810147.00 (3.00%)       843147.00
length=16777279,align1=3,align2=5:      972569.00 (-16.00%)     808588.00 (4.00%)       843731.00
length=33554439,align1=0,align2=0:      1842240.00 (-0.01%)     1863590.00 (-1.17%)     1841990.00
length=33554447,align1=0,align2=3:      2103470.00 (-2.74%)     1919460.00 (6.25%)      2047440.00
length=33554463,align1=3,align2=0:      2075690.00 (-1.07%)     1930040.00 (6.02%)      2053720.00
length=33554495,align1=3,align2=5:      2110590.00 (-2.82%)     1924440.00 (6.25%)      2052650.00

Function: memcpy
__memcpy_thunderx       __memcpy_falkor __memcpy_generic
Variant: random
================================================================================
max-size=4096:  44061.90 (5.85%)        38568.20 (17.59%)       46799.90
max-size=8192:  42790.90 (5.27%)        38158.90 (15.52%)       45171.50
max-size=16384:         44912.10 (2.25%)        38710.40 (15.75%)       45945.00
max-size=32768:         43577.90 (1.23%)        37975.10 (13.93%)       44120.00
max-size=65536:         44375.50 (1.04%)        38474.20 (14.20%)       44840.60

	* manual/tunables.texi (Tunable glibc.tune.cpu): Add falkor.
	* sysdeps/aarch64/multiarch/Makefile (sysdep_routines): Add
	memcpy_falkor.
	* sysdeps/aarch64/multiarch/ifunc-impl-list.c (MAX_IFUNC):
	Bump.
	(__libc_ifunc_impl_list): Add __memcpy_falkor.
	* sysdeps/aarch64/multiarch/memcpy.c: Likewise.
	* sysdeps/aarch64/multiarch/memcpy_falkor.S: New file.
	* sysdeps/unix/sysv/linux/aarch64/cpu-features.c (cpu_list):
	Add falkor.
	* sysdeps/unix/sysv/linux/aarch64/cpu-features.h (IS_FALKOR):
	New macro.
2017-08-09 06:32:17 +05:30
Joseph Myers f17a42333f Do not use __ptr_t.
sys/cdefs.h has a macro __ptr_t, which a few places in glibc use
instead of void *.  void * is a well-understood standard type for that
purpose and in a post-C89 context there is no need for a macro for it;
this patch changes those places to use void * directly instead.

Unlike __long_double_t, __ptr_t is widely used outside glibc (or at
least has many hits on codesearch.debian.net).  I don't know how many
of those uses would break if sys/cdefs.h ceased to define the macro,
but there's enough risk that this patch leaves the definition and just
removes the uses within glibc; removal of the definition can be
considered separately if desired.

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

	* malloc/mcheck.c (old_free_hook): Use void * instead of __ptr_t.
	(old_malloc_hook): Likewise.
	(old_memalign_hook): Likewise.
	(old_realloc_hook): Likewise.
	(struct hdr): Likewise.
	(flood): Likewise.
	(freehook): Likewise.
	(mallochook): Likewise.
	(memalignhook): Likewise.
	(reallochook): Likewise.
	(mprobe): Likewise.
	* malloc/mtrace.c (mallwatch): Likewise.
	(tr_old_free_hook): Likewise.
	(tr_old_malloc_hook): Likewise.
	(tr_old_realloc_hook): Likewise.
	(tr_old_memalign_hook): Likewise.
	(tr_where): Likewise.
	(lock_and_info): Likewise.
	(tr_freehook): Likewise.
	(tr_mallochook): Likewise.
	(tr_reallochook): Likewise.
	(tr_memalignhook): Likewise.
	* misc/err.h [!__GNUC_VA_LIST] (__gnuc_va_list): Likewise.
	* misc/mmap.c (__mmap): Likewise.
	* misc/mmap64.c (__mmap64): Likewise.
	* misc/mprotect.c (__mprotect): Likewise.
	* misc/msync.c (msync): Likewise.
	* misc/munmap.c (__munmap): Likewise.
	* posix/posix_madvise.c (posix_madvise): Likewise.
	* socket/send.c (__send): Likewise.
	* socket/sendto.c (__sendto): Likewise.
	* socket/setsockopt.c (__setsockopt): Likewise.
	* string/memcmp.c (__ptr_t): Remove macro.
	(MEMCMP): Use void * instead of ptr_t.
	* string/memrchr.c (__ptr_t): Remove macro.
	(__memrchr): Use void * instead of ptr_t.
	* sysdeps/mach/hurd/dl-sysdep.c (__mmap): Likewise.
	* sysdeps/mach/hurd/mmap.c (__mmap): Likewise.
	* sysdeps/mach/hurd/mmap64.c (__mmap64): Likewise.
	* sysdeps/mach/mprotect.c (__mprotect): Likewise.
	* sysdeps/mach/msync.c (msync): Likewise.
	* sysdeps/mach/munmap.c (__munmap): Likewise.
	* sysdeps/mips/bits/setjmp.h (struct __jmp_buf_internal_tag):
	Likewise.
	* sysdeps/posix/getcwd.c (__getcwd): Likewise.
	* sysdeps/powerpc/powerpc32/memset.S (memset): Likewise.
	* sysdeps/powerpc/powerpc32/power4/memcpy.S (memcpy): Likewise.
	* sysdeps/powerpc/powerpc32/power4/memset.S (memset): Likewise.
	* sysdeps/powerpc/powerpc32/power6/memcpy.S (memcpy): Likewise.
	* sysdeps/powerpc/powerpc32/power6/memset.S (memset): Likewise.
	* sysdeps/powerpc/powerpc32/power7/memcpy.S (memcpy): Likewise.
	* sysdeps/powerpc/powerpc32/power7/mempcpy.S (__mempcpy):
	Likewise.
	* sysdeps/powerpc/powerpc32/power7/memset.S (memset): Likewise.
	* sysdeps/powerpc/powerpc64/memcpy.S (memcpy): Likewise.
	* sysdeps/powerpc/powerpc64/memset.S (memset): Likewise.
	* sysdeps/powerpc/powerpc64/power4/memcpy.S (memcpy): Likewise.
	* sysdeps/powerpc/powerpc64/power4/memset.S (memset): Likewise.
	* sysdeps/powerpc/powerpc64/power6/memcpy.S (memcpy): Likewise.
	* sysdeps/powerpc/powerpc64/power6/memset.S (memset): Likewise.
	* sysdeps/powerpc/powerpc64/power7/memcpy.S (memcpy): Likewise.
	* sysdeps/powerpc/powerpc64/power7/mempcpy.S (__mempcpy):
	Likewise.
	* sysdeps/powerpc/powerpc64/power7/memset.S (memset): Likewise.
	* sysdeps/powerpc/powerpc64/power8/memset.S (memset): Likewise.
	* sysdeps/tile/memcmp.c (__ptr_t): Remove macro.
	(MEMCMP): Use void * instead of ptr_t.
	* sysdeps/unix/sysv/linux/alpha/oldglob.c (old_glob_t): Likewise.
	* sysdeps/unix/sysv/linux/mmap.c (__mmap): Likewise.
2017-08-08 17:14:49 +00:00
H.J. Lu 086df229ee i386: Add <startup.h> [BZ #21913]
On Linux/i386, there are 3 ways to make a system call:

1. call *%gs:SYSINFO_OFFSET.  This requires TLS initialization.
2. call *_dl_sysinfo.  This requires relocation of _dl_sysinfo.
3. int $0x80.  This is slower than #2 and #3, but works everywhere.

When an object file is compiled with PIC, #1 is prefered since it is
faster than #3 and doesn't require relocation of _dl_sysinfo.  For
dynamic executables, ld.so initializes TLS.  However, for static
executables, before TLS is initialized by __libc_setup_tls, #3 should
be used for system calls.

This patch adds <startup.h> which defines _startup_fatal and defaults
it to __libc_fatal.  It replaces __libc_fatal with _startup_fatal in
static executables where it is called before __libc_setup_tls is called.
This header file is included in all files containing functions which are
called before __libc_setup_tls is called.  On Linux/i386, when PIE is
enabled by default, _startup_fatal is turned into ABORT_INSTRUCTION and
I386_USE_SYSENTER is defined to 0 so that "int $0x80" is used for system
calls before __libc_setup_tls is called.

Tested on i686 and x86-64.  Without this patch, all statically-linked
tests will fail on i686 when the compiler defaults to -fPIE.

	[BZ #21913]
	* csu/libc-tls.c: Include <startup.h> first.
	(__libc_setup_tls): Call _startup_fatal instead of __libc_fatal.
	* elf/dl-tunables.c: Include <startup.h> first.
	* include/libc-symbols.h (BUILD_PIE_DEFAULT): New.
	* sysdeps/generic/startup.h: New file.
	* sysdeps/unix/sysv/linux/i386/startup.h: Likewise.
	* sysdeps/unix/sysv/linux/i386/brk.c [BUILD_PIE_DEFAULT != 0]
	(I386_USE_SYSENTER): New.  Defined to 0.
2017-08-08 08:43:15 -07:00
Adhemerval Zanella 852d631207 posix: Set p{read,write}v2 to return ENOTSUP (BZ#21780)
Different than other architectures hppa-linux-gnu define different values
for ENOTSUP and EOPNOTSUPP, where the later is a Linux specific one.
This leads to tst-preadwritev{64}v2 tests failures:

$ ./testrun.sh misc/tst-preadvwritev2
error: tst-preadvwritev2-common.c:35: preadv2 failure did not set errno to ENOTSUP (223)
error: 1 test failures

The straightforward fix is to return the POSIX defined ENOTSUP on all
p{read,write}v{64}v2 implementations instead of Linux specific one.

Checked on x86_64-linux-gnu and the tst-preadwritev{64}v2 on
hppa-linux-gnu (although due the installed kernel on my testing system
the pwritev{64}v2 with an invalid flag still fails due a known kernel
issue [1]).

	[BZ #21780]
	* sysdeps/posix/preadv2.c (preadv2): Use ENOTSUP instead of
	EOPNOTSUPP.
	* sysdeps/posix/preadv64v2.c (preadv64v2): Likewise.
	* sysdeps/posix/pwritev2.c (pwritev2): Likewise.
	* sysdeps/posix/pwritev64v2.c (pwritev64v2): Likewise.
	* sysdeps/unix/sysv/linux/preadv2.c (preadv2): Likewise.
	* sysdeps/unix/sysv/linux/preadv64v2.c (preadv64v2): Likewise.
	* sysdeps/unix/sysv/linux/pwritev2.c (pwritev2): Likewise.
	* sysdeps/unix/sysv/linux/pwritev64v2.c (pwritev64v2): Likewise.

[1] https://sourceware.org/ml/libc-alpha/2017-06/msg00726.html
2017-08-08 09:59:46 -03:00
Joseph Myers cd65836b5f Fix XPG4.2 bits/sigaction.h namespace (bug 21899).
For XPG4.2, sa_sigaction, SA_ONSTACK, SA_RESETHAND, SA_RESTART and
SA_NODEFER should be defined in signal.h, but they are only defined
for other standards at present.

This patch fixes the various bits/sigaction.h headers accordingly.
All the fixes are essentially the same, except those for SPARC and
Tile.

For SPARC, the header (a) spuriously defined various nonstandard
macros for __USE_UNIX98 || defined __USE_XOPEN2K8 and (b) defined some
standard macros as aliases of nonstandard ones instead of the other
way round.  This patch fixes the SPARC header to handle these macros
the same way and with the same conditions as those for other
architectures, so the standard macros are the primary ones and the
other ones are defined only for __USE_MISC and are aliases of the
standard ones where applicable.

For Tile, the header spuriously defined the nonstandard macro
SA_NOPTRACE for __USE_UNIX98 || defined __USE_XOPEN2K8; this is moved
to __USE_MISC.

(Those nonstandard macros are in a reserved namespace, but it seems
desirable to be consistent between architectures as far as possible,
and so not define them in standard modes anywhere.)

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

	[BZ #21899]
	* bits/sigaction.h (struct sigaction): Define sa_handler and
	sa_sigaction using union also for [__USE_XOPEN_EXTENDED].
	(SA_ONSTACK): Change [__USE_UNIX98] condition to
	[__USE_XOPEN_EXTENDED].
	(SA_RESTART): Likewise.
	(SA_NODEFER): Likewise.
	(SA_RESETHAND): Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/sigaction.h
	(struct sigaction): Define sa_handler and sa_sigaction using union
	also for [__USE_XOPEN_EXTENDED].
	(SA_ONSTACK): Change [__USE_UNIX98] condition to
	[__USE_XOPEN_EXTENDED].
	(SA_RESTART): Likewise.
	(SA_NODEFER): Likewise.
	(SA_RESETHAND): Likewise.
	* sysdeps/unix/sysv/linux/bits/sigaction.h
	(struct sigaction): Define sa_handler and sa_sigaction using union
	also for [__USE_XOPEN_EXTENDED].
	(SA_ONSTACK): Change [__USE_UNIX98] condition to
	[__USE_XOPEN_EXTENDED].
	(SA_RESTART): Likewise.
	(SA_NODEFER): Likewise.
	(SA_RESETHAND): Likewise.
	* sysdeps/unix/sysv/linux/hppa/bits/sigaction.h
	(struct sigaction): Define sa_handler and sa_sigaction using union
	also for [__USE_XOPEN_EXTENDED].
	(SA_ONSTACK): Change [__USE_UNIX98] condition to
	[__USE_XOPEN_EXTENDED].
	(SA_RESTART): Likewise.
	(SA_NODEFER): Likewise.
	(SA_RESETHAND): Likewise.
	* sysdeps/unix/sysv/linux/ia64/bits/sigaction.h
	(struct sigaction): Define sa_handler and sa_sigaction using union
	also for [__USE_XOPEN_EXTENDED].
	(SA_ONSTACK): Change [__USE_UNIX98] condition to
	[__USE_XOPEN_EXTENDED].
	(SA_RESTART): Likewise.
	(SA_NODEFER): Likewise.
	(SA_RESETHAND): Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/sigaction.h
	(struct sigaction): Define sa_handler and sa_sigaction using union
	also for [__USE_XOPEN_EXTENDED].
	(SA_ONSTACK): Change [__USE_UNIX98] condition to
	[__USE_XOPEN_EXTENDED].
	(SA_RESTART): Likewise.
	(SA_NODEFER): Likewise.
	(SA_RESETHAND): Likewise.
	* sysdeps/unix/sysv/linux/s390/bits/sigaction.h
	(struct sigaction): Define sa_handler and sa_sigaction using union
	also for [__USE_XOPEN_EXTENDED].
	(SA_ONSTACK): Change [__USE_UNIX98] condition to
	[__USE_XOPEN_EXTENDED].
	(SA_RESTART): Likewise.
	(SA_NODEFER): Likewise.
	(SA_RESETHAND): Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/sigaction.h
	(struct sigaction): Define sa_handler and sa_sigaction using union
	also for [__USE_XOPEN_EXTENDED].
	(SA_ONSTACK): Change [__USE_UNIX98] condition to
	[__USE_XOPEN_EXTENDED].
	(SA_RESTART): Likewise.
	(SA_NODEFER): Likewise.  Define directly rather than as alias.
	(SA_RESETHAND): Likewise.
	(SA_INTERRUPT): Define only for [__USE_MISC].
	(SA_NOMASK): Define as alias of SA_NODEFER, only for [__USE_MISC].
	(SA_ONESHOT): Define as alias of SA_RESETHAND, only for
	[__USE_MISC].
	(SA_STACK): Define only for [__USE_MISC].
	* sysdeps/unix/sysv/linux/tile/bits/sigaction.h
	(struct sigaction): Define sa_handler and sa_sigaction using union
	also for [__USE_XOPEN_EXTENDED].
	(SA_ONSTACK): Change [__USE_UNIX98] condition to
	[__USE_XOPEN_EXTENDED].
	(SA_RESTART): Likewise.
	(SA_NODEFER): Likewise.
	(SA_RESETHAND): Likewise.
	(SA_NOPTRACE): Define only for [__USE_MISC].
2017-08-07 23:41:32 +00:00
Joseph Myers d9fee042e2 Consistently use uintN_t not u_intN_t everywhere.
This patch changes the remaining uses of the old nonstandard u_intN_t
types in glibc to use the C99 uintN_t instead, except for the
definitions of those typedefs and the tests of them in the c++-types
test.  This follows the previous such fix for libm, and being
consistent in using uintN_t makes sense as a global cleanup.

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

	* catgets/catgets.c (catgets): Use uintN_t instead of u_intN_t.
	* catgets/catgetsinfo.h (struct catalog_obj): Likewise.
	(struct catalog_info): Likewise.
	* inet/htontest.c (lo): Likewise.
	(foo): Likewise.
	* inet/inet_lnaof.c (inet_lnaof): Likewise.
	* inet/inet_net.c (inet_network): Likewise.
	* inet/inet_netof.c (inet_netof): Likewise.
	* inet/rcmd.c (__ivaliduser): Likewise.
	(iruserok): Likewise.
	* locale/loadlocale.c (_nl_intern_locale_data): Likewise.
	* locale/programs/locale-spec.c (locale_special): Likewise.
	* nis/nis_findserv.c (struct findserv_req): Likewise.
	(__nis_findfastest_with_timeout): Likewise.
	* nss/test-netdb.c (test_network): Likewise.
	* resolv/inet_neta.c (inet_neta): Likewise.
	* resolv/ns_date.c (ns_datetosecs): Likewise.
	(SECS_PER_DAY): Likewise.
	* resolv/nss_dns/dns-network.c (_nss_dns_getnetbyaddr_r):
	Likewise.
	* resolv/res_comp.c (__putlong): Likewise.
	(__putshort): Likewise.
	(_getlong): Likewise.
	(_getshort): Likewise.
	* resolv/res_debug.c (p_time): Likewise.
	(precsize_ntoa): Likewise.
	(precsize_aton): Likewise.
	(latlon2ul): Likewise.
	(loc_aton): Likewise.
	(loc_ntoa): Likewise.
	* resolv/res_hconf.c (struct netaddr): Likewise.
	(_res_hconf_reorder_addrs): Likewise.
	* sunrpc/clnt_tcp.c (clnttcp_call): Likewise.
	(clnttcp_control): Likewise.
	* sunrpc/clnt_udp.c (clntudp_call): Likewise.
	(clntudp_control): Likewise.
	* sunrpc/clnt_unix.c (clntunix_call): Likewise.
	(clntunix_control): Likewise.
	* sunrpc/pmap_rmt.c (clnt_broadcast): Likewise.
	* sunrpc/rpc/auth.h (union des_block): Likewise.
	* sunrpc/tst-udp-nonblocking.c (do_test): Likewise.
	* sunrpc/xdr_rec.c (struct rec_strm): Likewise.
	(xdrrec_create): Likewise.
	(xdrrec_endofrecord): Likewise.
	(flush_out): Likewise.
	* sunrpc/xdr_stdio.c (xdrstdio_getlong): Likewise.
	(xdrstdio_putlong): Likewise.
	* sysdeps/unix/sysv/linux/errqueue.h (struct sock_extended_err):
	Likewise.
2017-08-07 19:55:34 +00:00
H.J. Lu 627c69c838 i386: Update I386_USE_SYSENTER for early PIC syscall
Define I386_USE_SYSENTER to 0 or 1 so that special versions of syscalls
with "int $0x80" can be provided for static PIE during self relocation.
Also check PIC instead SHARED for PIC version of syscall macros.

	* sysdeps/unix/sysv/linux/i386/sysdep.h (I386_USE_SYSENTER):
	Define to I386_USE_SYSENTER to 0 or 1 if not defined.
	(ENTER_KERNEL): Check if I386_USE_SYSENTER is 1 and check PIC.
	(INTERNAL_SYSCALL_MAIN_INLINE): Likewise.
	(INTERNAL_SYSCALL_NCS): Likewise.
	(LOADARGS_1): Likewise.
	(LOADARGS_5): Likewise.
	(RESTOREARGS_1): Likewise.
	(RESTOREARGS_5): Likewise.
2017-08-04 12:30:38 -07:00
Nathan Rossi d95fcb2df4 microblaze: Resolve non-relocatable branch in pt-vfork.S (BZ#21779)
The relative branch directly to __libc_vfork results in an relocation
that cannot be resolved. Specifically a R_MICROBLAZE_64_PCREL relocation
is created for this branch, however for MicroBlaze R_MICROBLAZE_64_PCREL
type relocations symbols are not resolved. Additionally due to the
branch being located in the .text section the instruction cannot be
rewritten as the section is not writable, and causes a segfault at
runtime when loading libpthread.

To resolve this issue, ensure the branch is done using PLT. This removes
the need to modify the instruction and trades the R_MICROBLAZE_64_PCREL
for a more common R_MICROBLAZE_JUMP via the PLT.

	[BZ #21779]
	* sysdeps/unix/sysv/linux/microblaze/pt-vfork.S: Branch using PLT.
2017-07-28 09:21:14 -03:00
Adhemerval Zanella 95a7339258 tunables: Use direct syscall for access (BZ#21744)
The function maybe_enable_malloc_check, which is called by
__tunables_init, calls __access_noerrno.  It isn't problem when
symbol is is in ld.so, which has a special version of __access_noerrno
without stack protector.  But when glibc is built with stack protector,
maybe_enable_malloc_check in libc.a can't call the regular version of
__access_noerrno with stack protector.

This patch changes how Linux defines the __access_noerrno to be an
inline call instead and thus preventing defining different build
rules for ld/static and shared.

	H.J. Lu  <hongjiu.lu@intel.com>
	Adhemerval Zanella  <adhemerval.zanella@linaro.org>

	[BZ #21744]
	* elf/dl-tunables.c: Include not-errno.h header.
	* include/unistd.h (__access_noerrno): Remove definition.
	* sysdeps/unix/sysv/linux/access.c (__access_noerrno): Likewise.
	* sysdeps/generic/not-errno.h: New file.
	* sysdeps/unix/sysv/linux/not-errno.h: Likewise.
2017-07-24 11:21:07 -03:00
Dmitry V. Levin cab91f947a S390: fix sys/ptrace.h to make it includible again after asm/ptrace.h
sys/ptrace.h on S390 used to be includible both before and after
asm/ptrace.h, until commit b08a6a0dea
among other changes introduced PTRACE_SINGLEBLOCK enum constant which
is also defined in asm/ptrace.h as a macro, making sys/ptrace.h fail
to compile when included after asm/ptrace.h.

* sysdeps/unix/sysv/linux/s390/sys/ptrace.h [_LINUX_PTRACE_H ||
_S390_PTRACE_H]: Undefine all PTRACE_* macro constants defined
later as enum constants, except PTRACE_PEEKUSER, PTRACE_POKEUSER,
and PTRACE_SEIZE_DEVEL that are not defined by Linux headers.
2017-07-23 23:22:53 +00:00
Adhemerval Zanella d500130f31 alpha: Fix clone exit syscall argument passing (BZ#21512)
This patch fixes the argument passing for exit syscall after
the clone function returns on hppa.  This fixes misc/tst-clone2
on alpha-linux-gnu.

Checked misc/tst-clone2 on alpha-linux-gnu.

	[BZ #21512]
	* sysdeps/unix/sysv/linux/alpha/clone.S (__clone): Fix argument
	passing to syscall exit.
2017-07-19 14:24:43 -03:00
Szabolcs Nagy 82e0660050 [AArch64] Update dl-procinfo for new HWCAP flags in Linux 4.12
Follow up to commit 512d245bc3.

	* sysdeps/unix/sysv/linux/aarch64/dl-procinfo.c:
	(_dl_aarch64_cap_flags): Update.
	* sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h
	(_DL_HWCAP_COUNT, _DL_HWCAP_LAST): Update.
2017-07-19 13:50:23 +01:00
Szabolcs Nagy 00d7a37773 [AArch64] Fix out of bound array access regression
Partially revert ea01a4da21
"aarch64: Add hwcap string routines" because _dl_procinfo cannot
be future proof and avoid oob access in _dl_hwcap_string.
2017-07-18 10:34:20 +01:00
Tulio Magno Quites Machado Filho 91ac3a7d84 powerpc: Fix float128 IFUNC relocations [BZ #21707]
The patch proposed by Peter Bergner [1] to libgcc in order to fix
[BZ #21707] adds a dependency on a symbol provided by the loader,
forcing the loader to be linked to tests after libgcc was linked.

It also requires to read the thread pointer during IRELA relocations.

Tested on powerpc, powerpc64, powerpc64le, s390x and x86_64.

[1] https://sourceware.org/ml/libc-alpha/2017-06/msg01383.html

	[BZ #21707]
	* csu/libc-start.c (LIBC_START_MAIN): Perform IREL{,A}
	relocations before or after initializing the TCB on statically
	linked executables.  That's a per-architecture definition.
	* elf/rtld.c (dl_main): Add a comment about thread-local
	variables initialization.
	* sysdeps/generic/libc-start.h: New file.  Define
	ARCH_APPLY_IREL and ARCH_SETUP_IREL.
	* sysdeps/powerpc/Makefile:
	[$(subdir) = elf && $(multi-arch) != no] (tests-static-internal): Add tst-tlsifunc-static.
	[$(subdir) = elf && $(multi-arch) != no && $(build-shared) == yes]
	(tests-internal): Add tst-tlsifunc.
	* sysdeps/powerpc/tst-tlsifunc.c: New file.
	* sysdeps/powerpc/tst-tlsifunc-static.c: Likewise.
	* sysdeps/powerpc/powerpc64le/Makefile (f128-loader-link): New
	variable.
	[$(subdir) = math] (test-float128% test-ifloat128%): Force
	linking to the loader after linking to libgcc.
	[$(subdir) = wcsmbs || $(subdir) = stdlib] (bug-strtod bug-strtod2)
	(bug-strtod2 tst-strtod-round tst-wcstod-round tst-strtod6 tst-strrom)
	(tst-strfrom-locale strfrom-skeleton): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/libc-start.h: New file.  Define
	ARCH_APPLY_IREL and ARCH_SETUP_IREL.
2017-07-17 17:49:26 -03:00
Adhemerval Zanella 48145e1c7d hppa: Fix clone exit syscall argument passing (BZ#21512)
This patch fixes the argument passing for exit syscall after
the clone function returns on hppa.  This fixes misc/tst-clone2
on hppa-linux-gnu.

Checked misc/tst-clone2 on hppa-linux-gnu.

	[BZ #21512]
	* sysdeps/unix/sysv/linux/hppa/clone.S (__clone): Fix argument
	passing to syscall exit.
2017-07-17 14:25:40 -03:00
Szabolcs Nagy 512d245bc3 Add HWCAP_ macros from Linux 4.12 to AArch64 bits/hwcap.h.
This patch adds the HWCAP_JSCVT, HWCAP_FCMA and HWCAP_LRCPC macros
from Linux 4.12 to the AArch64 bits/hwcap.h.

	* sysdeps/unix/sysv/linux/aarch64/bits/hwcap.h (HWCAP_FCMA): New macro.
	(HWCAP_JSCVT, HWCAP_LRCPC): Likewise.
2017-07-17 09:24:08 +01:00
John David Anglin ce1917d0bf Add CFI annotation. 2017-07-16 12:46:50 -04:00
John David Anglin cc407f4e81 Fix stack offset for r19 load in __getcontext. 2017-07-16 12:24:30 -04:00
John David Anglin 07f94b7a96 Fix __setcontext return value on hppa. 2017-07-16 12:13:14 -04:00
John David Anglin d71400dca6 Fix syscall cancellation on hppa. 2017-07-16 11:58:01 -04:00
John David Anglin a363f70336 Remove _exit entry from sysdeps/unix/sysv/linux/hppa/localplt.data. 2017-07-16 11:28:02 -04:00
John David Anglin 32d9b0e7a6 Fix [BZ locale/19838]. 2017-07-15 12:54:14 -04:00
Adhemerval Zanella 94070f86c0 posix: Add p{read,write}v2 RWF_NOWAIT flag (BZ#21738)
Linux 4.12 (b745fafaf70c0a98a2e1e7ac8cb14542889ceb0e) adds a new
p{read,write}v2 flag RWF_NOWAIT.  This patch adds it for linux
uio-ext.h header.

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

	[BZ #21738]
	* manual/llio.texi (RWF_NOWAIT): New item.
	* misc/tst-preadvwritev2-common.c (do_test_with_invalid_flags):
	Add RWF_NOWAIT check.
	* sysdeps/unix/sysv/linux/bits/uio-ext.h (RWF_NOWAIT): New flag.
2017-07-11 11:06:44 -03:00
Stefan Liebler 2c80445787 S390: Fix tst-ptrace-singleblock if kernel does not support PTRACE_SINGLEBLOCK.
The request PTRACE_SINGLEBLOCK was introduced in Linux 3.15.  Thus the ptrace call
will fail on older kernels.
Thus the test is now testing PTRACE_SINGLEBLOCK with data argument pointing to a
buffer on stack which is assumed to fail.  If the request would be interpreted as
PTRACE_GETREGS, then the ptrace call will not fail and the regs are written to buf.

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

ChangeLog:

	* sysdeps/unix/sysv/linux/s390/tst-ptrace-singleblock.c:
	Support running on kernels without PTRACE_SINGLEBLOCK.
2017-07-11 10:38:44 +02:00
John David Anglin c5f70682a5 Use generic pthread support on hppa. 2017-07-09 15:01:11 -04:00
Florian Weimer 1ff6c67a25 sysconf: Use conservative default for _SC_NPROCESSORS_ONLN [BZ #21542] 2017-07-04 16:12:46 +02:00
Siddhesh Poyarekar 47ea614b9a Fix typo in glibc.tune.cpu name 2017-07-01 19:51:44 +05:30
Adhemerval Zanella 9b8f8593e5 Consolidate Linux fcntl implementation
This patch consolidates the fcntl Linux syscall generation on
sysdeps/unix/sysv/linux/fcntl.c.  It basically removes all the
architecture specific implementations.

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

	* sysdeps/unix/sysv/linux/arm/fcntl.c: Remove file.
	* sysdeps/unix/sysv/linux/generic/wordsize-32/fcntl.c: Likewise.
	* sysdeps/unix/sysv/linux/hppa/fcntl.c: Likewise.
	* sysdeps/unix/sysv/linux/i386/fcntl.c: Likewise.
	* sysdeps/unix/sysv/linux/m68k/fcntl.c: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/fcntl.c: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/fcntl.c: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n32/fcntl.c: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fcntl.c: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/fcntl.c: Likewise.
	* sysdeps/unix/sysv/linux/sh/fcntl.c: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/fcntl.c: Likewise.
	* sysdeps/unix/sysv/linux/fcntl.c: New file.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/fcntl.c: Refactor to
	use default implementation.
2017-06-30 15:17:26 -03:00
Siddhesh Poyarekar 28cfa3a48e tunables, aarch64: New tunable to override cpu
Add a new tunable (glibc.tune.cpu) to override CPU identification on
aarch64.  This is useful in two cases: one where it is desirable to
pretend to be another CPU for purposes of testing or because routines
written for that CPU are beneficial for specific workloads and second
where the underlying kernel does not support emulation of MRS to get
the MIDR of the CPU.

	* elf/dl-tunables.h (tunable_is_name): Move from...
	* elf/dl-tunables.c (is_name): ... here.
	(parse_tunables, __tunables_init): Adjust.
	* manual/tunables.texi: Document glibc.tune.cpu.
	* sysdeps/aarch64/dl-tunables.list: New file.
	* sysdeps/unix/sysv/linux/aarch64/cpu-features.c (struct
	cpu_list): New type.
	(cpu_list): New list of CPU names and their MIDR.
	(get_midr_from_mcpu): New function.
	(init_cpu_features): Override MIDR if necessary.
2017-06-30 22:58:39 +05:30
Joseph Myers e78dc67889 SPARC sys/ucontext.h namespace fixes (bug 21457).
This patch fixes various miscellaneous namespace issues in the SPARC
sys/ucontext.h header.  These are similar to changes made previous to
other sys/ucontext.h headers, where the SPARC header was excluded from
those previous patches because of its complexity.

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

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

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

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

	[BZ #21457]
	* sysdeps/unix/sysv/linux/m68k/sys/ucontext.h (fpregset_t): Remove
	struct tag.
	* sysdeps/unix/sysv/linux/mips/sys/ucontext.h (fpregset_t):
	Likewise.
	* sysdeps/unix/sysv/linux/nios2/sys/ucontext.h (mcontext_t):
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h (pt_regs):
	Declare struct type with __ctx.
	[__WORDSIZE != 32] (mcontext_t): Use __ctx with pt_regs struct
	tag.
	(ucontext_t) [__WORDSIZE == 32]: Use __ctx with pt_regs struct tag
	and regs field name.
2017-06-28 10:33:23 +00:00
Stefan Liebler f21f59124d S390: Add new hwcap values for new cpu architecture - arch12.
The new hwcap values indicate support for:
- Vector packed decimal facility
- Vector enhancements facility 1
- Guarded storage facility

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

ChangeLog:

	* sysdeps/s390/dl-procinfo.c (_dl_s390_cap_flags):
	Add vxd, vxe, gs flag.
	* sysdeps/s390/dl-procinfo.h: Add HWCAP_S390_VXD, HWCAP_S390_VXE,
	HWCAP_S390_GS capability.
	* sysdeps/unix/sysv/linux/s390/bits/hwcap.h
	(HWCAP_S390_VXD, HWCAP_S390_VXE, HWCAP_S390_GS): Define.
2017-06-27 17:09:42 +02:00
Joseph Myers 034e738021 Add float128 support for ia64.
This patch enables float128 support for ia64, so that all the
configurations where GCC supports _Float128 / __float128 as an
ABI-distinct type now have glibc support as well.  bits/floatn.h
declares the support to be available for GCC 4.4 and later, which is
when the libgcc support was added.  The removal of
sysdeps/ia64/fpu/k_rem_pio2.c is because the generic k_rem_pio2.c
defines a function required by the float128 code.

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

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

	* sysdeps/ia64/Implies: Add ieee754/float128.
	* sysdeps/ia64/bits/floatn.h: New file.
	* sysdeps/ia64/float128-abi.h: Likewise.
	* manual/math.texi (Mathematics): Document support for _Float128
	on ia64.
	* sysdeps/ia64/Makefile [$(subdir) = math] (CPPFLAGS): Append to
	Makefile variable.
	* sysdeps/ia64/fpu/e_sqrtf128.c: New file.
	* sysdeps/ia64/fpu/k_rem_pio2.c: Remove file.
	* sysdeps/ia64/fpu/sfp-machine.h: New file.  Based on libgcc.
	* sysdeps/ia64/math-tests.h: New file.
	* math/libm-test-support.h (XFAIL_FLOAT128_PAYLOAD): Also define
	based on TEST_COND_binary128 for [__ia64__].
	* sysdeps/unix/sysv/linux/ia64/libc.abilist: Update.
	* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise,
2017-06-26 22:50:45 +00:00
Joseph Myers 251287734e Rename struct ucontext tag (bug 21457).
The ucontext_t type has a tag struct ucontext.  As with previous such
issues for siginfo_t and stack_t, this tag is not permitted by POSIX
(is not in a reserved namespace), and so namespace conformance means
breaking C++ name mangling for this type.

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

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

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

	[BZ #21457]
	* sysdeps/arm/sys/ucontext.h (struct ucontext): Rename to struct
	ucontext_t.
	* sysdeps/generic/sys/ucontext.h (struct ucontext): Likewise.
	* sysdeps/i386/sys/ucontext.h (struct ucontext): Likewise.
	* sysdeps/m68k/sys/ucontext.h (struct ucontext): Likewise.
	* sysdeps/mips/sys/ucontext.h (struct ucontext): Likewise.
	* sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h (struct
	ucontext): Likewise.
	* sysdeps/unix/sysv/linux/alpha/sys/ucontext.h (struct ucontext):
	Likewise.
	* sysdeps/unix/sysv/linux/arm/sys/ucontext.h (struct ucontext):
	Likewise.
	* sysdeps/unix/sysv/linux/hppa/sys/ucontext.h (struct ucontext):
	Likewise.
	* sysdeps/unix/sysv/linux/ia64/sys/ucontext.h (struct ucontext):
	Likewise.
	* sysdeps/unix/sysv/linux/m68k/sys/ucontext.h (struct ucontext):
	Likewise.
	* sysdeps/unix/sysv/linux/mips/sys/ucontext.h (struct ucontext):
	Likewise.
	* sysdeps/unix/sysv/linux/nios2/sys/ucontext.h (struct ucontext):
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h (struct
	ucontext): Likewise.
	* sysdeps/unix/sysv/linux/s390/sys/ucontext.h (struct ucontext):
	Likewise.
	* sysdeps/unix/sysv/linux/sh/sys/ucontext.h (struct ucontext):
	Likewise.
	* sysdeps/unix/sysv/linux/sparc/sys/ucontext.h (struct ucontext):
	Likewise.
	* sysdeps/unix/sysv/linux/tile/sys/ucontext.h (struct ucontext):
	Likewise.
	* sysdeps/unix/sysv/linux/x86/sys/ucontext.h (struct ucontext):
	Likewise.
	* sysdeps/powerpc/powerpc32/backtrace.c (struct
	rt_signal_frame_32): Likewise.
	* sysdeps/powerpc/powerpc64/backtrace.c (struct signal_frame_64):
	Likewise.
	* sysdeps/unix/sysv/linux/aarch64/kernel_rt_sigframe.h (struct
	kernel_rt_sigframe): Likewise.
	* sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h (SIGCONTEXT):
	Likewise.
	* sysdeps/unix/sysv/linux/arm/register-dump.h (register_dump):
	Likewise.
	* sysdeps/unix/sysv/linux/arm/sigcontextinfo.h (SIGCONTEXT):
	Likewise.
	* sysdeps/unix/sysv/linux/hppa/profil-counter.h
	(__profil_counter): Likewise.
	* sysdeps/unix/sysv/linux/microblaze/sigcontextinfo.h
	(SIGCONTEXT): Likewise.
	* sysdeps/unix/sysv/linux/mips/kernel_rt_sigframe.h (struct
	kernel_rt_sigframe): Likewise.
	* sysdeps/unix/sysv/linux/nios2/kernel_rt_sigframe.h (struct
	kernel_rt_sigframe): Likewise.
	* sysdeps/unix/sysv/linux/nios2/sigcontextinfo.h (SIGCONTEXT):
	Likewise.
	* sysdeps/unix/sysv/linux/sh/makecontext.S (__makecontext):
	Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/makecontext.c
	(__start_context): Likewise.
	* sysdeps/unix/sysv/linux/tile/sigcontextinfo.h (SIGCONTEXT):
	Likewise.
	* sysdeps/unix/sysv/linux/x86_64/register-dump.h (register_dump):
	Likewise.
	* sysdeps/unix/sysv/linux/x86_64/sigcontextinfo.h (SIGCONTEXT):
	Likewise.
2017-06-26 22:03:58 +00:00
Joseph Myers c86ed71d63 Add float128 support for x86_64, x86.
This patch enables float128 support for x86_64 and x86.  All GCC
versions that can build glibc provide the required support, but since
GCC 6 and before don't provide __builtin_nanq / __builtin_nansq, sNaN
tests and some tests of NaN payloads need to be disabled with such
compilers (this does not affect the generated glibc binaries at all,
just the tests).  bits/floatn.h declares float128 support to be
available for GCC versions that provide the required libgcc support
(4.3 for x86_64, 4.4 for i386 GNU/Linux, 4.5 for i386 GNU/Hurd);
compilation-only support was present some time before then, but not
really useful without the libgcc functions.

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

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

	* sysdeps/i386/Implies: Add ieee754/float128.
	* sysdeps/x86_64/Implies: Likewise.
	* sysdeps/x86/bits/floatn.h: New file.
	* sysdeps/x86/float128-abi.h: Likewise.
	* manual/math.texi (Mathematics): Document support for _Float128
	on x86_64 and x86.
	* sysdeps/i386/fpu/fenv_private.h: Include <bits/floatn.h>.
	(math_opt_barrier): Do not put _Float128 values in floating-point
	registers.
	(math_force_eval): Likewise.
	[__x86_64__] (SET_RESTORE_ROUNDF128): New macro.
	* sysdeps/x86/fpu/Makefile [$(subdir) = math] (CPPFLAGS): Append
	to Makefile variable.
	* sysdeps/x86/fpu/e_sqrtf128.c: New file.
	* sysdeps/x86/fpu/sfp-machine.h: Likewise.  Based on libgcc.
	* sysdeps/x86/math-tests.h: New file.
	* math/libm-test-support.h (XFAIL_FLOAT128_PAYLOAD): New macro.
	* math/libm-test-getpayload.inc (getpayload_test_data): Use
	XFAIL_FLOAT128_PAYLOAD.
	* math/libm-test-setpayload.inc (setpayload_test_data): Likewise.
	* math/libm-test-totalorder.inc (totalorder_test_data): Likewise.
	* math/libm-test-totalordermag.inc (totalordermag_test_data):
	Likewise.
	* sysdeps/unix/sysv/linux/i386/libc.abilist: Update.
	* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
	* sysdeps/i386/fpu/libm-test-ulps: Likewise.
	* sysdeps/i386/i686/fpu/multiarch/libm-test-ulps: Likewise.
	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
2017-06-26 22:02:24 +00:00
Adhemerval Zanella 3f823e87cc Call exit directly in clone (BZ #21512)
On aarch64, alpha, arm, hppa, mips, nios2, powerpc, sh, sparc, tile,
and x86_64 the clone syscall jumps to _exit after the child execution
and the function ends the process execution by calling exit_group.
This behavior have a small issue where threads created with
CLONE_THREAD using clone syscall directly will eventually exit the
whole group altogether instead of just the thread created.  Also,
s390, microblaze, ia64, i386, and m68k differs by calling exit
syscall directly.

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

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

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

Fix
2017-06-26 17:52:20 -03:00
Paul E. Murphy f819dbea0a powerpc64le: Enable float128
This patch adds ULPs for the float128 type, updates the abilist for libc
and libm, and adds the files bits/floatn.h and float128-abi.h, in order to
enable the new type for powerpc64le.

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

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

	* manual/math.texi (Mathematics): Mention the enabling of float128
	for powerpc64le.
	* sysdeps/powerpc/bits/floatn.h: New file.
	* sysdeps/powerpc/fpu/libm-test-ulps: Regenerated.
	* sysdeps/powerpc/fpu/math_private.h:
	(__ieee754_sqrtf128): New inline override.
	* sysdeps/powerpc/powerpc64le/Implies-before: New file.
	* sysdeps/powerpc/powerpc64le/Makefile: New file.
	* sysdeps/powerpc/powerpc64le/fpu/e_sqrtf128.c: New file.
	* sysdeps/powerpc/powerpc64le/fpu/sfp-machine.h: New file.
	* sysdeps/powerpc/powerpc64le/power9/fpu/e_sqrtf128.c: New file.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist:
	Updated.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64le/float128-abi.h:
	New file.
2017-06-26 15:04:47 -03:00
Adhemerval Zanella fa872e1b62 Clean pthread functions namespaces for C11 threads
This patch adds internal definition (through {libc_}hidden_{proto,def}) and
also change some strong to weak alias for symbols that might be used by C11
threads implementations.

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

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

	* include/sched.h (__sched_get_priority_max): Add libc hidden proto.
	(__sched_get_prioriry_min): Likewise.
	* include/sys/mman.h (__mmap): Likewise.
	(__mmap64): Likewise.
	(__munmap): Likewise.
	(__mprotect): Likewise.
	* include/termios.h (__tcsetattr): Likewise.
	* include/time.h (__nanosleep): Use hidden_proto instead of
	libc_hidden_proto.
	* posix/nanosleep.c (__nanosleep): Likewise.
	* misc/Versions (libc): Export __mmap, __munmap, __mprotect,
	__sched_get_priority_min, and __sched_get_priority_max under
	GLIBC_PRIVATE.
	* nptl/allocatestack.c (__free_stacks): Use internal definition for
	libc symbols.
	(change_stack_perm): Likewise.
	(allocate_stack): Likewise.
	* sysdeps/posix/gethostname.c: Likewise.
	* nptl/tpp.c (__init_sched_fifo_prio): Likewise.
	* sysdeps/unix/sysv/linux/i386/smp.h (is_smp_system): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/ioctl.c (__ioctl): Likewise.
	* nptl/pthreadP.h (__pthread_mutex_timedlock): Add definition.
	(__pthread_key_delete): Likewise.
	(__pthread_detach): Likewise.
	(__pthread_cancel): Likewise.
	(__pthread_mutex_trylock): Likewise.
	(__pthread_mutexattr_init): Likewise.
	(__pthread_mutexattr_settype): Likewise.
	* nptl/pthread_cancel.c (pthread_cancel): Change to internal name and
	create alias for exported one.
	* nptl/pthread_join.c (pthread_join): Likewise.
	* nptl/pthread_detach.c (pthread_detach): Likewise.
	* nptl/pthread_key_delete.c (pthread_key_delete): Likewise.
	* nptl/pthread_mutex_timedlock.c (pthread_mutex_timedlock): Likewise.
	* nptl/pthread_create.c: Change static requirements for pthread
	symbols.
	* nptl/pthread_equal.c (__pthread_equal): Change strong alias to weak
	for internal definition.
	* nptl/pthread_exit.c (__pthread_exit): Likewise.
	* nptl/pthread_getspecific.c (__pthread_getspecific): Likewise.
	* nptl/pthread_key_create.c (__pthread_key_create): Likewise.
	* nptl/pthread_mutex_destroy.c (__pthread_mutex_destroy): Likewise.
	* nptl/pthread_mutex_init.c (__pthread_mutex_init): Likewise.
	* nptl/pthread_mutex_lock.c (__pthread_mutex_lock): Likewise.
	* nptl/pthread_mutex_trylock.c (__pthread_mutex_trylock): Likewise.
	* nptl/pthread_mutex_unlock.c (__pthread_mutex_unlock): Likewise.
	* nptl/pthread_mutexattr_init.c (__pthread_mutexattr_init): Likwise.
	* nptl/pthread_mutexattr_settype.c (__pthread_mutexattr_settype):
	Likewise.
	* nptl/pthread_self.c (__pthread_self): Likewise.
	* nptl/pthread_setspecific.c (__pthread_setspecific): Likewise.
	* sysdeps/unix/sysv/linux/tcsetattr.c (tcsetattr): Likewise.
	* misc/mmap.c (__mmap): Add internal symbol definition.
	* misc/mmap.c (__mmap64): Likewise.
	* sysdeps/unix/sysv/linux/mmap.c (__mmap): Likewise.
	* sysdeps/unix/sysv/linux/mmap64.c (__mmap): Likewise.
	(__mmap64): Likewise.
	* sysdeps/unix/sysv/linux/i386/Versions (libc) [GLIBC_PRIVATE):
	Add __uname.
2017-06-23 17:38:17 -03:00
Paul Clarke 1301c20f6c powerpc: fix sysconf support for cache geometries
Commit cdfbe5037f added sysconf support
for cache geometries on powerpc, but mishandled errno.  For valid input
parameters, sysconf() should not set errno.

	* sysdeps/unix/sysv/linux/powerpc/sysconf.c: Remove references
	to errno, and simplify remaining related code.
2017-06-23 09:10:32 -03:00
Joseph Myers 9649350d2e Fix tile SA_* conditions for POSIX.1:2008 (bug 21622).
As shown by conform/ tests once the remaining namespace issues are
fixed, the tile bits/sigaction.h fails to declare SA_RESETHAND,
SA_RESTART and SA_NODEFER for non-XSI POSIX.1:2008 as other versions
do.  Those constants were moved from XSI to Base in the 2008 edition
of POSIX.  This patch fixes the conditions to match other versions of
this header.

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

	[BZ #21622]
	* sysdeps/unix/sysv/linux/tile/bits/sigaction.h (SA_RESTART):
	Define for [__USE_UNIX98 || __USE_XOPEN2K8], not [__USE_UNIX98 ||
	__USE_MISC].
	(SA_NODEFER): Likewise.
	(SA_RESETHAND): Likewise.
2017-06-21 17:35:24 +00:00
Zack Weinberg 8082d91e1c Factor out shared definitions from bits/signum.h.
Many of the things defined by bits/signum.h are invariant across all
supported operating systems.  This patch factors out all of them to a
new header bits/signum-generic.h, which each bits/signum.h will include
and then override whichever things need adjustment.  Normally that will
mean, at most, adding or changing a few signal numbers.

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

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

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

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

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

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

	* sysdeps/unix/sysv/linux/tst-signal-numbers.sh: New test.
	* sysdeps/unix/sysv/linux/Makefile: Run it.
2017-06-20 20:32:50 -04:00
Adhemerval Zanella bafcba22ac Consolidate Linux openat implementation
This patch consolidates the open Linux syscall implementation on
sysdeps/unix/sysv/linux/open{64}.c.  The changes are:

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

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

	* sysdeps/unix/sysv/linux/openat.c (__libc_openat): Build only
	for !__OFF_T_MATCHES_OFF64_T.
	* sysdeps/unix/sysv/linux/openat64.c (__libc_openat64): New
	implementation based on open64.
	* sysdeps/unix/sysv/linux/wordsize-64/openat.c: Remove file.
	* sysdeps/unix/sysv/linux/wordsize-64/openat64.c: Likewise.
2017-06-20 18:20:06 -03:00
Joseph Myers 46ad8909ce conformtest: XFAIL uc_mcontext test for powerpc32 (bug 21635).
This patch XFAILs one test where the powerpc32 ucontext_t has the
wrong type of a field, to allow the conform/ tests as a whole to pass
once the namespace issues are fixed.

Tested with build-many-glibcs.py.

	[BZ #21635]
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/Makefile
	[$(subdir) = conform] (conformtest-xfail-conds): New variable.
	* conform/data/signal.h-data (uc_mcontext): XFAIL for
	powerpc32-linux.
	* conform/data/ucontext.h-data (uc_mcontext): Likewise.
2017-06-20 17:51:36 +00:00
Joseph Myers e0b5a3b654 conformtest: XFAIL uc_sigmask test for ia64 (bug 21634).
This patch XFAILs one test where the ia64 ucontext_t has the wrong
type of a field, to allow the conform/ tests as a whole to pass once
the namespace issues are fixed.

Tested with build-many-glibcs.py.

	[BZ #21634]
	* sysdeps/unix/sysv/linux/ia64/Makefile [$(subdir) = conform]
	(conformtest-xfail-conds): New variable.
	* conform/data/signal.h-data (uc_sigmask): XFAIL for ia64-linux.
	* conform/data/ucontext.h-data (uc_sigmask): Likewise.
2017-06-20 17:47:32 +00:00
H.J. Lu 905947c304 tunables: Add IFUNC selection and cache sizes
The current IFUNC selection is based on microbenchmarks in glibc.  It
should give the best performance for most workloads.  But other choices
may have better performance for a particular workload or on the hardware
which wasn't available at the selection was made.  The environment
variable, GLIBC_TUNABLES=glibc.tune.ifunc=-xxx,yyy,-zzz...., can be used
to enable CPU/ARCH feature yyy, disable CPU/ARCH feature yyy and zzz,
where the feature name is case-sensitive and has to match the ones in
cpu-features.h.  It can be used by glibc developers to override the
IFUNC selection to tune for a new processor or improve performance for
a particular workload.  It isn't intended for normal end users.

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

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

	* elf/dl-tunables.list (tune): Add ifunc,
	x86_non_temporal_threshold,
	x86_data_cache_size and x86_shared_cache_size.
	* manual/tunables.texi: Document glibc.tune.ifunc,
	glibc.tune.x86_data_cache_size, glibc.tune.x86_shared_cache_size
	and glibc.tune.x86_non_temporal_threshold.
	* sysdeps/unix/sysv/linux/x86/dl-sysdep.c: New file.
	* sysdeps/x86/cpu-tunables.c: Likewise.
	* sysdeps/x86/cacheinfo.c
	(init_cacheinfo): Check and get data cache size, shared cache
	size and non temporal threshold from cpu_features.
	* sysdeps/x86/cpu-features.c [HAVE_TUNABLES] (TUNABLE_NAMESPACE):
	New.
	[HAVE_TUNABLES] Include <unistd.h>.
	[HAVE_TUNABLES] Include <elf/dl-tunables.h>.
	[HAVE_TUNABLES] (TUNABLE_CALLBACK (set_ifunc)): Likewise.
	[HAVE_TUNABLES] (init_cpu_features): Use TUNABLE_GET to set
	IFUNC selection, data cache size, shared cache size and non
	temporal threshold.
	* sysdeps/x86/cpu-features.h (cpu_features): Add data_cache_size,
	shared_cache_size and non_temporal_threshold.
2017-06-20 08:37:28 -07:00
Stefan Liebler b08a6a0dea S390: Sync ptrace.h with kernel. [BZ #21539]
This patch removes PTRACE_GETREGS, PTRACE_SETREGS, PTRACE_GETFPREGS
and PTRACE_SETFPREGS as these requests does not exist on s390 kernel.

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

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

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

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

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

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

ChangeLog:

	[BZ #21539]
	* NEWS: Mention s390 ptrace request changes.
	* sysdeps/unix/sysv/linux/s390/sys/ptrace.h
	(PTRACE_GETREGS, PTRACE_SETREGS, PTRACE_GETFPREGS,
	PTRACE_SETFPREGS): Remove enum constant.
	(PT_GETREGS, PT_SETREGS, PT_GETFPREGS, T_SETFPREGS):
	Remove defines.
	(PTRACE_SINGLEBLOCK): New enum constant.
	(PT_STEPBLOCK): New define.
	(PTRACE_PEEKUSR_AREA, PTRACE_POKEUSR_AREA,
	PTRACE_GET_LAST_BREAK, PTRACE_ENABLE_TE, PTRACE_DISABLE_TE,
	PTRACE_TE_ABORT_RAND): New enum constant and define.
	* sysdeps/s390/fpu/fesetenv.c: Remove ptrace.h includes.
	* sysdeps/unix/sysv/linux/s390/tst-ptrace-singleblock.c:
	New file.
	* sysdeps/unix/sysv/linux/s390/Makefile: Add test.
2017-06-19 16:27:25 +02:00
Joseph Myers 487549c466 Fix another x86 sys/ucontext.h namespace issue (bug 21457).
This patch fixes a namespace issue for one more field in the x86
sys/ucontext.h that I missed in my previous changes.

Tested for x86_64.

	[BZ #21457]
	* sysdeps/unix/sysv/linux/x86/sys/ucontext.h [__x86_64__] (struct
	_libc_xmmreg): Use __ctx in defining field.
2017-06-19 12:21:35 +00:00
Joseph Myers a66bc30d6b Define struct rusage in sys/wait.h when required (bug 21575).
Some older standards (XPG4.2 through POSIX.1:2001, XSI only) require
sys/wait.h to include the definition of struct rusage.  This is
missing in glibc.

This patch adds the required definition.  struct rusage is moved to a
new header bits/types/struct_rusage.h to avoid bringing in the whole
of sys/resource.h (although the standards in question do allow the
whole of sys/resource.h to be brought in).  In the five
bits/resource.h headers, the only variation between the definitions of
struct rusage is that the sysdeps/unix/sysv/linux version is prepared
for x32 (by having anonymous unions with __syscall_slong_t fields) and
the others are not.  Thus, this version is suitable for use
generically (everything other than x32 simply has __syscall_slong_t
the same as long int, so there are no API or ABI changes involved, and
anonymous unions are already a required language feature for glibc
headers elsewhere), and this patch uses it as a base for the single
implementation of bits/types/struct_rusage.h.

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

	[BZ #21575]
	* resource/bits/types/struct_rusage.h: New file.
	* include/bits/types/struct_rusage.h: Likewise.
	* bits/resource.h (struct rusage): Include
	<bits/types/struct_rusage.h> instead of defining here.
	* sysdeps/unix/sysv/linux/bits/resource.h (struct rusage):
	Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/resource.h (struct rusage):
	Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/resource.h (struct rusage):
	Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/resource.h (struct rusage):
	Likewise.
	* resource/Makefile (headers): Add bits/types/struct_rusage.h.
	* posix/sys/wait.h [__USE_XOPEN_EXTENDED && !__USE_XOPEN2K8]:
	Include <bits/types/struct_rusage.h>
2017-06-19 11:59:19 +00:00
Stefan Liebler 5e5b3b8866 S390: Fix build with gcc configured with --enable-default-pie. [BZ #21537]
Building glibc with gcc configured with --enable-default-pie failed on s390
due to assembler messages:
../sysdeps/unix/sysv/linux/s390/s390-32/__makecontext_ret.S:44:
Error: junk at end of line, first unrecognized character is `@'

HIDDEN_JUMPTARGET was expanded to exit@PLT@GOTOFF.
If SHARED is not defined, HIDDEN_JUMPTARGET is defined to JUMPTARGET
in sysdeps/s390/s390-32/sysdep.h.  There it expanded to exit@PLT
in non SHARED case as PIC is defined if gcc is configured with
--enable-default-pie. Thus I've changed the "ifdef PIC" to "ifdef SHARED"
as we do not want PLTs in the static obj files.  I've also changed this
in sysdeps/s390/s390-64/sysdep.h.

I've also adjusted sysdeps/unix/sysv/linux/s390/s390-32/__makecontext_ret.S.
If glibc is configured with --disable-hidden-plt, then NO_HIDDEN is defined.
In SHARED case HIDDEN_JUMPTARGET would be expanded to exit@PLT@GOTOFF
instead of __GI_exit@GOTOFF.
Now we jump to:
- __GI_exit if SHARED is defined
- exit@PLT if SHARED and NO_HIDDEN is defined
- exit if both are not defined.
On s390 31bit we have to setup GOT pointer in r12 if we use a PLT stub.
Therefore I use SYSCALL_PIC_SETUP from sysdep.h and added the missing semicolons.

ChangeLog:

	[BZ #21537]
	* sysdeps/s390/s390-32/sysdep.h (JUMPTARGET, SYSCALL_PIC_SETUP):
	Check SHARED instead of PIC.
	(SYSCALL_PIC_SETUP): Add missing semicolons.
	* sysdeps/s390/s390-64/sysdep.h (JUMPTARGET, SYSCALL_PIC_SETUP):
	Check SHARED instead of PIC.
	* sysdeps/unix/sysv/linux/s390/s390-32/__makecontext_ret.S
	(__makecontext_ret): Adjust code to jump to exit.
2017-06-19 11:08:58 +02:00
Christian Borntraeger 35810f5ccf s390: optimize syscall function
Since kernel 2.6.0 all Linux version accept the system call number
in register 1 for svc 0. There is no need to have special handling
that uses EX for system calls < 256. This will simplify and speed
up that code.

A microbenchmark doing "syscall(__NR_getpid);" in a loops gets faster
by ~12%.

        * sysdeps/unix/sysv/linux/s390/s390-32/syscall.S: Simplify
        code by always using SVC 0 instead of EX.
        * sysdeps/unix/sysv/linux/s390/s390-64/syscall.S: Likewise.
2017-06-19 10:59:40 +02:00
Adhemerval Zanella 48d966eb35 linux: Consolidate sync_file_range implementation
This patch consolidates Linux sync_file_range at default
sysdeps/unix/sysv/linux/sync_file_range.c implementation.  It also
moves the rules flags from generic io/Makefile to Linux one due the
fact it is a Linux-only symbol.

Checked on i686-linux-gnu and x86_64-linux-gnu.

	* io/Makefile (CFLAGS-sync_file_range.c): Remove rule.
	* sysdeps/unix/sysv/linux/Makefile (CFLAGS-sync_file_range.c): New
	rule.
	* sysdeps/unix/sysv/linux/wordsize-64/syscalls.list: Remove
	sync_file_range.
2017-06-15 16:03:37 -03:00
Zack Weinberg fd860eaaa8 Remove __need macros from errno.h (__need_Emath, __need_error_t).
This is fairly complicated, not because the users of __need_Emath and
__need_error_t have complicated requirements, but because the core
changes had a lot of fallout.

__need_error_t exists for gnulib compatibility in argz.h and argp.h.
error_t itself is a Hurdism, an enum containing all the E-constants,
so you can do 'p (error_t) errno' in gdb and get a symbolic value.
argz.h and argp.h use it for function return values, and they want to
fall back to 'int' when that's not available.  There is no reason why
these nonstandard headers cannot just go ahead and include all of
errno.h; so we do that.

__need_Emath is defined only by .S files; what they _really_ need is
for errno.h to avoid declaring anything other than the E-constants
(e.g. 'extern int __errno_location(void);' is a syntax error in
assembly language). This is replaced with a check for __ASSEMBLER__ in
errno.h, plus a carefully documented requirement for bits/errno.h not
to define anything other than macros.  That in turn has the
consequence that bits/errno.h must not define errno - fortunately, all
live ports use the same definition of errno, so I've moved it to
errno.h.  The Hurd bits/errno.h must also take care not to define
error_t when __ASSEMBLER__ is defined, which involves repeating all of
the definitions twice, but it's a generated file so that's okay.

	* stdlib/errno.h: Remove __need_Emath and __need_error_t logic.
	Reorganize file.  Declare errno here.  When __ASSEMBLER__ is
	defined, don't declare anything other than the E-constants.

	* include/errno.h: Change conditional for exposing internal
	declarations to (not _ISOMAC and not __ASSEMBLER__).
	* bits/errno.h: Remove logic for __need_Emath.  Document
	requirements for a port-specific bits/errno.h.

	* sysdeps/unix/sysv/linux/bits/errno.h
	* sysdeps/unix/sysv/linux/alpha/bits/errno.h
	* sysdeps/unix/sysv/linux/hppa/bits/errno.h
	* sysdeps/unix/sysv/linux/mips/bits/errno.h
	* sysdeps/unix/sysv/linux/sparc/bits/errno.h:
	Add multiple-include guard and check against improper inclusion.
	Remove __need_Emath logic.  Don't declare errno here.  Ensure all
	constants are defined as simple integer literals.  Consistent
	formatting.
	* sysdeps/mach/hurd/errnos.awk: Likewise.  Only define error_t and
	enum __error_t_codes if __ASSEMBLER__ is not defined.
	* sysdeps/mach/hurd/bits/errno.h: Regenerate.

	* argp/argp.h, string/argz.h: Don't define __need_error_t before
	including errno.h.
	* sysdeps/i386/i686/fpu/multiarch/s_cosf-sse2.S
	* sysdeps/i386/i686/fpu/multiarch/s_sincosf-sse2.S
	* sysdeps/i386/i686/fpu/multiarch/s_sinf-sse2.S
	* sysdeps/x86_64/fpu/s_cosf.S
	* sysdeps/x86_64/fpu/s_sincosf.S
	* sysdeps/x86_64/fpu/s_sinf.S:
	Just include errno.h; don't define __need_Emath or include
	bits/errno.h directly.
2017-06-14 08:14:34 -04:00
Zack Weinberg 37f802f864 Remove __need_IOV_MAX and __need_FOPEN_MAX.
__need_FOPEN_MAX wasn't being used anywhere.  __need_IOV_MAX was more
complicated; the basic deal is that sys/uio.h wants to define a
constant named UIO_MAXIOV and bits/xopen_lim.h wants to define a
constant named IOV_MAX, with the same meaning.  For no apparent reason
this was being handled via bits/stdio_lim.h -- stdio.h is NOT supposed
to define IOV_MAX -- and some mess in Makerules.  Also, bits/uio.h on
Linux was being used as a dumping ground for extension functions.

So now we have bits/uio_lim.h, which defines __IOV_MAX.
bits/xopen_lim.h and sys/uio.h use that to define their respective
constants.  We also now have bits/uio-ext.h, which is the official
Proper Home for extensions to sys/uio.h.  bits/uio.h is removed, and
stdio_lim.h doesn't define IOV_MAX at all.

	* bits/uio_lim.h, sysdeps/unix/sysv/linux/bits/uio_lim.h
	* bits/uio-ext.h, sysdeps/unix/sysv/linux/bits/uio-ext.h: New file.
	* bits/uio.h, sysdeps/unix/sysv/linux/bits/uio.h: Delete file.

	* include/bits/xopen_lim.h: Use bits/uio_lim.h to get the value
	for IOV_MAX.
	* misc/Makefile: Install bits/uio-ext.h and bits/uio_lim.h.
	Don't install bits/uio.h.
	* misc/sys/uio.h: Don't include bits/uio.h.  Do include
	bits/types/struct_iovec.h and bits/uio_lim.h.  Set UIO_MAXIOV
	based on __IOV_MAX. Under __USE_GNU, also include bits/uio-ext.h.

	* stdio-common/stdio_lim.h.in: Remove logic for __need_FOPEN_MAX
	and __need_IOV_MAX.  Don't define IOV_MAX at all.
	* Makerules (stdio_lim.h): Remove logic for setting IOV_MAX.

	* sysdeps/unix/sysv/linux/bits/fcntl-linux.h:
	Include bits/types/struct_iovec.h, not bits/uio.h.
	Use __ssize_t, not ssize_t, in function prototypes.
	Don't use hard TAB for double space after period in comments.
2017-06-14 07:51:30 -04:00
Alan Modra fb499eb04e PowerPC64 FRAME_PARM_SAVE
I think FRAME_PARM[1-9]_SAVE confuse the code, particularly
FRAME_PARM9_SAVE.  There are only 8 parameter save slots!

	* sysdeps/powerpc/powerpc64/sysdep.h: (FRAME_BACKCHAIN,
	FRAME_CR_SAVE, FRAME_LR_SAVE): Move out of conditional.
	(FRAME_PARM1_SAVE, FRAME_PARM2_SAVE, FRAME_PARM3_SAVE,
	FRAME_PARM4_SAVE, FRAME_PARM5_SAVE, FRAME_PARM6_SAVE,
	FRAME_PARM7_SAVE, FRAME_PARM8_SAVE, FRAME_PARM9_SAVE): Delete.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S: Replace
	uses of FRAME_PARM[1-9]_SAVE with FRAME_PARM_SAVE plus offset.
2017-06-14 10:43:33 +09:30
Gordana Cmiljanovic b309f058cf mips: Fix store/load gp registers to/from ucontext_t
General purpose registers in mcontext_t structure
are 8 bytes long for both MIPS32/MIPS64.

get/set/make/swap context implementations for MIPS O32
incorrectly assume that general purpose registers
in this structure are 4 bytes long.

This patch is fixing that.

Tested for MIPS O32 LE and BE.
Compared objdump of modified functions for mips n32 and mips n64.

	[BZ #21548]
	* sysdeps/unix/sysv/linux/mips/getcontext.S: Define MCONTEXT_SZGREG as
	8 and use it when copying general purpose registers.
	* sysdeps/unix/sysv/linux/mips/makecontext.S: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/Makefile: Include new test for
	mips o32.
	* sysdeps/unix/sysv/linux/mips/mips32/bug-getcontext-mips-gp.c: Added
	new test for mips o32.
	* sysdeps/unix/sysv/linux/mips/setcontext.S: Define MCONTEXT_SZGREG as
	8 and use it when copying general purpose registers.
	* sysdeps/unix/sysv/linux/mips/swapcontext.S: Likewise.
2017-06-13 21:34:45 +00:00
Zack Weinberg 46ee3da55e Remove __need_schedparam and __cpu_set_t_defined.
bits/sched.h has logic to expose only an impl-namespace variant of
struct sched_param (i.e. struct __sched_param), but nothing uses it,
and the only header that includes bits/sched.h is sched.h.  The
__need_schedparam logic can therefore be removed.

bits/sched.h also has a great deal of code relating to cpu_set_t
objects that was *almost* the same between the two versions of
bits/sched.h in the tree; a little spelunking indicated that this is
because some bug fixes got applied to the Linux-specific bits/sched.h
but not the generic one.  Introduce a new header, bits/cpu-set.h,
containing the version of that code with the bugfixes, have sched.h
include it directly, and delete all of the code from both versions of
bits/sched.h.

Also remove the unnecessary name mangling in the definition of struct
sched_param -- POSIX specifies a field 'sched_priority', so there is
no reason to define it as '__sched_priority' and then paper over that
with a macro.  (Just in case someone was using the internal name,
'sched_priority' remains a macro defined to expand to itself, and
'__sched_priority' now expands to 'sched_priority'.)

Finally, as long as I'm touching these files anyway, merge new
constants from linux/sched.h into the Linux bits/sched.h.

	* bits/sched.h: Remove __need_schedparam logic and replace with a
	normal multiple-include guard.  Change field name in struct
	sched_param from __sched_priority to sched_priority.  Delete
	everything under #ifndef __cpu_set_t_defined.
	* sysdeps/unix/sysv/linux/bits/sched.h: Likewise.  Also sync with
	kernel sched.h, adding SCHED_ISO and SCHED_DEADLINE constants.

	* posix/sched.h: Include bits/cpu-set.h as well as bits/sched.h.
	For compatibility, #define sched_priority to itself, and #define
	__sched_priority as sched_priority.
	* posix/bits/cpu-set.h: New file containing, verbatim, the code
	that was under #ifndef __cpu_set_t_defined in
	sysdeps/unix/sysv/linux/bits/sched.h.
	* include/bits/cpu-set.h: New wrapper.
	* posix/Makefile: Install bits/cpu-set.h.
2017-06-12 17:11:36 -04:00
Paul Clarke cdfbe5037f powerpc: add sysconf support for cache geometries
There is currently no "cross-platform" (x86 and POWER) support for
determining the cacheline size.

This patch adds support to sysconf() to correctly report cacheline sizes
based on the information in the auxilliary vector.

Thus, using sysconf() is a cross-platform (x86 and POWER) solution for
determining cacheline sizes.

Support is added (on powerpc) for:
_SC_LEVEL1_ICACHE_SIZE _SC_LEVEL1_ICACHE_ASSOC _SC_LEVEL1_ICACHE_LINESIZE
_SC_LEVEL1_DCACHE_SIZE _SC_LEVEL1_DCACHE_ASSOC _SC_LEVEL1_DCACHE_LINESIZE
_SC_LEVEL2_CACHE_SIZE  _SC_LEVEL2_CACHE_ASSOC  _SC_LEVEL2_CACHE_LINESIZE
_SC_LEVEL3_CACHE_SIZE  _SC_LEVEL3_CACHE_ASSOC  _SC_LEVEL3_CACHE_LINESIZE

	* sysdeps/unix/sysv/linux/powerpc/sysconf.c: New file.
	Add powerpc-specific overrides for L1, L2, L3 CACHE_SIZEs,
	CACHE_ASSOCs, and CACHE_LINESIZEs, retrieving from auxv.
	* sysdeps/unix/sysv/linux/powerpc/test-powerpc-linux-sysconf.c:
	New file.  Invoke newly supported sysconf values for powerpc,
	and report results.  If none are supported, report so.
	* sysdeps/unix/sysv/linux/powerpc/Makefile (tests):  Add new test,
	tst-sysconf.
2017-06-09 14:36:22 -03:00
Joseph Myers a17973efc6 Fix waitid namespace (bug 21561).
In sys/wait.h, waitid and associated constants and types are UX-shaded
in XPG4.2 (so not in XPG4), and XSI-shaded in POSIX before 2008, so
should be appropriately conditional in the headers.  This patch fixes
the conditionals accordingly.  (WCONTINUED is actually still
XSI-shaded in POSIX.1:2008, but W* is also reserved there without
XSI-shading, so nothing special needs to be done about the
conditionals on WCONTINUED to conform to POSIX.1:2008 namespace
rules.)

Tested for x86_64.

	[BZ #21561]
	* posix/sys/wait.h (idtype_t): Change [__USE_XOPEN] condition to
	[__USE_XOPEN_EXTENDED].
	(id_t): Likewise.
	(include of <bits/types/siginfo_t.h): Likewise.
	(waitid): Likewise.
	* sysdeps/unix/sysv/linux/bits/waitflags.h (WSTOPPED): Condition
	on [__USE_XOPEN_EXTENDED || __USE_XOPEN2K8].
	(WEXITED): Likewise.
	(WCONTINUED): Likewise.
	(WNOWAIT): Likewise.
	* conform/Makefile (test-xfail-XPG4/stdlib.h/conform): Remove.
	(test-xfail-XPG4/sys/wait.h/conform): Likewise.
	(test-xfail-POSIX/sys/wait.h/conform): Likewise.
2017-06-09 16:28:07 +00:00
Joseph Myers 10d33c5a86 Update nios2, sparc32 localplt.data files for recent GCC change.
A recent GCC change to expand floating-point classification built-in
functions inline using integer rather than floating-point arithmetic
in some cases resulted in localplt test failures for nios2 and sparc32
<https://sourceware.org/ml/libc-testresults/2017-q2/msg00320.html>.
This patch updates the localplt.data files in question to mark the
relevant symbols as optional / add a new optional symbol.  (The GCC
patch has been reverted because of other problems it caused, but one
can assume it will be applied again, without changes that would affect
the PLT entries generated, once those issues have been resolved.)

Tested with build-many-glibcs.py.

	* sysdeps/unix/sysv/linux/nios2/localplt.data (__gtdf2): Mark
	libc.so PLT entry optional.
	(__gtsf2): Likewise.
	(__unorddf2): Likewise.
	(__unordsf2): Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/localplt.data (_Q_fgt):
	New optional libc.so PLT entry.
2017-06-09 16:26:06 +00:00
Siddhesh Poyarekar 6c85cc2852 aarch64: Fix undefined behavior in _dl_procinfo
1 << 31 is undefined, so replace it with a cleaner check.  Also remove
magic numbers in comments.

	* sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h: Remove
	mention of magic numbers in comments.
	(_dl_procinfo): Fix undefined behavior
2017-06-09 14:18:12 +05:30
H.J. Lu 37b66c0b1a ld.so: Consolidate 2 strtouls into _dl_strtoul [BZ #21528]
There are 2 minimal strtoul implementations in ld.so:

1. __strtoul_internal in elf/dl-minimal.c.
2. tunables_strtoul in elf/dl-tunables.c.

This patch adds _dl_strtoul to replace them.  Tested builds with and
without --enable-tunables.

	[BZ #21528]
	* elf/dl-minimal.c (__strtoul_internal): Removed.
	(strtoul): Likewise.
	* elf/dl-misc.c (_dl_strtoul): New function.
	* elf/dl-tunables.c (tunables_strtoul): Removed.
	(tunable_initialize): Replace tunables_strtoul with _dl_strtoul.
	* elf/rtld.c (process_envvars): Likewise.
	* sysdeps/unix/sysv/linux/dl-librecon.h (_dl_osversion_init):
	Likewise.
	* sysdeps/generic/ldsodefs.h (_dl_strtoul): New prototype.
2017-06-08 12:52:42 -07:00
Zack Weinberg 199fc19d3a Remove __need macros from stdio.h and wchar.h.
wint_t is a little finicky because it might be defined by stddef.h, which
belongs to the compiler.

In addition to the _types_, a bunch of other declarations shared between
wctype.h and wchar.h are factored out to their own header.

	* libio/bits/types/FILE.h, libio/bits/types/__FILE.h
	* wcsmbs/bits/types/mbstate_t.h, wcsmbs/bits/types/__mbstate_t.h
	* wcsmbs/bits/types/wint_t.h: New single-type definition files.
	* wctype/bits/wctype-wchar.h: New file holding declarations shared
	between wctype.h and wchar.h.

	* libio/Makefile, wcsmbs/Makefile, wctype/Makefile:
	Install them.

	* include/bits/types/FILE.h, include/bits/types/__FILE.h
	* include/bits/types/mbstate_t.h, include/bits/types/__mbstate_t.h
	* include/bits/types/wint_t.h, include/bits/wcsmbs-wchar.h:
	New wrappers.
	* include/stdio.h, include/wchar.h, include/wctype.h:
	No need to handle __need macros.

	* grp/grp.h, gshadow/gshadow.h, hurd/hurd.h, iconv/gconv.h
	* libio/stdio.h, mach/mach.h, misc/mntent.h, pwd/pwd.h
	* shadow/shadow.h, stdio-common/printf.h, wcsmbs/uchar.h
	* wcsmbs/wchar.h, wctype/wctype.h
	* sysdeps/generic/_G_config.h, sysdeps/unix/sysv/linux/_G_config.h
	Use the new files instead of __need macros.
2017-06-08 13:58:17 -04:00
Arjun Shankar 8f0a947cf5 Remove check for NULL buffer passed to `ptsname_r'
`ptsname_r' is declared in stdlib.h to only accept a `nonnull'
second argument and therefore GCC may choose to make optimizations
based on the assumption that this argument is NULL. This means
that potentially, GCC can optimize away the NULL check at some
point in the future. Since this is a programming interface, we
might as well remove the NULL check ourselves.

This also warrants a change to the `ptsname_r' manual page that
must be submitted to the corresponding mailing list.

In addition, remove the NULL buffer test in login/tst-ptsname.c.
2017-06-07 17:37:59 +02:00
Arjun Shankar fdc543919a Use test-driver in sysdeps/unix/sysv/linux/tst-clone2.c 2017-06-07 14:05:42 +02:00
Siddhesh Poyarekar ea01a4da21 aarch64: Add hwcap string routines
Add support for routines in dl-procinfo.h to show string versions of
HWCAP entries when a program is invoked with the LD_SHOW_AUXV
environment variable set and also to aid in path resolution for
ldconfig.

	* sysdeps/unix/sysv/linux/aarch64/dl-procinfo.c
	(_dl_aarch64_cap_flags): New array.
	* sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h
	(_dl_hwcap_string, _dl_string_hwcap, _dl_procinfo): Implement
	functions.
2017-06-07 11:11:40 +05:30
Siddhesh Poyarekar f82e9672ad aarch64: Allow overriding HWCAP_CPUID feature check using HWCAP_MASK
Now that LD_HWCAP_MASK (or glibc.tune.hwcap_mask) is read early enough
to influence cpu feature check in aarch64, use it to influence
multiarch selection.  Setting LD_HWCAP_MASK such that it clears
HWCAP_CPUID will now disable multiarch for the binary.

HWCAP_CPUID is also now set in HWCAP_IMPORTANT so that it is set by
default.  With this patch, this feature is only usable with
dyanmically linked binaries because LD_HWCAP_MASK is not read for
static binaries.  A future patch fixes that.

	* sysdeps/unix/sysv/linux/aarch64/cpu-features.c
	(init_cpu_features): Use glibc.tune.hwcap_mask.
	* sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h: New file.
2017-06-07 11:11:39 +05:30
Siddhesh Poyarekar 6482e63403 Add include guards to dl-procinfo.h
The dl-procinfo.h for linux/s390 and linux/i386 don't have include
guards, which causes them to fail since addition of LD_HWCAP_MASK to
tunables.  Add _DL_I386_PROCINFO_H guard to avoid redefining
_dl_procinfo on multiple includes and also allow the subsequent
include of another dl-procinfo.h to work.

Verified with a build test on i686.

	* sysdeps/unix/sysv/linux/i386/dl-procinfo.h: Add include
	guard.
	* sysdeps/unix/sysv/linux/s390/dl-procinfo.h: Likewise.
2017-06-07 11:11:38 +05:30
Stefan Liebler 12d2dd7060 Optimize generic spinlock code and use C11 like atomic macros.
This patch optimizes the generic spinlock code.

The type pthread_spinlock_t is a typedef to volatile int on all archs.
Passing a volatile pointer to the atomic macros which are not mapped to the
C11 atomic builtins can lead to extra stores and loads to stack if such
a macro creates a temporary variable by using "__typeof (*(mem)) tmp;".
Thus, those macros which are used by spinlock code - atomic_exchange_acquire,
atomic_load_relaxed, atomic_compare_exchange_weak - have to be adjusted.
According to the comment from  Szabolcs Nagy, the type of a cast expression is
unqualified (see http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_423.htm):
__typeof ((__typeof (*(mem)) *(mem)) tmp;
Thus from spinlock perspective the variable tmp is of type int instead of
type volatile int.  This patch adjusts those macros in include/atomic.h.
With this construct GCC >= 5 omits the extra stores and loads.

The atomic macros are replaced by the C11 like atomic macros and thus
the code is aligned to it.  The pthread_spin_unlock implementation is now
using release memory order instead of sequentially consistent memory order.
The issue with passed volatile int pointers applies to the C11 like atomic
macros as well as the ones used before.

I've added a glibc_likely hint to the first atomic exchange in
pthread_spin_lock in order to return immediately to the caller if the lock is
free.  Without the hint, there is an additional jump if the lock is free.

I've added the atomic_spin_nop macro within the loop of plain reads.
The plain reads are also realized by C11 like atomic_load_relaxed macro.

The new define ATOMIC_EXCHANGE_USES_CAS determines if the first try to acquire
the spinlock in pthread_spin_lock or pthread_spin_trylock is an exchange
or a CAS.  This is defined in atomic-machine.h for all architectures.

The define SPIN_LOCK_READS_BETWEEN_CMPXCHG is now removed.
There is no technical reason for throwing in a CAS every now and then,
and so far we have no evidence that it can improve performance.
If that would be the case, we have to adjust other spin-waiting loops
elsewhere, too!  Using a CAS loop without plain reads is not a good idea
on many targets and wasn't used by one.  Thus there is now no option to
do so.

Architectures are now using the generic spinlock automatically if they
do not provide an own implementation.  Thus the pthread_spin_lock.c files
in sysdeps folder are deleted.

ChangeLog:

	* NEWS: Mention new spinlock implementation.
	* include/atomic.h:
	(__atomic_val_bysize): Cast type to omit volatile qualifier.
	(atomic_exchange_acq): Likewise.
	(atomic_load_relaxed): Likewise.
	(ATOMIC_EXCHANGE_USES_CAS): Check definition.
	* nptl/pthread_spin_init.c (pthread_spin_init):
	Use atomic_store_relaxed.
	* nptl/pthread_spin_lock.c (pthread_spin_lock):
	Use C11-like atomic macros.
	* nptl/pthread_spin_trylock.c (pthread_spin_trylock):
	Likewise.
	* nptl/pthread_spin_unlock.c (pthread_spin_unlock):
	Use atomic_store_release.
	* sysdeps/aarch64/nptl/pthread_spin_lock.c: Delete File.
	* sysdeps/arm/nptl/pthread_spin_lock.c: Likewise.
	* sysdeps/hppa/nptl/pthread_spin_lock.c: Likewise.
	* sysdeps/m68k/nptl/pthread_spin_lock.c: Likewise.
	* sysdeps/microblaze/nptl/pthread_spin_lock.c: Likewise.
	* sysdeps/mips/nptl/pthread_spin_lock.c: Likewise.
	* sysdeps/nios2/nptl/pthread_spin_lock.c: Likewise.
	* sysdeps/aarch64/atomic-machine.h (ATOMIC_EXCHANGE_USES_CAS): Define.
	* sysdeps/alpha/atomic-machine.h: Likewise.
	* sysdeps/arm/atomic-machine.h: Likewise.
	* sysdeps/i386/atomic-machine.h: Likewise.
	* sysdeps/ia64/atomic-machine.h: Likewise.
	* sysdeps/m68k/coldfire/atomic-machine.h: Likewise.
	* sysdeps/m68k/m680x0/m68020/atomic-machine.h: Likewise.
	* sysdeps/microblaze/atomic-machine.h: Likewise.
	* sysdeps/mips/atomic-machine.h: Likewise.
	* sysdeps/powerpc/powerpc32/atomic-machine.h: Likewise.
	* sysdeps/powerpc/powerpc64/atomic-machine.h: Likewise.
	* sysdeps/s390/atomic-machine.h: Likewise.
	* sysdeps/sparc/sparc32/atomic-machine.h: Likewise.
	* sysdeps/sparc/sparc32/sparcv9/atomic-machine.h: Likewise.
	* sysdeps/sparc/sparc64/atomic-machine.h: Likewise.
	* sysdeps/tile/tilegx/atomic-machine.h: Likewise.
	* sysdeps/tile/tilepro/atomic-machine.h: Likewise.
	* sysdeps/unix/sysv/linux/hppa/atomic-machine.h: Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/atomic-machine.h: Likewise.
	* sysdeps/unix/sysv/linux/nios2/atomic-machine.h: Likewise.
	* sysdeps/unix/sysv/linux/sh/atomic-machine.h: Likewise.
	* sysdeps/x86_64/atomic-machine.h: Likewise.
2017-06-06 09:41:56 +02:00
H.J. Lu d8a7d10324 x86-64: Update LO_HI_LONG for p{readv,writev}{64}v2
The kernel interface for p{readv,writev}{64}v is

(unsigned long fd, {const }struct iovec *iov, unsigned long vlen,
 unsigned long pos_l, unsigned long pos_h)

Except for targets which define __ARCH_WANT_COMPAT_SYS_PREADV64 and
__ARCH_WANT_COMPAT_SYS_PWRITEV64,

(unsigned long fd, {const }struct iovec *iov, unsigned long vlen,
 off64_t pos)

is used for p{readv,writev}{64}v.  X32 is the only such target.  The
LO_HI_LONG macro is used to pass offset to the pos_l and pos_h pair.
Since pos_h is ignored when size of offset == sizeof of pos_l, x86-64
has

 #define LO_HI_LONG(val) (val)

But the kernel interface for p{readv,writev}{64}v2 is

(unsigned long fd, {const }struct iovec *iov, unsigned long vlen,
 unsigned long pos_l, unsigned long pos_h, int flags)

Except for targets which define __ARCH_WANT_COMPAT_SYS_PREADV64V2 and
__ARCH_WANT_COMPAT_SYS_PWRITEV64V2,

(unsigned long fd, {const }struct iovec *iov, unsigned long vlen,
 off64_t pos, int flags)

is used for p{readv,writev}{64}v2.  X32 is the only such target.  Update
x86-64 LO_HI_LONG to pass 0 as the high part of the offset argument for
p{readv,writev}{64}v2 and define a different LO_HI_LONG for x32 to only
pass one argument for offset.

Tested on x32 and x86-64.

	* sysdeps/unix/sysv/linux/x86_64/sysdep.h (LO_HI_LONG): Pass
	0 as the high part of offset.
	* sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h (LO_HI_LONG): New.
2017-06-05 07:21:57 -07:00
Joseph Myers c4c96f92f7 Define SIG_HOLD for XPG4 (bug 21538).
Various bits/signum.h headers define SIG_HOLD if __USE_UNIX98.  That
should be __USE_XOPEN, as this macro is in XPG4.  This patch fixes the
conditionals accordingly.  Because of other header bugs, this does not
allow any XFAILs to be removed (however, the XPG4/signal.h/conform
XFAIL only depends on a few such straightforward header bugs, not on
the more complicated to fix ucontext_t issues, as ucontext_t isn't
included in signal.h in XPG4).

Tested for x86_64.

	[BZ #21538]
	* bits/signum.h (SIG_HOLD): Define if [__USE_XOPEN], not
	[__USE_UNIX98].
	* sysdeps/unix/bsd/bits/signum.h (SIG_HOLD): Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/signum.h (SIG_HOLD):
	Likewise.
	* sysdeps/unix/sysv/linux/bits/signum.h (SIG_HOLD): Likewise.
	* sysdeps/unix/sysv/linux/hppa/bits/signum.h (SIG_HOLD): Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/signum.h (SIG_HOLD): Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/signum.h (SIG_HOLD):
	Likewise.
2017-06-05 10:19:03 +00:00
Joseph Myers 7553131847 Fix struct sigaltstack namespace (bug 21517).
glibc defines the stack_t type with the tag struct sigaltstack.  This
is not permitted by POSIX; sigaltstack is only reserved with file
scope in the namespace of ordinary identifiers, not the tag namespace,
and in the case where stack_t is obtained from ucontext.h rather than
signal.h, it's not reserved with file scope at all.

This patch removes the tag accordingly and updates uses in glibc of
struct sigaltstack.  This is similar to the removal of the "struct
siginfo" tag a few years ago: C++ name mangling changes are an
unavoidable consequence.  A NEWS item is added to note the changed
mangling.  There is inevitably some risk of breaking builds of
anything that relies on the struct sigaltstack name (though the first
few hits I looked at from codesearch.debian.net generally seemed to
involve code that could use the stack_t name conditionally, so
depending on how they determine the conditionals they may work with
glibc not defining the struct tag anyway).

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

	[BZ #21517]
	* bits/types/stack_t.h (stack_t): Remove struct tag.
	* sysdeps/unix/sysv/linux/bits/types/stack_t.h (stack_t):
	Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/types/stack_t.h (stack_t):
	Likewise.
	* debug/segfault.c (install_handler): Use stack_t instead of
	struct sigaltstack.
	* hurd/hurd/signal.h (struct hurd_sigstate): Likewise.
	* hurd/trampoline.c (_hurd_setup_sighandler): Likewise.
	* include/signal.h (__sigaltstack): Likwise.
	* signal/sigaltstack.c (__sigaltstack): Likewise.
	* signal/signal.h (sigaltstack): Likewise.
	* sysdeps/mach/hurd/i386/signal-defines.sym
	(SIGALTSTACK__SS_SP__OFFSET): Likewise.
	(SIGALTSTACK__SS_SIZE__OFFSET): Likewise.
	(SIGALTSTACK__SS_FLAGS__OFFSET): Likewise.
	* sysdeps/mach/hurd/sigaltstack.c (__sigaltstack): Likewise.
	* sysdeps/mach/hurd/sigstack.c (sigstack): Likewise.
	* sysdeps/unix/sysv/linux/alpha/sys/procfs.h (struct
	elf_prstatus): Likewise.
	* sysdeps/unix/sysv/linux/hppa/____longjmp_chk.c (CHECK_SP):
	Likewise.
	* sysdeps/unix/sysv/linux/ia64/sys/procfs.h (struct elf_prstatus):
	Likewise.
	* sysdeps/unix/sysv/linux/m68k/____longjmp_chk.c (CHECK_SP):
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/sys/procfs.h (struct
	elf_prstatus): Likewise.
	* sysdeps/unix/sysv/linux/sh/sys/procfs.h (struct elf_prstatus):
	Likewise.
	* sysdeps/unix/sysv/linux/sys/procfs.h (struct elf_prstatus):
	Likewise.
2017-06-05 10:17:46 +00:00
Zack Weinberg 72b81552a1 Add shim header for bits/syscall.h.
On Linux-based configurations, bits/syscall.h is a generated file.
To avoid build-ordering problems, the Linux sys/syscall.h only includes
bits/syscall.h if _LIBC is not defined.  After the _ISOMAC-testsuite
changes, this means any test case that includes sys/syscall.h tries to
pull in bits/syscall.h.  This would be fine, because it'll definitely
have been generated by the time we start compiling tests, except that
the generated <builddir>/misc/bits/syscall.h is not visible in the
include path, because nothing needed it till now.  So we either get
the bits/syscall.h from the host system, or the build fails.

The fix is simple: add a shim header for bits/syscall.h.  I put it in
sysdeps/unix/sysv/linux/include instead of the top-level include/
because bits/syscall.h doesn't exist at all on other configurations as
far as I can tell.

This is known to affect nptl/tst-cond2[45].  Thanks to John David
Anglin for noticing the problem.

	[BZ #21514]
	* sysdeps/unix/sysv/linux/include/bits/syscall.h: New shim header
	pointing to the generated file in <builddir>/misc/bits/syscall.h.
2017-06-01 10:56:10 -04:00
Joseph Myers 139904b7e4 Fix more namespace issues in sys/ucontext.h (bug 21457).
Continuing the fixes for namespace issues in sys/ucontext.h, this
patch moves various symbols into the implementation namespace in the
absence of __USE_MISC.  As with previous changes, it is nonexhaustive,
just covering more straightforward cases.

Structure fields are generally changed to have a prefix __ in the
absence of __USE_MISC, via a macro __ctx (used without a space before
the open parenthesis, since the result is a single identifier).
Various macros such as NGREG also have leading __ added.  No changes
are made to structure tags (and thus to C++ name mangling), except
that in the (unused) file sysdeps/i386/sys/ucontext.h, structures
defined inside other structures as the type for a field have their
tags removed in the non-__USE_MISC case (those structure tags would
not in any case have been visible in C++, because in C++ the scope of
such a tag is limited to the containing structure).  No changes are
made to the contents of bits/sigcontext.h, or to whether it is
included.  Because of remaining namespace issues, this patch does not
yet fix the bug or allow any XFAILs to be removed.

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

	[BZ #21457]
	* sysdeps/arm/sys/ucontext.h (NGREG): Rename to __NGREG and define
	NGREG to __NGREG if [__USE_MISC].
	(gregset_t): Define using __NGREG.
	(__ctx): New macro.
	(mcontext_t): Use __ctx in defining fields.
	* sysdeps/i386/sys/ucontext.h (NGREG): Rename to __NGREG and
	define NGREG to __NGREG if [__USE_MISC].
	(gregset_t): Define using __NGREG.
	(__ctx): New macro.
	(__ctxt): Likewise.
	(fpregset_t): Use __ctx and __ctxt in defining fields.
	(mcontext_t): Likewise.
	* sysdeps/m68k/sys/ucontext.h (NGREG): Rename to __NGREG and
	define NGREG to __NGREG if [__USE_MISC].
	(gregset_t): Define using __NGREG.
	(__ctx): New macro.
	(mcontext_t): Use __ctx in defining fields.
	* sysdeps/mips/sys/ucontext.h (NGREG): Rename to __NGREG and
	define NGREG to __NGREG if [__USE_MISC].
	(gregset_t): Define using __NGREG.
	(__ctx): New macro.
	(fpregset_t): Use __ctx in defining fields.
	(mcontext_t): Likewise.
	* sysdeps/unix/sysv/linux/alpha/sys/ucontext.h (NGREG): Rename to
	__NGREG and define NGREG to __NGREG if [__USE_MISC].
	(gregset_t): Define using __NGREG.
	(NFPREG): Rename to __NFPREG and define NFPREG to __NFPREG if
	[__USE_MISC].
	(fpregset_t): Define using __NFPREG.
	* sysdeps/unix/sysv/linux/m68k/sys/ucontext.h (NGREG): Rename to
	__NGREG and define NGREG to __NGREG if [__USE_MISC].
	(gregset_t): Define using __NGREG.
	(__ctx): New macro.
	(fpregset_t): Use __ctx in defining fields.
	(mcontext_t): Likewise.
	* sysdeps/unix/sysv/linux/mips/sys/ucontext.h (NGREG): Rename to
	__NGREG and define NGREG to __NGREG if [__USE_MISC].
	(NFPREG): Rename to __NFPREG and define NFPREG to __NFPREG if
	[__USE_MISC].
	(gregset_t): Define using __NGREG.
	(__ctx): New macro.
	(fpregset_t): Use __ctx in defining fields.
	(mcontext_t): Likewise.
	* sysdeps/unix/sysv/linux/nios2/sys/ucontext.h (__ctx): New macro.
	(mcontext_t): Use __ctx in defining fields.
	* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h (__ctx): New
	macro.
	[__WORDSIZE == 32] (NGREG): Rename to __NGREG and define NGREG to
	__NGREG if [__USE_MISC].
	[__WORDSIZE == 32] (gregset_t): Define using __NGREG.
	[__WORDSIZE == 32] (fpregset_t): Use __ctx in defining fields.
	(mcontext_t): Likewise.
	[__WORDSIZE != 32] (NGREG): Rename to __NGREG and define NGREG to
	__NGREG if [__USE_MISC].
	[__WORDSIZE != 32] (NFPREG): Rename to __NFPREG and define NFPREG
	to __NFPREG if [__USE_MISC].
	[__WORDSIZE != 32] (NVRREG): Rename to __NVRREG and define NVRREG
	to __NVRREG if [__USE_MISC].
	[__WORDSIZE != 32] (gregset_t): Define using __NGREG.
	[__WORDSIZE != 32] (fpregset_t): Define using __NFPREG.
	[__WORDSIZE != 32] (vscr_t): Use __ctx in defining fields.
	[__WORDSIZE != 32] (vrregset_t): Likewise.
	[__WORDSIZE != 32] (mcontext_t): Likewise.
	* sysdeps/unix/sysv/linux/s390/sys/ucontext.h (__ctx): New macro.
	(__psw_t): Use __ctx in defining fields.
	(NGREG): Rename to __NGREG and define NGREG to __NGREG if
	[__USE_MISC].
	(gregset_t): Define using __NGREG.
	(fpreg_t): Use __ctx in defining fields.
	(fpregset_t): Likewise.
	(mcontext_t): Likewise.
	* sysdeps/unix/sysv/linux/sh/sys/ucontext.h (NGREG): Rename to
	__NGREG and define NGREG to __NGREG if [__USE_MISC].
	(gregset_t): Define using __NGREG.
	(NFPREG): Rename to __NFPREG and define NFPREG to __NFPREG if
	[__USE_MISC].
	(fpregset_t): Define using __NFPREG.
	(__ctx): New macro.
	(mcontext_t): Use __ctx in defining fields.
	* sysdeps/unix/sysv/linux/x86/sys/ucontext.h (__ctx): New macro.
	[__x86_64__] (NGREG): Rename to __NGREG and define NGREG to
	__NGREG if [__USE_MISC].
	[__x86_64__] (gregset_t): Define using __NGREG.
	[__x86_64__] (struct _libc_fpxreg): Use __ctx in defining fields.
	[__x86_64__] (struct _libc_fpstate): Likewise.
	[__x86_64__] (mcontext_t): Likewise.
	[!__x86_64__] (NGREG): Rename to __NGREG and define NGREG to
	__NGREG if [__USE_MISC].
	[!__x86_64__] (gregset_t): Define using __NGREG.
	[!__x86_64__] (struct _libc_fpreg): Use __ctx in defining fields.
	[!__x86_64__] (struct _libc_fpstate): Likewise.
	[!__x86_64__] (mcontext_t): Likewise.
2017-06-01 14:07:40 +00:00
Zack Weinberg 491bb0858e Avoid tickling a linker bug from microblaze pt-vfork.S.
libpthread used to have its own vfork implementation that differed
from libc's only in having a pointless micro-optimization.  There is
no longer any use to having a separate copy in libpthread, but the
historical ABI requires a compatibility shim.  microblaze was trying
to be slightly too clever about how it did this, and tickled a linker
bug.  The linker bug should get fixed eventually, but there's no
reason for us to keep tickling it in the meantime.

This doesn't reuse the generic pt-vfork.c because microblaze doesn't
have IFUNC support yet, and it doesn't reuse aarch64/pt-vfork.c
because that fails to generate a tailcall (with GCC 7.1.1).

	* sysdeps/unix/sysv/linux/microblaze/pt-vfork.S: Don't include
	alpha/pt-vfork.S.  Provide own compat shim for vfork and __vfork.
	* sysdeps/unix/sysv/linux/microblaze/vfork.S: Add __libc_vfork alias.
	* sysdeps/unix/sysv/linux/microblaze/localplt.data:
	libpthread.so no longer references __errno_location.
2017-06-01 08:53:56 -04:00
Adhemerval Zanella 52bd938169 posix: Implement preadv2 and pwritev2
This patch adds support of preadv2 and pwritev2 which are similar to
preadv/pwritev but with an extra flag argument.  As for preadv/pwritev
both interfaces are added a non-standard GNU API.

For default 'posix' implementation trying to emulate the Linux supported
flags is troublesome:

   * We can not temporary change the file state of the O_DSYNC and O_SYNC
     flags to emulate RWF_{D}SYNC (attempts to change the state of using
     fcntl are silently ignored).

   * IOCB_HIPRI requires the file opened in O_DIRECT and uses an internal
     semantic not provided by any other flag (O_NONBLOCK for instance).

So default sysdeps/posix implementations fails with EOPNOTSUPP for any non
supported flag (which are none currently) calls generic preadv/pwritev.
Basically this implementation supports only preadv2 called as preadv (with
flags sets to 0).

The Linux one uses the preadv2/pwritev2 syscall if defined, otherwise it
call preadv/writev.  Instead of using the previous __ASSUME_* to
unconditionally issue the syscall (and avoid building the fallback routine),
it call pread/write if the preadv2/pwritev2 syscalls fails.  The idea
is just avoid adding another __ASSUME_* and checking each architecture
on every kernel bump and simplify code conditionals.

Checked on x86_64-linux-gnu and on i686-linux-gnu and a check with
run-built-tests=no on aarch64-linux-gnu, alpha-linux-gnu, arm-linux-gnueabihf,
ia64-linux-gnu, m68k-linux-gnu, microblaze-linux-gnu, mips{64,64n32}-linux-gnu,
nios2-linux-gnu, powerpc{64,64le}-linux-gnu, s390{x}-linux-gnu,
sparc{64,v9}-linux-gnu, tile{gx,pro}-linux-gnu, and sh4-linux-gnu (all using
gcc 6.3).

	* NEWS: Add note about pwritev2 and preadv2 inclusion.
	* misc/Makefile (routines): Add preadv2, preadv64v2, pwritev2, and
	pwritev64v2.
	(tests): Add tst-preadvwritev2 and tst-preadvwritev64v2.
	* misc/Versions (GLIBC_2.26): Add preadv2, preadv64v2, pwritev2, and
	pwritev64v2.
	* misc/preadv2.c: New file.
	* misc/preadv64v2.c: Likewise.
	* misc/pwritev2.c: Likewise.
	* misc/pwritev64v2.c: Likewise.
	* misc/tst-preadvwritev2.c: Likewise.
	* misc/tst-preadvwritev64v2.c: Likewise.
	* manual/llio.texi: Add preadv2 and pwritev2 documentation.
	* misc/sys/uio.h [__USE_GNU && !__USE_FILE_OFFSET64] (preadv2): New
	prototype.
	[__USE_GNU && !__USE_FILE_OFFSET64] (pwritev2):	Likewise.
	[__USE_GNU && __USE_FILE_OFFSET64] (preadv64v2): Likewise.
	[__USE_GNU && __USE_FILE_OFFSET64] (pwritev64v2): Likewise.
	* misc/tst-preadvwritev-common.c (PREADV): Define if not defined.
	(PWRITEV): Likewise.
	(do_test_with_offset): Use PREADV and PWRITEV macros and check for
	ENOSYS.
	* nptl/tst-cancel4.c (tf_pwritev2): New test.
	(tf_preadv2): Likewise.
	(tf_fsync): Add tf_pwritev2 and tf_preadv2.
	* sysdeps/posix/preadv2.c: Likewise.
	* sysdeps/posix/preadv64v2.c: Likewise.
	* sysdeps/posix/pwritev2.c: Likewise.
	* sysdeps/posix/pwritev64v2.c: Likewise.
	* sysdeps/unix/sysv/linux/kernel-features.h: Add comment for syscall
	support in kernel.
	* sysdeps/unix/sysv/linux/preadv2.c: Likewise.
	* sysdeps/unix/sysv/linux/preadv64v2.c: Likewise.
	* sysdeps/unix/sysv/linux/pwritev2.c: Likewise.
	* sysdeps/unix/sysv/linux/pwritev64v2.c: Likewise.
	* sysdeps/unix/sysv/linux/preadv.c (preadv): Add libc_hidden_def.
	* sysdeps/unix/sysv/linux/preadv64.c (preadv64): Likewise.
	* sysdeps/unix/sysv/linux/pwritev.c (pwritev): Likewise.
	* sysdeps/unix/sysv/linux/pwritev64.c (pwritev64): Likewise.
	* sysdeps/unix/sysv/linux/bits/uio.h: Add supported preadv2/pwritev2
	support flags on Linux.
	* sysdeps/unix/sysv/linux/aarch64/libc.abilist (GLIBC_2.26): Add
	preadv2, preadv64v2, pwritev2, pwritev64v2.
	* sysdeps/unix/sysv/linux/alpha/libc.abilist (GLIBC_2.26): Likewise.
	* sysdeps/unix/sysv/linux/arm/libc.abilist (GLIBC_2.26): Likewise.
	* sysdeps/unix/sysv/linux/hppa/libc.abilist (GLIBC_2.26): Likewise.
	* sysdeps/unix/sysv/linux/i386/libc.abilist (GLIBC_2.26): Likewise.
	* sysdeps/unix/sysv/linux/ia64/libc.abilist (GLIBC_2.26): Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist (GLIBC_2.26):
	Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist (GLIBC_2.26):
	Likewise.
	* sysdeps/unix/sysv/linux/microblaze/libc.abilist (GLIBC_2.26):
	Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist (GLIBC_2.26):
	Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist (GLIBC_2.26):
	Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist (GLIBC_2.26):
	Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist (GLIBC_2.26):
	Likewise.
	* sysdeps/unix/sysv/linux/nios2/libc.abilist (GLIBC_2.26): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
	(GLIBC_2.26): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
	(GLIBC_2.26): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist (GLIBC_2.26):
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
	(GLIBC_2.26): Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist (GLIBC_2.26):
	Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist (GLIBC_2.26):
	Likewise.
	* sysdeps/unix/sysv/linux/sh/libc.abilist (GLIBC_2.26): Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist (GLIBC_2.26):
	Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist (GLIBC_2.26):
	Likewise.
	* sysdeps/sysv/linux/tile/tilegx/tilegx32/libc.abilist (GLIBC_2.26):
	Likewise.
	* sysdeps/sysv/linux/tile/tilegx/tilegx64/libc.abilist (GLIBC_2.26):
	Likewise.
	* sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist (GLIBC_2.26):
	Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist (GLIBC_2.26):
	Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist (GLIBC_2.26):
	Likewise.
2017-05-31 17:35:46 -03:00