]> sourceware.org Git - glibc.git/log
glibc.git
7 years agoMake LD_HWCAP_MASK usable for static binaries
Siddhesh Poyarekar [Mon, 22 May 2017 19:29:16 +0000 (00:59 +0530)]
Make LD_HWCAP_MASK usable for static binaries

The LD_HWCAP_MASK environment variable was ignored in static binaries,
which is inconsistent with the behaviour of dynamically linked
binaries.  This seems to have been because of the inability of
ld_hwcap_mask being read early enough to influence anything but now
that it is in tunables, the mask is usable in static binaries as well.

This feature is important for aarch64, which relies on HWCAP_CPUID
being masked out to disable multiarch.  A sanity test on x86_64 shows
that there are no failures.  Likewise for aarch64.

* elf/dl-hwcaps.h [HAVE_TUNABLES]: Always read hwcap_mask.
* sysdeps/sparc/sparc32/dl-machine.h [HAVE_TUNABLES]:
Likewise.
* sysdeps/x86/cpu-features.c (init_cpu_features): Always set
up hwcap and hwcap_mask.

7 years agoaarch64: Allow overriding HWCAP_CPUID feature check using HWCAP_MASK
Siddhesh Poyarekar [Tue, 25 Apr 2017 17:09:17 +0000 (22:39 +0530)]
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.

7 years agotunables: Use glibc.tune.hwcap_mask tunable instead of _dl_hwcap_mask
Siddhesh Poyarekar [Thu, 1 Jun 2017 17:02:03 +0000 (22:32 +0530)]
tunables: Use glibc.tune.hwcap_mask tunable instead of _dl_hwcap_mask

Drop _dl_hwcap_mask when building with tunables.  This completes the
transition of hwcap_mask reading from _dl_hwcap_mask to tunables.

* elf/dl-hwcaps.h: New file.
* elf/dl-hwcaps.c: Include it.
(_dl_important_hwcaps)[HAVE_TUNABLES]: Read and update
glibc.tune.hwcap_mask.
* elf/dl-cache.c: Include dl-hwcaps.h.
(_dl_load_cache_lookup)[HAVE_TUNABLES]: Read
glibc.tune.hwcap_mask.
* sysdeps/sparc/sparc32/dl-machine.h: Likewise.
* elf/dl-support.c (_dl_hwcap2)[HAVE_TUNABLES]: Drop
_dl_hwcap_mask.
* elf/rtld.c (rtld_global_ro)[HAVE_TUNABLES]: Drop
_dl_hwcap_mask.
(process_envvars)[HAVE_TUNABLES]: Likewise.
* sysdeps/generic/ldsodefs.h (rtld_global_ro)[HAVE_TUNABLES]:
Likewise.
* sysdeps/x86/cpu-features.c (init_cpu_features): Don't
initialize dl_hwcap_mask when tunables are enabled.

7 years agoAdd include guards to dl-procinfo.h
Siddhesh Poyarekar [Wed, 7 Jun 2017 05:23:49 +0000 (10:53 +0530)]
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.

7 years agotunables: Add LD_HWCAP_MASK to tunables
Siddhesh Poyarekar [Mon, 17 Apr 2017 04:30:35 +0000 (10:00 +0530)]
tunables: Add LD_HWCAP_MASK to tunables

Add LD_HWCAP_MASK to tunables in preparation of it being removed from
rtld.c.  This allows us to read LD_HWCAP_MASK much earlier so that it
can influence IFUNC resolution in aarch64.

This patch does not actually do anything other than read the
LD_HWCAP_MASK variable and add the tunables way to set the
LD_HWCAP_MASK, i.e. via the glibc.tune.hwcap_mask tunable.  In a
follow-up patch, the _dl_hwcap_mask will be replaced with
glibc.tune.hwcap_mask to complete the transition.

* elf/dl-tunables.list: Add glibc.tune.hwcap_mask.
* scripts/gen-tunables.awk: Include dl-procinfo.h.
* manual/tunables.texi: Document glibc.tune.hwcap_mask.

7 years agotunables: Clean up hooks to get and set tunables
Siddhesh Poyarekar [Thu, 1 Jun 2017 14:54:46 +0000 (20:24 +0530)]
tunables: Clean up hooks to get and set tunables

The TUNABLE_SET_VALUE and family of macros (and my later attempt to
add a TUNABLE_GET) never quite went together very well because the
overall interface was not clearly defined.  This patch is an attempt
to do just that.

This patch consolidates the API to two simple sets of macros,
TUNABLE_GET* and TUNABLE_SET*.  If TUNABLE_NAMESPACE is defined,
TUNABLE_GET takes just the tunable name, type and a (optionally NULL)
callback function to get the value of the tunable.  The callback
function, if non-NULL, is called if the tunable was externally set
(i.e. via GLIBC_TUNABLES or any future mechanism).  For example:

    val = TUNABLE_GET (check, int32_t, check_callback)

returns the value of the glibc.malloc.check tunable (assuming
TUNABLE_NAMESPACE is set to malloc) as an int32_t into VAL after
calling check_callback.

Likewise, TUNABLE_SET can be used to set the value of the tunable,
although this is currently possible only in the dynamic linker before
it relocates itself.  For example:

  TUNABLE_SET (check, int32_t, 2)

will set glibc.malloc.check to 2.  Of course, this is not possible
since we set (or read) glibc.malloc.check long after it is relocated.

To access or set a tunable outside of TUNABLE_NAMESPACE, use the
TUNABLE_GET_FULL and TUNABLE_SET_FULL macros, which have the following
prototype:

  TUNABLE_GET_FULL (glibc, tune, hwcap_mask, uint64_t, NULL)
  TUNABLE_SET_FULL (glibc, tune, hwcap_mask, uint64_t, 0xffff)

In future the tunable list may get split into mutable and immutable
tunables where mutable tunables can be modified by the library and
userspace after relocation as well and TUNABLE_SET will be more useful
than it currently is.  However whenever we actually do that split, we
will have to ensure that the mutable tunables are protected with
locks.

* elf/Versions (__tunable_set_val): Rename to __tunable_get_val.
* elf/dl-tunables.c: Likewise.
(do_tunable_update_val): New function.
(__tunable_set_val): New function.
(__tunable_get_val): Call CB only if the tunable was externally
initialized.
(tunables_strtoul): Replace strval with initialized.
* elf/dl-tunables.h (strval): Replace with a bool initialized.
(TUNABLE_ENUM_NAME, TUNABLE_ENUM_NAME1): Adjust names to
prevent collision.
(__tunable_set_val): New function.
(TUNABLE_GET, TUNABLE_GET_FULL): New macros.
(TUNABLE_SET, TUNABLE_SET_FULL): Likewise.
(TUNABLE_SET_VAL): Remove.
(TUNABLE_SET_VAL_WITH_CALLBACK): Likewise.
* README.tunables: Document the new macros.
* malloc/arena.c (ptmalloc_init): Adjust.

7 years agox86-64: Move wcsnlen.S to multiarch/wcsnlen-sse4_1.S
H.J. Lu [Tue, 6 Jun 2017 13:12:22 +0000 (06:12 -0700)]
x86-64: Move wcsnlen.S to multiarch/wcsnlen-sse4_1.S

Since wcsnlen.S uses pminud which is the part of SSE4.1, move wcsnlen.S
to multiarch/wcsnlen-sse4_1.S.

* sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add
wcsnlen-sse4_1 and wcsnlen-c.
* sysdeps/x86_64/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Test __wcsnlen_sse4_1 and
__wcsnlen_sse2.
* sysdeps/x86_64/multiarch/ifunc-sse4_1.h: New file.
* sysdeps/x86_64/multiarch/wcsnlen-c.c: Likewise.
* sysdeps/x86_64/multiarch/wcsnlen-sse4_1.S: Likewise.
* sysdeps/x86_64/multiarch/wcsnlen.c: Likewise.
* sysdeps/x86_64/wcsnlen.S: Removed.

7 years agoS390: Use generic spinlock code.
Stefan Liebler [Tue, 6 Jun 2017 07:41:56 +0000 (09:41 +0200)]
S390: Use generic spinlock code.

This patch removes the s390 specific implementation of spinlock code
and is now using the generic one.

ChangeLog:

* sysdeps/s390/nptl/pthread_spin_init.c: Delete File.
* sysdeps/s390/nptl/pthread_spin_lock.c: Likewise.
* sysdeps/s390/nptl/pthread_spin_trylock.c: Likewise.
* sysdeps/s390/nptl/pthread_spin_unlock.c: Likewise.

7 years agoOptimize generic spinlock code and use C11 like atomic macros.
Stefan Liebler [Tue, 6 Jun 2017 07:41:56 +0000 (09:41 +0200)]
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.

7 years agox86: Don't use dl_x86_cpu_features in cacheinfo.c
H.J. Lu [Mon, 5 Jun 2017 23:20:00 +0000 (16:20 -0700)]
x86: Don't use dl_x86_cpu_features in cacheinfo.c

Since cpu_features is available, use it instead of dl_x86_cpu_features.

* sysdeps/x86/cacheinfo.c (intel_check_word): Accept cpu_features
and use it instead of dl_x86_cpu_features.
(handle_intel): Replace maxidx with cpu_features.  Pass
cpu_features to intel_check_word.
(__cache_sysconf): Pass cpu_features to handle_intel.
(init_cacheinfo): Likewise.  Use cpu_features instead of
dl_x86_cpu_features.

7 years agox86-64: Optimize memcmp/wmemcmp with AVX2 and MOVBE
H.J. Lu [Mon, 5 Jun 2017 19:52:41 +0000 (12:52 -0700)]
x86-64: Optimize memcmp/wmemcmp with AVX2 and MOVBE

Optimize x86-64 memcmp/wmemcmp with AVX2.  It uses vector compare as
much as possible.  It is as fast as SSE4 memcmp for size <= 16 bytes
and up to 2X faster for size > 16 bytes on Haswell and Skylake.  Select
AVX2 memcmp/wmemcmp on AVX2 machines where vzeroupper is preferred and
AVX unaligned load is fast.

NB: It uses TZCNT instead of BSF since TZCNT produces the same result
as BSF for non-zero input.  TZCNT is faster than BSF and is executed
as BSF if machine doesn't support TZCNT.

Key features:

1. For size from 2 to 7 bytes, load as big endian with movbe and bswap
   to avoid branches.
2. Use overlapping compare to avoid branch.
3. Use vector compare when size >= 4 bytes for memcmp or size >= 8
   bytes for wmemcmp.
4. If size is 8 * VEC_SIZE or less, unroll the loop.
5. Compare 4 * VEC_SIZE at a time with the aligned first memory area.
6. Use 2 vector compares when size is 2 * VEC_SIZE or less.
7. Use 4 vector compares when size is 4 * VEC_SIZE or less.
8. Use 8 vector compares when size is 8 * VEC_SIZE or less.

* sysdeps/x86/cpu-features.h (index_cpu_MOVBE): New.
* sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add
memcmp-avx2 and wmemcmp-avx2.
* sysdeps/x86_64/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Test __memcmp_avx2 and __wmemcmp_avx2.
* sysdeps/x86_64/multiarch/memcmp-avx2.S: New file.
* sysdeps/x86_64/multiarch/wmemcmp-avx2.S: Likewise.
* sysdeps/x86_64/multiarch/memcmp.S: Use __memcmp_avx2 on AVX
2 machines if AVX unaligned load is fast and vzeroupper is
preferred.
* sysdeps/x86_64/multiarch/wmemcmp.S: Use __wmemcmp_avx2 on AVX
2 machines if AVX unaligned load is fast and vzeroupper is
preferred.

7 years agox86-64: Optimize wmemset with SSE2/AVX2/AVX512
H.J. Lu [Mon, 5 Jun 2017 18:09:48 +0000 (11:09 -0700)]
x86-64: Optimize wmemset with SSE2/AVX2/AVX512

The difference between memset and wmemset is byte vs int.  Add stubs
to SSE2/AVX2/AVX512 memset for wmemset with updated constant and size:

SSE2 wmemset:
shl    $0x2,%rdx
movd   %esi,%xmm0
mov    %rdi,%rax
pshufd $0x0,%xmm0,%xmm0
jmp entry_from_wmemset

SSE2 memset:
movd   %esi,%xmm0
mov    %rdi,%rax
punpcklbw %xmm0,%xmm0
punpcklwd %xmm0,%xmm0
pshufd $0x0,%xmm0,%xmm0
entry_from_wmemset:

Since the ERMS versions of wmemset requires "rep stosl" instead of
"rep stosb", only the vector store stubs of SSE2/AVX2/AVX512 wmemset
are added.  The SSE2 wmemset is about 3X faster and the AVX2 wmemset
is about 6X faster on Haswell.

* include/wchar.h (__wmemset_chk): New.
* sysdeps/x86_64/memset.S (VDUP_TO_VEC0_AND_SET_RETURN): Renamed
to MEMSET_VDUP_TO_VEC0_AND_SET_RETURN.
(WMEMSET_VDUP_TO_VEC0_AND_SET_RETURN): New.
(WMEMSET_CHK_SYMBOL): Likewise.
(WMEMSET_SYMBOL): Likewise.
(__wmemset): Add hidden definition.
(wmemset): Add weak hidden definition.
* sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add
wmemset_chk-nonshared.
* sysdeps/x86_64/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Add __wmemset_sse2_unaligned,
__wmemset_avx2_unaligned, __wmemset_avx512_unaligned,
__wmemset_chk_sse2_unaligned, __wmemset_chk_avx2_unaligned
and __wmemset_chk_avx512_unaligned.
* sysdeps/x86_64/multiarch/memset-avx2-unaligned-erms.S
(VDUP_TO_VEC0_AND_SET_RETURN): Renamed to ...
(MEMSET_VDUP_TO_VEC0_AND_SET_RETURN): This.
(WMEMSET_VDUP_TO_VEC0_AND_SET_RETURN): New.
(WMEMSET_SYMBOL): Likewise.
* sysdeps/x86_64/multiarch/memset-avx512-unaligned-erms.S
(VDUP_TO_VEC0_AND_SET_RETURN): Renamed to ...
(MEMSET_VDUP_TO_VEC0_AND_SET_RETURN): This.
(WMEMSET_VDUP_TO_VEC0_AND_SET_RETURN): New.
(WMEMSET_SYMBOL): Likewise.
* sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S: Updated.
(WMEMSET_CHK_SYMBOL): New.
(WMEMSET_CHK_SYMBOL (__wmemset_chk, unaligned)): Likewise.
(WMEMSET_SYMBOL (__wmemset, unaligned)): Likewise.
* sysdeps/x86_64/multiarch/memset.S (WMEMSET_SYMBOL): New.
(libc_hidden_builtin_def): Also define __GI_wmemset and
__GI___wmemset.
(weak_alias): New.
* sysdeps/x86_64/multiarch/wmemset.c: New file.
* sysdeps/x86_64/multiarch/wmemset.h: Likewise.
* sysdeps/x86_64/multiarch/wmemset_chk-nonshared.S: Likewise.
* sysdeps/x86_64/multiarch/wmemset_chk.c: Likewise.
* sysdeps/x86_64/wmemset.c: Likewise.
* sysdeps/x86_64/wmemset_chk.c: Likewise.

