8ae002
commit 89fb6835583088059b8d8987c86caac33e37e5ea
8ae002
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
8ae002
Date:   Tue Jun 11 11:11:11 2013 +0530
8ae002
8ae002
    Fix symbol definitions for __clock_* functions
8ae002
    
8ae002
    __clock_gettime and other __clock_* functions could result in an extra
8ae002
    PLT reference within libc.so if it actually gets used.  None of the
8ae002
    code currently uses them, which is why this probably went unnoticed.
8ae002
8ae002
Index: b/include/time.h
8ae002
===================================================================
8ae002
--- a/include/time.h
8ae002
+++ b/include/time.h
8ae002
@@ -21,6 +21,7 @@ libc_hidden_proto (strptime)
8ae002
 
8ae002
 extern __typeof (clock_getres) __clock_getres;
8ae002
 extern __typeof (clock_gettime) __clock_gettime;
8ae002
+libc_hidden_proto (__clock_gettime)
8ae002
 extern __typeof (clock_settime) __clock_settime;
8ae002
 extern __typeof (clock_nanosleep) __clock_nanosleep;
8ae002
 extern __typeof (clock_getcpuclockid) __clock_getcpuclockid;
8ae002
Index: b/rt/clock_getcpuclockid.c
8ae002
===================================================================
8ae002
--- a/rt/clock_getcpuclockid.c
8ae002
+++ b/rt/clock_getcpuclockid.c
8ae002
@@ -21,7 +21,7 @@
8ae002
 #include <unistd.h>
8ae002
 
8ae002
 int
