This version resolves the issue with running from an installed copy of ODP.

On Thu, Sep 29, 2016 at 6:46 PM, Petri Savolainen <
petri.savolai...@nokia.com> wrote:

> Building ABI compatible or shared library are two different
> targets. A shared library may be used also without ABI
> compatibility. A new --enable-abi-compat configuration option
> is introduced. By default libraries are not built in ABI compat
> mode to enable function inlining. There is a noticeable
> performance difference when e.g. odp_atomic_xxx calls
> are not inlined.
>
> Signed-off-by: Petri Savolainen <petri.savolai...@nokia.com>
>

Reviewed-and-tested-by: Bill Fischofer <bill.fischo...@linaro.org>


> ---
>  configure.ac                                       | 26 ++++++++++++-----
>  platform/linux-generic/.gitignore                  |  2 +-
>  platform/linux-generic/Makefile.am                 |  2 +-
>  platform/linux-generic/include/odp/api/atomic.h    |  4 +--
>  platform/linux-generic/include/odp/api/byteorder.h |  4 +--
>  .../include/odp/api/plat/inlines.h.in              | 33
> ----------------------
>  .../include/odp/api/plat/static_inline.h.in        | 32
> +++++++++++++++++++++
>  platform/linux-generic/include/odp/api/std_clib.h  |  4 +--
>  platform/linux-generic/include/odp/api/sync.h      |  4 +--
>  platform/linux-generic/m4/configure.m4             |  2 +-
>  platform/linux-generic/odp_atomic.c                |  2 +-
>  platform/linux-generic/odp_byteorder.c             |  2 +-
>  platform/linux-generic/odp_std_clib.c              |  2 +-
>  platform/linux-generic/odp_sync.c                  |  2 +-
>  14 files changed, 66 insertions(+), 55 deletions(-)
>  delete mode 100644 platform/linux-generic/include/odp/api/plat/inlines.
> h.in
>  create mode 100644 platform/linux-generic/include/odp/api/plat/static_
> inline.h.in
>
> diff --git a/configure.ac b/configure.ac
> index 982aff7..f081c51 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -176,13 +176,6 @@ AM_CONDITIONAL([test_example], [test x$test_example =
> xyes ])
>  AM_CONDITIONAL([HAVE_DOXYGEN], [test "x${DOXYGEN}" = "xdoxygen"])
>  AM_CONDITIONAL([user_guide], [test "x${user_guides}" = "xyes" ])
>  AM_CONDITIONAL([HAVE_MSCGEN], [test "x${MSCGEN}" = "xmscgen"])
> -if test x$enable_shared != xyes;
> -then
> -       _ODP_INLINES="_ODP_INLINES"
> -else
> -       _ODP_INLINES="_ODP_NO_INLINES"
> -fi
> -AC_SUBST(_ODP_INLINES)
>
>  ############################################################
> ##############
>  # Setup doxygen documentation
> @@ -225,6 +218,22 @@ AC_ARG_ENABLE([debug],
>  ODP_CFLAGS="$ODP_CFLAGS -DODP_DEBUG=$ODP_DEBUG"
>
>  ############################################################
> ##############
> +# Enable/disable ABI compatible build
> +###########################################################
> ###############
> +ODP_ABI_COMPAT=1
> +abi_compat=yes
> +AC_ARG_ENABLE([abi-compat],
> +    [  --enable-abi-compat     build all targets in ABI compatible mode
> (default=yes)],
> +    [if test "x$enableval" = "xyes"; then
> +       ODP_ABI_COMPAT=1
> +       abi_compat=yes
> +     else
> +       ODP_ABI_COMPAT=0
> +       abi_compat=no
> +    fi])
> +AC_SUBST(ODP_ABI_COMPAT)
> +
> +###########################################################
> ###############
>  # Default warning setup
>  ############################################################
> ##############
>  ODP_CFLAGS="$ODP_CFLAGS -W -Wall -Werror -Wstrict-prototypes
> -Wmissing-prototypes"
> @@ -307,6 +316,9 @@ AC_MSG_RESULT([
>         am_ldflags:             ${AM_LDFLAGS}
>         libs:                   ${LIBS}
>         defs:                   ${DEFS}
> +       static libraries:       ${enable_static}
> +       shared libraries:       ${enable_shared}
> +       ABI compatible:         ${abi_compat}
>         cunit:                  ${cunit_support}
>         test_vald:              ${test_vald}
>         test_perf:              ${test_perf}
> diff --git a/platform/linux-generic/.gitignore b/platform/linux-generic/.
> gitignore
> index ec6ca37..909756a 100644
> --- a/platform/linux-generic/.gitignore
> +++ b/platform/linux-generic/.gitignore
> @@ -1 +1 @@
> -include/odp/api/plat/inlines.h
> +include/odp/api/plat/static_inline.h
> diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/
> Makefile.am
> index 900ac08..0ec13d4 100644
> --- a/platform/linux-generic/Makefile.am
> +++ b/platform/linux-generic/Makefile.am
> @@ -61,7 +61,7 @@ odpapiinclude_HEADERS = \
>
>  odpapiplatincludedir= $(includedir)/odp/api/plat
>  odpapiplatinclude_HEADERS = \
> -                 $(builddir)/include/odp/api/plat/inlines.h \
> +                 $(builddir)/include/odp/api/plat/static_inline.h \
>                   $(srcdir)/include/odp/api/plat/atomic_inlines.h \
>                   $(srcdir)/include/odp/api/plat/atomic_types.h \
>                   $(srcdir)/include/odp/api/plat/barrier_types.h \
> diff --git a/platform/linux-generic/include/odp/api/atomic.h
> b/platform/linux-generic/include/odp/api/atomic.h
> index c18e68b..7886cb4 100644
> --- a/platform/linux-generic/include/odp/api/atomic.h
> +++ b/platform/linux-generic/include/odp/api/atomic.h
> @@ -24,8 +24,8 @@ extern "C" {
>   *  @{
>   */
>
> -#include <odp/api/plat/inlines.h>
> -#ifdef _ODP_INLINES
> +#include <odp/api/plat/static_inline.h>
> +#if ODP_ABI_COMPAT == 0
>  #include <odp/api/plat/atomic_inlines.h>
>  #endif
>
> diff --git a/platform/linux-generic/include/odp/api/byteorder.h
> b/platform/linux-generic/include/odp/api/byteorder.h
> index 84d1173..ec3d0ee 100644
> --- a/platform/linux-generic/include/odp/api/byteorder.h
> +++ b/platform/linux-generic/include/odp/api/byteorder.h
> @@ -25,8 +25,8 @@ extern "C" {
>   *  @{
>   */
>
> -#include <odp/api/plat/inlines.h>
> -#ifdef _ODP_INLINES
> +#include <odp/api/plat/static_inline.h>
> +#if ODP_ABI_COMPAT == 0
>  #include <odp/api/plat/byteorder_inlines.h>
>  #endif
>
> diff --git a/platform/linux-generic/include/odp/api/plat/inlines.h.in
> b/platform/linux-generic/include/odp/api/plat/inlines.h.in
> deleted file mode 100644
> index 5d8c0dc..0000000
> --- a/platform/linux-generic/include/odp/api/plat/inlines.h.in
> +++ /dev/null
> @@ -1,33 +0,0 @@
> -/* Copyright (c) 2016, Linaro Limited
> - * All rights reserved.
> - *
> - * SPDX-License-Identifier: BSD-3-Clause
> - */
> -
> -/**
> - * @file
> - *
> - * ODP platform inline functions
> - */
> -
> -#ifndef ODP_PLAT_INLINES_H_
> -#define ODP_PLAT_INLINES_H_
> -
> -#ifdef __cplusplus
> -extern "C" {
> -#endif
> -
> -#define @_ODP_INLINES@
> -
> -#ifdef _ODP_INLINES
> -#define _STATIC static inline
> -#else
> -#define _STATIC
> -#endif
> -
> -#ifdef __cplusplus
> -}
> -#endif
> -
> -
> -#endif /* ODP_PLAT_INLINES_H_ */
> diff --git a/platform/linux-generic/include/odp/api/plat/static_
> inline.h.in b/platform/linux-generic/include/odp/api/plat/static_
> inline.h.in
> new file mode 100644
> index 0000000..acee5f3
> --- /dev/null
> +++ b/platform/linux-generic/include/odp/api/plat/static_inline.h.in
> @@ -0,0 +1,32 @@
> +/* Copyright (c) 2016, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier: BSD-3-Clause
> + */
> +
> +/**
> + * @file
> + *
> + * Macro for static inline functions
> + */
> +
> +#ifndef ODP_PLAT_STATIC_INLINE_H_
> +#define ODP_PLAT_STATIC_INLINE_H_
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#if @ODP_ABI_COMPAT@
> +#define ODP_ABI_COMPAT 1
> +#define _STATIC
> +#else
> +#define ODP_ABI_COMPAT 0
> +#define _STATIC static inline
> +#endif
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif
> diff --git a/platform/linux-generic/include/odp/api/std_clib.h
> b/platform/linux-generic/include/odp/api/std_clib.h
> index c498f68..fea4725 100644
> --- a/platform/linux-generic/include/odp/api/std_clib.h
> +++ b/platform/linux-generic/include/odp/api/std_clib.h
> @@ -14,8 +14,8 @@ extern "C" {
>  #include <odp/api/spec/std_types.h>
>  #include <string.h>
>
> -#include <odp/api/plat/inlines.h>
> -#ifdef _ODP_INLINES
> +#include <odp/api/plat/static_inline.h>
> +#if ODP_ABI_COMPAT == 0
>  #include <odp/api/plat/std_clib_inlines.h>
>  #endif
>
> diff --git a/platform/linux-generic/include/odp/api/sync.h
> b/platform/linux-generic/include/odp/api/sync.h
> index d2becb9..e1afcc7 100644
> --- a/platform/linux-generic/include/odp/api/sync.h
> +++ b/platform/linux-generic/include/odp/api/sync.h
> @@ -21,8 +21,8 @@ extern "C" {
>   *  @{
>   */
>
> -#include <odp/api/plat/inlines.h>
> -#ifdef _ODP_INLINES
> +#include <odp/api/plat/static_inline.h>
> +#if ODP_ABI_COMPAT == 0
>  #include <odp/api/plat/sync_inlines.h>
>  #endif
>
> diff --git a/platform/linux-generic/m4/configure.m4
> b/platform/linux-generic/m4/configure.m4
> index 6fb05c0..d3e5528 100644
> --- a/platform/linux-generic/m4/configure.m4
> +++ b/platform/linux-generic/m4/configure.m4
> @@ -37,4 +37,4 @@ m4_include([platform/linux-generic/m4/odp_ipc.m4])
>  m4_include([platform/linux-generic/m4/odp_schedule.m4])
>
>  AC_CONFIG_FILES([platform/linux-generic/Makefile
> -                platform/linux-generic/include/odp/api/plat/inlines.h])
> +                 platform/linux-generic/include/odp/api/plat/static_
> inline.h])
> diff --git a/platform/linux-generic/odp_atomic.c
> b/platform/linux-generic/odp_atomic.c
> index e9a3ed0..0e40cda 100644
> --- a/platform/linux-generic/odp_atomic.c
> +++ b/platform/linux-generic/odp_atomic.c
> @@ -5,7 +5,7 @@
>   */
>
>  #include <odp/api/atomic.h>
> -#ifndef _ODP_INLINES
> +#if ODP_ABI_COMPAT == 1
>  #include <odp/api/plat/atomic_inlines.h>
>  #endif
>
> diff --git a/platform/linux-generic/odp_byteorder.c
> b/platform/linux-generic/odp_byteorder.c
> index fc87291..a344c53 100644
> --- a/platform/linux-generic/odp_byteorder.c
> +++ b/platform/linux-generic/odp_byteorder.c
> @@ -5,6 +5,6 @@
>   */
>
>  #include <odp/api/byteorder.h>
> -#ifndef _ODP_INLINES
> +#if ODP_ABI_COMPAT == 1
>  #include <odp/api/plat/byteorder_inlines.h>
>  #endif
> diff --git a/platform/linux-generic/odp_std_clib.c
> b/platform/linux-generic/odp_std_clib.c
> index 611ba12..24df249 100644
> --- a/platform/linux-generic/odp_std_clib.c
> +++ b/platform/linux-generic/odp_std_clib.c
> @@ -5,6 +5,6 @@
>   */
>
>  #include <odp/api/std_clib.h>
> -#ifndef _ODP_INLINES
> +#if ODP_ABI_COMPAT == 1
>  #include <odp/api/plat/std_clib_inlines.h>
>  #endif
> diff --git a/platform/linux-generic/odp_sync.c
> b/platform/linux-generic/odp_sync.c
> index f31c389..b7eb503 100644
> --- a/platform/linux-generic/odp_sync.c
> +++ b/platform/linux-generic/odp_sync.c
> @@ -5,6 +5,6 @@
>   */
>
>  #include <odp/api/sync.h>
> -#ifndef _ODP_INLINES
> +#if ODP_ABI_COMPAT == 1
>  #include <odp/api/plat/sync_inlines.h>
>  #endif
> --
> 2.8.1
>
>

Reply via email to