Commit Graph

31353 Commits

Author SHA1 Message Date
Carlos O'Donell fa17b9c720 Bug 20116: Clarify behaviour of PD->lock.
Add comments to the concurrency notes to clarify the semaphore-like and
mutex-like behaviours of PD->lock.
2017-05-03 15:24:43 -04:00
Adhemerval Zanella b62c381591 Consolidate Linux epoll_wait syscall
This patch consolidates the epoll_wait Linux syscall generation on
sysdeps/unix/sysv/linux/epoll_wait.c.  The implementation tries to
use __NR_epoll_wait if defined, otherwise calls epoll_pwait.

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/epoll_wait.c: New file.
	* sysdeps/unix/sysv/linux/generic/epoll_wait.c: Remove file.
	* sysdeps/unix/sysv/linux/syscalls.list: Remove epoll_wait from
	auto-generation list.
2017-05-03 10:36:43 -03:00
Adhemerval Zanella 26f28fd73d Consolidate Linux select implementation
This patch consolidates the select Linux syscall implementation on
sysdeps/unix/sysv/linux/select.c.  The changes are:

  1. Remove select from auto-generation syscalls.list on the architecture
     that uses __NR_select.
  2. Remove generic implementation add a default one that handle all
     current cases (with the expection of alpha)
     The new default implementation will either use __NR_select if
     available of fallback to __NR_pselect6 otherwise.
  3. Add a alpha outlier implementation which requires old compatibility
     symbols.

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/alpha/Makefile (sysdep_routines): Add
	osf_select.
	* sysdeps/unix/sysv/linux/alpha/select.c: New file.
	* sysdeps/unix/sysv/linux/alpha/syscalls.list: Remove select and
	osf_select from auto-generation list.
	* sysdeps/unix/sysv/linux/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/generic/select.c: Remove file.
	* sysdeps/unix/sysv/linux/select.c: New file.
2017-05-03 10:36:36 -03:00
Adhemerval Zanella b5eede9730 Consolidate Linux poll implementation
This patch consolidates the poll Linux syscall implementation on
sysdeps/unix/sysv/linux/poll.c.  It basically removes poll from
auto-generation list and add a default implementation that either
call __NR_poll directly (if the kernel headers defines it) or
ppoll adjusting the timeout argument (as the generic implementation).

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/generic/poll.c: Remove file.
	* sysdeps/unix/sysv/linux/poll.c: New file.
	* sysdeps/unix/sysv/linux/syscalls.list: Remove poll from
	auto-generation list.
2017-05-03 10:36:01 -03:00
Joseph Myers 14ea415d04 Add HWCAP_ASIMDRDM from Linux 4.11 to AArch64 bits/hwcap.h.
This patch adds the HWCAP_ASIMDRDM macro from Linux 4.11 to the
AArch64 bits/hwcap.h.

Tested (compilation only) with build-many-glibcs.py.

	* sysdeps/unix/sysv/linux/aarch64/bits/hwcap.h (HWCAP_ASIMDRDM):
	New macro.
2017-05-03 11:04:07 +00:00
Vladimir Mezentsev b3d9c9a20c sparc: handle R_SPARC_DISP64 and R_SPARC_REGISTER relocs
The Studio compiler generates relocation types which are not supported
in glibc. Handle these relocs.

Tested in sparc64-linux-gnu. No regressions.

	BZ #21179]
	* sysdeps/sparc/sparc64/dl-machine.h: Handle R_SPARC_DISP64 and
	R_SPARC_REGISTER relocations.
2017-05-02 16:57:31 -03:00
Adhemerval Zanella 827b823783 posix: Fix internal p{read,write} plt usage
This patch adds internal alias for __pread, __pread64, and __pwrite
following the already in place one for __pwrite64.  This is not used
in any implementation but on microblaze on preadv/pwritev fallback
(since it does not define __ASSUME_PREADV).

In fact it was signaled by commit c35db50ff5 which update the expected
localptl.data for the architecture based on resulted value.  This patch
updates the plt for microblaze now that p{read,write}{64} are correctly
routed to use internal alias.

Checked on x86_64-linux-gnu and a build for all supported architectures
(no all variants although).

	* include/unistd.h (__pread): Add libc_hidden_proto.
	(__pread64): Likewise.
	(__pwrite): Likewise.
	* sysdeps/unix/sysv/linux/microblaze/localplt.data [libc.so]
	(__pread64): Remove.
	* sysdeps/unix/sysv/linux/pread.c (__pread64): Add libc_hidden_weak.
	* sysdeps/unix/sysv/linux/pread64.c (__pread64): Likewise.
	* sysdeps/unix/sysv/linux/pwrite.c (__pwrite): Likewise.
