about summary refs log tree commit diff
path: root/include/libc-symbols.h
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2016-08-02 17:18:08 +0200
committerFlorian Weimer <fweimer@redhat.com>2016-08-02 17:18:08 +0200
commit968dc26df61f4577c6a1df5734de21c1504d2c79 (patch)
tree36f1096f0d8da1a01667b467d61160527b52f775 /include/libc-symbols.h
parentf690b56979dea81340a397c1b5e44827a6fb06e7 (diff)
downloadglibc-968dc26df61f4577c6a1df5734de21c1504d2c79.tar.gz
glibc-968dc26df61f4577c6a1df5734de21c1504d2c79.tar.xz
glibc-968dc26df61f4577c6a1df5734de21c1504d2c79.zip
Add support for referencing specific symbol versions
This is needed for writing tests of compat symbols.
Diffstat (limited to 'include/libc-symbols.h')
-rw-r--r--include/libc-symbols.h19
1 files changed, 14 insertions, 5 deletions
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index 4548e097dc..c2b499ae36 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -282,19 +282,28 @@ for linking")
    past the last element in SET.  */
 #define symbol_set_end_p(set, ptr) ((ptr) >= (void *const *) &__stop_##set)
 
+/* Use symbol_version_reference to specify the version a symbol
+   reference should link to.  Use symbol_version or
+   default_symbol_version for the definition of a versioned symbol.
+   The difference is that the latter is a no-op in non-shared
+   builds.  */
+#ifdef __ASSEMBLER__
+# define symbol_version_reference(real, name, version) \
+     .symver real, name##@##version
+#else  /* !__ASSEMBLER__ */
+# define symbol_version_reference(real, name, version) \
+  __asm__ (".symver " #real "," #name "@" #version)
+#endif
+
 #ifdef SHARED
 # define symbol_version(real, name, version) \
-     _symbol_version(real, name, version)
+  symbol_version_reference(real, name, version)
 # define default_symbol_version(real, name, version) \
      _default_symbol_version(real, name, version)
 # ifdef __ASSEMBLER__
-#  define _symbol_version(real, name, version) \
-     .symver real, name##@##version
 #  define _default_symbol_version(real, name, version) \
      .symver real, name##@##@##version
 # else
-#  define _symbol_version(real, name, version) \
-     __asm__ (".symver " #real "," #name "@" #version)
 #  define _default_symbol_version(real, name, version) \
      __asm__ (".symver " #real "," #name "@@" #version)
 # endif