7 years agox86: Add macros to implement ifunce selection in C
H.J. Lu [Mon, 5 Jun 2017 15:28:01 +0000 (08:28 -0700)]
x86: Add macros to implement ifunce selection in C

These macros are used to implement ifunc selection in C.  To implement
an ifunc function, foo, which returns the address of __foo_sse2 or
__foo_avx2:

   __foo_avx2:

   #define foo __redirect_foo
   #define __foo __redirect___foo
   #include <foo.h>
   #undef foo
   #undef __foo
   #define SYMBOL_NAME foo
   #include <init-arch.h>

   extern __typeof (REDIRECT_NAME) OPTIMIZE (sse2) attribute_hidden;
   extern __typeof (REDIRECT_NAME) OPTIMIZE (avx2) attribute_hidden;

   static inline void *
   foo_selector (void)
   {
     if (use AVX2)
      return OPTIMIZE (avx2);

     return OPTIMIZE (sse2);
   }

   libc_ifunc_redirected (__redirect_foo, foo, foo_selector ());

* sysdeps/x86/init-arch.h (PASTER1): New.
(EVALUATOR1): Likewise.
(PASTER2): Likewise.
(EVALUATOR2): Likewise.
(REDIRECT_NAME): Likewise.
(OPTIMIZE): Likewise.
(IFUNC_SELECTOR): Likewise.

7 years agox86-64: Update strlen.S to support wcslen/wcsnlen
H.J. Lu [Mon, 5 Jun 2017 14:58:11 +0000 (07:58 -0700)]
x86-64: Update strlen.S to support wcslen/wcsnlen

The difference between strlen and wcslen is byte vs int.  We can
replace pminub and pcmpeqb with pminud and pcmpeqd to turn strlen
into wcslen.

* sysdeps/x86_64/strlen.S (PMINU): New.
(PCMPEQ): Likewise.
(SHIFT_RETURN): Likewise.
(FIND_ZERO): Replace pcmpeqb with PCMPEQ.
(strlen): Add SHIFT_RETURN before ret.  Replace pcmpeqb and
pminub with PCMPEQ and PMINU.
* sysdeps/x86_64/wcsnlen.S: New file.

7 years agox86_64: Remove redundant REX bytes from memrchr.S
H.J. Lu [Mon, 5 Jun 2017 14:41:14 +0000 (07:41 -0700)]
x86_64: Remove redundant REX bytes from memrchr.S

By x86-64 specification, 32-bit destination registers are zero-extended
to 64 bits.  There is no need to use 64-bit registers when only the lower
32 bits are non-zero.  Also 2 instructions in:

mov %rdi, %rcx
and $15, %rcx
jz L(length_less16_offset0)

mov %rdi, %rcx <<< redundant
and $15, %rcx <<< redundant

are redundant.

* sysdeps/x86_64/memrchr.S (__memrchr): Use 32-bit registers for
the lower 32 bits.  Remove redundant instructions.

7 years agox86-64: Update LO_HI_LONG for p{readv,writev}{64}v2
H.J. Lu [Mon, 5 Jun 2017 14:21:44 +0000 (07:21 -0700)]
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.

7 years agoDefine SIG_HOLD for XPG4 (bug 21538).
Joseph Myers [Mon, 5 Jun 2017 10:19:03 +0000 (10:19 +0000)]
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.

7 years agoFix struct sigaltstack namespace (bug 21517).
Joseph Myers [Mon, 5 Jun 2017 10:17:46 +0000 (10:17 +0000)]
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.

7 years agoRegenerate sysdeps/gnu/errlist.c.
Zack Weinberg [Sun, 4 Jun 2017 19:27:14 +0000 (15:27 -0400)]
Regenerate sysdeps/gnu/errlist.c.

This file needs to be regenerated whenever errno.texi changes.

7 years agobenchtests: Add more tests for memrchr
H.J. Lu [Sun, 4 Jun 2017 16:44:48 +0000 (09:44 -0700)]
benchtests: Add more tests for memrchr

bench-memchr.c is shared with bench-memrchr.c.  This patch adds some
tests for positions close to the beginning for memrchr, which are
equivalent to positions close to the end for memchr.

* benchtests/bench-memchr.c (do_test): Print out both length
and position.
(test_main): Also test the position close to the beginning for
memrchr.

7 years agoAdd forgotten changelog entry for 82f43dd2d1
Zack Weinberg [Sun, 4 Jun 2017 15:34:14 +0000 (11:34 -0400)]
Add forgotten changelog entry for 82f43dd2d1

7 years agoInclude shlib-compat.h in many sunrpc/nis source files.
Zack Weinberg [Sun, 4 Jun 2017 15:14:43 +0000 (11:14 -0400)]
Include shlib-compat.h in many sunrpc/nis source files.

Every file that uses libc_hidden_nolink_sunrpc or
libnsl_hidden_nolink_def needs to include shlib-compat.h.  Currently,
most of them are getting it via stdio.h, because libio.h refers to
SHLIB_COMPAT when _LIBC is defined, so it includes shlib-compat.h.  My
experimental patch to not install libio.h breaks that chain; stdio.h
no longer pulls in libio.h even for internal users.

Accordingly, this patch adds #include <shlib-compat.h> to many files
in sunrpc/ and nis/.  There are also a small number of really obvious
fixups to includes that caught my eye while proofreading the patch -
not including headers twice in a row, not worrying about portability
to Ultrix anymore, sort of thing.

* nis/nis_add.c, nis/nis_addmember.c, nis/nis_call.c
* nis/nis_checkpoint.c, nis/nis_clone_dir.c, nis/nis_clone_obj.c
* nis/nis_clone_res.c, nis/nis_creategroup.c, nis/nis_defaults.c
* nis/nis_destroygroup.c, nis/nis_domain_of.c
* nis/nis_domain_of_r.c, nis/nis_error.c, nis/nis_file.c
* nis/nis_free.c, nis/nis_getservlist.c, nis/nis_ismember.c
* nis/nis_local_names.c, nis/nis_lookup.c, nis/nis_mkdir.c
* nis/nis_modify.c, nis/nis_ping.c, nis/nis_print.c
* nis/nis_print_group_entry.c, nis/nis_remove.c
* nis/nis_removemember.c, nis/nis_rmdir.c, nis/nis_server.c
* nis/nis_subr.c, nis/nis_table.c, nis/nis_util.c
* nis/nis_verifygroup.c, nis/nis_xdr.c, nis/yp_xdr.c
* nis/ypclnt.c, nis/ypupdate_xdr.c, sunrpc/auth_des.c
* sunrpc/auth_none.c, sunrpc/auth_unix.c, sunrpc/authdes_prot.c
* sunrpc/authuxprot.c, sunrpc/clnt_gen.c, sunrpc/clnt_perr.c
* sunrpc/clnt_raw.c, sunrpc/clnt_simp.c, sunrpc/clnt_tcp.c
* sunrpc/clnt_udp.c, sunrpc/clnt_unix.c, sunrpc/des_crypt.c
* sunrpc/des_soft.c, sunrpc/get_myaddr.c, sunrpc/key_call.c
* sunrpc/key_prot.c, sunrpc/netname.c, sunrpc/pm_getmaps.c
* sunrpc/pm_getport.c, sunrpc/pmap_clnt.c, sunrpc/pmap_prot.c
* sunrpc/pmap_prot2.c, sunrpc/pmap_rmt.c, sunrpc/publickey.c
* sunrpc/rpc_cmsg.c, sunrpc/rpc_dtable.c, sunrpc/rpc_prot.c
* sunrpc/rpc_thread.c, sunrpc/rtime.c, sunrpc/svc.c
* sunrpc/svc_auth.c, sunrpc/svc_raw.c, sunrpc/svc_run.c
* sunrpc/svc_tcp.c, sunrpc/svc_udp.c, sunrpc/svc_unix.c
* sunrpc/svcauth_des.c, sunrpc/xdr.c, sunrpc/xdr_array.c
* sunrpc/xdr_float.c, sunrpc/xdr_intXX_t.c, sunrpc/xdr_mem.c
* sunrpc/xdr_rec.c, sunrpc/xdr_ref.c, sunrpc/xdr_sizeof.c
* sunrpc/xdr_stdio.c: Include shlib-compat.h.

* sunrpc/des_crypt.c, sunrpc/des_soft.c: No need to include
abi-versions.h as well as shlib-compat.h.
* sunrpc/get_myaddr.c: Remove obsolete comment.
* sunrpc/pmap_rmt.c: Remove obsolete comment and #undef.
* sunrpc/rpc_thread.c: Include libc-lock.h only once.
* resolv/res_libc.c: Include shlib-compat.h only once.

7 years agogetaddrinfo: Eliminate another strdup call
Florian Weimer [Sat, 3 Jun 2017 06:37:13 +0000 (08:37 +0200)]
getaddrinfo: Eliminate another strdup call

7 years agox86: Update __x86_shared_non_temporal_threshold
H.J. Lu [Sat, 3 Jun 2017 00:32:21 +0000 (17:32 -0700)]
x86: Update __x86_shared_non_temporal_threshold

__x86_shared_non_temporal_threshold was set to 6 times of per-core
shared cache size, based on the large memcpy micro benchmark in glibc
on a 8-core processor.  For a processor with more than 8 cores, the
threshold is too low.  Set __x86_shared_non_temporal_threshold to the
3/4 of the total shared cache size so that it is unchanged on 8-core
processors.  On processors with less than 8 cores, the threshold is
lower.

* sysdeps/x86/cacheinfo.c (__x86_shared_non_temporal_threshold):
Set to the 3/4 of the total shared cache size.

7 years agomanual: Provide consistent errno documentation.
Rical Jasan [Thu, 1 Jun 2017 09:07:01 +0000 (02:07 -0700)]
manual: Provide consistent errno documentation.

The @errno macro is extended to render the canonical error string in
every documented errno error.  Redundant entries and "???" are
removed.  Sixty-six errors now at least contain the error string as
the description, where no description (or "???") existed before.

* manual/errno.texi: Remove redundant error strings.
* manual/macros.texi (@errno): Render the error string in
every description.

7 years agoFix sigevent namespace (bug 21543).
Joseph Myers [Fri, 2 Jun 2017 19:47:03 +0000 (19:47 +0000)]
Fix sigevent namespace (bug 21543).

signal.h defines the sigevent structure and constants if defined
__USE_POSIX199309 || defined __USE_XOPEN_EXTENDED.  The
__USE_XOPEN_EXTENDED condition is incorrect; this structure does not
appear in XSI standards before Unix98 (which implies
__USE_POSIX199309).  This patch fixes the conditionals accordingly
(the existing conditional is correct for siginfo_t, just not for
sigevent).

Tested for x86_64.  This does not allow any conform/ XFAILs to be
removed because of other signal.h namespace bugs.