2017-05-02 14:57:40 -03:00
Tulio Magno Quites Machado Filho 24a10cfb3e powerpc: Update powerpc-fpu libm-test-ulps
* sysdeps/powerpc/fpu/libm-test-ulps: Update.
2017-05-02 13:40:11 -03:00
Adhemerval Zanella fa66f341a0 nptl: Using libsupport for tst-cancel4*
Checked on x86_64-linux-gnu.

	* nptl/tst-cancel4-common.c: Use libsupport.
	* nptl/tst-cancel4-common.h: Likewise.
	* nptl/tst-cancel4.c (tf_read): Likewise.
	(tf_readv): Likewise.
	(tf_write): Likewise.
	(tf_writev): Likewise.
	(tf_sleep): Likewise.
	(tf_usleep): Likewise.
	(tf_nanosleep): Likewise.
	(tf_select): Likewise.
	(tf_pselect): Likewise.
	(tf_poll): Likewise.
	(tf_ppoll): Likewise.
	(tf_wait): Likewise.
	(tf_waitpid): Likewise.
	(tf_waitid): Likewise.
	(tf_sigpause): Likewise.
	(tf_sigsuspend): Likewise.
	(tf_sigwait): Likewise.
	(tf_sigwaitinfo): Likewise.
	(tf_sigtimedwait): Likewise.
	(tf_pause): Likewise.
	(tf_accept): Likewise.
	(tf_send): Likewise.
	(tf_recv): Likewise.
	(tf_recvfrom): Likewise.
	(tf_recvmsg): Likewise.
	(tf_open): Likewise.
	(tf_close): Likewise.
	(tf_pread): Likewise.
	(tf_pwrite): Likewise.
	(tf_preadv): Likewise.
	(tf_pwritev): Likewise.
	(tf_fsync): Likewise.
	(tf_fdatasync): Likewise.
	(tf_msync): Likewise.
	(tf_sendto): Likewise.
	(tf_sendmsg): Likewise.
	(tf_creat): Likewise.
	(tf_connect): Likewise.
	(tf_tcdrain): Likewise.
	(tf_msgrcv): Likewise.
	(tf_msgsnd): Likewise.
	* nptl/tst-cancel4_1.c (tf_sendmmsg): Likewise.
	* nptl/tst-cancel4_2.c (tf_recvmmsg): Likewise.
2017-05-01 15:41:46 -03:00
Adhemerval Zanella ffd6023885 posix: Using libsupport for p{write,read}v tests
Checked on x86_64-linux-gnu.

	* misc/tst-preadvwritev-common.c (do_prepare): Use libsupport
	expected arguments.
	(do_test): Adapt to use libsupport.
2017-05-01 15:41:45 -03:00
Joseph Myers 25e39b4229 Add TCP_FASTOPEN_CONNECT from Linux 4.11 to netinet/tcp.h.
This patch adds the TCP_FASTOPEN_CONNECT macro from Linux 4.11 to
sysdeps/gnu/netinet/tcp.h.

Tested for x86-64.

	* sysdeps/gnu/netinet/tcp.h (TCP_FASTOPEN_CONNECT): New macro.
2017-05-01 16:18:31 +00:00
Joseph Myers ef0e5f2f5c Add PF_SMC, AF_SMC from Linux 4.11 to bits/socket.h.
This patch adds the PF_SMC / AF_SMC macros from Linux 4.11 to
sysdeps/unix/sysv/linux/bits/socket.h.

Tested for x86_64.

	* sysdeps/unix/sysv/linux/bits/socket.h (PF_SMC): New macro.
	(PF_MAX): Set to 44.
	(AF_SMC): New macro.
2017-05-01 15:11:33 +00:00
Joseph Myers 3e4df7ef13 Default Linux kernel version in build-many-glibcs.py to 4.11.
* scripts/build-many-glibcs.py (Context.checkout): Default Linux
	kernel version to 4.11.
