[v2,01/14] Add OTHER_SHLIB_COMPAT

Message ID 20210319202914.2475530-2-adhemerval.zanella@linaro.org
State Committed
Headers
Series libpthread removal: pthread-compat-wrappers and other libc symbols |

Commit Message

Adhemerval Zanella Netto March 19, 2021, 8:29 p.m. UTC
  It is similar to SHLIB_COMPAT, but allows to check versions from
other libraries.  It is used to move compat symbol from other libraries
to libc.
---
 include/shlib-compat.h | 9 +++++++++
 1 file changed, 9 insertions(+)
  

Comments

Florian Weimer March 19, 2021, 8:36 p.m. UTC | #1
* Adhemerval Zanella via Libc-alpha:

> +/* Like SHLIB_COMPAT, but can check versions in other libraries.  It is
> +   not always false outside for !IS_IN (LIB).  */
> +#define OTHER_SHLIB_COMPAT(lib, introduced, obsoleted)	\
> +  _OTHER_SHLIB_COMPAT (lib, introduced, obsoleted)
> +#define _OTHER_SHLIB_COMPAT(lib, introduced, obsoleted)			\
> +  (!(ABI_##lib##_##obsoleted - 0)					\
> +   || ((ABI_##lib##_##introduced - 0) < (ABI_##lib##_##obsoleted - 0)))
> +

Maybe: “Like SHLIB_COMPAT, but it can check versions in other
libraries.  It is not always false for !IS_IN (LIB).”

Looks okay otherwise.
  

Patch

diff --git a/include/shlib-compat.h b/include/shlib-compat.h
index f4978c05af..750d72b732 100644
--- a/include/shlib-compat.h
+++ b/include/shlib-compat.h
@@ -53,6 +53,14 @@ 
 # define SHLIB_COMPAT(lib, introduced, obsoleted)			      \
   _LIB_COMPAT (lib, introduced, obsoleted)
 
+/* Like SHLIB_COMPAT, but can check versions in other libraries.  It is
+   not always false outside for !IS_IN (LIB).  */
+#define OTHER_SHLIB_COMPAT(lib, introduced, obsoleted)	\
+  _OTHER_SHLIB_COMPAT (lib, introduced, obsoleted)
+#define _OTHER_SHLIB_COMPAT(lib, introduced, obsoleted)			\
+  (!(ABI_##lib##_##obsoleted - 0)					\
+   || ((ABI_##lib##_##introduced - 0) < (ABI_##lib##_##obsoleted - 0)))
+
 /* That header also defines symbols like `VERSION_libm_GLIBC_2_1' to
    the version set name to use for e.g. symbols first introduced into
    libm in the GLIBC_2.1 version.  Definitions of symbols with explicit
@@ -88,6 +96,7 @@ 
 
 /* Not compiling ELF shared libraries at all, so never any old versions.  */
 # define SHLIB_COMPAT(lib, introduced, obsoleted)	0
+# define OTHER_SHLIB_COMPAT(lib, introduced, obsoleted)	0
 
 /* No versions to worry about, just make this the global definition.  */
 # define versioned_symbol(lib, local, symbol, version) \