[BZ #21543]
* signal/signal.h: Only include <bits/types/sigevent_t.h> and
<bits/sigevent-consts.h> if [__USE_POSIX199309], not if
[__USE_XOPEN_EXTENDED].

7 years agogetaddrinfo: Fix localplt failure involving strdup
Florian Weimer [Fri, 2 Jun 2017 14:35:13 +0000 (16:35 +0200)]
getaddrinfo: Fix localplt failure involving strdup

7 years agoposix: Add missing build flags for p{write,read}v2
Adhemerval Zanella [Fri, 2 Jun 2017 13:58:53 +0000 (10:58 -0300)]
posix: Add missing build flags for p{write,read}v2

This patch adds the missing compiler flags for correct pthread cancellation
on some architectures for the p{read,write}v2 implementation (52bd9381692fd23).

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

* misc/Makefile (CFLAGS-preadv2.c): New rule.
(CFLAGS-preadv64v2.c): Likewise.
(CFLAGS-pwritev2.c): Likewise.
(CFLAGS-pwritev64v2.c): Likewise.

7 years agoresolv: Tests for various versions of res_init
Florian Weimer [Fri, 2 Jun 2017 13:50:36 +0000 (15:50 +0200)]
resolv: Tests for various versions of res_init

7 years agogetaddrinfo: Always allocate canonical name on the heap
Florian Weimer [Fri, 2 Jun 2017 12:54:56 +0000 (14:54 +0200)]
getaddrinfo: Always allocate canonical name on the heap

A further simplification could eliminate the canon variable in
gaih_inet and replace it with canonbuf.  However, canonbuf is
used as a flag in the nscd code, which makes this somewhat
non-straightforward.

7 years agoAdd internal facility for dynamic array handling
Florian Weimer [Fri, 2 Jun 2017 09:59:28 +0000 (11:59 +0200)]
Add internal facility for dynamic array handling

This is intended as a type-safe alternative to obstacks and
hand-written realloc constructs.  The implementation avoids
writing function pointers to the heap.

7 years agoInclude sys/param.h in stdlib/gmp-impl.h instead of redefining MAX/MIN
Gabriel F. T. Gomes [Fri, 26 May 2017 22:29:20 +0000 (19:29 -0300)]
Include sys/param.h in stdlib/gmp-impl.h instead of redefining MAX/MIN

In stdlib/gmp-impl.h, the macros MAX and MIN are defined exactly the same
as in sys/param.h.  This patch removes the redefinition and makes
gmp-impl.h include sys/param.h instead.

Tested for powerpc64le and s390x.

* stdlib/gmp-impl.h: Include sys/param.h instead of redefining the
macros MAX and MIN.

7 years agoconformtest: Correct signal.h expectations for XPG4 / XPG42.
Joseph Myers [Thu, 1 Jun 2017 17:17:43 +0000 (17:17 +0000)]
conformtest: Correct signal.h expectations for XPG4 / XPG42.

Various of the signal.h conform/ failures for XPG4 and XPG42 are
actually the result of incorrect test expectations rather than header
bugs.  This patch fixes the expectations to accord with those
standards (this does not however allow any XFAILs to be removed, as
some header bugs remain).  Note for anyone comparing with the
standards: corrigendum U013/16 removes the mention of a sigmask
function in signal.h (C435 lists such a function in the definition of
signal.h, but without any actual specification for the function
itself), so sigmask is not included in the expectations.

Tested for x86_64.

* conform/data/signal.h-data (sa_sigaction): Do not expect for
[XPG4].
(SA_SIGINFO): Likewise.
(SA_ONSTACK): Likewise.
(SA_RESETHAND): Likewise.
(SA_RESTART): Likewise.
(SA_NOCLDWAIT): Likewise.
(SA_NODEFER): Likewise.
(SS_ONSTACK): Likewise.
(SS_DISABLE): Likewise.
(MINSIGSTKSZ): Likewise.
(SIGSTKSZ): Likewise.
(ucontext_t): Likewise.
(stack_t): Likewise.
(struct sigstack): Likewise.
(SI_USER): Do not expect for [XPG4 || XPG42].
(SI_QUEUE): Likewise.
(SI_TIMER): Likewise.
(SI_ASYNCIO): Likewise.
(SI_MESGQ): Likewise.
(bsd_signal): Do not expect for [XPG4].
(killpg): Likewise.
(sigaltstack): Likewise.
(sighold): Likewise.
(sigignore): Likewise.
(siginterrupt): Likewise.
(sigpause): Likewise.
(sigrelse): Likewise.
(sigset): Likewise.
(sigwait): Do not expect for [XPG4 || XPG42].

7 years agoAdd shim header for bits/syscall.h.
Zack Weinberg [Thu, 1 Jun 2017 14:56:10 +0000 (10:56 -0400)]
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.

7 years agoFix more namespace issues in sys/ucontext.h (bug 21457).
Joseph Myers [Thu, 1 Jun 2017 14:07:40 +0000 (14:07 +0000)]
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.

7 years agoAvoid tickling a linker bug from microblaze pt-vfork.S.
Zack Weinberg [Wed, 31 May 2017 01:05:04 +0000 (21:05 -0400)]
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.

7 years agoposix: Implement preadv2 and pwritev2
Adhemerval Zanella [Tue, 25 Apr 2017 19:43:27 +0000 (16:43 -0300)]
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.

7 years agoUse test-driver in nptl/tst-fork3.c
Andreas Schwab [Thu, 18 May 2017 16:08:06 +0000 (18:08 +0200)]
Use test-driver in nptl/tst-fork3.c

7 years agoDelay initialization of CPU features struct in static binaries
Siddhesh Poyarekar [Wed, 31 May 2017 01:08:32 +0000 (06:38 +0530)]
Delay initialization of CPU features struct in static binaries

Allow the CPU features structure set up to be overridden by tunables
by delaying it to until after tunables are initialized.  The
initialization is already delayed in dynamically linked glibc, it is
only in static binaries that the initialization is set early to allow
it to influence IFUNC relocations that happen in libc-start.  It is a
bit too early however and there is a good place between tunables
initialization and IFUNC relocations where this can be done.

Verified that this does not regress the testsuite.

* csu/libc-start.c [!ARCH_INIT_CPU_FEATURES]: Define
ARCH_INIT_CPU_FEATURES.
(LIBC_START_MAIN): Call it.
* sysdeps/unix/sysv/linux/aarch64/libc-start.c
(__libc_start_main): Remove.
(ARCH_INIT_CPU_FEATURES): New macro.
* sysdeps/x86/libc-start.c (__libc_start_main): Remove.
(ARCH_INIT_CPU_FEATURES): New macro.

7 years agoAdd reallocarray function
Dennis Wölfing [Tue, 30 May 2017 21:26:19 +0000 (18:26 -0300)]
Add reallocarray function

The reallocarray function is an extension from OpenBSD.  It is an
integer-overflow-safe replacement for realloc(p, X*Y) and
malloc(X*Y) (realloc(NULL, X*Y)).  It can therefore help in preventing
certain security issues in code.

This is an updated version of a patch originally submitted by Rüdiger
Sonderfeld in May 2014 [1].

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

[1] <https://sourceware.org/ml/libc-alpha/2014-05/msg00481.html>.

2017-05-30  Dennis Wölfing  <denniswoelfing@gmx.de>
            Rüdiger Sonderfeld  <ruediger@c-plusplus.de>

* include/stdlib.h (__libc_reallocarray): New declaration.
* malloc/Makefile (routines): Add reallocarray.
(tests): Add tst-reallocarray.c.
* malloc/Versions: Add reallocarray and __libc_reallocarray.
* malloc/malloc-internal.h (check_mul_overflow_size_t): New inline
function.
* malloc/malloc.h (reallocarray): New declaration.
* stdlib/stdlib.h (reallocarray): Likewise.
* malloc/reallocarray.c: New file.
* malloc/tst-reallocarray.c: New test file.
* manual/memory.texi: Document reallocarray.
* sysdeps/unix/sysv/linux/aarch64/libc.abilist: Add reallocarray.
* sysdeps/unix/sysv/linux/alpha/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/tilepro/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Likewise.

7 years agox86_64: Remove redundant REX bytes from memchr.S
H.J. Lu [Tue, 30 May 2017 19:39:14 +0000 (12:39 -0700)]
x86_64: Remove redundant REX bytes from memchr.S

By x86-64 specification, 32-bit destination registers are zero-extended
to 64 bits.  There is no need to use 64-bit registers when only the lower
32 bits are non-zero.

* sysdeps/x86_64/memchr.S (MEMCHR): Use 32-bit registers for
the lower 32 bits.

7 years agom68k: handle default PIE
Andreas Schwab [Sun, 28 May 2017 21:55:46 +0000 (23:55 +0200)]
m68k: handle default PIE

7 years agoAdd memchr tests for n == 0
H.J. Lu [Thu, 25 May 2017 18:36:53 +0000 (11:36 -0700)]
Add memchr tests for n == 0

* string/test-memchr.c (test_main): Add tests for n == 0.

7 years agoMove tst-mutex*8* to tests-internal
Tulio Magno Quites Machado Filho [Thu, 25 May 2017 17:53:40 +0000 (14:53 -0300)]
Move tst-mutex*8* to tests-internal

The following tests depend on ENABLE_LOCK_ELISION, which is only
available on tests-internal.

 - nptl/tst-mutex8
 - nptl/tst-mutex8-static
 - nptl/tst-mutexpi8
 - nptl/tst-mutexpi8-static

* nptl/Makefile (tests): Move nptl/tst-mutex8, nptl/tst-mutex8-static,
nptl/tst-mutexpi8 and nptl/tst-mutexpi8-static to...
(tests-internal): ... here.

7 years agoMake __tunables_init hidden and avoid PLT
H.J. Lu [Thu, 25 May 2017 13:55:42 +0000 (06:55 -0700)]
Make __tunables_init hidden and avoid PLT

Since __tunables_init is internal to ld.so, we should mark it hidden
to avoid PLT.  We should also avoid PLT when calling __tunable_set_val
within ld.so.

2017-05-25   Siddhesh Poyarekar  <siddhesh@sourceware.org>
     H.J. Lu  <hongjiu.lu@intel.com>

* elf/dl-tunables.c (__tunable_set_val): Make a hidden alias.
* elf/dl-tunables.h (__tunables_init): Mark it hidden in rtld.
(__tunable_set_val): Likewise.

7 years agoSupport dl-tunables.list in subdirectories
H.J. Lu [Thu, 25 May 2017 12:41:05 +0000 (05:41 -0700)]
Support dl-tunables.list in subdirectories

We can put processor specific tunables in dl-tunables.list under
sysdeps instead of in elf/dl-tunables.list.

* Makeconfig ($(common-objpfx)dl-tunable-list.h): Also check
dl-tunables.list in subdirectories.

7 years agofloat128: Add wrappers to override ldbl-128 as float128.
Paul E. Murphy [Mon, 8 Aug 2016 20:49:31 +0000 (15:49 -0500)]
float128: Add wrappers to override ldbl-128 as float128.

This change defines float128_private.h which contains
macros used to override long double naming conventions
when building a ldbl file.

* math/math.h [__HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)]
(SNANF128): New macro.
* math/e_sqrtf128.c: New file.
* math/s_fmaxmag_template.c: Include math_private.h in order to
make inline expansion of fabs128().
* math/s_fminmag_template.c: Likewise.

* sysdeps/ieee754/float128/e_acosf128.c: New file.
* sysdeps/ieee754/float128/e_acoshf128.c: New file.
* sysdeps/ieee754/float128/e_asinf128.c: New file.
* sysdeps/ieee754/float128/e_atan2f128.c: New file.
* sysdeps/ieee754/float128/e_atanhf128.c: New file.
* sysdeps/ieee754/float128/e_coshf128.c: New file.
* sysdeps/ieee754/float128/e_exp10f128.c: New file.
* sysdeps/ieee754/float128/e_expf128.c: New file.
* sysdeps/ieee754/float128/e_fmodf128.c: New file.
* sysdeps/ieee754/float128/e_gammaf128_r.c: New file.
* sysdeps/ieee754/float128/e_hypotf128.c: New file.
* sysdeps/ieee754/float128/e_ilogbf128.c: New file.
* sysdeps/ieee754/float128/e_j0f128.c: New file.
* sysdeps/ieee754/float128/e_j1f128.c: New file.
* sysdeps/ieee754/float128/e_jnf128.c: New file.
* sysdeps/ieee754/float128/e_lgammaf128_r.c: New file.
* sysdeps/ieee754/float128/e_log10f128.c: New file.
* sysdeps/ieee754/float128/e_log2f128.c: New file.
* sysdeps/ieee754/float128/e_logf128.c: New file.
* sysdeps/ieee754/float128/e_powf128.c: New file.
* sysdeps/ieee754/float128/e_rem_pio2f128.c: New file.
* sysdeps/ieee754/float128/e_remainderf128.c: New file.
* sysdeps/ieee754/float128/e_scalbf128.c: New file.
* sysdeps/ieee754/float128/e_sinhf128.c: New file.
* sysdeps/ieee754/float128/float128_private.h: New file.
* sysdeps/ieee754/float128/gamma_productf128.c: New file.
* sysdeps/ieee754/float128/ieee754_float128.h: New file.
* sysdeps/ieee754/float128/k_cosf128.c: New file.
* sysdeps/ieee754/float128/k_sincosf128.c: New file.
* sysdeps/ieee754/float128/k_sinf128.c: New file.
* sysdeps/ieee754/float128/k_tanf128.c: New file.
* sysdeps/ieee754/float128/lgamma_negf128.c: New file.
* sysdeps/ieee754/float128/lgamma_productf128.c: New file.
* sysdeps/ieee754/float128/s_asinhf128.c: New file.
* sysdeps/ieee754/float128/s_atanf128.c: New file.
* sysdeps/ieee754/float128/s_cbrtf128.c: New file.
* sysdeps/ieee754/float128/s_ceilf128.c: New file.
* sysdeps/ieee754/float128/s_copysignf128.c: New file.
* sysdeps/ieee754/float128/s_cosf128.c: New file.
* sysdeps/ieee754/float128/s_erff128.c: New file.
* sysdeps/ieee754/float128/s_expm1f128.c: New file.
* sysdeps/ieee754/float128/s_fabsf128.c: New file.
* sysdeps/ieee754/float128/s_finitef128.c: New file.
* sysdeps/ieee754/float128/s_floorf128.c: New file.
* sysdeps/ieee754/float128/s_fmaf128.c: New file.
* sysdeps/ieee754/float128/s_fpclassifyf128.c: New file.
* sysdeps/ieee754/float128/s_frexpf128.c: New file.
* sysdeps/ieee754/float128/s_fromfpf128.c: New file.
* sysdeps/ieee754/float128/s_fromfpxf128.c: New file.
* sysdeps/ieee754/float128/s_getpayloadf128.c: New file.
* sysdeps/ieee754/float128/s_isinff128.c: New file.
* sysdeps/ieee754/float128/s_isnanf128.c: New file.
* sysdeps/ieee754/float128/s_issignalingf128.c: New file.
* sysdeps/ieee754/float128/s_llrintf128.c: New file.
* sysdeps/ieee754/float128/s_llroundf128.c: New file.
* sysdeps/ieee754/float128/s_log1pf128.c: New file.
* sysdeps/ieee754/float128/s_logbf128.c: New file.
* sysdeps/ieee754/float128/s_lrintf128.c: New file.
* sysdeps/ieee754/float128/s_lroundf128.c: New file.
* sysdeps/ieee754/float128/s_modff128.c: New file.
* sysdeps/ieee754/float128/s_nearbyintf128.c: New file.
* sysdeps/ieee754/float128/s_nextafterf128.c: New file.
* sysdeps/ieee754/float128/s_nexttowardf128.c: New file.
* sysdeps/ieee754/float128/s_nextupf128.c: New file.
* sysdeps/ieee754/float128/s_remquof128.c: New file.
* sysdeps/ieee754/float128/s_rintf128.c: New file.
* sysdeps/ieee754/float128/s_roundevenf128.c: New file.
* sysdeps/ieee754/float128/s_roundf128.c: New file.
* sysdeps/ieee754/float128/s_scalblnf128.c: New file.
* sysdeps/ieee754/float128/s_scalbnf128.c: New file.
* sysdeps/ieee754/float128/s_setpayloadf128.c: New file.
* sysdeps/ieee754/float128/s_setpayloadsigf128.c: New file.
* sysdeps/ieee754/float128/s_signbitf128.c: New file.
* sysdeps/ieee754/float128/s_significandf128.c: New file.
* sysdeps/ieee754/float128/s_sincosf128.c: New file.
* sysdeps/ieee754/float128/s_sinf128.c: New file.
* sysdeps/ieee754/float128/s_tanf128.c: New file.
* sysdeps/ieee754/float128/s_tanhf128.c: New file.
* sysdeps/ieee754/float128/s_totalorderf128.c: New file.
* sysdeps/ieee754/float128/s_totalordermagf128.c: New file.
* sysdeps/ieee754/float128/s_truncf128.c: New file.
* sysdeps/ieee754/float128/s_ufromfpf128.c: New file.
* sysdeps/ieee754/float128/s_ufromfpxf128.c: New file.
* sysdeps/ieee754/float128/t_sincosf128.c: New file.
* sysdeps/ieee754/float128/x2y2m1f128.c: New file.

* sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h:
(__iscanonicalf128): Define as a macro.

7 years agoaarch64: Thunderx specific memcpy and memmove
Steve Ellcey [Wed, 24 May 2017 23:46:48 +0000 (16:46 -0700)]
aarch64: Thunderx specific memcpy and memmove

* sysdeps/aarch64/memcpy.S (MEMMOVE, MEMCPY): New macros.
(memmove): Use MEMMOVE for name.
(memcpy): Use MEMCPY for name.  Change internal labels
to external labels.
* sysdeps/aarch64/multiarch/Makefile: New file.
* sysdeps/aarch64/multiarch/ifunc-impl-list.c: Likewise.
* sysdeps/aarch64/multiarch/init-arch.h: Likewise.
* sysdeps/aarch64/multiarch/memcpy.c: Likewise.
* sysdeps/aarch64/multiarch/memcpy_generic.S: Likewise.
* sysdeps/aarch64/multiarch/memcpy_thunderx.S: Likewise.
* sysdeps/aarch64/multiarch/memmove.c: Likewise.