8ae002
-clock_getcpuclockid (pid_t pid, clockid_t *clock_id)
8ae002
+__clock_getcpuclockid (pid_t pid, clockid_t *clock_id)
8ae002
 {
8ae002
   /* We don't allow any process ID but our own.  */
8ae002
   if (pid != 0 && pid != getpid ())
8ae002
@@ -37,4 +37,4 @@ clock_getcpuclockid (pid_t pid, clockid_
8ae002
   return ENOENT;
8ae002
 #endif
8ae002
 }
8ae002
-strong_alias (clock_getcpuclockid, __clock_getcpuclockid)
8ae002
+weak_alias (__clock_getcpuclockid, clock_getcpuclockid)
8ae002
Index: b/rt/clock_getres.c
8ae002
===================================================================
8ae002
--- a/rt/clock_getres.c
8ae002
+++ b/rt/clock_getres.c
8ae002
@@ -21,10 +21,10 @@
8ae002
 
8ae002
 /* Get resolution of clock.  */
8ae002
 int
8ae002
-clock_getres (clockid_t clock_id, struct timespec *res)
8ae002
+__clock_getres (clockid_t clock_id, struct timespec *res)
8ae002
 {
8ae002
   __set_errno (ENOSYS);
8ae002
   return -1;
8ae002
 }
8ae002
-strong_alias (clock_getres, __clock_getres)
8ae002
+weak_alias (__clock_getres, clock_getres)
8ae002
 stub_warning (clock_getres)
8ae002
Index: b/rt/clock_gettime.c
8ae002
===================================================================
8ae002
--- a/rt/clock_gettime.c
8ae002
+++ b/rt/clock_gettime.c
8ae002
@@ -21,10 +21,11 @@
8ae002
 
8ae002
 /* Get current value of CLOCK and store it in TP.  */
8ae002
 int
8ae002
-clock_gettime (clockid_t clock_id, struct timespec *tp)
8ae002
+__clock_gettime (clockid_t clock_id, struct timespec *tp)
8ae002
 {
8ae002
   __set_errno (ENOSYS);
8ae002
   return -1;
8ae002
 }
8ae002
-strong_alias (clock_gettime, __clock_gettime)
8ae002
+weak_alias (__clock_gettime, clock_gettime)
8ae002
+libc_hidden_def (__clock_gettime)
8ae002
 stub_warning (clock_gettime)
8ae002
Index: b/rt/clock_nanosleep.c
8ae002
===================================================================
8ae002
--- a/rt/clock_nanosleep.c
8ae002
+++ b/rt/clock_nanosleep.c
8ae002
@@ -20,8 +20,8 @@
8ae002
 #include <time.h>
8ae002
 
8ae002
 int
8ae002
-clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req,
8ae002
-		 struct timespec *rem)
8ae002
+__clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req,
8ae002
+		   struct timespec *rem)
8ae002
 {
8ae002
   if (__builtin_expect (req->tv_nsec, 0) < 0
8ae002
       || __builtin_expect (req->tv_nsec, 0) >= 1000000000)
8ae002
@@ -33,5 +33,5 @@ clock_nanosleep (clockid_t clock_id, int
8ae002
   /* Not implemented.  */
8ae002
   return ENOSYS;
8ae002
 }
8ae002
-strong_alias (clock_nanosleep, __clock_nanosleep)
8ae002
+weak_alias (__clock_nanosleep, clock_nanosleep)
8ae002
 stub_warning (clock_nanosleep)
8ae002
Index: b/rt/clock_settime.c
8ae002
===================================================================
8ae002
--- a/rt/clock_settime.c
8ae002
+++ b/rt/clock_settime.c
8ae002
@@ -21,10 +21,10 @@
8ae002
 
8ae002
 /* Set CLOCK to value TP.  */
8ae002
 int
8ae002
-clock_settime (clockid_t clock_id, const struct timespec *tp)
8ae002
+__clock_settime (clockid_t clock_id, const struct timespec *tp)
8ae002
 {
8ae002
   __set_errno (ENOSYS);
8ae002
   return -1;
8ae002
 }
8ae002
-strong_alias (clock_settime, __clock_settime)
8ae002
+weak_alias (__clock_settime, clock_settime)
8ae002
 stub_warning (clock_settime)
8ae002
Index: b/sysdeps/posix/clock_getres.c
8ae002
===================================================================
8ae002
--- a/sysdeps/posix/clock_getres.c
8ae002
+++ b/sysdeps/posix/clock_getres.c
8ae002
@@ -76,7 +76,7 @@ realtime_getres (struct timespec *res)
8ae002
 
8ae002
 /* Get resolution of clock.  */
8ae002
 int
8ae002
-clock_getres (clockid_t clock_id, struct timespec *res)
8ae002
+__clock_getres (clockid_t clock_id, struct timespec *res)
8ae002
 {
8ae002
   int retval = -1;
8ae002
 
8ae002
@@ -115,4 +115,4 @@ clock_getres (clockid_t clock_id, struct
8ae002
 
8ae002
   return retval;
8ae002
 }
8ae002
-strong_alias (clock_getres, __clock_getres)
8ae002
+weak_alias (__clock_getres, clock_getres)
8ae002
Index: b/sysdeps/unix/clock_gettime.c
8ae002
===================================================================
8ae002
--- a/sysdeps/unix/clock_gettime.c
8ae002
+++ b/sysdeps/unix/clock_gettime.c
8ae002
@@ -89,7 +89,7 @@ realtime_gettime (struct timespec *tp)
8ae002
 
8ae002
 /* Get current value of CLOCK and store it in TP.  */
8ae002
 int
8ae002
-clock_gettime (clockid_t clock_id, struct timespec *tp)
8ae002
+__clock_gettime (clockid_t clock_id, struct timespec *tp)
8ae002
 {
8ae002
   int retval = -1;
8ae002
 
8ae002
@@ -132,4 +132,5 @@ clock_gettime (clockid_t clock_id, struc
8ae002
 
8ae002
   return retval;
8ae002
 }
8ae002
-strong_alias (clock_gettime, __clock_gettime)
8ae002
+weak_alias (__clock_gettime, clock_gettime)
8ae002
+libc_hidden_def (__clock_gettime)
8ae002
Index: b/sysdeps/unix/clock_nanosleep.c
8ae002
===================================================================
8ae002
--- a/sysdeps/unix/clock_nanosleep.c
8ae002
+++ b/sysdeps/unix/clock_nanosleep.c
8ae002
@@ -39,8 +39,8 @@
8ae002
 /* This implementation assumes that these is only a `nanosleep' system
8ae002
    call.  So we have to remap all other activities.  */
8ae002
 int
8ae002
-clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req,
8ae002
-		 struct timespec *rem)
8ae002
+__clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req,
8ae002
+		   struct timespec *rem)
8ae002
 {
8ae002
   struct timespec now;
8ae002
 
8ae002
@@ -98,4 +98,4 @@ clock_nanosleep (clockid_t clock_id, int
8ae002
 
8ae002
   return __builtin_expect (nanosleep (req, rem), 0) ? errno : 0;
8ae002
 }
8ae002
-strong_alias (clock_nanosleep, __clock_nanosleep)
8ae002
+weak_alias (__clock_nanosleep, clock_nanosleep)
8ae002
Index: b/sysdeps/unix/clock_settime.c
8ae002
===================================================================
8ae002
--- a/sysdeps/unix/clock_settime.c
8ae002
+++ b/sysdeps/unix/clock_settime.c
8ae002
@@ -72,7 +72,7 @@ hp_timing_settime (clockid_t clock_id, c
8ae002
 
8ae002
 /* Set CLOCK to value TP.  */
8ae002
 int
8ae002
-clock_settime (clockid_t clock_id, const struct timespec *tp)
8ae002
+__clock_settime (clockid_t clock_id, const struct timespec *tp)
8ae002
 {
8ae002
   int retval;
8ae002
 
8ae002
@@ -124,4 +124,4 @@ clock_settime (clockid_t clock_id, const
8ae002
 
8ae002
   return retval;
8ae002
 }
8ae002
-strong_alias (clock_settime, __clock_settime)
8ae002
+weak_alias (__clock_settime, clock_settime)
8ae002
Index: b/sysdeps/unix/sysv/linux/clock_getcpuclockid.c
8ae002
===================================================================
8ae002
--- a/sysdeps/unix/sysv/linux/clock_getcpuclockid.c
8ae002
+++ b/sysdeps/unix/sysv/linux/clock_getcpuclockid.c
8ae002
@@ -23,7 +23,7 @@
8ae002
 #include "kernel-posix-cpu-timers.h"
8ae002
 
8ae002
 int
8ae002
-clock_getcpuclockid (pid_t pid, clockid_t *clock_id)
8ae002
+__clock_getcpuclockid (pid_t pid, clockid_t *clock_id)
8ae002
 {
8ae002
   /* The clockid_t value is a simple computation from the PID.
8ae002
      But we do a clock_getres call to validate it.  */
8ae002
@@ -46,4 +46,4 @@ clock_getcpuclockid (pid_t pid, clockid_
8ae002
   else
8ae002
     return INTERNAL_SYSCALL_ERRNO (r, err);
8ae002
 }
8ae002
-strong_alias (clock_getcpuclockid, __clock_getcpuclockid)
8ae002
+weak_alias (__clock_getcpuclockid, clock_getcpuclockid)
8ae002
Index: b/sysdeps/unix/sysv/linux/clock_nanosleep.c
8ae002
===================================================================
8ae002
--- a/sysdeps/unix/sysv/linux/clock_nanosleep.c
8ae002
+++ b/sysdeps/unix/sysv/linux/clock_nanosleep.c
8ae002
@@ -26,8 +26,8 @@
8ae002
 /* We can simply use the syscall.  The CPU clocks are not supported
8ae002
    with this function.  */
8ae002
 int
8ae002
-clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req,
8ae002
-		 struct timespec *rem)
8ae002
+__clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req,
8ae002
+		   struct timespec *rem)
8ae002
 {
8ae002
   INTERNAL_SYSCALL_DECL (err);
8ae002
   int r;
8ae002
@@ -52,4 +52,4 @@ clock_nanosleep (clockid_t clock_id, int
8ae002
   return (INTERNAL_SYSCALL_ERROR_P (r, err)
8ae002
 	  ? INTERNAL_SYSCALL_ERRNO (r, err) : 0);
8ae002
 }
8ae002
-strong_alias (clock_nanosleep, __clock_nanosleep)
8ae002
+weak_alias (__clock_nanosleep, clock_nanosleep)