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