DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/1] compat: fixed versioning macros
@ 2015-06-23 11:38 Maciej Gajdzica
  2015-06-24 17:42 ` [dpdk-dev] [dpdk-dev,1/1] " Neil Horman
  0 siblings, 1 reply; 2+ messages in thread
From: Maciej Gajdzica @ 2015-06-23 11:38 UTC (permalink / raw)
  To: dev

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@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_ */
-- 
1.7.9.5

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [dpdk-dev,1/1] compat: fixed versioning macros
  2015-06-23 11:38 [dpdk-dev] [PATCH 1/1] compat: fixed versioning macros Maciej Gajdzica
@ 2015-06-24 17:42 ` Neil Horman
  0 siblings, 0 replies; 2+ messages in thread
From: Neil Horman @ 2015-06-24 17:42 UTC (permalink / raw)
  To: Maciej Gajdzica; +Cc: dev

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@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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-06-24 17:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-23 11:38 [dpdk-dev] [PATCH 1/1] compat: fixed versioning macros Maciej Gajdzica
2015-06-24 17:42 ` [dpdk-dev] [dpdk-dev,1/1] " Neil Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).