On 30 September 2016 at 01:46, 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> > --- > 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)
I'm sorry for the late reply but to recap, I had a comment that we must have a way to tell users that we built a shared lib that isn't ABI-compatible, one way to do that would be to reset SO-version to 0:0:0 [1] and you replied that we weren't ABI-compatible [2] and that you were not sure how libs version number could indicate that [2]. So what I propose is that we reset the SO-version number to 0:0:0 if we build a library with ODP_ABI_COMPAT=0, then the consumers know that they have to rebuild their code if they wan't to build against this library. And you are correct about that we aren't ABI-compatible yet, however, I see that as another issue that we need to work towards. For this patch where we introduce a new configure flag that will for sure break for project that consumes ODP I think we need to find a way to tell them how the library have been built. Cheers, Anders [1] https://lists.linaro.org/pipermail/lng-odp/2016-September/025608.html [2] https://lists.linaro.org/pipermail/lng-odp/2016-September/025619.html > + > +########################################################################## > # 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 >