7 years agoarm: Fix typo in array count
Siddhesh Poyarekar [Wed, 24 May 2017 16:56:36 +0000 (22:26 +0530)]
arm: Fix typo in array count

I just noticed that the array count for the hwcap flags list in ARM is
off by 10, i.e. 37 instead of 27.  Following patch fixes this.

* sysdeps/unix/sysv/linux/arm/dl-procinfo.c
(_dl_arm_cap_flags): Fix array subscript.
* sysdeps/unix/sysv/linux/arm/dl-procinfo.h (_DL_HWCAP_COUNT):
Fix count.

7 years agox86: Don't include cacheinfo.c in ld.so
H.J. Lu [Wed, 24 May 2017 13:31:16 +0000 (06:31 -0700)]
x86: Don't include cacheinfo.c in ld.so

Since cacheinfo.c isn't used by ld.so, there is no need to include it
in ld.so.

* sysdeps/x86/cacheinfo.c: Skip if not in libc.

7 years agox86: Use __get_cpu_features to get cpu_features
H.J. Lu [Wed, 24 May 2017 13:28:37 +0000 (06:28 -0700)]
x86: Use __get_cpu_features to get cpu_features

Remove is_intel, is_amd and max_cpuid macros.  Use __get_cpu_features
to get cpu_features instead.

* sysdeps/x86/cacheinfo.c (is_intel): Removed.
(is_amd): Likewise.
(max_cpuid): Likewise.
(__cache_sysconf): Use __get_cpu_features to get cpu_features.
(init_cacheinfo): Likewise.

7 years agoFix sigstack namespace (bug 21511).
Joseph Myers [Tue, 23 May 2017 16:47:29 +0000 (16:47 +0000)]
Fix sigstack namespace (bug 21511).

The sigstack function was removed in the 2001 edition of POSIX, and
the sigstack structure in the 2008 edition.  signal.h wrongly includes
those declarations even for newer POSIX versions.  This patch fixes
the conditions, and conform/ expectations, accordingly.

This patch makes the minimum change to when these declarations are
present, leaving them visible for __USE_MISC as they would previously
have been visible by default.  Arguably these legacy declarations
should only be visible when an old standard is specifically requested,
but implementing that would require arranging for the various sigstack
implementations to be able to see the struct sigstack type despite it
not being in _GNU_SOURCE in that case.

Tested for x86_64.