2017-05-01 11:15:43 +00:00
Tulio Magno Quites Machado Filho c064f6a613 powerpc: Fix logbl on power7 [BZ# 21280]
1. Fix the results for negative subnormals by ignoring the signal when
    normalizing the value.
 2. Fix the output when the high part is a power of 2 and the low part
    is a nonzero number with opposite sign.  This fix is based on commit
    380bd0fd24.

After applying this patch, logbl() tests pass cleanly on POWER >= 7.

Tested on powerpc, powerpc64 and powerpc64le

	[BZ #21280]
	* sysdeps/powerpc/power7/fpu/s_logbl.c (__logbl): Ignore the
	signal of subnormals and adjust the exponent of power of 2 down
	when low part has opposite sign.
2017-04-28 19:45:52 -03:00
Paul E. Murphy 2f7f3cd8cd powerpc64le: Create divergent sysdep directory for powerpc64le.
float128 on powerpc64le requires the addition of the ieee754/float128
sysdep, whereas powerpc64 doesn't.  This requires creating a bunch of
submachine and cpu directories and Implies files which just point
towards their powerpc64 equivalent.

Tested on P7, P8, and generic powerpc64le targets with and without
multiarch.

	* sysdeps/powerpc/powerpc64le/Implies: New file.
	* sysdeps/powerpc/powerpc64le/fpu/Implies: New file.
	* sysdeps/powerpc/powerpc64le/fpu/multiarch/Implies: New file.
	* sysdeps/powerpc/powerpc64le/multiarch/Implies: New file.
	* sysdeps/powerpc/powerpc64le/power7/Implies: New file.
	* sysdeps/powerpc/powerpc64le/power7/fpu/Implies: New file.
	* sysdeps/powerpc/powerpc64le/power7/fpu/multiarch/Implies: New file.
	* sysdeps/powerpc/powerpc64le/power7/multiarch/Implies: New file.
	* sysdeps/powerpc/powerpc64le/power8/Implies: New file.
	* sysdeps/powerpc/powerpc64le/power8/fpu/Implies: New file.
	* sysdeps/powerpc/powerpc64le/power8/fpu/multiarch/Implies: New file.
	* sysdeps/powerpc/powerpc64le/power8/multiarch/Implies: New file.
	* sysdeps/powerpc/powerpc64le/power9/Implies: New file.
	* sysdeps/powerpc/powerpc64le/power9/fpu/Implies: New file.
	* sysdeps/powerpc/powerpc64le/power9/fpu/multiarch/Implies: New file.
	* sysdeps/powerpc/powerpc64le/power9/multiarch/Implies: New file.
	* sysdeps/powerpc/preconfigure: New file.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64le/Implies: New file.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64le/fpu/Implies: New file.
2017-04-28 14:17:57 -03:00
Joseph Myers 085e07db22 conformtest: Allow time.h inclusion from semaphore.h for XOPEN2K.
POSIX.1:2001 added sem_timedwait, but said nothing about defining
struct timespec in semaphore.h.  The 2008 edition added a
corresponding permission to include <time.h> from <semaphore.h>.
Since this is the normal POSIX approach in such cases, it seems
appropriate to consider this a bug fix, and so this patch makes the
conform/ tests allow that inclusion for POSIX.1:2001 as well.

Tested for x86_64.

	* conform/data/semaphore.h-data [XOPEN2K] (time.h): Allow header
	inclusion.
	* conform/Makefile (test-xfail-XOPEN2K/semaphore.h/conform):
	Remove.
2017-04-28 16:52:16 +00:00
Joseph Myers 0516e24d18 conformtest: Fix XPG standard naming.
The conform/ tests test -D_XOPEN_SOURCE under the name "XPG3", and
-D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED under the name "XPG4".

That naming is misleading.  _XOPEN_SOURCE_EXTENDED actually means
XPG4.2, including UX-shaded interfaces.  _XOPEN_SOURCE actually means
XPG4, or XPG4.2 without UX-shaded interfaces.  (Prior XPG versions
also used _XOPEN_SOURCE, but without any versioning of the values of
the macro, so XPG4.2 without UX-shaded interfaces is the only sensible
set of interfaces for glibc to expose given _XOPEN_SOURCE=1 without
_XOPEN_SOURCE_EXTENDED defined.)

This patch fixes the naming in the conform/ tests, so that what is now
called XPG4 is changed to XPG42, and what is now called XPG3 is
changed to XPG4.

Tested for x86_64 (and verified the complete set of expectations is
unchanged by the patch beyond the intended renaming).

	* conform/GlibcConform.pm (XPG4): Rename standard to XPG42.
	(XPG3): Rename standard to XPG4.
	* conform/Makefile: Likewise.
	* conform/list-header-symbols.pl: Likewise.
	* conform/data/aio.h-data: Likewise.
	* conform/data/arpa/inet.h-data: Likewise.
	* conform/data/complex.h-data: Likewise.
	* conform/data/ctype.h-data: Likewise.
	* conform/data/dlfcn.h-data: Likewise.
	* conform/data/fcntl.h-data: Likewise.
	* conform/data/fenv.h-data: Likewise.
	* conform/data/float.h-data: Likewise.
	* conform/data/fmtmsg.h-data: Likewise.
	* conform/data/ftw.h-data: Likewise.
	* conform/data/grp.h-data: Likewise.
	* conform/data/inttypes.h-data: Likewise.
	* conform/data/iso646.h-data: Likewise.
	* conform/data/langinfo.h-data: Likewise.
	* conform/data/libgen.h-data: Likewise.
	* conform/data/limits.h-data: Likewise.
	* conform/data/locale.h-data: Likewise.
	* conform/data/math.h-data: Likewise.
	* conform/data/mqueue.h-data: Likewise.
	* conform/data/ndbm.h-data: Likewise.
	* conform/data/net/if.h-data: Likewise.
	* conform/data/netdb.h-data: Likewise.
	* conform/data/netinet/in.h-data: Likewise.
	* conform/data/poll.h-data: Likewise.
	* conform/data/pthread.h-data: Likewise.
	* conform/data/pwd.h-data: Likewise.
	* conform/data/sched.h-data: Likewise.
	* conform/data/search.h-data: Likewise.
	* conform/data/semaphore.h-data: Likewise.
	* conform/data/signal.h-data: Likewise.
	* conform/data/spawn.h-data: Likewise.
	* conform/data/stdbool.h-data: Likewise.
	* conform/data/stdint.h-data: Likewise.
	* conform/data/stdio.h-data: Likewise.
	* conform/data/stdlib.h-data: Likewise.
	* conform/data/string.h-data: Likewise.
	* conform/data/strings.h-data: Likewise.
	* conform/data/stropts.h-data: Likewise.
	* conform/data/sys/mman.h-data: Likewise.
	* conform/data/sys/resource.h-data: Likewise.
	* conform/data/sys/select.h-data: Likewise.
	* conform/data/sys/socket.h-data: Likewise.
	* conform/data/sys/stat.h-data: Likewise.
	* conform/data/sys/statvfs.h-data: Likewise.
	* conform/data/sys/time.h-data: Likewise.
	* conform/data/sys/timeb.h-data: Likewise.
	* conform/data/sys/types.h-data: Likewise.
	* conform/data/sys/uio.h-data: Likewise.
	* conform/data/sys/un.h-data: Likewise.
	* conform/data/sys/wait.h-data: Likewise.
	* conform/data/syslog.h-data: Likewise.
	* conform/data/termios.h-data: Likewise.
	* conform/data/tgmath.h-data: Likewise.
	* conform/data/time.h-data: Likewise.
	* conform/data/ucontext.h-data: Likewise.
	* conform/data/unistd.h-data: Likewise.
	* conform/data/utmpx.h-data: Likewise.
	* conform/data/varargs.h-data: Likewise.
	* conform/data/wchar.h-data: Likewise.
	* conform/data/wctype.h-data: Likewise.
2017-04-27 20:29:35 +00:00
Joseph Myers 6ef8a2c76a Default build-many-glibcs.py to GCC 7 branch.
Now there is a GCC 7 release branch, this patch makes
build-many-glibcs.py default to using it instead of GCC 6.

Relative to GCC 6, this fixes the MicroBlaze build but introduces ICEs
building glibc testcases for SH (GCC PRs 78459, 78460; the latter is
an out-of-memory issue so you may want to set memory limits when
running build-many-glibcs.py).

	* scripts/build-many-glibcs.py (Context.checkout): Default gcc
	version to 7 branch.
2017-04-26 15:26:47 +00:00
Uros Bizjak 1e1f44de64 Add earlyclobber to sqrtt/sqrtf insns.
When using software completions, we have to prevent assembler to match
input and output operands of sqrtt/sqrtf insn. Add earlyclobber to
output operand to avoid unwanted operand matching.

2017-04-14  Uros Bizjak  <ubizjak@gmail.com>

    * sysdeps/alpha/fpu/math_private.h (__ieee754_sqrt): Add
    earlyclobber to output operand of sqrt insn.
    (__ieee754_sqrtf): Ditto.
2017-04-26 04:21:59 -07:00
Joseph Myers 9fe3c80c7c Fix sys/socket.h namespace issues from sys/uio.h inclusion (bug 21426).
sys/socket.h includes sys/uio.h to get the definition of the iovec
structure.

POSIX allows sys/socket.h to make all sys/uio.h symbols visible.
However, all of sys/uio.h is XSI-shaded, so for non-XSI POSIX this
results in conformtest failures (for sys/socket.h and other headers
that include it):

    Namespace violation: "UIO_MAXIOV"
    Namespace violation: "readv"
    Namespace violation: "writev"

Now, there is some ambiguity in POSIX about what namespace
reservations apply in this case - see
http://austingroupbugs.net/view.php?id=1127 - but glibc convention
would still avoid declaring readv and writev, for example, for feature
test macros that don't include them (if only headers from the relevant
standard are included), even if such declarations are permitted, so
there is a bug here according to glibc conventions.

This patch moves the struct iovec definition to a new
bits/types/struct_iovec.h header and includes that from sys/socket.h
instead of including the whole of sys/uio.h.  This fixes the namespace
issue; however, three files in glibc that were relying on the implicit
inclusion needed to be updated to include sys/uio.h explicitly.  So
there is a question of whether sys/socket.h should continue to include
sys/uio.h under some conditions, such as __USE_XOPEN or __USE_MISC or
__USE_XOPEN || __USE_MISC, for greater compatibility with code that
(wrongly) expects this optional inclusion to be present there.  (I
think the three affected files in glibc should still have explicit
sys/uio.h inclusions added in any case, however.)

Tested for x86_64.

	[BZ #21426]
	* misc/bits/types/struct_iovec.h: New file.
	* misc/Makefile (headers): Add bits/types/struct_iovec.h.
	* include/bits/types/struct_iovec.h: New file.
	* bits/uio.h (struct iovec): Replace by inclusion of
	<bits/types/struct_iovec.h>.
	* sysdeps/unix/sysv/linux/bits/uio.h (struct iovec): Likewise.
	* socket/sys/socket.h: Include <bits/types/struct_iovec.h> instead
	of <sys/uio.h>.
	* nptl/tst-cancel4.c: Include <sys/uio.h>
	* posix/test-errno.c: Likewise.
	* support/resolv_test.c: Likewise.
	* conform/Makefile (test-xfail-POSIX2008/arpa/inet.h/conform):
	Remove.
	(test-xfail-POSIX2008/netdb.h/conform): Likewise.
	(test-xfail-POSIX2008/netinet/in.h/conform): Likewise.
	(test-xfail-POSIX2008/sys/socket.h/conform): Likewise.
2017-04-25 17:52:47 +00:00
Joseph Myers 3fa6e4872d conformtest: Allow *_t in sys/socket.h.
The conformtest expectations in sys/socket.h are missing the standard
POSIX allowance for all headers to define *_t names.  For XSI standard
versions that allowance comes in via the permission to include
<sys/uio.h> (for which the expectations properly allow *_t), but for
non-XSI POSIX nothing brings in that allowance and spurious namespace
failures occur.  This patch adds the required permission to the
expectations to remove the spurious failures (by itself this does not
allow any XFAILs to be removed).

Tested for x86_64.

	* conform/data/sys/socket.h-data (*_t): Allow.
2017-04-25 16:00:28 +00:00
Adhemerval Zanella 249548e476 posix: Remove ununsed posix_spawn internal assignment
The internal 'ret' variable in '__spawni_child' function is not
used after assignment in most cases.

Checked on x86_64-linux-gnu.

	* sysdeps/unix/sysv/linux/spawni.c (__spawni_child): Remove ununsed
	assignment.
2017-04-25 08:51:21 -03:00
Adhemerval Zanella daeb1fa2e1 [BZ 21340] add support for POSIX_SPAWN_SETSID
This patch adds support for the POSIX_SPAWN_SETSID flag.

It was recently accepted by the Austin Group:
http://austingroupbugs.net/view.php?id=1044

Checked on x86_64

	Daurnimator  <quae@daurnimator.com>
	Adhemerval Zanella  <adhemerval.zanella@linaro.org>

	[BZ #21340]
	* posix/Makefile (tests): Add tst-posix_spawn-setsid to list of tests.
	* posix/spawn.h: define POSIX_SPAWN_SETSID flag.
	* posix/spawnattr_setflags.c (ALL_FLAGS): Add POSIX_SPAWN_SETSID to
	valid flags.
	* posix/tst-posix_spawn-setsid.c: Add test for POSIX_SPAWN_SETSID.
	* sysdeps/mach/hurd/spawni.c (__spawni): Implementation of
	POSIX_SPAWN_SETSID.
	* sysdeps/posix/spawni.c (__spawni): Likewise.
	* sysdeps/unix/sysv/linux/spawni.c (__spawni_child): Likewise.
	* NEWS: Add note about POSIX_SPAWN_SETSID support.
2017-04-25 08:51:12 -03:00
Gabriel F. T. Gomes 9581e76dbb Macroize function declarations in math_private.h
This patch moves the declaration of many floating-point functions from
math_private.h to math_private_calls.h and macroize the declaration to
be dependent on floating-point type.  For each of float, double, and
long double, the new header file is included once.  This reduces the
amount of repetitive boilerplate that will be required when adding
float128 versions of these functions.

Tested for powerpc64le and s390x.

	* sysdeps/generic/math_private.h: Move the declaration of many
	functions to sysdeps/generic/math_private_calls.h.
	* sysdeps/generic/math_private_calls.h: New file with the
	declarations of the functions removed from math_private.h
	macroized by floating-point type.
2017-04-24 09:30:56 -03:00
Stefan Liebler 5ea9ce3749 S390: Move utf8-utf32-z9.c to multiarch folder and use s390_libc_ifunc_expr macro.
The utf8-utf32-z9.c iconv module is using ifunc and thus the ifunc part should
be in multiarch folder.  Otherwise ifunc is used even if you configure
with --disable-multi-arch.

This patch moves the ifunc resolvers to the new file
sysdeps/s390/multiarch/utf8-utf32-z9.c. The resolvers are now implemented
with s390_libc_ifunc_expr macro instead of using gcc attribute ifunc directly.

The ifunc versions are implemented in sysdeps/s390/utf8-utf32-z9.c.
Each version is only implemented if needed or supported.  Therefore there is
a block at beginning of the file which selects the versions which should be
defined depending on support for multiarch, vector-support and used minimum
architecture level.  This block defines HAVE_[FROM|TO]_[C|CU|VX] to 1 or 0.
The code below is rearranged and surrounded
by #if HAVE_[FROM|TO]_[C|CU|VX] == 1.  There is no functional change.

The cu instructions are z9 zarch instructions.  As the major distros are
already using the newer z196 as architecture level set, those instructions
can be used as fallback version instead of the c-code.  This behaviour is
decided at compile time via HAVE_S390_MIN_Z196_ZARCH_ASM_SUPPORT.

ChangeLog:

	* sysdeps/s390/multiarch/utf8-utf32-z9.c: New File.
	* sysdeps/s390/utf8-utf32-z9.c: Move ifunc resolvers to multiarch
	folder and define ifunc versions depending on HAVE_[FROM|TO]_[C|CU|VX].
	(HAVE_FROM_C, HAVE_FROM_CU, HAVE_FROM_VX, HAVE_TO_C, HAVE_TO_VX,
	FROM_LOOP_DEFAULT, FROM_LOOP_C, FROM_LOOP_CU, FROM_LOOP_VX,
	TO_LOOP_DEFAULT, TO_LOOP_C, TO_LOOP_VX): New Define.
2017-04-21 15:30:00 +02:00
Stefan Liebler 85286aaf1d S390: Move utf16-utf32-z9.c to multiarch folder and use s390_libc_ifunc_expr macro.
The utf16-utf32-z9.c iconv module is using ifunc and thus the ifunc part should
be in multiarch folder.  Otherwise ifunc is used even if you configure
with --disable-multi-arch.

This patch moves the ifunc resolvers to the new file
sysdeps/s390/multiarch/utf16-utf32-z9.c. The resolvers are now implemented
with s390_libc_ifunc_expr macro instead of using gcc attribute ifunc directly.

The ifunc versions are implemented in sysdeps/s390/utf16-utf32-z9.c.
Each version is only implemented if needed or supported.  Therefore there is
a block at beginning of the file which selects the versions which should be
defined depending on support for multiarch, vector-support and used minimum
architecture level.  This block defines HAVE_[FROM|TO]_[C|VX] to 1 or 0.
The code below is rearranged and surrounded
by #if HAVE_[FROM|TO]_[C|VX] == 1.  There is no functional change.

ChangeLog:

	* sysdeps/s390/multiarch/utf16-utf32-z9.c: New File.
	* sysdeps/s390/utf16-utf32-z9.c: Move ifunc resolvers to multiarch
	folder and define ifunc versions depending on HAVE_[FROM|TO]_[C|VX].
	(HAVE_FROM_C, HAVE_FROM_VX, HAVE_TO_C, HAVE_TO_VX, FROM_LOOP_DEFAULT,
	FROM_LOOP_C, FROM_LOOP_VX, TO_LOOP_DEFAULT, TO_LOOP_C, TO_LOOP_VX):
	New Define.
2017-04-21 15:30:00 +02:00
Stefan Liebler df6cc7ee3b S390: Move utf8-utf16-z9.c to multiarch folder and use s390_libc_ifunc_expr macro.
The utf8-utf16-z9.c iconv module is using ifunc and thus the ifunc part should
be in multiarch folder.  Otherwise ifunc is used even if you configure
with --disable-multi-arch.

This patch moves the ifunc resolvers to the new file
sysdeps/s390/multiarch/utf8-utf16-z9.c. The resolvers are now implemented
with s390_libc_ifunc_expr macro instead of using gcc attribute ifunc directly.

The ifunc versions are implemented in sysdeps/s390/utf8-utf16-z9.c.
Each version is only implemented if needed or supported.  Therefore there is
a block at beginning of the file which selects the versions which should be
defined depending on support for multiarch, vector-support and used minimum
architecture level.  This block defines HAVE_[FROM|TO]_[C|CU|VX] to 1 or 0.
The code below is rearranged and surrounded
by #if HAVE_[FROM|TO]_[C|CU|VX] == 1.  There is no functional change.

The cu instructions are z9 zarch instructions.  As the major distros are
already using the newer z196 as architecture level set, those instructions
can be used as fallback version instead of the c-code.  This behaviour is
decided at compile time via HAVE_S390_MIN_Z196_ZARCH_ASM_SUPPORT.

ChangeLog:

	* sysdeps/s390/multiarch/utf8-utf16-z9.c: New File.
	* sysdeps/s390/utf8-utf16-z9.c: Move ifunc resolvers to multiarch
	folder and define ifunc versions depending on HAVE_[FROM|TO]_[C|CU|VX].
	(HAVE_FROM_C, HAVE_FROM_CU, HAVE_FROM_VX, HAVE_TO_C, HAVE_TO_VX,
	FROM_LOOP_DEFAULT, FROM_LOOP_C, FROM_LOOP_CU, FROM_LOOP_VX,
	TO_LOOP_DEFAULT, TO_LOOP_C, TO_LOOP_VX): New Define.
2017-04-21 15:30:00 +02:00
Stefan Liebler 51213e2b8d S390: Use new s390_libc_ifunc_expr macro in s390 8bit-generic.c.
This patch adds s390_libc_ifunc_expr macro which uses the __ifunc base macro
in include/libc-symbols.h and lets the user define a generic expression to
choose the correct ifunc variant.  Furthermore as the base macro is used,
the ifunc resolver functions are now also using inhibit_stack_protector.
S390 needs its own version due to the hwcap argument of the ifunc resolver.

This new macro is now used in iconv code in 8bit-generic.c instead of using
gcc attribute ifunc directly.

ChangeLog:

	* sysdeps/s390/multiarch/ifunc-resolve.h
	(s390_libc_ifunc_expr_init, s390_libc_ifunc_expr): New Define.
	* sysdeps/s390/multiarch/8bit-generic.c
	(__to_generic, __from_generic): Use s390_libc_ifunc_expr to
	define ifunc resolvers.
2017-04-21 15:30:00 +02:00
Florian Weimer 44e4b889ab manual: Document replacing malloc [BZ #20424] 2017-04-21 10:28:37 +02:00
Joseph Myers 832d8bc00b Do not use wildcard symbol names for public versions in Versions files.
As noted in
<https://sourceware.org/ml/libc-alpha/2012-12/msg00240.html>,
stdlib/Versions and wcsmbs/Versions list some functions as
__strto*_internal and __wcsto*_internal rather than explicitly listing
the symbols to be exported (so any new internal function matching one
of those patterns would be wrongly added to version GLIBC_2.0), which
seems like a bad idea.  This patch changes those files to list the
exported symbols explicitly.  There are still entries in
sysdeps/nacl/Versions for __nacl_irt_*, but as GLIBC_PRIVATE symbols
that seems less significant.

Tested with build-many-glibcs.py that installed stripped shared
libraries are unchanged by the patch.

	* stdlib/Versions (__strtod_internal): List explicitly, not as
	wildcard.
	(__strtof_internal): Likewise.
	(__strtold_internal): Likewise.
	(__strtol_internal): Likewise.
	(__strtoll_internal): Likewise.
	(__strtoul_internal): Likewise.
	(__strtoull_internal): Likewise.
	(__strtoq_internal): Likewise.
	(__strtouq_internal): Likewise.
	* wcsmbs/Versions (__wcstod_internal): Likewise.
	(__wcstof_internal): Likewise.
	(__wcstold_internal): Likewise.
	(__wcstol_internal): Likewise.
	(__wcstoll_internal): Likewise.
	(__wcstoul_internal): Likewise.
	(__wcstoull_internal): Likewise.
2017-04-20 20:35:21 +00:00
Adhemerval Zanella d76d370355 Fix missing timespec definition for sys/stat.h (BZ #21371)
As indicated by the bug report, the 'struct timespec' definition
is not defined for '_XOPEN_SOURCE=700' and '_POSIX_C_SOURCE=200112L'.

It is because current code only includes its definition if __USE_ATFILE
is defined and the define is only set with:

  1. _GNU_SOURCE and/or _ATFILE_SOURCE definition.
  2. _POSIX_C_SOURCE >= 200809L

However, the 'st_*' fields in 'struct stat' are defined if __USE_XOPEN2K8.
This patch uses the same logic for 'struct timespec' inclusion.

Tested on x86_64-linux-gnu.

	* io/sys/stat.h: Use __USE_XOPEN2K8 insteaf of __USE_ATFILE for
	struct timespec definition.
2017-04-20 17:09:17 -03:00
Florian Weimer a0704b1ac7 nss_dns: Correct parentheses for the __glibc_unlikely argument
This fixes commit bee05c9d58.
2017-04-19 22:19:17 +02:00
Florian Weimer b8129a415e rcmd/rexec: Fix typo in comment 2017-04-19 22:19:17 +02:00
Zack Weinberg 25cfd50214 A third round of inclusion fixes for _ISOMAC testsuite.
* posix/tst-mmap-offset.c: Include stdint.h.
	* resolv/tst-ns_name_compress.c: Include string.h.
	* resolv/tst-resolv-edns.c: Include resolv.h.
2017-04-19 14:39:04 -04:00
Florian Weimer bee05c9d58 resolv: Replace __builtin_expect with __glibc_unlikely/__glibc_likely 2017-04-19 14:29:24 +02:00
Christopher Chittleborough 3e2cf872a5 Bug 21399: Fix CP1254 comment for U+00EC 2017-04-19 08:10:35 -04:00
Florian Weimer 2f83a7294d Create more sockets with SOCK_CLOEXEC [BZ #15722] 2017-04-19 07:45:04 +02:00
Florian Weimer e92030239a Assume that accept4 is always available and works
Simplify the Linux accept4 implementation based on the assumption
that it is available in some way.  __ASSUME_ACCEPT4_SOCKETCALL was
previously unused, so remove it.

For ia64, the accept4 system call (and socket call) were backported
in kernel version 3.2.18.  Reflect this in the installation
instructions.
2017-04-19 07:44:48 +02:00
Joseph Myers 62f71aad7e conformtest: Enable tests when cross compiling.
This patch enables the compilation part of the conformtest tests (the
vast bulk of them) when cross compiling, so making it easy to run them
across many configurations with build-many-glibcs.py.

Tested with build-many-glibcs.py.

	* conform/Makefile (tests-special): Do not make addition of
	$(conformtest-header-tests) conditional on [$(cross-compiling) = no].
	(generated): Do not make addition of $(conformtest-header-base)
	conditional on [$(cross-compiling) = no].
2017-04-18 23:51:35 +00:00
Joseph Myers 2288c2674d Fix bits/socket.h IOC* namespace issues (bug 21267).
sysdeps/unix/sysv/linux/bits/socket.h includes asm/socket.h.  That
includes asm/sockios.h, which on MIPS includes asm/ioctl.h, resulting
in namespace violations from IOC* macros.

bits/socket.h already has code to handle asm/socket.h unconditionally
defining macros that are only wanted for __USE_MISC.  This patch
extends it to handle the IOC* macros as well (always undefining them
if not defined when bits/socket.h was included, as I don't think they
are part of the intended API even for __USE_MISC).

It's possible there should also be a kernel fix - it's not clear to me
that IOC* belong in the uapi headers, and even if they do they might
best be split out into another header to avoid getting defined by this
particular path.  But since glibc needs to deal with existing kernel
headers, it also seems appropriate to extend the existing workaround
to these macros.

Tested (compilation only) with build-many-glibcs.py.

	[BZ #21267]
	* sysdeps/unix/sysv/linux/bits/socket.h (IOCSIZE_MASK): Undefine
	if defined by <asm/socket.h> and not previously defined.
	(IOCSIZE_SHIFT): Likewise.
	(IOC_IN): Likewise.
	(IOC_INOUT): Likewise.
	(IOC_OUT): Likewise.
2017-04-18 21:22:51 +00:00
H.J. Lu 4cb334c4d6 x86: Use AVX2 memcpy/memset on Skylake server [BZ #21396]
On Skylake server, AVX512 load/store instructions in memcpy/memset may
lead to lower CPU turbo frequency in certain situations.  Use of AVX2
in memcpy/memset has been observed to have improved overall performance
in many workloads due to the higher frequency.

Since AVX512ER is unique to Xeon Phi, this patch sets Prefer_No_AVX512
if AVX512ER isn't available so that AVX2 versions of memcpy/memset are
used on Skylake server.

	[BZ #21396]
	* sysdeps/x86/cpu-features.c (init_cpu_features): Set
	Prefer_No_AVX512 if AVX512ER isn't available.
	* sysdeps/x86/cpu-features.h (bit_arch_Prefer_No_AVX512): New.
	(index_arch_Prefer_No_AVX512): Likewise.
	* sysdeps/x86_64/multiarch/memcpy.S (__new_memcpy): Don't use
	AVX512 version if Prefer_No_AVX512 is set.
	* sysdeps/x86_64/multiarch/memcpy_chk.S (__memcpy_chk):
	Likewise.
	* sysdeps/x86_64/multiarch/memmove.S (__libc_memmove): Likewise.
	* sysdeps/x86_64/multiarch/memmove_chk.S (__memmove_chk):
	Likewise.
	* sysdeps/x86_64/multiarch/mempcpy.S (__mempcpy): Likewise.
	* sysdeps/x86_64/multiarch/mempcpy_chk.S (__mempcpy_chk):
	Likewise.
	* sysdeps/x86_64/multiarch/memset.S (memset): Likewise.
	* sysdeps/x86_64/multiarch/memset_chk.S (__memset_chk):
	Likewise.
2017-04-18 14:01:45 -07:00
H.J. Lu 1c53cb49de x86: Set Prefer_No_VZEROUPPER if AVX512ER is available
AVX512ER won't be implemented in any Xeon processors and will be in
all Xeon Phi processors.  Don't check CPU model number when setting
Prefer_No_VZEROUPPER for Xeon Phi.  Instead, set Prefer_No_VZEROUPPER
if AVX512ER is available.  It works with current and future Xeon Phi
and non-Xeon Phi processors.

	* sysdeps/x86/cpu-features.c (init_cpu_features): Set
	Prefer_No_VZEROUPPER if AVX512ER is available.
	* sysdeps/x86/cpu-features.h
	(bit_cpu_AVX512PF): New.
	(bit_cpu_AVX512ER): Likewise.
	(bit_cpu_AVX512CD): Likewise.
	(bit_cpu_AVX512BW): Likewise.
	(bit_cpu_AVX512VL): Likewise.
	(index_cpu_AVX512PF): Likewise.
	(index_cpu_AVX512ER): Likewise.
	(index_cpu_AVX512CD): Likewise.
	(index_cpu_AVX512BW): Likewise.
	(index_cpu_AVX512VL): Likewise.
	(reg_AVX512PF): Likewise.
	(reg_AVX512ER): Likewise.
	(reg_AVX512CD): Likewise.
	(reg_AVX512BW): Likewise.
	(reg_AVX512VL): Likewise.
2017-04-18 08:27:32 -07:00
Florian Weimer cef9b65376 Assume that O_CLOEXEC is always defined and works 2017-04-18 14:56:51 +02:00
Florian Weimer b48061e1a5 Assume that dup3 is available 2017-04-18 14:42:19 +02:00
Florian Weimer 46d8874d5b Assume that pipe2 is always available
The Debian patches for Hurd (which are already required to build
glibc before this commit) contain an implementation of pipe2.
2017-04-18 14:09:01 +02:00
Florian Weimer 025b33ae84 malloc: Turn cfree into a compatibility symbol 2017-04-18 11:50:58 +02:00
Rajalakshmi Srinivasaraghavan 6c6ab1fc49 powerpc64: strrchr optimization for power8
P7 code is used for <=32B strings and for > 32B vectorized loops are used.
This shows as an average 25% improvement depending on the position of search
character.  The performance is same for shorter strings.
Tested on ppc64 and ppc64le.
2017-04-18 11:28:56 +05:30
Rabin Vincent 2604882cef [BZ 21357] unwind-dw2-fde: Call free() outside of unwind mutex
__deregister_frame_info_bases() calls free() while holding a mutex which
is also used from _Unwind_Find_FDE().  This leads to a deadlock if
AddressSanitizer uses _Unwind_Backtrace() from its free()
implementation.

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

	[BZ #21357]
	* sysdeps/generic/unwind-dw2-fde.c (__deregister_frame_info_bases):
	Call free() outside of mutex.
2017-04-17 12:03:44 -03:00
Florian Weimer a12ae89f86 Assume that O_NOFOLLOW is always defined 2017-04-13 21:28:18 +02:00
Florian Weimer 44500cbb25 resolv: Remove EDNS fallback [BZ #21369]
EDNS is disabled by default (so there is interoperability issue), and
the fallback code is problematic because it prevents an application
from obtaining DNSSEC data after a FORMERR response.
2017-04-13 13:22:51 +02:00