1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00
lvm2/lib/misc
Bryn M. Reeves 82a27a85b5 macros: fix default symbol export control
Fix the version export macros to make it possible to export two
different DM_* versions of a symbol: currently it is only possible for a
DM_* symbol to override a symbol in Base. Attempting to export two
symbols at different DM_* version levels (e.g. DM_1_02_104 and
DM_1_02_106) leads to a linker error due to a duplicate symbol
definition.

This is because the DM_EXPORTED_SYMBOL macro makes each exported symbol
the default (@@VERSION):

       __asm__(".symver " #func "_v" #ver ", " #func "@@DM_" #ver )

Fix the macro to use a single '@' for a symbols exported in multiple
versions and rename the macros to DM_EXPORT_*:

  DM_EXPORT_SYMBOL(func,ver)
  DM_EXPORT_SYMBOL_BASE(func,ver)

For functions that have multiple implementations these macros control
symbol export and versioning.

Function definitions that exist in only one version never need to use
these macros.

Backwards compatible implementations must include a version tag of
the form "_v1_02_104" as a suffix to the function name and use the
macro DM_EXPORT_SYMBOL to export the function and bind it to the
specified version string.

Since versioning is only available when compiling with GCC the entire
compatibility version should be enclosed in '#if defined(__GNUC__)',
for example:

  int dm_foo(int bar)
  {
    return bar;
  }

  #if defined(__GNUC__)
  // Backward compatible dm_foo() version 1.02.104
  int dm_foo_v1_02_104(void);
  int dm_foo_v1_02_104(void)
  {
    return 0;
  }
  DM_EXPORT_SYMBOL(dm_foo,1_02_104)
  #endif

A prototype for the compatibility version is required as these
functions must not be declared static.

The DM_EXPORT_SYMBOL_BASE macro is only used to export the base
versions of library symbols prior to the introduction of symbol
versioning: it must never be used for new symbols.
2015-08-24 20:03:21 +01:00
..
.gitignore gitignore: Update for in-place build. 2015-07-27 13:18:35 +01:00
configure.h.in dmsetup: use timerfd for interval timing if available 2015-08-12 15:09:57 +01:00
crc_gen.c was renamed 2010-09-27 19:10:46 +00:00
crc.c Fix CRC32 calculation on big endian CPU 2011-02-08 12:41:08 +00:00
crc.h cleanup: self compilable headers 2013-12-12 13:28:19 +01:00
intl.h Fix inconsistent licence notices: executables are GPLv2; libraries LGPLv2.1. 2007-08-20 20:55:30 +00:00
last-path-component.h cleaner const char* usage for last_path_component() 2008-11-12 09:53:33 +00:00
lib.h macros: fix default symbol export control 2015-08-24 20:03:21 +01:00
lvm-exec.c locking: Add missing error handling. 2015-06-30 18:54:38 +01:00
lvm-exec.h exec: pipe open 2013-08-06 16:18:43 +02:00
lvm-file.c cleanup: drop unneeded header file 2015-05-08 15:15:10 +02:00
lvm-file.h lvm-file: wrapper to read ctim from stat 2015-03-18 13:42:24 +01:00
lvm-flock.c cleanup: avoid double assign 2014-08-19 14:33:06 +02:00
lvm-flock.h signals: Move sigint handling out to lvm-signal. 2014-05-01 20:07:17 +01:00
lvm-globals.c config: replace find_config_tree_node with find_config_tree_array where appropriate 2015-07-08 13:03:08 +02:00
lvm-globals.h Add a global get_cmd_name() 2015-06-16 15:13:10 -05:00
lvm-percent.c report: select: refactor: move percent handling code to libdm for reuse 2014-06-17 16:27:21 +02:00
lvm-percent.h report: select: refactor: move percent handling code to libdm for reuse 2014-06-17 16:27:21 +02:00
lvm-signal.c clean-up: typos s/bellow/below/ 2015-07-06 10:15:11 -05:00
lvm-signal.h signals: Add init_signals. 2014-05-01 20:31:19 +01:00
lvm-string.c systemid: Require alphanumeric 1st character. 2015-02-23 19:47:03 +00:00
lvm-string.h systemid: Require alphanumeric 1st character. 2015-02-23 19:47:03 +00:00
lvm-version.h.in Add an API version number, LVM_LIBAPI, to the VERSION string. 2009-07-22 20:01:28 +00:00
lvm-wrappers.c cleanup: drop inline keyword 2014-06-10 10:51:26 +02:00
lvm-wrappers.h cleanup: drop inline keyword 2014-06-10 10:51:26 +02:00
sharedlib.c cleanup: tiny speedup of lib_dir checking 2013-12-10 11:15:48 +01:00
sharedlib.h Fix inconsistent licence notices: executables are GPLv2; libraries LGPLv2.1. 2007-08-20 20:55:30 +00:00
util.h cleanup: add FMTssize_t 2015-08-18 15:00:08 +02:00