a2cf7d
commit f289e656ec8221756519a601042bc9fbe1b310fb
a2cf7d
Author: Florian Weimer <fweimer@redhat.com>
a2cf7d
Date:   Fri Feb 8 10:21:56 2019 +0100
a2cf7d
a2cf7d
    rt: Turn forwards from librt to libc into compat symbols [BZ #24194]
a2cf7d
    
a2cf7d
    As the  result of commit 6e6249d0b461b952d0f544792372663feb6d792a
a2cf7d
    ("BZ#14743: Move clock_* symbols from librt to libc."), in glibc 2.17,
a2cf7d
    clock_gettime, clock_getres, clock_settime, clock_getcpuclockid,
a2cf7d
    clock_nanosleep were added to libc, and the file rt/clock-compat.c
a2cf7d
    was added with forwarders to the actual implementations in libc.
a2cf7d
    These forwarders were wrapped in
a2cf7d
    
a2cf7d
    #if SHLIB_COMPAT (librt, GLIBC_2_2, GLIBC_2_17)
a2cf7d
    
a2cf7d
    so that they are not present for newer architectures (such as
a2cf7d
    powerpc64le) with a 2.17 or later ABI baseline.  But the forwarders
a2cf7d
    were not marked as compatibility symbols.  As a result, on older
a2cf7d
    architectures, historic configure checks such as
a2cf7d
    
a2cf7d
    AC_CHECK_LIB(rt, clock_gettime)
a2cf7d
    
a2cf7d
    still cause linking against librt, even though this is completely
a2cf7d
    unnecessary.  It also creates a needless porting hazard because
a2cf7d
    architectures behave differently when it comes to symbol availability.
a2cf7d
    
a2cf7d
    Reviewed-by: Carlos O'Donell <carlos@redhat.com>
a2cf7d
a2cf7d
diff --git a/rt/clock-compat.c b/rt/clock-compat.c
a2cf7d
index f816973c05c29d5d..11e71aa89019b173 100644
a2cf7d
--- a/rt/clock-compat.c
a2cf7d
+++ b/rt/clock-compat.c
a2cf7d
@@ -30,14 +30,16 @@
a2cf7d
 #if HAVE_IFUNC
a2cf7d
 # undef INIT_ARCH
a2cf7d
 # define INIT_ARCH()
a2cf7d
-# define COMPAT_REDIRECT(name, proto, arglist) libc_ifunc (name, &__##name)
a2cf7d
+# define COMPAT_REDIRECT(name, proto, arglist) libc_ifunc (name, &__##name) \
a2cf7d
+    compat_symbol (librt, name, name, GLIBC_2_2);
a2cf7d
 #else
a2cf7d
 # define COMPAT_REDIRECT(name, proto, arglist)				      \
a2cf7d
   int									      \
a2cf7d
   name proto								      \
a2cf7d
   {									      \
a2cf7d
     return __##name arglist;						      \
a2cf7d
-  }
a2cf7d
+  }									      \
a2cf7d
+  compat_symbol (librt, name, name, GLIBC_2_2);
a2cf7d
 #endif
a2cf7d
 
a2cf7d
 COMPAT_REDIRECT (clock_getres,