[BZ #21511]
* signal/signal.h: Include <bits/types/struct_sigstack.h> only if
[(__USE_XOPEN_EXTENDED && !__USE_XOPEN2K8) || __USE_MISC].
(sigstack): Declare only if [(__USE_XOPEN_EXTENDED &&
!__USE_XOPEN2K) || __USE_MISC].
* conform/data/signal.h-data (struct sigstack): Expect type only
if [!XOPEN2K8 && !POSIX2008].
(sigstack): Expect function only if [XPG42 || UNIX98].

7 years agoFix sys/ucontext.h namespace from signal.h etc. inclusion (bug 21457).
Joseph Myers [Tue, 23 May 2017 11:49:48 +0000 (11:49 +0000)]
Fix sys/ucontext.h namespace from signal.h etc. inclusion (bug 21457).

The various sys/ucontext.h headers include <signal.h> and all the
headers split out of <bits/sigstack.h>.  (Except that the powerpc
version does not include <signal.h>.)

None of the standard versions defining ucontext.h require or permit
such inclusions; rather, they all say that the stack_t and sigset_t
types from signal.h are defined.  This patch fixes the headers to
include just the bits/ headers for those types (and the existing
includes of bits/sigcontext.h).  Since bits/types/sigset_t.h is now
being included instead of bits/types/__sigset_t.h, __sigset_t uses in
the headers are replaced by direct use of the public sigset_t type.
sysdeps/unix/sysv/linux/x86/bits/sigcontext.h was relying on the prior
inclusion of <signal.h> to define types such as __uint32_t, so gets a
bits/types.h include added to provide those types.

Although one could keep some or all of the includes under a __USE_MISC
conditional, that seems unnecessary to me, especially given the lack
of a <signal.h> include in the powerpc version meaning that portable
programs already cannot rely on such an include.

Tested for x86_64 and x86, and with build-many-glibcs.py.  As with
other such fixes, more namespace issues remain so this does not permit
any XFAILs to be removed or bugs to be closed.

[BZ #21457]
* sysdeps/arm/sys/ucontext.h: Do not include <signal.h>,
<bits/sigstack.h>, <bits/types/struct_sigstack.h> or
<bits/ss_flags.h>.  Include <bits/types/sigset_t.h> instead of
<bits/types/__sigset_t.h>.
(ucontext_t): Use sigset_t instead of __sigset_t.
* sysdeps/generic/sys/ucontext.h: Do not include <signal.h>,
<bits/sigstack.h>, <bits/types/struct_sigstack.h> or
<bits/ss_flags.h>.  Include <bits/types/sigset_t.h> instead of
<bits/types/__sigset_t.h>.
(ucontext_t): Use sigset_t instead of __sigset_t.
* sysdeps/i386/sys/ucontext.h: Do not include <signal.h>,
<bits/sigstack.h>, <bits/types/struct_sigstack.h> or
<bits/ss_flags.h>.  Include <bits/types/sigset_t.h> instead of
<bits/types/__sigset_t.h>.
(ucontext_t): Use sigset_t instead of __sigset_t.
* sysdeps/m68k/sys/ucontext.h: Do not include <signal.h>,
<bits/sigstack.h>, <bits/types/struct_sigstack.h> or
<bits/ss_flags.h>.  Include <bits/types/sigset_t.h> instead of
<bits/types/__sigset_t.h>.
(ucontext_t): Use sigset_t instead of __sigset_t.
* sysdeps/mips/sys/ucontext.h: Do not include <signal.h>,
<bits/sigstack.h>, <bits/types/struct_sigstack.h> or
<bits/ss_flags.h>.  Include <bits/types/sigset_t.h> instead of
<bits/types/__sigset_t.h>.
(ucontext_t): Use sigset_t instead of __sigset_t.
* sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h: Do not include
<signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or
<bits/ss_flags.h>.  Include <bits/types/sigset_t.h> instead of
<bits/types/__sigset_t.h>.
(ucontext_t): Use sigset_t instead of __sigset_t.
* sysdeps/unix/sysv/linux/alpha/sys/ucontext.h: Do not include
<signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or
<bits/ss_flags.h>.  Include <bits/types/sigset_t.h> instead of
<bits/types/__sigset_t.h>.
(ucontext_t): Use sigset_t instead of __sigset_t.
* sysdeps/unix/sysv/linux/arm/sys/ucontext.h: Do not include
<signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or
<bits/ss_flags.h>.  Include <bits/types/sigset_t.h> instead of
<bits/types/__sigset_t.h>.
(ucontext_t): Use sigset_t instead of __sigset_t.
* sysdeps/unix/sysv/linux/hppa/sys/ucontext.h: Do not include
<signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or
<bits/ss_flags.h>.  Include <bits/types/sigset_t.h> instead of
<bits/types/__sigset_t.h>.
(ucontext_t): Use sigset_t instead of __sigset_t.
* sysdeps/unix/sysv/linux/ia64/sys/ucontext.h: Do not include
<signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or
<bits/ss_flags.h>.  Include <bits/types/sigset_t.h>.
* sysdeps/unix/sysv/linux/m68k/sys/ucontext.h: Do not include
<signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or
<bits/ss_flags.h>.  Include <bits/types/sigset_t.h> instead of
<bits/types/__sigset_t.h>.
(ucontext_t): Use sigset_t instead of __sigset_t.
* sysdeps/unix/sysv/linux/mips/sys/ucontext.h: Do not include
<signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or
<bits/ss_flags.h>.  Include <bits/types/sigset_t.h> instead of
<bits/types/__sigset_t.h>.
(ucontext_t): Use sigset_t instead of __sigset_t.
* sysdeps/unix/sysv/linux/nios2/sys/ucontext.h: Do not include
<signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or
<bits/ss_flags.h>.  Include <bits/types/sigset_t.h> instead of
<bits/types/__sigset_t.h>.
(ucontext_t): Use sigset_t instead of __sigset_t.
* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h: Do not include
<bits/sigstack.h>, <bits/types/struct_sigstack.h> or
<bits/ss_flags.h>.
* sysdeps/unix/sysv/linux/s390/sys/ucontext.h: Do not include
<signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or
<bits/ss_flags.h>.  Include <bits/types/sigset_t.h> instead of
<bits/types/__sigset_t.h>.
(ucontext_t): Use sigset_t instead of __sigset_t.
* sysdeps/unix/sysv/linux/sh/sys/ucontext.h: Do not include
<signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or
<bits/ss_flags.h>.  Include <bits/types/sigset_t.h> instead of
<bits/types/__sigset_t.h>.
(ucontext_t): Use sigset_t instead of __sigset_t.
* sysdeps/unix/sysv/linux/sparc/sys/ucontext.h: Do not include
<signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or
<bits/ss_flags.h>.  Include <bits/types/sigset_t.h> instead of
<bits/types/__sigset_t.h>.
(ucontext_t): Use sigset_t instead of __sigset_t.
* sysdeps/unix/sysv/linux/tile/sys/ucontext.h: Do not include
<signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or
<bits/ss_flags.h>.  Include <bits/types/sigset_t.h> instead of
<bits/types/__sigset_t.h>.
(ucontext_t): Use sigset_t instead of __sigset_t.
* sysdeps/unix/sysv/linux/x86/bits/sigcontext.h: Include
<bits/types.h>.
* sysdeps/unix/sysv/linux/x86/sys/ucontext.h: Do not include
<signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or
<bits/ss_flags.h>.  Include <bits/types/sigset_t.h> instead of
<bits/types/__sigset_t.h>.
(ucontext_t): Use sigset_t instead of __sigset_t.

7 years agoFix a bug in 'Remove __need macros from signal.h' (a992f506)
Zack Weinberg [Tue, 23 May 2017 02:28:09 +0000 (22:28 -0400)]
Fix a bug in 'Remove __need macros from signal.h' (a992f506)

siginfo-arch.h is included in two different places, so the default
definitions of the macros that it might or might not define need to
be done conditionally afterward, not unconditionally beforehand.

* sysdeps/unix/sysv/linux/bits/siginfo-consts.h
(__SI_ASYNCIO_AFTER_SIGIO): Define default after including
bits/siginfo-arch.h, only if not already defined.
* sysdeps/unix/sysv/linux/bits/types/siginfo_t.h
(__SI_ALIGNMENT, __SI_BAND_TYPE, __SI_CLOCK_T)
(__SI_ERRNO_THEN_CODE, __SI_HAVE_SIGSYS, __SI_SEGFAULT_ADDL):
Likewise.

* sysdeps/unix/sysv/linux/ia64/bits/siginfo-arch.h
* sysdeps/unix/sysv/linux/mips/bits/siginfo-arch.h
* sysdeps/unix/sysv/linux/sparc/bits/siginfo-arch.h
* sysdeps/unix/sysv/linux/tile/bits/siginfo-arch.h
* sysdeps/unix/sysv/linux/x86/bits/siginfo-arch.h:
Unconditionally define __SI_* macros.

7 years agolibio: Avoid dup already opened file descriptor [BZ#21393]
Adhemerval Zanella [Fri, 5 May 2017 14:31:38 +0000 (11:31 -0300)]
libio: Avoid dup already opened file descriptor [BZ#21393]

As described in BZ#21398 (close as dup of 21393) report current
freopen implementation fails when one tries to freopen STDIN_FILENO,
STDOUT_FILENO, or STDERR_FILENO.  Although on bug report the
discussion leads to argue if a close followed by a freopen on the
standard file is a valid operation, the underlying issue is not
really the check for dup3 returned value, but rather calling it
if the returned file descriptor is equal as the input one.

So for a quality of implementation this patch avoid calling dup3
for the aforementioned case.  It also adds a dup3 error case check
for the two possible failures, with one being Linux only: EINTR and
EBUSY.  The EBUSY issue is better explained on this stackoverflow
thread [1], but in a short it is due the internal Linux
implementation which allows a race condition window for dup2 due
the logic dissociation of file descriptor allocation and actual
VFS 'install' operation.  For both outliers failures all allocated
memory is freed and a NULL FILE* is returned.

With this patch the example on BZ#21398 is now actually possible
(I used as the testcase for the bug report).  Checked on
x86_64-linux-gnu.

[BZ #21393]
* libio/freopen.c (freopen): Avoid dup already opened file descriptor
and add a check for dup3 failure.
* libio/freopen64.c (freopen64): Likewise.
* libio/tst-freopen.c (do_test): Rename to do_test_basic and use
libsupport.
(do_test_bz21398): New test.
* manual/stdio.texi (freopen): Add documentation of EBUSY failure.

[1] http://stackoverflow.com/questions/23440216/race-condition-when-using-dup2

7 years agoRemove useless comment from sysdeps/sparc/sparc32/dl-machine.h
Siddhesh Poyarekar [Mon, 22 May 2017 19:40:29 +0000 (01:10 +0530)]
Remove useless comment from sysdeps/sparc/sparc32/dl-machine.h

David Miller has not been shot yet AFAIK (yes, I googled for any news
that may seem relevant and I poked him on twitter some days ago) so
either nobody uses SPARC or the code is correct or nobody read the
instructions in the comment to shoot him.  In all of those cases the
comment is clearly not useful, so getting rid of it.

7 years agoAdd one more header to be installed, missed from previous patch.
Zack Weinberg [Sun, 21 May 2017 13:50:26 +0000 (09:50 -0400)]
Add one more header to be installed, missed from previous patch.

* signal/Makefile (headers): Add bits/types/sigval_t.h.

7 years agoRemove __need macros from signal.h.
Zack Weinberg [Fri, 2 Dec 2016 00:24:13 +0000 (19:24 -0500)]
Remove __need macros from signal.h.

The types affected are __sig_atomic_t, sig_atomic_t, __sigset_t,
sigset_t, sigval_t, sigevent_t, and siginfo_t. __sig_atomic_t is a
scalar, so it's now directly available from bits/types.h.  The others
get bits/types/ headers.

Side effects include: There have been small changes to which
non-signal headers expose which subset of the signal-related types.
A couple of architectures' nested siginfo_t fields had to be renamed
to prevent undesired macro expansion.  Internal code that wants to
manipulate signal masks must now include <sigsetops.h> (which is not
installed) and should be aware that __sigaddset, __sigandset,
__sigdelset, __sigemptyset, and __sigorset no longer return a value
(unlike the public API).  Relatedly, the public signal.h no longer
declares any of those functions.  The obsolete sigmask() macro no
longer has a system-specific definition -- in the cases where it
matters, it didn't work anyway.

New Linux architectures should create bits/siginfo-arch.h and/or
bits/siginfo-consts-arch.h to customize their siginfo_t, rather than
duplicating everything in bits/siginfo.h (which no longer exists).
Add new __SI_* macros if necessary.  Ports to other operating systems
are strongly encouraged to generalize this scheme further.

* bits/sigevent-consts.h
* bits/siginfo-consts.h
* bits/types/__sigset_t.h
* bits/types/sigevent_t.h
* bits/types/siginfo_t.h
* sysdeps/unix/sysv/linux/bits/sigevent-consts.h
* sysdeps/unix/sysv/linux/bits/siginfo-consts.h
* sysdeps/unix/sysv/linux/bits/types/__sigset_t.h
* sysdeps/unix/sysv/linux/bits/types/sigevent_t.h
* sysdeps/unix/sysv/linux/bits/types/siginfo_t.h:
New system-dependent bits headers.

* sysdeps/unix/sysv/linux/bits/siginfo-arch.h
* sysdeps/unix/sysv/linux/bits/siginfo-consts-arch.h
* sysdeps/unix/sysv/linux/ia64/bits/siginfo-arch.h
* sysdeps/unix/sysv/linux/ia64/bits/siginfo-consts-arch.h
* sysdeps/unix/sysv/linux/mips/bits/siginfo-arch.h
* sysdeps/unix/sysv/linux/sparc/bits/siginfo-arch.h
* sysdeps/unix/sysv/linux/tile/bits/siginfo-arch.h
* sysdeps/unix/sysv/linux/tile/bits/siginfo-consts-arch.h
* sysdeps/unix/sysv/linux/x86/bits/siginfo-arch.h:
New Linux-only system-dependent bits headers.

* signal/bits/types/sig_atomic_t.h
* signal/bits/types/sigset_t.h
* signal/bits/types/sigval_t.h:
New non-system-dependent bits headers.

* sysdeps/generic/sigsetops.h
* sysdeps/unix/sysv/linux/sigsetops.h:
New internal headers.

* include/bits/types/sig_atomic_t.h
* include/bits/types/sigset_t.h
* include/bits/types/sigval_t.h:
New wrappers.

* signal/sigsetops.h
* bits/siginfo.h
* bits/sigset.h
* sysdeps/unix/sysv/linux/bits/siginfo.h
* sysdeps/unix/sysv/linux/bits/sigset.h
* sysdeps/unix/sysv/linux/ia64/bits/siginfo.h
* sysdeps/unix/sysv/linux/mips/bits/siginfo.h
* sysdeps/unix/sysv/linux/s390/bits/siginfo.h
* sysdeps/unix/sysv/linux/sparc/bits/siginfo.h
* sysdeps/unix/sysv/linux/tile/bits/siginfo.h
* sysdeps/unix/sysv/linux/x86/bits/siginfo.h:
Deleted.

* signal/Makefile, sysdeps/unix/sysv/linux/Makefile:
Update lists of installed headers.

* posix/bits/types.h: Define __sig_atomic_t here.
* signal/signal.h: Use the new bits headers; no need to handle
__need_sig_atomic_t nor __need_sigset_t.  Don't use __sigmask
to define sigmask.
* include/signal.h: No need to handle __need_sig_atomic_t
nor __need_sigset_t.  Don't define __sigemptyset.

* io/sys/poll.h, setjmp/setjmp.h
* sysdeps/arm/sys/ucontext.h, sysdeps/generic/sys/ucontext.h
* sysdeps/i386/sys/ucontext.h, sysdeps/m68k/sys/ucontext.h
* sysdeps/mach/hurd/i386/bits/sigcontext.h
* sysdeps/mips/sys/ucontext.h, sysdeps/powerpc/novmxsetjmp.h
* sysdeps/pthread/bits/sigthread.h
* sysdeps/unix/sysv/linux/hppa/sys/ucontext.h
* sysdeps/unix/sysv/linux/m68k/sys/ucontext.h
* sysdeps/unix/sysv/linux/mips/sys/ucontext.h
* sysdeps/unix/sysv/linux/nios2/sys/ucontext.h
* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h
* sysdeps/unix/sysv/linux/s390/sys/ucontext.h
* sysdeps/unix/sysv/linux/sh/sys/ucontext.h
* sysdeps/unix/sysv/linux/sparc/sys/ucontext.h
* sysdeps/unix/sysv/linux/tile/sys/ucontext.h
* sysdeps/unix/sysv/linux/x86/sys/ucontext.h:
Use bits/types/__sigset_t.h.

* misc/sys/select.h, posix/spawn.h
* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h
* sysdeps/unix/sysv/linux/sys/epoll.h
* sysdeps/unix/sysv/linux/sys/signalfd.h:
Use bits/types/sigset_t.h.

* resolv/netdb.h, rt/mqueue.h: Use bits/types/sigevent_t.h.
* rt/aio.h: Use bits/types/sigevent_t.h and bits/sigevent-consts.h.
* socket/sys/socket.h: Don't include bits/sigset.h.

* login/utmp_file.c, shadow/lckpwdf.c, signal/sigandset.c
* signal/sigisempty.c, stdlib/abort.c, sysdeps/posix/profil.c
* sysdeps/posix/sigignore.c, sysdeps/posix/sigintr.c
* sysdeps/posix/signal.c, sysdeps/posix/sigset.c
* sysdeps/posix/sprofil.c, sysdeps/posix/sysv_signal.c
* sysdeps/unix/sysv/linux/nptl-signals.h:
Include sigsetops.h.

* signal/sigaddset.c, signal/sigandset.c, signal/sigdelset.c
* signal/sigorset.c, stdlib/abort.c, sysdeps/posix/sigignore.c
* sysdeps/posix/signal.c, sysdeps/posix/sigset.c:
__sigaddset, __sigandset, __sigdelset, __sigemptyset, __sigorset
now return no value.

* signal/sigaddset.c, signal/sigdelset.c, signal/sigismem.c
Include <errno.h>, <signal.h>, and <sigsetops.h> instead of
"sigsetops.h".

* signal/sigsetops.c: Explicitly define __sigismember,
__sigaddset, and __sigdelset as compatibility symbols.

* signal/Versions: Correct commentary on __sigpause,
__sigaddset, __sigdelset, __sigismember.

* inet/rcmd.c: Include sigsetops.h.  Convert old code using
__sigblock/__sigsetmask to use __sigprocmask and friends.

7 years agoRemove __need_list_t and __need_res_state.
Zack Weinberg [Wed, 22 Mar 2017 13:55:25 +0000 (09:55 -0400)]
Remove __need_list_t and __need_res_state.

These __need macros are only used internally, by nptl/descr.h.
However, including all of resolv.h from descr.h causes build failures
due to resolv.h's dozens of pseudo-struct-field macros, some of which
collide with struct fields in NPTL internal data structures.
Similarly, including all of list.h from descr.h produces an include
cycle, atomic.h -> atomic-machine.h -> tls.h -> descr.h -> list.h ->
atomic.h, and then list.h tries to use atomic.h macros that haven't
been defined yet.  So we do need mini-headers for these.  In the
list.h case I called it include/list_t.h since it isn't going to be
installed.

* resolv/resolv.h: Remove __need_res_state logic.
Move definition of res_state and related constants to ...
* resolv/bits/types/res_state.h: ...this new file.
* resolv/Makefile: Install bits/types/res_state.h.
* include/bits/types/res_state.h: New wrapper.
* include/list.h: Remove __need_list_t logic.
Move definition of list_t to ...
* include/list_t.h: ...this new file.

* nptl/descr.h: Include list_t.h and bits/types/res_state.h
instead of list.h and resolv.h.

7 years agox86_64: Remove L(return_null) from rawmemchr.S
H.J. Lu [Sat, 20 May 2017 13:13:38 +0000 (06:13 -0700)]
x86_64: Remove L(return_null) from rawmemchr.S

L(return_null) is unused.

* sysdeps/x86_64/rawmemchr.S (L(return_null)): Removed.

7 years agoRemove sfi_* annotations from ARM assembly files.
Zack Weinberg [Fri, 12 May 2017 00:36:15 +0000 (20:36 -0400)]
Remove sfi_* annotations from ARM assembly files.

This semi-mechanical patch removes all uses and definitions of the
sfi_breg, sfi_pld, and sfi_sp macros from various ARM-specific
assembly files.  These were only used by NaCl.

* sysdeps/arm/sysdep.h
        (ARM_SFI_MACROS, sfi_breg, sfi_pld, sfi_sp): Delete definitions.

* sysdeps/arm/__longjmp.S, sysdeps/arm/add_n.S
* sysdeps/arm/addmul_1.S, sysdeps/arm/arm-mcount.S
* sysdeps/arm/armv6/rawmemchr.S, sysdeps/arm/armv6/strchr.S
* sysdeps/arm/armv6/strcpy.S, sysdeps/arm/armv6/strlen.S
* sysdeps/arm/armv6/strrchr.S, sysdeps/arm/armv6t2/memchr.S
* sysdeps/arm/armv6t2/strlen.S
* sysdeps/arm/armv7/multiarch/memcpy_impl.S
* sysdeps/arm/armv7/strcmp.S, sysdeps/arm/dl-tlsdesc.S
* sysdeps/arm/memcpy.S, sysdeps/arm/memmove.S
* sysdeps/arm/memset.S, sysdeps/arm/setjmp.S
* sysdeps/arm/strlen.S, sysdeps/arm/submul_1.S:
        Remove all uses of sfi_breg, sfi_pld, and sfi_sp.

7 years agoRemove the bulk of the NaCl port.
Zack Weinberg [Fri, 12 May 2017 00:28:07 +0000 (20:28 -0400)]
Remove the bulk of the NaCl port.

The NaCl port has not been actively maintained since before the 2.25
release.  The complementary GCC back-end was never contributed to GCC,
and we are given to understand that the current NaCl SDK has switched
to Clang and therefore cannot be used to build glibc anymore, so we
doubt that the port remains useful.

This commit simply removes the sysdeps/arm/nacl and sysdeps/nacl
directories and the abi-tags entry.

Remove the NaCl port.
* abi-tags: Remove .*-.*-nacl.* entry.
* sysdeps/arm/nacl: Remove directory and contents.
* sysdeps/nacl: Likewise.

7 years agomanual: Convert errno @comments to new @errno macro.
Rical Jasan [Sat, 20 May 2017 05:44:25 +0000 (22:44 -0700)]
manual: Convert errno @comments to new @errno macro.

errno.texi documents error macros, their values, and error strings in
Texinfo @comments, some of which are also used for @standards.  The
purpose of this commit is to separate the standards from the error
strings so that both the @standards conversion script picks up clean
@standards and the errno documentation framework is improved.

The error names, values, and messages are consolidated in a new custom
macro, @errno.  It is not clear that scripts within the sources rely
on the special Texinfo @comment-based format to generate files used
throughout the library, so the definition of @errno in macros.texi now
provides a comment indicating the dependency.  The dependent scripts
are updated to use @errno, which also simplifies them a bit.  The
files those scripts generate were verified to be unchanged.

The @errno macro is not visibly rendered in any way at this time, but
it does use an @cindex command to add the error string to the Concept
Index, to facilitate searching on error messages.

* manual/errno.texi: Convert @comment-based errno
documentation to @errno.
* manual/macros.texi (@errno): New macro.  Consolidate errors,
their values, and messages, adding the error string to the
Concept Index.  Provide a warning in the comment about
external (to the manual) dependencies.
* sysdeps/gnu/errlist.awk: Use @errno instead of @comments.
* sysdeps/mach/hurd/errnos.awk: Likewise.

7 years agoSplit up bits/sigstack.h.
Joseph Myers [Fri, 19 May 2017 20:35:07 +0000 (20:35 +0000)]
Split up bits/sigstack.h.

bits/sigstack.h contains four things: the legacy struct sigstack type,
the preferred stack_t type, the SS_* enum values and macros for signal
stack sizes.

These vary in different ways between glibc configurations; in
particular, the stack sizes vary much more than any of the other
pieces.  Furthermore, these pieces have different standard namespace
rules for when they should be visible (not currently visible in
conform/ results both because the relevant tests are XFAILed for
sys/ucontext.h namespace issues, and because some of the expectations
are incorrect in the same way as the headers, e.g. neither
expectations nor headers reflect that current POSIX no longer has
either the sigstack function or the sigstack structure).

To reduce duplication of identical definitions, and facilitate
namespace fixes without requiring the same feature test macro
conditions to be repeated in many versions of the same header, this
patch splits bits/sigstack.h up into four headers.  It keeps the stack
size macros, while new bits/types/struct_sigstack.h,
bits/types/stack_t.h and bits/ss_flags.h are added for the other
pieces.  bits/types/struct_sigstack.h is the same everywhere,
bits/types/stack_t.h has three variants different in the order of the
structure elements (generic = MIPS Linux, and other Linux), and
bits/ss_flags.h has generic and Linux variants.

This patch includes the new headers everywhere that included
<bits/sigstack.h>, so should cause no difference to what any public
header defines.  Subsequent namespace fixes would then remove or
condition some of those includes.

There should be no conflicts with Zack's changes to signal.h types,
beyond the trivial conflict of both making additions to
signal/Makefile's headers list; the two patches affect disjoint sets
of types and other definitions.

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

* bits/ss_flags.h: New file.
* bits/types/stack_t.h: Likewise.
* include/bits/types/struct_sigstack.h: Likewise.
* signal/bits/types/struct_sigstack.h: Likewise.
* sysdeps/unix/sysv/linux/bits/ss_flags.h: Likewise.
* sysdeps/unix/sysv/linux/bits/types/stack_t.h: Likewise.
* sysdeps/unix/sysv/linux/mips/bits/types/stack_t.h: Likewise.
* signal/Makefile (headers): Add bits/types/struct_sigstack.h,
bits/types/stack_t.h and bits/ss_flags.h.
* signal/signal.h [__USE_XOPEN_EXTENDED || __USE_XOPEN2K8]:
Include <bits/types/struct_sigstack.h>, <bits/types/stack_t.h> and
<bits/ss_flags.h>.
* bits/sigstack.h (struct sigstack): Remove.
(stack_t): Likewise.
(SS_ONSTACK): Likewise.
(SS_DISABLE): Likewise.
* sysdeps/unix/sysv/linux/aarch64/bits/sigstack.h
(struct sigstack): Likewise.
(stack_t): Likewise.
(SS_ONSTACK): Likewise.
(SS_DISABLE): Likewise.
* sysdeps/unix/sysv/linux/alpha/bits/sigstack.h (struct sigstack):
Likewise.
(stack_t): Likewise.
(SS_ONSTACK): Likewise.
(SS_DISABLE): Likewise.
* sysdeps/unix/sysv/linux/bits/sigstack.h (struct sigstack):
Likewise.
(stack_t): Likewise.
(SS_ONSTACK): Likewise.
(SS_DISABLE): Likewise.
* sysdeps/unix/sysv/linux/mips/bits/sigstack.h: Likewise.
* sysdeps/unix/sysv/linux/ia64/bits/sigstack.h (struct sigstack):
Likewise.
(stack_t): Likewise.
(SS_ONSTACK): Likewise.
(SS_DISABLE): Likewise.
* sysdeps/unix/sysv/linux/powerpc/bits/sigstack.h
(struct sigstack): Likewise.
(stack_t): Likewise.
(SS_ONSTACK): Likewise.
(SS_DISABLE): Likewise.
* sysdeps/unix/sysv/linux/sparc/bits/sigstack.h (struct sigstack):
Likewise.
(stack_t): Likewise.
(SS_ONSTACK): Likewise.
(SS_DISABLE): Likewise.
* sysdeps/arm/sys/ucontext.h: Include
<bits/types/struct_sigstack.h>, <bits/types/stack_t.h> and
<bits/ss_flags.h>.
* sysdeps/generic/sys/ucontext.h: Likewise.
* sysdeps/i386/sys/ucontext.h: Likewise.
* sysdeps/m68k/sys/ucontext.h: Likewise.
* sysdeps/mips/sys/ucontext.h: Likewise.
* sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h: Likewise.
* sysdeps/unix/sysv/linux/alpha/sys/ucontext.h: Likewise.
* sysdeps/unix/sysv/linux/arm/sys/ucontext.h: Likewise.
* sysdeps/unix/sysv/linux/hppa/sys/ucontext.h: Likewise.
* sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h: Likewise.
* sysdeps/unix/sysv/linux/ia64/sys/ucontext.h: Likewise.
* sysdeps/unix/sysv/linux/m68k/sys/ucontext.h: Likewise.
* sysdeps/unix/sysv/linux/mips/sys/ucontext.h: Likewise.
* sysdeps/unix/sysv/linux/nios2/sys/ucontext.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h: Likewise.
* sysdeps/unix/sysv/linux/s390/sys/ucontext.h: Likewise.
* sysdeps/unix/sysv/linux/sh/sys/ucontext.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/sys/ucontext.h: Likewise.
* sysdeps/unix/sysv/linux/tile/sys/ucontext.h: Likewise.
* sysdeps/unix/sysv/linux/x86/sys/ucontext.h: Likewise.

7 years agox86: Optimize SSE2 memchr overflow calculation
H.J. Lu [Fri, 19 May 2017 17:46:29 +0000 (10:46 -0700)]
x86: Optimize SSE2 memchr overflow calculation

SSE2 memchr computes "edx + ecx - 16" where ecx is less than 16.  Use
"edx - (16 - ecx)", instead of satured math, to avoid possible addition
overflow.  This replaces

add %ecx, %edx
sbb %eax, %eax
or %eax, %edx
sub $16, %edx

with

neg %ecx
add $16, %ecx
sub %ecx, %edx

It is the same for x86_64, except for rcx/rdx, instead of ecx/edx.

* sysdeps/i386/i686/multiarch/memchr-sse2.S (MEMCHR): Use
"edx + ecx - 16" to avoid possible addition overflow.
* sysdeps/x86_64/memchr.S (memchr): Likewise.

7 years agoFix makefile rules for vmsplice, splice, and open_by_handle_at
Adhemerval Zanella [Fri, 19 May 2017 12:37:00 +0000 (09:37 -0300)]
Fix makefile rules for vmsplice, splice, and open_by_handle_at

Commits ecade1cafbbc18, and a5a34d2 added compiler flags for
vmsplice, splice, and open_by_handle_at respectively on default
misc/Makefile.  However such symbols are build only for Linux and
the rules should on linux Makefile only.

Checked on x86_64-linux-gnu.

* misc/Makefile (CFLAGS-vmsplice.c): Remove rule.
(CFLAGS-splice.c): Likewise.
(CFLAGS-open_by_handle_at.c): Likewise.
* sysdeps/unix/sysv/linux/Makefile (CFLAGS-vmsplice.c): New rule.
(CFLAGS-splice.c): Likewise.
(CFLAGS-open_by_handle_at.c): Likewise.

7 years agoAlso create and use ldbl-compat-choose.h.
Joseph Myers [Fri, 19 May 2017 11:30:26 +0000 (11:30 +0000)]
Also create and use ldbl-compat-choose.h.

This patch makes the glibc build generate an additional header
ldbl-compat-choose.h that defines LONG_DOUBLE_COMPAT_CHOOSE_* macros
for each libc and libm symbol, which select one or the other of their
arguments based on whether the symbol was added before a change to
long double != double.

The effect of this is that it is then possible to define a macro
maybe_long_double_symbol that automatically acts as either
long_double_symbol or weak_alias depending on when the symbol being
defined was added.  This can be used when building long double
functions from type-generic templates.  Thus, with this patch ldbl-opt
no longer needs special long double implementations of each new libm
function added using such a template, and the existing such
implementations are removed.

This is a step towards being able more generally to use common macros
to create all the aliases needed for a libm function, so reducing the
amount of special-case code needed in ldbl-opt and ldbl-64-128, and
facilitating subsequently adding *f32 / *f64 / *f128 / *f32x / *f64x
aliases to existing functions (where the set of aliases that a
function should have may depend on the architecture in various ways).

Tested with build-many-glibcs.py.  Except for on
powerpc64le-linux-gnu, installed stripped shared libraries are
unchanged by the patch.  powerpc64le-linux-gnu is the unique
configuration which used ldbl-opt from the start rather than adding a
new long double choice after originally only having had long double =
double.  The effect of the patch there is that various cases that
previously used long_double_symbol unconditionally now use weak_alias
instead, so .os files contain e.g. a symbol cabsl instead of
cabsl@@GLIBC_2.17.  The final dynamic symbols and versions in the
resulting shared libraries are unchanged (ABI tests pass), as is the
disassembly of the shared libraries, but the differences in the .os
files still result in different .gnu_hash contents in libm.so; the
differences are of no significance and logically using weak_alias is
what's most appropriate in those cases.

* scripts/versions.awk: Generate ldbl-compat-choose.h.
* sysdeps/ieee754/ldbl-opt/math-type-macros-ldouble.h: Include
<ldbl-compat-choose.h>.
(maybe_long_double_symbol): New macro.
[!declare_mgen_alias] (declare_mgen_alias): Use
maybe_long_double_symbol.
* sysdeps/ieee754/ldbl-opt/s_canonicalizel.c: Remove.
* sysdeps/ieee754/ldbl-opt/s_fmaxmagl.c: Likewise.
* sysdeps/ieee754/ldbl-opt/s_fminmagl.c: Likewise.
* sysdeps/ieee754/ldbl-opt/s_nextdownl.c: Likewise.
* sysdeps/ieee754/ldbl-opt/w_llogbl.c: Likewise.
* Makerules [$(build-shared) = yes && !avoid-generated]
(before-compile): Add $(common-objpfx)ldbl-compat-choose.h.
[$(build-shared) = yes && !avoid-generated]
($(common-objpfx)ldbl-compat-choose.h): New target.

7 years agoCreate and use first-versions.h with macros for function symbol versions.
Joseph Myers [Fri, 19 May 2017 11:26:00 +0000 (11:26 +0000)]
Create and use first-versions.h with macros for function symbol versions.

This patch arranges for the glibc build to generate a header
first-versions.h that defines macros for the earliest symbol version
in which each public symbol (GLIBC_[0-9]* symbol version, name only
uses C identifier characters) is available.

This is used in sysdeps/ieee754/ldbl-opt/math-type-macros-double.h to
replace the manually defined LDOUBLE_*_libm_version macros for various
functions defined using type-generic templates, the purpose of which
is to use in LONG_DOUBLE_COMPAT tests "was this function originally
added before glibc supported long double != double on this platform?".
As discussed in
<https://sourceware.org/ml/libc-alpha/2016-12/msg00246.html>, I expect
this to be useful more generally in reducing the amount of
special-case code needed in ldbl-opt and ldbl-64-128.

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

* scripts/versions.awk: Generate first-versions.h.
* sysdeps/ieee754/ldbl-opt/math-type-macros-double.h: Include
<first-versions.h>.
(LDOUBLE_cabsl_libm_version): Remove macro.
(LDOUBLE_cargl_libm_version): Likewise.
(LDOUBLE_cimagl_libm_version): Likewise.
(LDOUBLE_conjl_libm_version): Likewise.
(LDOUBLE_creall_libm_version): Likewise.
(LDOUBLE_cacosl_libm_version): Likewise.
(LDOUBLE_cacoshl_libm_version): Likewise.
(LDOUBLE_ccosl_libm_version): Likewise.
(LDOUBLE_ccoshl_libm_version): Likewise.
(LDOUBLE_casinl_libm_version): Likewise.
(LDOUBLE_csinl_libm_version): Likewise.
(LDOUBLE_casinhl_libm_version): Likewise.
(LDOUBLE_csinhl_libm_version): Likewise.
(LDOUBLE_catanl_libm_version): Likewise.
(LDOUBLE_catanhl_libm_version): Likewise.
(LDOUBLE_ctanl_libm_version): Likewise.
(LDOUBLE_ctanhl_libm_version): Likewise.
(LDOUBLE_cexpl_libm_version): Likewise.
(LDOUBLE_clogl_libm_version): Likewise.
(LDOUBLE_cprojl_libm_version): Likewise.
(LDOUBLE_csqrtl_libm_version): Likewise.
(LDOUBLE_cpowl_libm_version): Likewise.
(LDOUBLE_clog10l_libm_version): Likewise.
(LDOUBLE___clog10l_libm_version): Likewise.
(LDOUBLE_fdiml_libm_version): Likewise.
(LDOUBLE_fmaxl_libm_version): Likewise.
(LDOUBLE_fminl_libm_version): Likewise.
(LDOUBLE_ilogbl_libm_version): Likewise.
(LDOUBLE_nanl_libm_version): Likewise.
[!M_LIBM_NEED_COMPAT] (M_LIBM_NEED_COMPAT): Use
FIRST_VERSION_libm_* macros.
[!declare_mgen_libm_compat] (declare_mgen_libm_compat): Likewise.
* Makerules [$(build-shared) = yes && !avoid-generated]
(before-compile): Add $(common-objpfx)first-versions.h.
[$(build-shared) = yes && !avoid-generated]
($(common-objpfx)first-versions.h): New target.
($(common-objpfx)sysd-versions): Depend on and change to rule for
building $(common-objpfx)versions.stmp.

7 years agoposix: Consolidate Linux mq_timedsend syscall
Adhemerval Zanella [Wed, 4 Nov 2015 12:40:20 +0000 (10:40 -0200)]
posix: Consolidate Linux mq_timedsend syscall

This patch consolidates the mq_timedsend Linux syscall generation
on sysdeps/unix/sysv/linux/mq_timedsend.c.  It basically removes it
from architecture auto-generation list.

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

* rt/Makefile (CFLAGS-mq_timedsend.c): New flag.
* sysdeps/unix/sysv/linux/mq_timedsend.c: New file.
* sysdeps/unix/sysv/linux/syscalls.list (mq_timedsend): Remove from
auto-generation list.

7 years agoposix: Consolidate Linux mq_timedreceive syscall
Adhemerval Zanella [Wed, 4 Nov 2015 12:32:58 +0000 (10:32 -0200)]
posix: Consolidate Linux mq_timedreceive syscall

This patch consolidates the mq_timedreceive Linux syscall generation
on sysdeps/unix/sysv/linux/mq_timedreceive.c.  It basically removes it
from architecture auto-generation list.

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

* rt/Makefile (CFLAGS-mq_timedreceive.c): New flag.
* sysdeps/unix/sysv/linux/mq_timedreceive.c: New file.
* sysdeps/unix/sysv/linux/syscalls.list (mq_timedreceive): Remove
from auto-generation list.

7 years agolinux: Consolidate Linux open_by_handle_at syscall
Adhemerval Zanella [Mon, 2 Nov 2015 13:42:09 +0000 (11:42 -0200)]
linux: Consolidate Linux open_by_handle_at syscall

This patch consolidates the open_by_handle_at Linux syscall generation on
sysdeps/unix/sysv/linux/open_by_handle_at.c.  It basically removes it from
architectures auto-generation list.

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

* sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Add
open_by_handle_at.
(CFLAGS-open_by_handle_at.c): New flag.
* sysdeps/unix/sysv/linux/open_by_handle_at.c: New file.
* sysdeps/unix/sysv/linux/syscalls.list (open_by_handle_at): New
file.
* misc/Makefile (CFLAGS-open_by_handle_at.c): New rule.

7 years agolinux: Consolidate Linux splice syscall
Adhemerval Zanella [Mon, 2 Nov 2015 13:22:30 +0000 (11:22 -0200)]
linux: Consolidate Linux splice syscall

This patch consolidates the splice Linux syscall generation on
sysdeps/unix/sysv/linux/splice.c.  It basically removes it from
architectures auto-generation list.

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

* sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Add splice.
(CFLAGS-splice.c): New flag.
* sysdeps/unix/sysv/linux/splice.c: New file.
* sysdeps/unix/sysv/linux/syscalls.list (splice): Remove from
auto-generation syscall list.
* misc/Makefile (CFLAGS-splice.c): New rule.

7 years agolinux: Consolidate Linux vmsplice syscall
Adhemerval Zanella [Mon, 2 Nov 2015 13:13:24 +0000 (11:13 -0200)]
linux: Consolidate Linux vmsplice syscall

This patch consolidates the vmsplice Linux syscall generation on
sysdeps/unix/sysv/linux/vmsplice.c.  It basically removes it from
architectures auto-generation list.

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

* sysdeps/unix/sysv/linux/Makefile (CFLAGS-vmsplice.c): New flag.
* sysdeps/unix/sysv/linux/syscalls.list (vmsplice): Remove from
auto-generation syscall list.
* sysdeps/unix/sysv/linux/vmsplice.c: New file.
* misc/Makefile (CFLAGS-vmsplice.c): New rule.

7 years agoposix: Consolidate Linux fsync syscall
Adhemerval Zanella [Mon, 2 Nov 2015 14:14:35 +0000 (12:14 -0200)]
posix: Consolidate Linux fsync syscall

This patch consolidates the fsync Linux syscall generation on
sysdeps/unix/sysv/linux/fsync.c.  It basically removes it from
architectures auto-generation list.

For arm it also removes the __errno_location call since fsync
is not called with SYSCALL_CANCEL with call arch-specific
INLINE_SYSCALL macro which in turn will call __set_errno macro
(and setting errno directly).

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

* misc/Makefile (CFLAGS-fsync.c): New flag.
* nptl/Makefile (CFLAGS-fsync.c): Likewise.
* sysdeps/unix/syscalls.list (fsync): Remove from auto-generation
syscall list.
* sysdeps/unix/sysv/linux/fsync.c: New file.
* sysdeps/unix/sysv/linux/arm/localplt.data [libpthread.so]
(__errno_location): Remove.

7 years agoposix: Consolidate Linux fdatasync syscall
Adhemerval Zanella [Mon, 2 Nov 2015 13:00:39 +0000 (11:00 -0200)]
posix: Consolidate Linux fdatasync syscall

This patch consolidates the fdatasync Linux syscall generation on
sysdeps/unix/sysv/linux/fdatasync.c.  It basically removes it from
architectures auto-generation list.

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

* misc/makefile (CFLAGS-datasync.c): New flag.
* nptl/makefile (CFLAGS-datasync.c): Likewise.
* sysdeps/unix/sysv/linux/syscalls.list (fdatasync): Remove from
auto-generation syscall list.
* sysdeps/unix/sysv/linux/fdatasync.c: New file.

7 years agoposix: Consolidate Linux msync syscall
Adhemerval Zanella [Mon, 2 Nov 2015 12:53:29 +0000 (10:53 -0200)]
posix: Consolidate Linux msync syscall

This patch consolidates the msync Linux syscall generation on
sysdeps/unix/sysv/linux/msync.c.  It basically removes it from
architectures auto-generation list.

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

* misc/Makefile (CFLAGS-msync.c): New rule.
* nptl/Makefile (CFLAGS-msync.c): Likewise.
* sysdeps/unix/syscalls.list: Remove msync from auto-generation list.
* sysdeps/unix/sysv/linux/msync.c: New file.

7 years agoposix: Consolidate Linux sigsuspend implementation
Adhemerval Zanella [Thu, 24 Nov 2016 12:12:37 +0000 (10:12 -0200)]
posix: Consolidate Linux sigsuspend implementation

This patch consolidates the sigsuspend Linux syscall generation on
sysdeps/unix/sysv/linux/sigsuspend.c.  It basically removes the alpha
assembly version which call the old sigsusped interface using only
the first doubleword from sigset. Current minimum supported kernel
on alpha (3.2) enforces rt_sigsuspend on the architecture
(__ARCH_WANT_SYS_RT_SIGSUSPEND option on kernel), so it is possible
to use the default implementation.

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

* sysdeps/unix/sysv/linux/alpha/sigsuspend.S: Remove file.
* sysdeps/unix/sysv/linux/sigsuspend.c: Simplify include list.
* nptl/Makefile (CFLAGS-sigsuspend.c): New rule.
* sysdeps/unix/sysv/linux/sparc/sparc64/Makefile
(CFLAGS-sigsuspend.c): Remove rule.

7 years agolinux: Consolidate Linux tee implementation
Adhemerval Zanella [Thu, 24 Nov 2016 11:55:09 +0000 (09:55 -0200)]
linux: Consolidate Linux tee implementation

This patch consolidates the tee Linux syscall generation on
sysdeps/unix/sysv/linux/tee.c.  It basically removes it from
architectures auto-generation list.

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

* sysdeps/unix/sysv/linux/Makefile (sysdeps_routines): Add tee.
(CFLAGS-tee.c): New rule.
* sysdeps/unix/sysv/linux/syscalls.list: Remove tee from
auto-generated list.
* sysdeps/unix/sysv/linux/tee.c: New file.

7 years agoposix: Consolidate Linux nanosleep syscall
Adhemerval Zanella [Tue, 3 Nov 2015 18:03:56 +0000 (16:03 -0200)]
posix: Consolidate Linux nanosleep syscall

This patch consolidates the nanosleep Linux syscall generation on
sysdeps/unix/sysv/linux/nanosleep.c.  It basically removes it from
architectures auto-generation list.

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

* nptl/Makefile (CFLAGS-nanosleep.c): New rule.
* posix/Makefile (CFLAGS-nanosleep.c): Likewise.
* sysdeps/unix/sysv/linux/nanosleep.c: New file.
* sysdeps/unix/sysv/linux/syscalls.list: Remove nanosleep from
auto-generated list.

7 years agoposix: Consolidate Linux waitpid syscall
Adhemerval Zanella [Tue, 17 Jan 2017 17:57:33 +0000 (15:57 -0200)]
posix: Consolidate Linux waitpid syscall

This patch consolidates the waitpid Linux syscall generation on
sysdeps/unix/sysv/linux/waitpid.c.  It basically removes it from
architecture auto-generation list and also remove arch specific
implementations.

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/sh/syscalls.list: Remove waitpid from
auto-generated list.
* sysdeps/unix/sysv/linux/m68k/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/i386/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/sparc/syscalls.list: Remove file.
* sysdeps/unix/sysv/linux/tile/waitpid.S: Likewise.
* sysdeps/unix/sysv/linux/powerpc/syscalls.list: Likewise.

7 years agoposix: Consolidate Linux pause syscall
Adhemerval Zanella [Mon, 21 Nov 2016 19:26:35 +0000 (17:26 -0200)]
posix: Consolidate Linux pause syscall

This patch consolidates the pause Linux implementation on
sysdeps/unix/sysv/linux/pause.c.  If defined the pause syscall
(__NR_pause) will be used, other ppoll with 0 arguments will be
used instead.

It has the small advantage of generic pause implementation with
uses rt_sigprocmask plus rt_sigsuspend because it requires only
one syscall and the pause is done atomically regarding signal
handling (for instance, pause may not be interrupted if the
signal arrives between the rt_sigprocmask and rt_sigsuspend
syscall).

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

* sysdeps/unix/sysv/linux/generic/pause.c: Remove file.
* sysdeps/unix/sysv/linux/sparc/sparc64/pause.c: Likewise.
* sysdeps/unix/sysv/linux/sparc/kernel-features.h [__arch64__]
(__NR_pause): Undefine.
* sysdeps/unix/sysv/linux/pause.c: New file.
* sysdeps/unix/sysv/linux/syscalls.list: Remove pause from
auto-generation list.

7 years agoCorrect comments in x86_64/multiarch/memcmp.S
H.J. Lu [Thu, 18 May 2017 21:02:02 +0000 (14:02 -0700)]
Correct comments in x86_64/multiarch/memcmp.S

* sysdeps/x86_64/multiarch/memcmp.S (__GI_memcmp): Correct
comments.

7 years agoReduce value of LD_HWCAP_MASK for tst-env-setuid test case
Siddhesh Poyarekar [Thu, 18 May 2017 20:12:01 +0000 (01:42 +0530)]
Reduce value of LD_HWCAP_MASK for tst-env-setuid test case

It was discovered that the dynamic linker allocates a massive amount
of memory that increases with the value of LD_HWCAP_MASK.  Due to
this, setting its value to 0xffffffff in the environment of
tst-env-setuid would cause it to fail in some environments where
overcommit was disabled or severely constrained because malloc would
fail.

Since this test is only concerned with the value of LD_HWCAP_MASK
envvar being conserved (or not, for setxid binaries), lower its value
to avoid spurious failures.

The allocation bug is reported as #21502.

7 years agomanual: Convert @tables of annotated @items to @vtables.
Rical Jasan [Tue, 16 May 2017 06:41:25 +0000 (23:41 -0700)]
manual: Convert @tables of annotated @items to @vtables.

The conversion script will convert these annotations, but the
replacement Summary-generation script won't catch them because @items
in @tables are not generally considered annotatable, causing them to
be skipped over (or cause errors).  Using @vtable ensures their
continued presence in the Summary, with the added benefit that Texinfo
will also automatically include them in the Variable and Constant
Macro index now.

* manual/conf.texi: Convert @tables of annotated @items to
@vtables.
* manual/lang.texi: Likewise.
* manual/pattern.texi: Likewise.
* manual/resource.texi: Likewise.
* manual/socket.texi: Likewise.

7 years agomanual: Fix up invalid header and standards syntax.
Rical Jasan [Sun, 14 May 2017 10:58:32 +0000 (03:58 -0700)]
manual: Fix up invalid header and standards syntax.

This commit handles exceptional cases of invalid syntax for the
@standards conversion script.

* manual/crypt.texi: Move a comment out of an @*x list.
* manual/filesys.texi: Refactor some comments, one of which
looks like a standard.  Fix incorrectly separated standards.
* manual/locale.texi: Invert an annotation.
* manual/resource.texi: Fix incorrectly separated standards.
* manual/time.texi: Refactor a @vtable that obscures an
annotation.
* manual/users.texi: Refactor multiple headers to occupy a
single @comment.

7 years agopowerpc: Improve memcmp performance for POWER8
Rajalakshmi Srinivasaraghavan [Thu, 18 May 2017 05:51:20 +0000 (11:21 +0530)]
powerpc: Improve memcmp performance for POWER8

Vectorization improves performance over the current implementation.
Tested on powerpc64 and powerpc64le.

7 years agofloat128: Extend __MATH_TG for float128 support
Gabriel F. T. Gomes [Fri, 9 Dec 2016 13:41:55 +0000 (11:41 -0200)]
float128: Extend __MATH_TG for float128 support

* math/math.h (__MATH_TG): Extend the conditions to add
_Float128 support.
* misc/sys/cdefs.h (__HAVE_GENERIC_SELECTION): New macro.

7 years agopowerpc: Add a POWER8-optimized version of cosf()
Paul Clarke [Wed, 17 May 2017 19:35:33 +0000 (16:35 -0300)]
powerpc: Add a POWER8-optimized version of cosf()

This implementation is based on the one already used at
sysdeps/powerpc/powerpc64/fpu/multiarch/s_sinf-power8.S.

* sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
[$(subdir) = math] (libm-sysdep_routines): Add s_cosf-power8 and
s_cosf-ppc64.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_cosf-power8.S: New file.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_cosf-ppc64.c: Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_cosf.c: Likewise.
* sysdeps/powerpc/powerpc64/power8/fpu/s_cosf.S: Likewise.

7 years agoConvert e_exp2l.c into a template
Gabriel F. T. Gomes [Tue, 16 May 2017 16:34:34 +0000 (13:34 -0300)]
Convert e_exp2l.c into a template

This patch converts the implementation of exp2l in math/e_exp2l.c into
a template in math/e_exp2_template.c, then adjusts Makefile to use
this template for long double (the implementations for float and
double in sysdeps have higher precedence and are not used).  This
template can also be used for float128, thus reducing the amount of
duplicated code that gets added when adding support the new type.

Tested for powerpc64le and s390x.

* math/Makefile (libm-calls): Move e_exp2F to gen-libm-calls.
(gen-libm-calls): Add e_exp2F to use the template.
* math/e_exp2l.c: Rename to math/e_exp2_template.c.
* math/e_exp2_template.c: New file, renamed from
math/e_exp2l.c, and made into a template.
* sysdeps/generic/math-type-macros.h (M_MIN_EXP): New macro.

7 years agotunables: Add support for tunables of uint64_t type
Siddhesh Poyarekar [Wed, 17 May 2017 07:41:55 +0000 (13:11 +0530)]
tunables: Add support for tunables of uint64_t type

Recognize the uint64_t type in addition to the current int32_t and
size_t.  This allows addition of tunables of uint64_t types.  In
addition to adding the uint64_t type, this patch also consolidates
validation and reading of integer types in tunables.

One notable change is that of overflow computation in
tunables_strtoul.  The function was lifted from __internal_strtoul,
but it does not need the boundary condition check (i.e. result ==
ULONG_MAX) since it does not need to set errno.  As a result the check
can be simplified, which I have now done.

* elf/dl-tunable-types.h (tunable_type_code_t): New type
TUNABLE_TYPE_UINT_64.
* elf/dl-tunables.c (tunables_strtoul): Return uint64_t.
Simplify computation of overflow.
(tunable_set_val_if_valid_range_signed,
tunable_set_val_if_valid_range_unsigned): Remove and replace
with this...
(TUNABLE_SET_VAL_IF_VALID_RANGE): ... New macro.
(tunable_initialize): Adjust.  Add uint64_t support.
(__tunable_set_val): Add uint64_t support.
* README.tunables: Document it.

7 years agotunables: Specify a default value for tunables
Siddhesh Poyarekar [Wed, 17 May 2017 07:41:00 +0000 (13:11 +0530)]
tunables: Specify a default value for tunables

Enhance dl-tunables.list to allow specifying a default value for a
tunable that it would be initialized to.

* scripts/gen-tunables.awk: Recognize 'default' keyword in
dl-tunables.list.
* README.tunables: Document it.

7 years agoposix: Fix and simplify default p{read,write}v implementation
Adhemerval Zanella [Tue, 2 May 2017 17:39:58 +0000 (14:39 -0300)]
posix: Fix and simplify default p{read,write}v implementation

Currently all architectures but microblaze use wire-up syscall for
p{readv,write}v.  Microblaze still uses the syscall emulation using
sysdep/posix/p{readv,writev}.c and it was reported in some ocasions
[1] [2] that it might have some issues with some linux specific
usage (mainly with O_DIRECT and the alignment requirement).

Although it is not an issue for virtually all the system, this
patch refactors the sysdeps/posix p{read,write}v syscall to avoid
such issue (by using posix_memalign on the buffer used on
p{read,write} call) and by refactoring it common files to avoid
the need check on defines to correct set the alias and internal
symbols.

Checked on microblaze-linux-gnu check with run-built-tests=no and
by using the sysdeps/posix implementation on x86_64-linux-gnu (just
for sanity test where it shown no regression).

* sysdeps/posix/preadv.c: Use sysdeps/posix/preadv_common.c.
* sysdeps/posix/preadv64.c: Likewise.
* sysdeps/unix/sysv/linux/preadv.c: Likewise.
* sysdeps/unix/sysv/linux/preadv64.c: Likewise.
* sysdeps/posix/pwritev.c: Use sysdeps/posix/pwritev_common.c.
* sysdeps/posix/pwritev64.c: Likewise.
* sysdeps/unix/sysv/linux/pwritev.c: Likewise.
* sysdeps/unix/sysv/linux/pwritev64.c: Likewise.
* sysdeps/posix/preadv_common.c: New file.
* sysdeps/posix/pwritev_common.c: Likewise.

[1] http://www.mail-archive.com/qemu-devel@nongnu.org/msg25282.html
[2] https://bugzilla.redhat.com/show_bug.cgi?id=563103#c8

7 years agofloat128: Enable use of IEEE wrapper templates
Gabriel F. T. Gomes [Wed, 1 Feb 2017 19:54:25 +0000 (17:54 -0200)]
float128: Enable use of IEEE wrapper templates

The templates for the IEEE functions wrappers implement wrappers that
do not rely on _LIB_VERSION / matherr / __kernel_standard
functionality to set errno and fix the return value of the functions.
The wrappers are ready to be used by all floating-point types, however
they will first be used by float128, since the old wrappers for float,
double, and long double need to be first deprecated and versioned.

This commits defines __USE_WRAPPER_TEMPLATE to 1 for float128 files,
so that the new wrapper templates are used for this type.

* sysdeps/generic/math-type-macros-float128.h
(__USE_WRAPPER_TEMPLATE): Define to 1 to enable use of the
wrapper templates.

7 years agofloat128: Add private _Float128 declarations for libm.
Paul E. Murphy [Thu, 4 May 2017 20:00:33 +0000 (17:00 -0300)]
float128: Add private _Float128 declarations for libm.

Add the necessary bits to the private headers to support
building the _Float128 libm functions.

A local override for float.h is provided to include the
missing *FLT128 macros implied by TS 18661-3 for this
type when compiling prior to GCC 7.

* include/complex.h (__kernel_casinhf128): New declaration.
* include/float.h: New file.
* include/math.h (__finitef128): Add a hidden def.
(__isinff128): Likewise.
(__isnanf128): Likewise.
(__fpclassify): Likewise.
(__issignalling): Likewise.
(__expf128): Likewise.
(__expm1f128): Likewise.

* sysdeps/generic/fix-fp-int-convert-overflow.h:
(FIX_FLT128_LONG_CONVERT_OVERFLOW): New macro.
(FIX_FLT128_LLONG_CONVERT_OVERFLOW): Likewise.

* sysdeps/generic/math-type-macros-float128.h: New file.

* sysdeps/generic/math_private.h: Include bits/floatn.h and
math_private_calls.h for _Float128.
(__isinff128): New inline implementation used when GCC < 7.0,
since in this case __builtin_isinf_sign is broken.
(fabsf128): New inline implementation that calls the builtin.
(__EXPR_FLT128): New macro.
(min_of_type): Optionally include _Float128 types too.

* sysdeps/generic/math_private_calls.h (__kernel_sincos):
Declare for _Float128.
(__kernel_rem_pio2): Likewise.

* sysdeps/ieee754/ldbl-opt/s_sin.c:
(__DECL_SIMD_sincos_disablef128): New macro.

7 years agofloat128: Include math-finite.h for _Float128
Gabriel F. T. Gomes [Mon, 20 Mar 2017 13:07:35 +0000 (10:07 -0300)]
float128: Include math-finite.h for _Float128

All the declarations in math-finite.h are macroized by floating-point
type.  This patch includes it for float128 and protects the
declarations of functions that need not be declared for float128.

* math/math.h: Include bits/math-finite.h for float128.
(__MATH_DECLARING_FLOATN): Define to control declaration of
float128 functions.
* math/bits/math-finite.h (pow10): Do not declare for float128.
(gamma): Likewise.
(scalb): Likewise.

7 years agofloat128: Add public _Float128 declarations to libm.
Paul E. Murphy [Wed, 20 Jul 2016 16:53:36 +0000 (11:53 -0500)]
float128: Add public _Float128 declarations to libm.

This introduces the machine-dependent bits/floatn.h to control
the inclusion of _Float128 ABI.

* bits/floatn.h: New file.
* bits/huge_val_flt128.h: Likewise.

* bits/libm-simd-decl-stubs.h (__DECL_SIMD_cosf128): New macro.
(__DECL_SIMD_sinf128): Likewise.
(__DECL_SIMD_sincosf128): Likewise.
(__DECL_SIMD_logf128): Likewise.
(__DECL_SIMD_expf128): Likewise.
(__DECL_SIMD_powf128): Likewise.

* math/Makefile (headers): Install bits/floatn.h and
bits/huge_val_flt128.h.

* math/bits/cmathcalls.h (_Mdouble_complex_): Only define if not
defined.

* math/bits/mathcalls.h (pow10, isinf, finite, drem, significand)
(isnan, gamma, nexttoward, scalb): Only define if not
__MATH_DECLARING_FLOATN.
(nextdown, nextup, llogb, roundeven, fromfp, ufromfp, fromfpx)
(ufromfpx, fmaxmag, fminmag, totalorder, totalordermag)
(canonicalize, getpayload, setpayload, setpayloadsig): Declare for
_FloatN even if __STDC_WANT_IEC_60559_BFP_EXT__ is not defined.

* math/complex.h: Include bits/libc-header-start.h and bits/floatn.h.
Include bits/cmathcalls.h to get the declarations of _Float128
versions of complex functions.
[__HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)] (CMPLXF128):
Define macro.

* math/math.h: Include bits/floatn.h and bits/huge_val_flt128.h.
Include bits/mathcalls-helper-functions.h and bits/mathcalls.h to
get the declarations of _Float128 versions of math functions.
(__MATH_DECLARING_FLOATN): New macro to control declaration of
_FloatN types.
[__GNUC_PREREQ (6,0)] (signbit): Since GCC 6.0, __builtin_signbit
is type-generic, so use it without __MATH_TG.
[__HAVE_DISTINCT_FLOAT128] (isinf): This builtin is broken for
_Float128 type on GCC < 7.0.  Explicitly call __isinff128 for
_Float128 type and GCC < 7.0, otherwise use the builtin.
[__HAVE_FLOAT128 && defined __USE_GNU] (M_Ef128, M_LOG2Ef128)
(M_LOG10Ef128, M_LN2f128, M_LN10f128, M_PIf128, M_PI_2f128)
(M_PI_4f128, M_1_PIf128, M_2_PIf128, M_SQRT2f128, M_SQRT1_2f128):
New _GNU_SOURCE enabled macros.

7 years agoRemove useless SPARC signbit aliases.
Joseph Myers [Fri, 12 May 2017 16:37:12 +0000 (16:37 +0000)]
Remove useless SPARC signbit aliases.

The SPARC implementations of __signbit* functions have aliases
signbit, signbitf, signbitl.  These are useless, as they aren't
exported from the shared libraries (only the __signbit* functions are
exported, to be used by the type-generic signbit macro with older
compilers).  This patch removes the useless aliases.

Tested (compilation only) with build-many-glibcs.py for
sparc64-linux-gnu and sparcv9-linux-gnu.

* sysdeps/sparc/sparc32/fpu/s_signbit.S (signbit): Remove alias.
(signbitf): Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_signbit.S (signbit):
Likewise.
(signbitl): Likewise.
* sysdeps/sparc/sparc64/fpu/multiarch/s_signbitf.S (signbitf):
Likewise.
* sysdeps/sparc/sparc64/fpu/s_signbit.S (signbit): Likewise.
(signbitl): Likewise.
* sysdeps/sparc/sparc64/fpu/s_signbitf.S (signbitf): Likewise.

7 years agofork: Remove bogus parent PID assertions [BZ #21386]
Florian Weimer [Fri, 12 May 2017 09:58:09 +0000 (11:58 +0200)]
fork: Remove bogus parent PID assertions [BZ #21386]

7 years agoRemove __ASSUME_STATFS_F_FLAGS.
Joseph Myers [Fri, 12 May 2017 11:48:37 +0000 (11:48 +0000)]
Remove __ASSUME_STATFS_F_FLAGS.

Now that 3.2 is the minimum Linux kernel version for glibc, this patch
removes __ASSUME_STATFS_F_FLAGS and associated conditional code.

Tested for x86_64.

* sysdeps/unix/sysv/linux/kernel-features.h
(__ASSUME_STATFS_F_FLAGS): Remove macro.
* sysdeps/unix/sysv/linux/internal_statvfs.c
[!__ASSUME_STATFS_F_FLAGS]: Remove conditional code.

7 years agoSuppress internal declarations for most of the testsuite.
Zack Weinberg [Mon, 21 Nov 2016 01:46:30 +0000 (20:46 -0500)]
Suppress internal declarations for most of the testsuite.

This patch adds a new build module called 'testsuite'.
IS_IN (testsuite) implies _ISOMAC, as do IS_IN_build and __cplusplus
(which means several ad-hoc tests for __cplusplus can go away).
libc-symbols.h now suppresses almost all of *itself* when _ISOMAC is
defined; in particular, _ISOMAC mode does not get config.h
automatically anymore.

There are still quite a few tests that need to see internal gunk of
one variety or another.  For them, we now have 'tests-internal' and
'test-internal-extras'; files in this category will still be compiled
with MODULE_NAME=nonlib, and everything proceeds as it always has.
The bulk of this patch is moving tests from 'tests' to
'tests-internal'.  There is also 'tests-static-internal', which has
the same effect on files in 'tests-static', and 'modules-names-tests',
which has the *inverse* effect on files in 'modules-names' (it's
inverted because most of the things in modules-names are *not* tests).
For both of these, the file must appear in *both* the new variable and
the old one.

There is also now a special case for when libc-symbols.h is included
without MODULE_NAME being defined at all.  (This happens during the
creation of libc-modules.h, and also when preprocessing Versions
files.)  When this happens, IS_IN is set to be always false and
_ISOMAC is *not* defined, which was the status quo, but now it's
explicit.

The remaining changes to C source files in this patch seemed likely to
cause problems in the absence of the main change.  They should be
relatively self-explanatory.  In a few cases I duplicated a definition
from an internal header rather than move the test to tests-internal;
this was a judgement call each time and I'm happy to change those
however reviewers feel is more appropriate.

* Makerules: New subdir configuration variables 'tests-internal'
and 'test-internal-extras'.  Test files in these categories will
still be compiled with MODULE_NAME=nonlib.  Test files in the
existing categories (tests, xtests, test-srcs, test-extras) are
now compiled with MODULE_NAME=testsuite.
New subdir configuration variable 'modules-names-tests'.  Files
which are in both 'modules-names' and 'modules-names-tests' will
be compiled with MODULE_NAME=testsuite instead of
MODULE_NAME=extramodules.
(gen-as-const-headers): Move to tests-internal.
(do-tests-clean, common-mostlyclean): Support tests-internal.
* Makeconfig (built-modules): Add testsuite.
* Makefile: Change libof-check-installed-headers-c and
libof-check-installed-headers-cxx to 'testsuite'.
* Rules: Likewise.  Support tests-internal.
* benchtests/strcoll-inputs/filelist#en_US.UTF-8:
Remove extra-modules.mk.

* config.h.in: Don't check for __OPTIMIZE__ or __FAST_MATH__ here.
* include/libc-symbols.h: Move definitions of _GNU_SOURCE,
PASTE_NAME, PASTE_NAME1, IN_MODULE, IS_IN, and IS_IN_LIB to the
very top of the file and rationalize their order.
If MODULE_NAME is not defined at all, define IS_IN to always be
false, and don't define _ISOMAC.
If any of IS_IN (testsuite), IS_IN_build, or __cplusplus are
true, define _ISOMAC and suppress everything else in this file,
starting with the inclusion of config.h.
Do check for inappropriate definitions of __OPTIMIZE__ and
__FAST_MATH__ here, but only if _ISOMAC is not defined.
        Correct some out-of-date commentary.

* include/math.h: If _ISOMAC is defined, undefine NO_LONG_DOUBLE
and _Mlong_double_ before including math.h.
* include/string.h: If _ISOMAC is defined, don't expose
_STRING_ARCH_unaligned. Move a comment to a more appropriate
location.

* include/errno.h, include/stdio.h, include/stdlib.h, include/string.h
* include/time.h, include/unistd.h, include/wchar.h: No need to
check __cplusplus nor use __BEGIN_DECLS/__END_DECLS.

* misc/sys/cdefs.h (__NTHNL): New macro.
* sysdeps/m68k/m680x0/fpu/bits/mathinline.h
(__m81_defun): Use __NTHNL to avoid errors with GCC 6.

* elf/tst-env-setuid-tunables.c: Include config.h with _LIBC
defined, for HAVE_TUNABLES.
* inet/tst-checks-posix.c: No need to define _ISOMAC.
* intl/tst-gettext2.c: Provide own definition of N_.
* math/test-signgam-finite-c99.c: No need to define _ISOMAC.
* math/test-signgam-main.c: No need to define _ISOMAC.
* stdlib/tst-strtod.c: Convert to test-driver. Split locale_test to...
* stdlib/tst-strtod1i.c: ...this new file.
* stdlib/tst-strtod5.c: Convert to test-driver and add copyright notice.
        Split tests of __strtod_internal to...
* stdlib/tst-strtod5i.c: ...this new file.
* string/test-string.h: Include stdint.h. Duplicate definition of
inhibit_loop_to_libcall here (from libc-symbols.h).
* string/test-strstr.c: Provide dummy definition of
libc_hidden_builtin_def when including strstr.c.
* sysdeps/ia64/fpu/libm-symbols.h: Suppress entire file in _ISOMAC
mode; no need to test __STRICT_ANSI__ nor __cplusplus as well.
* sysdeps/x86_64/fpu/math-tests-arch.h: Include cpu-features.h.
Don't include init-arch.h.
* sysdeps/x86_64/multiarch/test-multiarch.h: Include cpu-features.h.
Don't include init-arch.h.

* elf/Makefile: Move tst-ptrguard1-static, tst-stackguard1-static,
tst-tls1-static, tst-tls2-static, tst-tls3-static, loadtest,
unload, unload2, circleload1, neededtest, neededtest2,
neededtest3, neededtest4, tst-tls1, tst-tls2, tst-tls3,
tst-tls6, tst-tls7, tst-tls8, tst-dlmopen2, tst-ptrguard1,
tst-stackguard1, tst-_dl_addr_inside_object, and all of the
ifunc tests to tests-internal.
Don't add $(modules-names) to test-extras.
* inet/Makefile: Move tst-inet6_scopeid_pton to tests-internal.
Add tst-deadline to tests-static-internal.
* malloc/Makefile: Move tst-mallocstate and tst-scratch_buffer to
tests-internal.
* misc/Makefile: Move tst-atomic and tst-atomic-long to tests-internal.
* nptl/Makefile: Move tst-typesizes, tst-rwlock19, tst-sem11,
tst-sem12, tst-sem13, tst-barrier5, tst-signal7, tst-tls3,
tst-tls3-malloc, tst-tls5, tst-stackguard1, tst-sem11-static,
tst-sem12-static, and tst-stackguard1-static to tests-internal.
        Link tests-internal with libpthread also.
Don't add $(modules-names) to test-extras.
* nss/Makefile: Move tst-field to tests-internal.
* posix/Makefile: Move bug-regex5, bug-regex20, bug-regex33,
tst-rfc3484, tst-rfc3484-2, and tst-rfc3484-3 to tests-internal.
* stdlib/Makefile: Move tst-strtod1i, tst-strtod3, tst-strtod4,
tst-strtod5i, tst-tls-atexit, and tst-tls-atexit-nodelete to
tests-internal.
        * sunrpc/Makefile: Move tst-svc_register to tests-internal.
* sysdeps/powerpc/Makefile: Move test-get_hwcap and
test-get_hwcap-static to tests-internal.
* sysdeps/unix/sysv/linux/Makefile: Move tst-setgetname to
tests-internal.
* sysdeps/x86_64/fpu/Makefile: Add all libmvec test modules to
modules-names-tests.

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