aboutsummaryrefslogtreecommitdiff
path: root/include
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
parentf690b56979dea81340a397c1b5e44827a6fb06e7 (diff)
downloadglibc-968dc26df61f4577c6a1df5734de21c1504d2c79.zip
glibc-968dc26df61f4577c6a1df5734de21c1504d2c79.tar.gz
glibc-968dc26df61f4577c6a1df5734de21c1504d2c79.tar.bz2
Add support for referencing specific symbol versions
This is needed for writing tests of compat symbols.
Diffstat (limited to 'include')
-rw-r--r--include/libc-symbols.h19
-rw-r--r--include/shlib-compat.h18
2 files changed, 25 insertions, 12 deletions
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index 4548e09..c2b499a 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
diff --git a/include/shlib-compat.h b/include/shlib-compat.h
index c1c5e2c..025c731 100644
--- a/include/shlib-compat.h
+++ b/include/shlib-compat.h
@@ -19,10 +19,10 @@
#ifndef _SHLIB_COMPAT_H
#define _SHLIB_COMPAT_H 1
-#ifdef SHARED
-
# include <abi-versions.h>
+#ifdef SHARED
+
/* The file abi-versions.h (generated by scripts/abi-versions.awk) defines
symbols like `ABI_libm_GLIBC_2_0' for each version set in the source
code for each library. For a version set that is subsumed by a later
@@ -62,11 +62,7 @@
default_symbol_version (local, symbol, name)
# define compat_symbol(lib, local, symbol, version) \
- compat_symbol_1 (lib, local, symbol, version)
-# define compat_symbol_1(lib, local, symbol, version) \
- compat_symbol_2 (local, symbol, VERSION_##lib##_##version)
-# define compat_symbol_2(local, symbol, name) \
- symbol_version (local, symbol, name)
+ compat_symbol_reference (lib, local, symbol, version)
#else
@@ -82,6 +78,14 @@
#endif
+/* Use compat_symbol_reference for a reference to a specific version
+ of a symbol. Use compat_symbol to define such a symbol. */
+#define compat_symbol_reference(lib, local, symbol, version) \
+ compat_symbol_reference_1 (lib, local, symbol, version)
+#define compat_symbol_reference_1(lib, local, symbol, version) \
+ compat_symbol_reference_2 (local, symbol, VERSION_##lib##_##version)
+#define compat_symbol_reference_2(local, symbol, name) \
+ symbol_version_reference (local, symbol, name)
# ifdef LINK_OBSOLETE_RPC
/* Export the symbol for both static and dynamic linking. */