Commit Graph

29861 Commits

Author SHA1 Message Date
Andreas Schwab
c83196b0df Force rereading TZDEFRULES after it was used to set DST rules only (bug #19253)
If the TZDEFRULES file was used to set the DST rules when $TZ didn't
provide any we need to make sure that the next time it is used we
recompute everything as __tzfile_default changes some setting from what is
provided by TZDEFRULES.
2016-01-11 16:42:25 +01:00
Paul Eggert
97ee300903 Fix doc quoting problems with Texinfo 5
Without this change, in the info file output, Texinfo 5 quotes code
in text with undirected single quotes 'like this' and generates
code examples that with many PDF readers cannot be cut out of PDFs
and pasted into code.
* manual/libc.texinfo: Configure the libc manual like the GNU
Emacs manual, by using @documentencoding and setting
txicodequoteundirected and txicodequotebacktick.  This way,
Texinfo 5 quotes code in text with directed single quotes ‘like
this’ and produces examples that can be cut out of PDFs.  This
change causes Texinfo 5 to generate info files that contain UTF-8
characters in the set {'‘', '’', '“', '”', 'Ä', 'ä', 'ö', '−',
'–', '—', '©', '⇒', '•', '…'}, which is OK nowadays.
2016-01-10 00:20:51 -08:00
Evert
812618055e localedata: nl_NL: date_fmt: rewrite to match standards [BZ #16495]
Add some references to public Dutch standards.
2016-01-08 19:13:41 -05:00
Tulio Magno Quites Machado Filho
42bf1c8971 powerpc: Enforce compiler barriers on hardware transactions
Work around a GCC behavior with hardware transactional memory built-ins.
GCC doesn't treat the PowerPC transactional built-ins as compiler
barriers, moving instructions past the transaction boundaries and
altering their atomicity.
2016-01-08 17:47:33 -02:00
Marko Myllynen
bc49a7afd3 Make shebang interpreter directives consistent
Undo changes in files maintained elsewhere.
2016-01-08 14:09:06 -05:00
Carlos Eduardo Seo
d2de9ef7ad powerpc: Add hwcap2 bits for POWER9.
Added hwcap2 bit masks for Power ISA 3.0 and VSX IEEE binary float 128-bit
features.
2016-01-08 11:19:40 -02:00
John David Anglin
48025aa9ed hppa: fix dladdr [BZ #19415]
The attached patch fixes dladdr on hppa.

Instead of using the generic version of _dl_lookup_address, we use an
implementation more or less modeled after __canonicalize_funcptr_for_compare()
in gcc.  The function pointer is analyzed and if it points to the
trampoline used to call _dl_runtime_resolve just before the global
offset table, then we call _dl_fixup to resolve the function pointer.
Then, we return the instruction pointer from the first word of the
descriptor.

The change fixes the testcase provided in [BZ #19415] and the Debian
nss package now builds successfully.
2016-01-08 02:19:26 -05:00
Mike Frysinger
6e76c11f89 longlong: fix sh -Wundef builds
This file fails when building for SuperH as it assumes __SHMEDIA__
is always defined.  Update the code to check if it's defined.
2016-01-07 17:29:17 -05:00
Andrew Stubbs
5d29eefd61 longlong: add SH FDPIC support 2016-01-07 17:27:32 -05:00
Richard Henderson
7f49b7c020 longlong.h: Disable alpha umul_ppmm for old g++
Causes "unexpected AST of kind MULT_HIGHPART" error with bootstrap from gcc 4.8.
2016-01-07 17:22:30 -05:00
Mike Frysinger
1f89b8d881 xstat: only check to see if __ASSUME_ST_INO_64_BIT is defined
We define __ASSUME_ST_INO_64_BIT by default for Linux targets, and then
undef it for alpha/sh targets.  But the code that uses it looks at its
value (as 0/1) rather than whether it's defined (like all other assume
knobs).  Change the code to see if it's defined to fix build Wundef build
errors for alpha/sh.
2016-01-07 14:37:09 -05:00
Paul Eggert
670a687dea Update timezone code from tzcode 2015g.
This patch updates the timezone code from tzcode 2015g.  The Makefile
and README changes are based on those in Paul's patch
<https://sourceware.org/ml/libc-alpha/2015-05/msg00553.html>.

Tested for x86_64 and x86.

2016-01-06  Paul Eggert  <eggert@cs.ucla.edu>
	    Joseph Myers  <joseph@codesourcery.com>

	* timezone/private.h: Update from tzcode 2015g.
	* timezone/tzfile.h: Likewise.
	* timezone/tzselect.ksh: Likewise.
	* timezone/zdump.c: Likewise.
	* timezone/zic.c: Likewise.
	* timezone/ialloc.c: Remove file.
	* timezone/scheck.c: Likewise.
	* timezone/Makefile (extra-objs): Remove variable.
	($(objpfx)zic): Do not depend on scheck.o and ialloc.o.
	(tz-cflags): Add -DHAVE_GETTEXT -DUSE_LTZ=0
	-Wno-maybe-uninitialized.
	(CFLAGS-zdump.c): Remove -fwrapv -DNOID -DHAVE_GETTEXT.
	(CFLAGS-zic.c): Remove -DNOID -DHAVE_GETTEXT.
	(CFLAGS-ialloc.c): Remove variable.
	(CFLAGS-scheck.c): Likewise.
	* timezone/README: Update list of files from tzcode.
2016-01-07 11:45:07 +00:00
Khem Raj
45c4f3665a argp: Use fwrite_unlocked instead of __fxprintf when !_LIBC
__fxprintf is not available when argp is built outside libc.
gnulib has the same logic already.
2016-01-07 04:25:54 -05:00
Marko Myllynen
48d0341cdd Make shebang interpreter directives consistent 2016-01-07 04:03:21 -05:00
John David Anglin
d7f914848b hppa: fix pthread spinlock
URL: https://bugs.debian.org/725508
2016-01-06 17:26:04 -05:00
H.J. Lu
db2f6f4794 Update copyright dates committed in 2016 2016-01-06 14:03:10 -08:00
H.J. Lu
730bbab2c3 Mark internal unistd functions hidden in ld.so
Since internal unistd functions are only used internally in ld.so and
libc.so, they can be made hidden.  __close, __getcwd, __getpid,
__libc_read and __libc_write can't be hidden in ld.so on Hurd since they
will be preempted by the ones in libc.so after bootstrap.

	[BZ #19122]
	* include/unistd.h [IS_IN (rtld)]: Include <dl-unistd.h>.
	* sysdeps/generic/dl-unistd.h: New file.
	* sysdeps/mach/hurd/dl-unistd.h: Likewise.
2016-01-06 12:54:10 -08:00
H.J. Lu
38acf35697 Mark ld.so internal mmap functions hidden in ld.so
Since ld.so internal mmap functions are only used internally in ld.so,
they can be made hidden.  Don't hide __mmap on Hurd, since __mmap in
ld.so will be preempted by the one in libc.so after bootstrap.

	 [BZ #19122]
	 * include/sys/mman.h [IS_IN (rtld)]: Include <dl-mman.h>.
	 * sysdeps/generic/dl-mman.h: New file.
	 * sysdeps/mach/hurd/dl-mman.h: Likewise.
2016-01-06 11:28:56 -08:00
Joseph Myers
084e7d57bb Update miscellaneous files from upstream sources.
This patch updates texinfo.tex, config.guess, config.sub and
move-if-change from their respective upstream sources.

	* manual/texinfo.tex: Update to version 2016-01-04.21 with
	trailing whitespace removed.
	* scripts/config.guess: Update to version 2016-01-01.
	* scripts/config.sub: Update to version 2016-01-01.
	* scripts/move-if-change: Update from gnulib.
2016-01-05 18:04:06 +00:00
Anton Blanchard
0a1f1e78fb Eliminate redundant sign extensions in pow()
When looking at the code generated for pow() on ppc64 I noticed quite
a few sign extensions. Making the array indices unsigned reduces the
number of sign extensions from 24 to 7.

Tested for powerpc64le and x86_64.
2016-01-04 14:55:38 -02:00
Joseph Myers
1979f3c1ad Update copyright dates not handled by scripts/update-copyrights.
I've updated copyright dates in glibc for 2016.  This is the patch for
the changes not generated by scripts/update-copyrights and subsequent
build / regeneration of generated files.

	* NEWS: Update copyright dates.
	* catgets/gencat.c (print_version): Likewise.
	* csu/version.c (banner): Likewise.
	* debug/catchsegv.sh: Likewise.
	* debug/pcprofiledump.c (print_version): Likewise.
	* debug/xtrace.sh (do_version): Likewise.
	* elf/ldconfig.c (print_version): Likewise.
	* elf/ldd.bash.in: Likewise.
	* elf/pldd.c (print_version): Likewise.
	* elf/sotruss.sh: Likewise.
	* elf/sprof.c (print_version): Likewise.
	* iconv/iconv_prog.c (print_version): Likewise.
	* iconv/iconvconfig.c (print_version): Likewise.
	* locale/programs/locale.c (print_version): Likewise.
	* locale/programs/localedef.c (print_version): Likewise.
	* login/programs/pt_chown.c (print_version): Likewise.
	* malloc/memusage.sh (do_version): Likewise.
	* malloc/memusagestat.c (print_version): Likewise.
	* malloc/mtrace.pl: Likewise.
	* manual/libc.texinfo: Likewise.
	* nptl/version.c (banner): Likewise.
	* nscd/nscd.c (print_version): Likewise.
	* nss/getent.c (print_version): Likewise.
	* nss/makedb.c (print_version): Likewise.
	* posix/getconf.c (main): Likewise.
	* scripts/test-installation.pl: Likewise.
	* sysdeps/unix/sysv/linux/lddlibc4.c (main): Likewise.
2016-01-04 16:26:30 +00:00
Joseph Myers
f7a9f785e5 Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
Helge Deller
d4eed61f85 hppa: Add MAP_HUGETLB and MAP_STACK defines [BZ #19285]
The attached patch adds some upstream defines like MAP_HUGETLB and MAP_STACK
in mman.h for the hppa architecture.

The existing MADV_xxK_PAGES defines were dropped upstream, because they were
originally added many years ago based on a proposed patch for the Linux kernel
which was never applied. So, this patch drops those unneeded defines.
2016-01-02 23:39:49 -05:00
Mike Frysinger
19e0751014 ia64: fpu: fix gamma definition handling [BZ #15421]
The rework in commit d709042a6e broke
buiding on ia64 due to compat_symbol expanding into ... in some cases.
The common files were wrapped in a BUILD_LGAMMA check, but the ia64
ones were not.  Add that logic to the ia64 files too.
2016-01-01 22:17:07 -05:00
Dmitry V. Levin
e0043e17df Fix linux personality syscall wrapper
The personality system call, starting with linux kernel commit
v2.6.29-6609-g11d06b2a1e5658f448a308aa3beb97bacd64a940, always
successfully changes the personality if requested.  The syscall
wrapper, however, still can return an error in the following cases:
- the value returned by the system call looks like an error
due to architecture limitations of 32-bit kernels;
- a personality greater than 0xffffffff is passed to the system call,
and the 64-bit kernel does not have commit
v2.6.35-rc1-372-g485d527686850d68a0e9006dd9904f19f122485e
that would truncate this value to unsigned int;
- on sparc64, the value returned by the system call looks like an error
due to sparc64 kernel sign extension bug.

The solution is three-fold:
- move generic syscalls.list personality entry to generic 64-bit
syscalls.list file;
- for each 32-bit architecture that use negated errno semantics,
add a NOERRNO personality entry to their syscalls.list file;
- for sparc64 and 32-bit architectures that use dedicated registers
to flag syscall errors, add a wrapper around personality syscall;
if the system call return value is flagged as an error, this wrapper
returns the negated "would be errno" value, otherwise it returns
the system call return value; on sparc64, it also truncates the
personality argument to unsigned int before passing it to the kernel.

[BZ #19408]
* sysdeps/unix/sysv/linux/personality.c: New file.
* sysdeps/unix/sysv/linux/sparc/sparc64/personality.c: Likewise.
* sysdeps/unix/sysv/linux/tst-personality.c: Likewise.
* sysdeps/unix/sysv/linux/Makefile [$(subdir) == misc]
(sysdep_routines): Add personality.
(tests): Add tst-personality.
* sysdeps/unix/sysv/linux/syscalls.list (personality): Move ...
* sysdeps/unix/sysv/linux/wordsize-64/syscalls.list: ... here.
* sysdeps/unix/sysv/linux/arm/syscalls.list (personality): New entry.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (personality): Likewise.
* sysdeps/unix/sysv/linux/i386/syscalls.list (personality): Likewise.
* sysdeps/unix/sysv/linux/m68k/syscalls.list (personality): Likewise.
* sysdeps/unix/sysv/linux/microblaze/syscalls.list (personality):
Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list (personality):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list (personality):
Likewise.
* sysdeps/unix/sysv/linux/sh/syscalls.list (personality): Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list (personality):
Likewise.
2015-12-31 00:17:48 +00:00
Aurelien Jarno
cc42170ef6 Cleanup ARM ioperm implementation (step 2)
Since GLIBC requires a minimum 2.6.32 kernel, the sysctl (CTL_BUS,
CTL_BUS_ISA, ISA_*) is always available.  We can therefore remove the
fallback code reading /etc/arm_systype or parsing /proc/cpuinfo.

Remove fscanf from localplt.data as it is no longer called from within
GLIBC.

	* sysdeps/unix/sysv/linux/arm/ioperm.c: Do not include <string.h>.
	(PATH_ARM_SYSTYPE): Remove.
	(PATH_CPUINFO): Likewise.
	(IO_BASE_FOOTBRIDGE): Likewise.
	(IO_SHIFT_FOOTBRIDGE): Likewise.
	(struct platform): Likewise.
	(init_iosys): Remove compatibility code for 2.4 kernels.
	* sysdeps/unix/sysv/linux/arm/localplt.data: Remove fscanf.
2015-12-30 23:31:18 +01:00
Mike Frysinger
a82cd945b5 localedata: nl_NL@euro: copy measurement from nl_NL [BZ #19198]
No real changes here as the output is the same.  Just making the input
a little bit nicer.
2015-12-29 23:19:54 -05:00
Florian Weimer
1bd5483e10 malloc: Test various special cases related to allocation failures
This test case exercises unusual code paths in allocation functions,
related to allocation failures.  Specifically, the test can reveal
the following bugs:

(a) calloc returns non-zero memory on fallback to sysmalloc.
(b) calloc can self-deadlock because it fails to release
    the arena lock on certain allocation failures.
(c) pvalloc can dereference a NULL arena pointer.

(a) and (b) appear specific to a faulty downstream backport.
(c) was fixed as part of commit 10ad46bc65.

The test for (a) was inspired by a reproducer supplied by Jeff Layton.
2015-12-29 20:32:35 +01:00
Damyan Ivanov
b69b5b3e3e localedata: bg_BG: use colon as time separator [BZ #19385]
The only official source is the "Official spelling dictionary of the
Bulgarian language, Prosveta 2012", which states there are three ways
to separate time components: comma, colon and dot. That same dictionary
doesn't say which one is preferred.

So I turned to the mailing list of the translators of free software in
Bulgarian. The consensus is that colon is the only separator that is
widely used in Bulgarian texts and everything else will just be confusing.

URL: http://lists.ludost.net/pipermail/dict/2015-December/000538.html
2015-12-29 13:49:01 -05:00
Mike Frysinger
d108b75561 list-fixed-bugs: use argparse for the commandline
This makes the interface more friendly to users.
2015-12-29 13:34:51 -05:00
Rob Wu
b674b82109 resolv: Reset defdname before use in __res_vinit [BZ #19369]
Resetting defdname (default domain name) before use in __res_vinit
ensures that the default domain name is correctly set to a default
value when it is not set by the LOCALDOMAIN environment variable or
the "domain" or "search" parameters in resolv.conf

Tested using the steps from:
https://sourceware.org/bugzilla/show_bug.cgi?id=19369
2015-12-29 13:28:04 -05:00
John David Anglin
d51442aacd hppa: Define __NO_LONG_DOUBLE_MATH so headers are consistent with libm build [BZ #19270]
The attached patch fixes BZ #19270 and the Debian gmt package now builds
successfully.  Aside from the comment, the define of __NO_LONG_DOUBLE_MATH
is similar to that in the generic version of glibc.

Build tested on hppa-unknown-linux-gnu with no observed regressions.
2015-12-29 13:24:51 -05:00
Mike Frysinger
d46256f440 ia64: fpu: fix gammaf typo [BZ #15421]
The lgamma rewrite in commit d709042a6e
used "gammaf" in this function when it should have used "gamma".
2015-12-28 22:20:03 -05:00
Dmitry V. Levin
3cf74f8a4a Fix getaddrinfo bug number in ChangeLog and NEWS files
This amends commit 34a9094f49
that erroneously mentions number 11869 instead of 11884.
2015-12-23 20:44:23 +00:00
Torvald Riegel
389fdf78b2 Do not violate mutex destruction requirements.
POSIX and C++11 require that a thread can destroy a mutex if no other
thread owns the mutex, is blocked on the mutex, or will try to acquire
it in the future.  After destroying the mutex, it can reuse or unmap the
underlying memory.  Thus, we must not access a mutex' memory after
releasing it.  Currently, we can load the private flag after releasing
the mutex, which is fixed by this patch.
See https://sourceware.org/bugzilla/show_bug.cgi?id=13690 for more
background.

We need to call futex_wake on the lock after releasing it, however.  This
is by design, and can lead to spurious wake-ups on unrelated futex words
(e.g., when the mutex memory is reused for another mutex).  This behavior
is documented in the glibc-internal futex API and in recent drafts of the
Linux kernel's futex documentation (see the draft_futex branch of
git://git.kernel.org/pub/scm/docs/man-pages/man-pages.git).
2015-12-23 18:44:53 +01:00
Florian Weimer
7962541a32 malloc: Update comment for list_lock 2015-12-23 17:23:33 +01:00
Carlos Eduardo Seo
c676e65939 powerpc: Export __parse_hwcap_and_convert_at_platform to libc.a.
Commit 67385a01d2 added a new feature for
powerpc, where we store HWCAP/Platform bits in the TCB.  In the dynamic
linking case, we use the versioned symbol
'__parse_hwcap_and_convert_at_platform' to verify if this feature is
available.  However, the same symbol was not exported to libc.a, making
it not possible for GCC to check for it prior to link time.
2015-12-22 15:41:19 -02:00
Carlos Eduardo Seo
b1f19b8ef1 powerpc: Add basic support for POWER9 sans hwcap.
This patch adds the minimum changes for supporting the POWER9 processor.
2015-12-22 14:45:55 -02:00
Samuel Thibault
2cf3e1aa74 Harmonize generic stdio-lock support with nptl
This fixes build when _IO_funlockfile is a macro, fixes build where
	_IO_acquire_lock_clear_flags2 is used, and fixes unlocking on unexpected
	stack unwind.

	* sysdeps/generic/stdio-lock.h [__EXCEPTIONS] (_IO_acquire_lock,
	_IO_release_lock ): Use cleanup attribute on new
	_IO_acquire_lock_file variable instead of assuming that
	_IO_release_lock will be called.
	[!__EXCEPTIONS] (_IO_acquire_lock): Define to non-existing
	_IO_acquire_lock_needs_exceptions_enabled.
	(_IO_acquire_lock_clear_flags2): New macro.
2015-12-22 14:39:19 +01:00
Adhemerval Zanella
661a29a518 powerpc: Regenerate libm-test-ulps
* sysdeps/powerpc/fpu/libm-test-ulps: Regenerated.
2015-12-22 11:11:01 -02:00
Florian Weimer
90c400bd49 malloc: Fix list_lock/arena lock deadlock [BZ #19182]
* malloc/arena.c (list_lock): Document lock ordering requirements.
	(free_list_lock): New lock.
	(ptmalloc_lock_all): Comment on free_list_lock.
	(ptmalloc_unlock_all2): Reinitialize free_list_lock.
	(detach_arena): Update comment.  free_list_lock is now needed.
	(_int_new_arena): Use free_list_lock around detach_arena call.
	Acquire arena lock after list_lock.  Add comment, including FIXME
	about incorrect synchronization.
	(get_free_list): Switch to free_list_lock.
	(reused_arena): Acquire free_list_lock around detach_arena call
	and attached threads counter update.  Add two FIXMEs about
	incorrect synchronization.
	(arena_thread_freeres): Switch to free_list_lock.
	* malloc/malloc.c (struct malloc_state): Update comments to
	mention free_list_lock.
2015-12-21 16:42:46 +01:00
Siddhesh Poyarekar
b300455644 Consolidate sincos computation for 2.426265 < |x| < 105414350
Like the previous change, exploit the fact that computation for sin
and cos is identical except that it is apart by a quadrant.  Also
remove csloww, csloww1 and csloww2 since they can easily be expressed
in terms of sloww, sloww1 and sloww2.
2015-12-21 10:43:04 +05:30
Siddhesh Poyarekar
f7953c44d5 Consolidate sin and cos code for 105414350 <|x|< 281474976710656
The sin and cos computation for this range of input is identical
except for a difference in quadrants by 1.  Exploit that fact and the
common argument reduction to reduce computations for sincos.
2015-12-21 10:41:46 +05:30
Siddhesh Poyarekar
a045832deb Consolidate range reduction in sincos for x > 281474976710656
Range reduction needs to be done only once for sin and cos, so copy
over all of the relevant functions (__sin, __cos, reduce_and_compute)
and consolidate common code.
2015-12-21 10:40:32 +05:30
Siddhesh Poyarekar
760c2eb7da Fix up ChangeLog 2015-12-21 10:38:45 +05:30
Aurelien Jarno
5537f466d6 i386: move ULPs to i686/multiarch and regenerate new ones for i386
The i386 ULPs are actually the i686/multiarch ones. The i686/multiarch
float ULPs are more precise as the SSE2 version (when available) uses
double for the cosf and sinf functions.

On the other hand the higher precision of the x86 FPU improves the
precision for a few other math functions.

	* sysdeps/i386/fpu/libm-test-ulps: Move to ....
	* sysdeps/i386/i686/multiarch/fpu/libm-test-ulps: ...here.
	* sysdeps/i386/fpu/libm-test-ulps: Regenerate.
2015-12-20 16:36:45 +01:00
Andrew Senkevich
83d776f979 Added memset optimized with AVX512 for KNL hardware.
It shows improvement up to 28% over AVX2 memset (performance results
attached at <https://sourceware.org/ml/libc-alpha/2015-12/msg00052.html>).

    * sysdeps/x86_64/multiarch/memset-avx512-no-vzeroupper.S: New file.
    * sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Added new file.
    * sysdeps/x86_64/multiarch/ifunc-impl-list.c: Added new tests.
    * sysdeps/x86_64/multiarch/memset.S: Added new IFUNC branch.
    * sysdeps/x86_64/multiarch/memset_chk.S: Likewise.
    * sysdeps/x86/cpu-features.h (bit_Prefer_No_VZEROUPPER,
    index_Prefer_No_VZEROUPPER): New.
    * sysdeps/x86/cpu-features.c (init_cpu_features): Set the
    Prefer_No_VZEROUPPER for Knights Landing.
2015-12-19 02:47:28 +03:00
Torvald Riegel
794950ed1d Remove unused variable in math/atest-exp2.c. 2015-12-18 11:53:22 +01:00
Adhemerval Zanella
fc48bfbc79 Fix SYSCALL_CANCEL for empty argumetns
This patch fixes the SYSCALL_CANCEL macro for usage with zero argument
number (for instance SYSCALL_CANCEL (pause)) using a similar approach
used for SOCKETCALL_CANCEL.

GLIBC build still does not hit this issue still since SYSCALL_CANCEL
is not currently being used for zero arguments calls.

Tested on i386, x86_64, powerpc64le, aarch64.

	* sysdeps/unix/sysdep.h (SYSCALL_CANCEL): Fix macro for zero argument
	syscalls.
	(__SYSCALL0): New macro.
	(__SYSCALL1): Likewise.
	(__SYSCALL2): Likewise.
	(__SYSCALL3): Likewise.
	(__SYSCALL4): Likewise.
	(__SYSCALL5): Likewise.
	(__SYSCALL6): Likewise.
	(__SYSCALL7): Likewise.
	(__SYSCALL_CONCAT_X): Likewise.
	(__SYSCALL_CONCAT): Likewise.
	(__SYSCALL_DIST): Likewise.
	(__SYSCALL_CALL): Likewise.
2015-12-17 18:16:59 -02:00
H.J. Lu
8ead7a9b94 Provide x32 times
Since times returns 64-bit clock_t on x32, we need to provide x32 times
by redefining INTERNAL_SYSCALL_NCS and INTERNAL_SYSCALL_ERROR_P with
64-bit return type for syscall.  All system calls returning 64-bit
integer, which are lseek, time and times, must be handled specially for
x32.  lseek is handled by x32 lseek.S and time doesn't check syscall
return.  times is the only missed one.  Before this patch, there are

0000000 <__times>:
   0:	b8 64 00 00 40       	mov    $0x40000064,%eax
   5:	0f 05                	syscall
   7:	48 63 d0             	movslq %eax,%rdx
                                ^^^^^^^^^^ Incorrect signed extension
   a:	48 83 fa f2          	cmp    $0xfffffffffffffff2,%rdx
   e:	75 07                	jne    17 <__times+0x17>
  10:	3d 00 f0 ff ff       	cmp    $0xfffff000,%eax
                                ^^^^^^^^^^^^^^^^^^^^^ 32-bit compare
  15:	77 11                	ja     28 <__times+0x28>
  17:	48 83 fa ff          	cmp    $0xffffffffffffffff,%rdx
  1b:	b8 00 00 00 00       	mov    $0x0,%eax
  20:	48 0f 45 c2          	cmovne %rdx,%rax
  24:	c3                   	retq

After this patch, there are

00000000 <__times>:
   0:	b8 64 00 00 40       	mov    $0x40000064,%eax
   5:	0f 05                	syscall
   7:	48 83 f8 f2          	cmp    $0xfffffffffffffff2,%rax
   b:	75 08                	jne    15 <__times+0x15>
   d:	48 3d 00 f0 ff ff    	cmp    $0xfffffffffffff000,%rax
  13:	77 13                	ja     28 <__times+0x28>
  15:	48 83 f8 ff          	cmp    $0xffffffffffffffff,%rax
  19:	ba 00 00 00 00       	mov    $0x0,%edx
  1e:	48 0f 44 c2          	cmove  %rdx,%rax
  22:	c3                   	retq

The incorrect signed extension and 32-bit compare are gone.

	[BZ #19363]
	* sysdeps/unix/sysv/linux/x86_64/x32/times.c: New file.
2015-12-17 11:47:06 -08:00