[dpdk-dev] [dpdk-dev,1/1] compat: fixed versioning macros
Neil Horman
nhorman at tuxdriver.com
Wed Jun 24 19:42:24 CEST 2015
On Tue, Jun 23, 2015 at 01:38:14PM +0200, Maciej Gajdzica wrote:
> Previous version of versioning macros didn't work properly. When
> building dpdk as static library, external application couldn't use
> versioned function. It happened, because versioning macros for static
> library were empty. Now the same version of versioning macros is used
> for both static and dynamic libraries.
>
> Signed-off-by: Maciej Gajdzica <maciejx.t.gajdzica at intel.com>
>
> ---
> lib/librte_compat/rte_compat.h | 25 +++++--------------------
> 1 file changed, 5 insertions(+), 20 deletions(-)
>
> diff --git a/lib/librte_compat/rte_compat.h b/lib/librte_compat/rte_compat.h
> index fb0dc19..c5752c1 100644
> --- a/lib/librte_compat/rte_compat.h
> +++ b/lib/librte_compat/rte_compat.h
> @@ -32,8 +32,6 @@
> #define _RTE_COMPAT_H_
> #include <rte_common.h>
>
> -#ifdef RTE_BUILD_SHARED_LIB
> -
> /*
> * Provides backwards compatibility when updating exported functions.
> * When a symol is exported from a library to provide an API, it also provides a
> @@ -59,12 +57,14 @@
> * 3) Add this macro immediately below the function
> * VERSION_SYMBOL(foo, _v20, 2.0);
> *
> - * 4) Implement a new version of foo.
> - * char foo(int value, int otherval) { ...}
> + * 4) Implement a new version of foo with _v21 suffix.
> + * char foo_v21(int value, int otherval) { ...}
> *
> * 5) Mark the newest version as the default version
> - * BIND_DEFAULT_SYMBOL(foo, 2.1);
> + * BIND_DEFAULT_SYMBOL(foo, _v21, 2.1);
> *
> + * 6) Header file should contain definitions of all three
> + * functions (foo, foo_v20, foo_v21).
> */
>
> /*
> @@ -96,19 +96,4 @@
> #define BIND_DEFAULT_SYMBOL(b, e, n) __asm__(".symver " RTE_STR(b) RTE_STR(e) ", "RTE_STR(b)"@@DPDK_"RTE_STR(n))
> #define __vsym __attribute__((used))
>
> -#else
> -/*
> - * No symbol versioning in use
> - */
> -#define VERSION_SYMBOL(b, e, v)
> -#define __vsym
> -#define BASE_SYMBOL(b, n)
> -#define BIND_DEFAULT_SYMBOL(b, v)
> -
> -/*
> - * RTE_BUILD_SHARED_LIB=n
> - */
> -#endif
> -
> -
> #endif /* _RTE_COMPAT_H_ */
NAK
Sorry it took me a bit to get to this, but you don't want to remove th empty
definitions from this header. The .symver directives aren't meaningful when
doing a static build, and we don't want them to cause any odd compilation
errors.
Neil
More information about the dev
mailing list