about summary refs log tree commit diff
path: root/include/shlib-compat.h
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2019-12-03 20:32:49 +0000
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2019-12-09 15:04:56 -0300
commit0487ebed2278b20971af4cabf186fd3681adccf0 (patch)
tree3d5424fedbc56d2436e0857dbf2e48cbda4c6077 /include/shlib-compat.h
parent7badf7b06fe796b3f549663d0d65d3012a7e0457 (diff)
downloadglibc-0487ebed2278b20971af4cabf186fd3681adccf0.tar.gz
glibc-0487ebed2278b20971af4cabf186fd3681adccf0.tar.xz
glibc-0487ebed2278b20971af4cabf186fd3681adccf0.zip
nptl: Add more missing placeholder abi symbol from nanosleep move
This patch adds the missing __libpthread_version_placeholder for
GLIBC_2.2.6 version from the nanosleep implementation move from
libpthread to libc (79a547b162).

It also fixes the wrong compat symbol definitions added by changing
back the version used on vfork check and remove the
__libpthread_version_placeholder added on some ABI (4f4bb489e0dd).

The __libpthread_version_placeholder is also refactored to make it
simpler to add new compat_symbols by adding a new macro
compat_symbol_unique which uses the compiler extension __COUNTER__
to generate unique strong alias to be used with compat_symbol.

Checked with a updated-abi on the all affected abis of the nanosleep
move.

Change-Id: I347a4dbdc931bb42b359456932dd1e17aa4d4078
Diffstat (limited to 'include/shlib-compat.h')
-rw-r--r--include/shlib-compat.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/include/shlib-compat.h b/include/shlib-compat.h
index f1c2fd8ed9..fafb5268a6 100644
--- a/include/shlib-compat.h
+++ b/include/shlib-compat.h
@@ -64,6 +64,41 @@
 # define compat_symbol(lib, local, symbol, version) \
   compat_symbol_reference (lib, local, symbol, version)
 
+/* This is similar to compat_symbol, but allows versioning the same symbol
+   to multiple version without having multiple symbol definitions.  For
+   instance:
+
+   #if (SHLIB_COMPAT (libpthread, GLIBC_2_1_2, GLIBC_2_2))
+   compat_symbol_unique (libc, old_foo, GLIBC_2_1_2)
+   #endif
+
+   #if (SHLIB_COMPAT (libpthread, GLIBC_2_2_6, GLIBC_2_3))
+   compat_symbol_unique (libc, old_foo, GLIBC_2_2_6)
+   #endif
+
+   Internally it creates a unique strong alias to the input symbol and
+   creates one compat_symbol on the alias.  Using the above example,
+   it is similar to:
+
+   #if (SHLIB_COMPAT (libpthread, GLIBC_2_1_2, GLIBC_2_2))
+   strong_alias (old_foo, old_foo__COUNTER__)
+   compat_symbol (libc, old_foo__COUNTER__, foo, GLIBC_2_2)
+   #endif.
+
+   With __COUNTER__ being a monotonic number generated by the compiler.  */
+
+# define __compat_symbol_unique_concat(x, y) x ## y
+# define _compat_symbol_unique_concat(x, y) \
+  __compat_symbol_unique_concat (x, y)
+# define _compat_symbol_unique_alias(name) \
+  _compat_symbol_unique_concat (name, __COUNTER__)
+# define _compat_symbol_unique(lib, orig_name, name, version) \
+  strong_alias (orig_name, name) \
+  compat_symbol (lib, name, orig_name, version)
+# define compat_symbol_unique(lib, name, version) \
+  _compat_symbol_unique (lib, name, _compat_symbol_unique_alias (name), \
+                         version)
+
 #else
 
 /* Not compiling ELF shared libraries at all, so never any old versions.  */
@@ -75,6 +110,7 @@
 
 /* This should not appear outside `#if SHLIB_COMPAT (...)'.  */
 # define compat_symbol(lib, local, symbol, version) ...
+# define compat_symbol_unique(lib, name, version) ...
 
 #endif