summaryrefslogtreecommitdiff
path: root/include/shlib-compat.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/shlib-compat.h')
-rw-r--r--include/shlib-compat.h34
1 files changed, 26 insertions, 8 deletions
diff --git a/include/shlib-compat.h b/include/shlib-compat.h
index c1c5e2c3b1..feacf35f03 100644
--- a/include/shlib-compat.h
+++ b/include/shlib-compat.h
@@ -1,5 +1,5 @@
/* Macros for managing ABI-compatibility definitions using ELF symbol versions.
- Copyright (C) 2000-2016 Free Software Foundation, Inc.
+ Copyright (C) 2000-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -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,18 @@
#endif
+/* Use compat_symbol_reference for a reference *or* definition of a
+ specific version of a symbol. Definitions are primarily used to
+ ensure tests reference the exact compat symbol required, or define an
+ interposing symbol of the right version e.g. __malloc_initialize_hook
+ in mcheck-init.c. Use compat_symbol to define such a symbol within
+ the shared libraries that are built for users. */
+#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. */
@@ -93,4 +101,14 @@
compat_symbol (libc, name, aliasname, version);
# endif
+/* The TEST_COMPAT macro acts just like the SHLIB_COMPAT macro except
+ that it does not check IS_IN. It is used by tests that are testing
+ functionality that is only available in specific GLIBC versions. */
+
+# define TEST_COMPAT(lib, introduced, obsoleted) \
+ _TEST_COMPAT (lib, introduced, obsoleted)
+# define _TEST_COMPAT(lib, introduced, obsoleted) \
+ (!(ABI_##lib##_##obsoleted - 0) \
+ || ((ABI_##lib##_##introduced - 0) < (ABI_##lib##_##obsoleted - 0)))
+
#endif /* shlib-compat.h */