diff options
author | Dan Winship <danw@redhat.com> | 2015-01-21 10:01:26 -0500 |
---|---|---|
committer | Dan Winship <danw@redhat.com> | 2015-01-21 10:20:57 -0500 |
commit | ccd9232dbca88ab99e2778576ed3ddbfb166e539 (patch) | |
tree | 5c3d516128b00f1b8050da28c366dbc9370860e9 | |
parent | ba4092ed9138e09bd0c69508784c31ac1a69e47b (diff) | |
download | NetworkManager-ccd9232dbca88ab99e2778576ed3ddbfb166e539.tar.gz |
internal: add NM_BACKPORT_SYMBOL()
Add a macro to insert the necessary compiler/linker magic to add a
copy of an existing symbol to an older version. Also, update
check-exports.sh to be able to check for such symbols by listed them
commented-out in the appropriate section.
(Based on a patch from Thomas Haller.)
-rw-r--r-- | include/nm-utils-internal.h | 13 | ||||
-rwxr-xr-x | tools/check-exports.sh | 4 |
2 files changed, 14 insertions, 3 deletions
diff --git a/include/nm-utils-internal.h b/include/nm-utils-internal.h index 7ca44f3c4b..cc95def0ab 100644 --- a/include/nm-utils-internal.h +++ b/include/nm-utils-internal.h @@ -160,4 +160,17 @@ NM_DEFINE_SINGLETON_DESTRUCTOR(TYPE) /*****************************************************************************/ +#define _NM_BACKPORT_SYMBOL_IMPL(VERSION, RETURN_TYPE, ORIG_FUNC, VERSIONED_FUNC, ARGS_TYPED, ARGS) \ +RETURN_TYPE VERSIONED_FUNC ARGS_TYPED; \ +RETURN_TYPE VERSIONED_FUNC ARGS_TYPED \ +{ \ + return ORIG_FUNC ARGS; \ +} \ +__asm__(".symver "G_STRINGIFY(VERSIONED_FUNC)","G_STRINGIFY(ORIG_FUNC)"@"G_STRINGIFY(VERSION)) + +#define NM_BACKPORT_SYMBOL(VERSION, RETURN_TYPE, FUNC, ARGS_TYPED, ARGS) \ +_NM_BACKPORT_SYMBOL_IMPL(VERSION, RETURN_TYPE, FUNC, _##FUNC##_##VERSION, ARGS_TYPED, ARGS) + +/*****************************************************************************/ + #endif diff --git a/tools/check-exports.sh b/tools/check-exports.sh index dfd882c15b..335312fad9 100755 --- a/tools/check-exports.sh +++ b/tools/check-exports.sh @@ -18,9 +18,7 @@ get_syms() { } get_syms_from_def() { - # be strict and only parse entries that start with one \t and end with a ';' - sed -n 's/^\t\([_a-zA-Z0-9]\+\);$/\1/p' "$1" | - grep '^\*$' -v | + sed -n 's/^\t\(\([_a-zA-Z0-9]\+\)\|#\s*\([_a-zA-Z0-9]\+@[_a-zA-Z0-9]\+\)\);$/\2\3/p' "$1" | sort } |