[PATCH] rt: Turn forwards from librt to libc into compatibility symbols

Florian Weimer fweimer@redhat.com
Thu Feb 7 16:56:00 GMT 2019


Without this change, a typical configure check looking for a
library that contains (say) clock_gettime will find and link
against librt, even though nothing in the program might actually
require librt after the move of clock_gettime from librt to libc.

Tested on x86-64, with and without --disable-multi-arch.

2019-02-07  Florian Weimer  <fweimer@redhat.com>

	* rt/clock-compat.c (COMPAT_REDIRECT): Turn librt forwarders into
	compatibility symbols.

diff --git a/rt/clock-compat.c b/rt/clock-compat.c
index c603f40b69..d8ced3cdc1 100644
--- a/rt/clock-compat.c
+++ b/rt/clock-compat.c
@@ -30,14 +30,16 @@
 #if HAVE_IFUNC
 # undef INIT_ARCH
 # define INIT_ARCH()
-# define COMPAT_REDIRECT(name, proto, arglist) libc_ifunc (name, &__##name)
+# define COMPAT_REDIRECT(name, proto, arglist) libc_ifunc (name, &__##name) \
+    compat_symbol (librt, name, name, GLIBC_2_2);
 #else
 # define COMPAT_REDIRECT(name, proto, arglist)				      \
   int									      \
   name proto								      \
   {									      \
     return __##name arglist;						      \
-  }
+  }									      \
+  compat_symbol (librt, name, name, GLIBC_2_2);
 #endif
 
 COMPAT_REDIRECT (clock_getres,



More information about the Libc-alpha mailing list