]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix powerpc32 __get_clockfreq for non-power4 (bug 17263).
authorJoseph Myers <joseph@codesourcery.com>
Wed, 13 Aug 2014 16:06:18 +0000 (16:06 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Wed, 13 Aug 2014 16:06:18 +0000 (16:06 +0000)
In my powerpc32 testing I've observed misc/test-gettimebasefreq
failing.

This is a glibc build (soft-float, though that's not relevant here)
without any --with-cpu and without any special configuration of the
default CPU for GCC either.  In particular, it's one not using
sysdeps/powerpc/powerpc32/power4/hp-timing.h (although in fact the
processor I'm using for testing is POWER4-based), so hp_timing_t is
32-bit not 64-bit.  But the VDSO call being used by
INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK is generating a 64-bit result
(high part in r3, low part in r4).  The code extracting that result,
however, expects a result of the type hp_timing_t as passed to
INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK, meaning that only r3 (= 0) is
used and the value in r4 is ignored.  This patch fixes this by always
using uint64_t as the type in INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK -
reflecting the actual ABI (unconditional in the kernel) of that VDSO
call.  This is the minimal change for this issue - no check for
overflow, no change of the type of the timebase_freq variable or the
return type of __get_clockfreq to something other than hp_timing_t
(such a change would simply move the implicit conversions to the over
callers of that function), no change to hp_timing_t itself.

Tested for powerpc32 soft float.

[BZ #17263]
* sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c: Include
<stdint.h>.
(__get_clockfreq): Use uint64_t instead of hp_timing_t in
INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK call.

ChangeLog
NEWS
sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c

index 3c54cee3bc3b879ebd3d93d51a4f6aa214066f91..cdfa6cf32f46a15a222082567d652f237acf0ad0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2014-08-13  Joseph Myers  <joseph@codesourcery.com>
+
+       [BZ #17263]
+       * sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c: Include
+       <stdint.h>.
+       (__get_clockfreq): Use uint64_t instead of hp_timing_t in
+       INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK call.
+
 2014-08-13  Siddhesh Poyarekar  <siddhesh@redhat.com>
 
        * sysdeps/x86/fpu/bits/mathinline.h: Fix typo in comment.
diff --git a/NEWS b/NEWS
index ca01275aff552a9de4e8db1c0edd39cb474fb13f..2220e97d2bcc5794cb56db85d512291124040d40 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -23,7 +23,7 @@ Version 2.20
   16977, 16978, 16984, 16990, 16996, 17009, 17022, 17031, 17042, 17048,
   17050, 17058, 17061, 17062, 17069, 17075, 17078, 17079, 17084, 17086,
   17088, 17092, 17097, 17125, 17135, 17137, 17150, 17153, 17213, 17259,
-  17261, 17262.
+  17261, 17262, 17263.
 
 * Reverted change of ABI data structures for s390 and s390x:
   On s390 and s390x the size of struct ucontext and jmp_buf was increased in
index 8b37943863eb748d6f5de2b006c3b158fd0a1da7..62217b1ca384301004ae8390ac15894003da07c2 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <ctype.h>
 #include <fcntl.h>
+#include <stdint.h>
 #include <string.h>
 #include <unistd.h>
 #include <libc-internal.h>
@@ -42,7 +43,7 @@ __get_clockfreq (void)
 #ifdef SHARED
   INTERNAL_SYSCALL_DECL (err);
   timebase_freq =
-    INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK (get_tbfreq, err, hp_timing_t, 0);
+    INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK (get_tbfreq, err, uint64_t, 0);
   if (INTERNAL_SYSCALL_ERROR_P (timebase_freq, err)
       && INTERNAL_SYSCALL_ERRNO (timebase_freq, err) == ENOSYS)
 #endif