List patch comments

GET /api/patches/382/comments/?format=api&order=-submitter
HTTP 200 OK
Allow: GET, HEAD, OPTIONS
Content-Type: application/json
Link: 
<https://patches.dpdk.org/api/patches/382/comments/?format=api&order=-submitter&page=1>; rel="first",
<https://patches.dpdk.org/api/patches/382/comments/?format=api&order=-submitter&page=1>; rel="last"
Vary: Accept
[ { "id": 919, "web_url": "https://patches.dpdk.org/comment/919/", "msgid": "<20140923103923.GA4642@sivswdev02.ir.intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20140923103923.GA4642@sivswdev02.ir.intel.com", "date": "2014-09-23T10:39:29", "subject": "Re: [dpdk-dev] [PATCH 1/4] compat: Add infrastructure to support\n\tsymbol versioning", "submitter": { "id": 73, "url": "https://patches.dpdk.org/api/people/73/?format=api", "name": "Sergio Gonzalez Monroy", "email": "sergio.gonzalez.monroy@intel.com" }, "content": "Hi Neil,\n\nOn Mon, Sep 15, 2014 at 03:23:48PM -0400, Neil Horman wrote:\n> Add initial pass header files to support symbol versioning.\n> \n> Signed-off-by: Neil Horman <nhorman@tuxdriver.com>\n> CC: Thomas Monjalon <thomas.monjalon@6wind.com>\n> CC: \"Richardson, Bruce\" <bruce.richardson@intel.com>\n> ---\n> lib/Makefile | 1 +\n> lib/librte_compat/Makefile | 38 +++++++++++++++++++\n> lib/librte_compat/rte_compat.h | 86 ++++++++++++++++++++++++++++++++++++++++++\n> mk/rte.lib.mk | 6 +++\n> 4 files changed, 131 insertions(+)\n> create mode 100644 lib/librte_compat/Makefile\n> create mode 100644 lib/librte_compat/rte_compat.h\n> \n> diff --git a/lib/Makefile b/lib/Makefile\n> index 10c5bb3..a85b55b 100644\n> --- a/lib/Makefile\n> +++ b/lib/Makefile\n> @@ -32,6 +32,7 @@\n> include $(RTE_SDK)/mk/rte.vars.mk\n> \n> DIRS-$(CONFIG_RTE_LIBC) += libc\n> +DIRS-y += librte_compat\n> DIRS-$(CONFIG_RTE_LIBRTE_EAL) += librte_eal\n> DIRS-$(CONFIG_RTE_LIBRTE_MALLOC) += librte_malloc\n> DIRS-$(CONFIG_RTE_LIBRTE_RING) += librte_ring\n> diff --git a/lib/librte_compat/Makefile b/lib/librte_compat/Makefile\n> new file mode 100644\n> index 0000000..a61511a\n> --- /dev/null\n> +++ b/lib/librte_compat/Makefile\n> @@ -0,0 +1,38 @@\n> +# BSD LICENSE\n> +#\n> +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved.\n> +# All rights reserved.\n> +#\n> +# Redistribution and use in source and binary forms, with or without\n> +# modification, are permitted provided that the following conditions\n> +# are met:\n> +#\n> +# * Redistributions of source code must retain the above copyright\n> +# notice, this list of conditions and the following disclaimer.\n> +# * Redistributions in binary form must reproduce the above copyright\n> +# notice, this list of conditions and the following disclaimer in\n> +# the documentation and/or other materials provided with the\n> +# distribution.\n> +# * Neither the name of Intel Corporation nor the names of its\n> +# contributors may be used to endorse or promote products derived\n> +# from this software without specific prior written permission.\n> +#\n> +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n> +# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n> +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n> +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n> +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n> +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n> +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n> +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n> +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n> +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n> +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n> +\n> +include $(RTE_SDK)/mk/rte.vars.mk\n> +\n> +\n> +# install includes\n> +SYMLINK-y-include := rte_compat.h\n> +\n> +include $(RTE_SDK)/mk/rte.lib.mk\n> diff --git a/lib/librte_compat/rte_compat.h b/lib/librte_compat/rte_compat.h\n> new file mode 100644\n> index 0000000..6d65a53\n> --- /dev/null\n> +++ b/lib/librte_compat/rte_compat.h\n> @@ -0,0 +1,86 @@\n> +/*-\n> + * BSD LICENSE\n> + *\n> + * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.\n> + * All rights reserved.\n> + *\n> + * Redistribution and use in source and binary forms, with or without\n> + * modification, are permitted provided that the following conditions\n> + * are met:\n> + *\n> + * * Redistributions of source code must retain the above copyright\n> + * notice, this list of conditions and the following disclaimer.\n> + * * Redistributions in binary form must reproduce the above copyright\n> + * notice, this list of conditions and the following disclaimer in\n> + * the documentation and/or other materials provided with the\n> + * distribution.\n> + * * Neither the name of Intel Corporation nor the names of its\n> + * contributors may be used to endorse or promote products derived\n> + * from this software without specific prior written permission.\n> + *\n> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n> + * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n> + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n> + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n> + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n> + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n> + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n> + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n> + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n> + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n> + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n> + */\n> +\n> +#ifndef _RTE_COMPAT_H_\n> +#define _RTE_COMPAT_H_\n> +\n> +/*\n> + * This is just a stringification macro for use below.\n> + */\n> +#define SA(x) #x\n> +\n> +#ifdef RTE_SYMBOL_VERSIONING\n> +\n> +/*\n> + * Provides backwards compatibility when updating exported functions.\n> + * When a symol is exported from a library to provide an API, it also provides a\n> + * calling convention (ABI) that is embodied in its name, return type,\n> + * arguments, etc. On occasion that function may need to change to accomodate\n> + * new functionality, behavior, etc. When that occurs, it is desireable to\n> + * allow for backwards compatibility for a time with older binaries that are\n> + * dynamically linked to the dpdk. to support that the __vsym and\n> + * VERSION_SYMBOL macros are created. They, in conjunction with the\n> + * <library>_version.map file for a given library allow for multiple versions of\n> + * a symbol to exist in a shared library so that older binaries need not be\n> + * immediately recompiled. Their use is outlined in the following example:\n> + * Assumptions: DPDK 1.(X) contains a function int foo(char *string)\n> + * DPDK 1.(X+1) needs to change foo to be int foo(int index)\n> + *\n> + * To accomplish this:\n> + * 1) Edit lib/<library>/library_version.map to add a DPDK_1.8 node, in which\n> + * foo is exported as a global symbol\n> + *\n> + * 2) rename the existing function int foo(char *string) to \n> + * \tint __vsym foo_v18(char *string)\n> + *\n> + * 3) Add this macro immediately below the function\n> + * \tVERSION_SYMBOL(foo, _v18, 1.8);\n> + *\n> + */\n> +#define VERSION_SYMBOL(b, e, v) __asm__(\".symver \" SA(b) SA(e) \", \"SA(b)\"@DPDK_\"SA(v))\n> +#define __vsym __attribute__((used))\n> +\n\nI may be missing something here but would it not be neccessary to define a\ndefault symbol?\nOtherwise there would be multiple definitions of a given symbol and the linker\nwon't know which symbol version to bind to.\n\nFollowing your example, something along these lines:\n 4) Edit lib/<library>/library_version.map to add a DPDK_1.9 node that is a\n successor to DPDK_1.8, in which foo is exported as a global symbol \n DPDK_1.9 {\n global: foo;\n } DPDK_1.8;\n\n 5) rename new function int foo(int index) to\n int __vsym foo_v19(int index)\n\n 6) Add this macro immediately below the function:\n DEFAULT_SYMBOL(foo, _v19, 1.9);\n\n#define DEFAULT_SYMBOL(b, e, v) __asm__(\".symver \" SA(b) SA(e) \", \"SA(b)\"@@DPDK_\"SA(v))\n\n> +#else\n> +/*\n> + * No symbol versioning in use\n> + */\n> +#define VERSION_SYMBOL(b, e, v)\n> +#define __vsym\n> +\n> +/*\n> + * RTE_SYMBOL_VERSIONING\n> + */\n> +#endif\n> +\n> +\n> +#endif /* _RTE_COMPAT_H_ */\n> diff --git a/mk/rte.lib.mk b/mk/rte.lib.mk\n> index f458258..82ac309 100644\n> --- a/mk/rte.lib.mk\n> +++ b/mk/rte.lib.mk\n> @@ -40,8 +40,12 @@ VPATH += $(SRCDIR)\n> \n> ifeq ($(RTE_BUILD_SHARED_LIB),y)\n> LIB := $(patsubst %.a,%.so,$(LIB))\n> +\n> +CPU_LDFLAGS += --version-script=$(EXPORT_MAP)\n> +\n> endif\n> \n> +\n> _BUILD = $(LIB)\n> _INSTALL = $(INSTALL-FILES-y) $(SYMLINK-FILES-y) $(RTE_OUTPUT)/lib/$(LIB)\n> _CLEAN = doclean\n> @@ -160,7 +164,9 @@ endif\n> $(RTE_OUTPUT)/lib/$(LIB): $(LIB)\n> \t@echo \" INSTALL-LIB $(LIB)\"\n> \t@[ -d $(RTE_OUTPUT)/lib ] || mkdir -p $(RTE_OUTPUT)/lib\n> +ifneq ($(LIB),)\n> \t$(Q)cp -f $(LIB) $(RTE_OUTPUT)/lib\n> +endif\n> \n> #\n> # Clean all generated files\n> -- \n> 1.9.3\n> \n\nSergio", "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id F2F2A68AF;\n\tTue, 23 Sep 2014 12:33:27 +0200 (CEST)", "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby dpdk.org (Postfix) with ESMTP id F25BC5920\n\tfor <dev@dpdk.org>; Tue, 23 Sep 2014 12:33:25 +0200 (CEST)", "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby fmsmga101.fm.intel.com with ESMTP; 23 Sep 2014 03:39:32 -0700", "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby fmsmga001.fm.intel.com with ESMTP; 23 Sep 2014 03:39:31 -0700", "from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com\n\t[10.237.217.46])\n\tby irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id\n\ts8NAdUJT008670; Tue, 23 Sep 2014 11:39:30 +0100", "from sivswdev02.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev02.ir.intel.com with ESMTP id s8NAdULc005758;\n\tTue, 23 Sep 2014 11:39:30 +0100", "(from smonroy@localhost)\n\tby sivswdev02.ir.intel.com with id s8NAdT32005753;\n\tTue, 23 Sep 2014 11:39:29 +0100" ], "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.04,579,1406617200\"; d=\"scan'208\";a=\"595506541\"", "Date": "Tue, 23 Sep 2014 11:39:29 +0100", "From": "Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>", "To": "Neil Horman <nhorman@tuxdriver.com>", "Message-ID": "<20140923103923.GA4642@sivswdev02.ir.intel.com>", "References": "<1410809031-19114-1-git-send-email-nhorman@tuxdriver.com>\n\t<1410809031-19114-2-git-send-email-nhorman@tuxdriver.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=us-ascii", "Content-Disposition": "inline", "In-Reply-To": "<1410809031-19114-2-git-send-email-nhorman@tuxdriver.com>", "User-Agent": "Mutt/1.5.20 (2009-06-14)", "Cc": "dev@dpdk.org", "Subject": "Re: [dpdk-dev] [PATCH 1/4] compat: Add infrastructure to support\n\tsymbol versioning", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "patches and discussions about DPDK <dev.dpdk.org>", "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://dpdk.org/ml/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "addressed": null }, { "id": 940, "web_url": "https://patches.dpdk.org/comment/940/", "msgid": "<20140923162947.GA22463@sivswdev02.ir.intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20140923162947.GA22463@sivswdev02.ir.intel.com", "date": "2014-09-23T16:29:48", "subject": "Re: [dpdk-dev] [PATCH 1/4] compat: Add infrastructure to support\n\tsymbol versioning", "submitter": { "id": 73, "url": "https://patches.dpdk.org/api/people/73/?format=api", "name": "Sergio Gonzalez Monroy", "email": "sergio.gonzalez.monroy@intel.com" }, "content": "On Tue, Sep 23, 2014 at 10:58:29AM -0400, Neil Horman wrote:\n> On Tue, Sep 23, 2014 at 11:39:29AM +0100, Sergio Gonzalez Monroy wrote:\n> > Hi Neil,\n> > \n> > On Mon, Sep 15, 2014 at 03:23:48PM -0400, Neil Horman wrote:\n> > > Add initial pass header files to support symbol versioning.\n> > > \n> > > Signed-off-by: Neil Horman <nhorman@tuxdriver.com>\n> > > CC: Thomas Monjalon <thomas.monjalon@6wind.com>\n> > > CC: \"Richardson, Bruce\" <bruce.richardson@intel.com>\n> > > ---\n> > > lib/Makefile | 1 +\n> > > lib/librte_compat/Makefile | 38 +++++++++++++++++++\n> > > lib/librte_compat/rte_compat.h | 86 ++++++++++++++++++++++++++++++++++++++++++\n> > > mk/rte.lib.mk | 6 +++\n> > > 4 files changed, 131 insertions(+)\n> > > create mode 100644 lib/librte_compat/Makefile\n> > > create mode 100644 lib/librte_compat/rte_compat.h\n> > > \n> > > diff --git a/lib/Makefile b/lib/Makefile\n> > > index 10c5bb3..a85b55b 100644\n> > > --- a/lib/Makefile\n> > > +++ b/lib/Makefile\n> > > @@ -32,6 +32,7 @@\n> > > include $(RTE_SDK)/mk/rte.vars.mk\n> > > \n> > > DIRS-$(CONFIG_RTE_LIBC) += libc\n> > > +DIRS-y += librte_compat\n> > > DIRS-$(CONFIG_RTE_LIBRTE_EAL) += librte_eal\n> > > DIRS-$(CONFIG_RTE_LIBRTE_MALLOC) += librte_malloc\n> > > DIRS-$(CONFIG_RTE_LIBRTE_RING) += librte_ring\n> > > diff --git a/lib/librte_compat/Makefile b/lib/librte_compat/Makefile\n> > > new file mode 100644\n> > > index 0000000..a61511a\n> > > --- /dev/null\n> > > +++ b/lib/librte_compat/Makefile\n> > > @@ -0,0 +1,38 @@\n> > > +# BSD LICENSE\n> > > +#\n> > > +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved.\n> > > +# All rights reserved.\n> > > +#\n> > > +# Redistribution and use in source and binary forms, with or without\n> > > +# modification, are permitted provided that the following conditions\n> > > +# are met:\n> > > +#\n> > > +# * Redistributions of source code must retain the above copyright\n> > > +# notice, this list of conditions and the following disclaimer.\n> > > +# * Redistributions in binary form must reproduce the above copyright\n> > > +# notice, this list of conditions and the following disclaimer in\n> > > +# the documentation and/or other materials provided with the\n> > > +# distribution.\n> > > +# * Neither the name of Intel Corporation nor the names of its\n> > > +# contributors may be used to endorse or promote products derived\n> > > +# from this software without specific prior written permission.\n> > > +#\n> > > +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n> > > +# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n> > > +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n> > > +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n> > > +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n> > > +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n> > > +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n> > > +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n> > > +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n> > > +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n> > > +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n> > > +\n> > > +include $(RTE_SDK)/mk/rte.vars.mk\n> > > +\n> > > +\n> > > +# install includes\n> > > +SYMLINK-y-include := rte_compat.h\n> > > +\n> > > +include $(RTE_SDK)/mk/rte.lib.mk\n> > > diff --git a/lib/librte_compat/rte_compat.h b/lib/librte_compat/rte_compat.h\n> > > new file mode 100644\n> > > index 0000000..6d65a53\n> > > --- /dev/null\n> > > +++ b/lib/librte_compat/rte_compat.h\n> > > @@ -0,0 +1,86 @@\n> > > +/*-\n> > > + * BSD LICENSE\n> > > + *\n> > > + * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.\n> > > + * All rights reserved.\n> > > + *\n> > > + * Redistribution and use in source and binary forms, with or without\n> > > + * modification, are permitted provided that the following conditions\n> > > + * are met:\n> > > + *\n> > > + * * Redistributions of source code must retain the above copyright\n> > > + * notice, this list of conditions and the following disclaimer.\n> > > + * * Redistributions in binary form must reproduce the above copyright\n> > > + * notice, this list of conditions and the following disclaimer in\n> > > + * the documentation and/or other materials provided with the\n> > > + * distribution.\n> > > + * * Neither the name of Intel Corporation nor the names of its\n> > > + * contributors may be used to endorse or promote products derived\n> > > + * from this software without specific prior written permission.\n> > > + *\n> > > + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n> > > + * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n> > > + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n> > > + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n> > > + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n> > > + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n> > > + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n> > > + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n> > > + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n> > > + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n> > > + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n> > > + */\n> > > +\n> > > +#ifndef _RTE_COMPAT_H_\n> > > +#define _RTE_COMPAT_H_\n> > > +\n> > > +/*\n> > > + * This is just a stringification macro for use below.\n> > > + */\n> > > +#define SA(x) #x\n> > > +\n> > > +#ifdef RTE_SYMBOL_VERSIONING\n> > > +\n> > > +/*\n> > > + * Provides backwards compatibility when updating exported functions.\n> > > + * When a symol is exported from a library to provide an API, it also provides a\n> > > + * calling convention (ABI) that is embodied in its name, return type,\n> > > + * arguments, etc. On occasion that function may need to change to accomodate\n> > > + * new functionality, behavior, etc. When that occurs, it is desireable to\n> > > + * allow for backwards compatibility for a time with older binaries that are\n> > > + * dynamically linked to the dpdk. to support that the __vsym and\n> > > + * VERSION_SYMBOL macros are created. They, in conjunction with the\n> > > + * <library>_version.map file for a given library allow for multiple versions of\n> > > + * a symbol to exist in a shared library so that older binaries need not be\n> > > + * immediately recompiled. Their use is outlined in the following example:\n> > > + * Assumptions: DPDK 1.(X) contains a function int foo(char *string)\n> > > + * DPDK 1.(X+1) needs to change foo to be int foo(int index)\n> > > + *\n> > > + * To accomplish this:\n> > > + * 1) Edit lib/<library>/library_version.map to add a DPDK_1.8 node, in which\n> > > + * foo is exported as a global symbol\n> > > + *\n> > > + * 2) rename the existing function int foo(char *string) to \n> > > + * \tint __vsym foo_v18(char *string)\n> > > + *\n> > > + * 3) Add this macro immediately below the function\n> > > + * \tVERSION_SYMBOL(foo, _v18, 1.8);\n> > > + *\n> > > + */\n> > > +#define VERSION_SYMBOL(b, e, v) __asm__(\".symver \" SA(b) SA(e) \", \"SA(b)\"@DPDK_\"SA(v))\n> > > +#define __vsym __attribute__((used))\n> > > +\n> > \n> > I may be missing something here but would it not be neccessary to define a\n> > default symbol?\n> > Otherwise there would be multiple definitions of a given symbol and the linker\n> > won't know which symbol version to bind to.\n> > \n> > Following your example, something along these lines:\n> > 4) Edit lib/<library>/library_version.map to add a DPDK_1.9 node that is a\n> > successor to DPDK_1.8, in which foo is exported as a global symbol \n> > DPDK_1.9 {\n> > global: foo;\n> > } DPDK_1.8;\n> > \n> > 5) rename new function int foo(int index) to\n> > int __vsym foo_v19(int index)\n> > \n> > 6) Add this macro immediately below the function:\n> > DEFAULT_SYMBOL(foo, _v19, 1.9);\n> > \n> > #define DEFAULT_SYMBOL(b, e, v) __asm__(\".symver \" SA(b) SA(e) \", \"SA(b)\"@@DPDK_\"SA(v))\n> > \n> \n> You're spot on (though the macro that I created in rte_compat.h is\n> VERSION_SYMBOL). \n> \n> When you use a version script to create a DSO, at link time, the appropriate\n> version is appended to the symbol name (you can see it with objdump -t in a\n> linked binary). If you want to update the symbol to a new version, you do what\n> I documented in the header file (though now that I re-read it, it could be more\n> clear. Hows this for a change to the documentation:\n> \n> To make a new version of a function foo in a DSO:\n> \n> 1) Edit lib/<library>/library_version.map to add a DPDK_1.8 node, in which\n> foo is exported as a global symbol\n> \n> 2) rename the existing function int foo(char *string) to \n> int __vsym foo_v18(char *string)\n> \n> 3) Add this macro immediately below the function\n> VERSION_SYMBOL(foo, _v18, 1.8);\n> \n> 4) Implement the new version of the function foo.\n> \n> \n> Those steps above will create two symbols in your export table of the DSO:\n> \n> foo@@DPDK_1.8\n> foo@@DPDK_1.9\n> \n> Any application linked against this DSO will link against the latest version\n> (DPDK_1.9). But if you look at the symbols referenced in a binary linked\n> against an older version of the same DSO, you'll note they explicitly look for\n> foo@@DPDK_1.8. Thats how we provide backwards compatibility\n> \n> Does that answer your questions?\n> \n> Neil\n> \nCorrect me if I am wrong but when we define multiple versions of a symbol we\nneed to specify a default one.\nAs an example, if we were to have three versions of foo the export table of the\nDSO should look something like this:\n\nfoo@VER_1.0\nfoo@VER_1.1\nfoo@@VER_1.2\n\nIn the above example, foo VER_1.2 is the default one and is indicated by\nhaving double @.\n\nEffectively we would need two macros VERSION_SYMBOL and DEFAULT_VERSION_SYMBOL\n(maybe this name is more appropriate).\n\n#define VERSION_SYMBOL(b, e, v) \\\n __asm__(\".symver \" SA(b) SA(e) \", \"SA(b)\"@DPDK_\"SA(v))\n#define DEFAULT_VERSION_SYMBOL(b, e, v) \\\n __asm__(\".symver \" SA(b) SA(e) \", \"SA(b)\"@@DPDK_\"SA(v))\n\nFollowing on the example, we should have something like:\n\n int __vsym foo_v18(char *string) {...}\n VERSION_SYMBOL(foo, _v18, 1.8);\n\n int __vsym foo_v19(int index) {...}\n DEFAULT_VERSION_SYMBOL(foo, _v19, 1.9);\n\nThe DSO export table would have the following symbols:\n\n foo@DPDK_1.8\n foo@@DPDK_1.9\n\nOld binaries linked against DPDK 1.8 would have references to:\nfoo@@DPDK_1.8\n\nand new binaries linked against DPDK 1.9 would have to:\nfoo@@DPDK_1.9\n\nSergio\n\n> > > +#else\n> > > +/*\n> > > + * No symbol versioning in use\n> > > + */\n> > > +#define VERSION_SYMBOL(b, e, v)\n> > > +#define __vsym\n> > > +\n> > > +/*\n> > > + * RTE_SYMBOL_VERSIONING\n> > > + */\n> > > +#endif\n> > > +\n> > > +\n> > > +#endif /* _RTE_COMPAT_H_ */\n> > > diff --git a/mk/rte.lib.mk b/mk/rte.lib.mk\n> > > index f458258..82ac309 100644\n> > > --- a/mk/rte.lib.mk\n> > > +++ b/mk/rte.lib.mk\n> > > @@ -40,8 +40,12 @@ VPATH += $(SRCDIR)\n> > > \n> > > ifeq ($(RTE_BUILD_SHARED_LIB),y)\n> > > LIB := $(patsubst %.a,%.so,$(LIB))\n> > > +\n> > > +CPU_LDFLAGS += --version-script=$(EXPORT_MAP)\n> > > +\n> > > endif\n> > > \n> > > +\n> > > _BUILD = $(LIB)\n> > > _INSTALL = $(INSTALL-FILES-y) $(SYMLINK-FILES-y) $(RTE_OUTPUT)/lib/$(LIB)\n> > > _CLEAN = doclean\n> > > @@ -160,7 +164,9 @@ endif\n> > > $(RTE_OUTPUT)/lib/$(LIB): $(LIB)\n> > > \t@echo \" INSTALL-LIB $(LIB)\"\n> > > \t@[ -d $(RTE_OUTPUT)/lib ] || mkdir -p $(RTE_OUTPUT)/lib\n> > > +ifneq ($(LIB),)\n> > > \t$(Q)cp -f $(LIB) $(RTE_OUTPUT)/lib\n> > > +endif\n> > > \n> > > #\n> > > # Clean all generated files\n> > > -- \n> > > 1.9.3\n> > > \n> > \n> > Sergio\n> >", "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 62B2558FE;\n\tTue, 23 Sep 2014 18:37:17 +0200 (CEST)", "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby dpdk.org (Postfix) with ESMTP id 31D08137D\n\tfor <dev@dpdk.org>; Tue, 23 Sep 2014 18:37:15 +0200 (CEST)", "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby fmsmga103.fm.intel.com with ESMTP; 23 Sep 2014 09:20:45 -0700", "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby fmsmga001.fm.intel.com with ESMTP; 23 Sep 2014 09:29:49 -0700", "from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com\n\t[10.237.217.46])\n\tby irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id\n\ts8NGTnY7001731; Tue, 23 Sep 2014 17:29:49 +0100", "from sivswdev02.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev02.ir.intel.com with ESMTP id s8NGTmZM028286;\n\tTue, 23 Sep 2014 17:29:48 +0100", "(from smonroy@localhost)\n\tby sivswdev02.ir.intel.com with id s8NGTmH3028281;\n\tTue, 23 Sep 2014 17:29:48 +0100" ], "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.04,581,1406617200\"; d=\"scan'208\";a=\"595684375\"", "Date": "Tue, 23 Sep 2014 17:29:48 +0100", "From": "Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>", "To": "Neil Horman <nhorman@tuxdriver.com>", "Message-ID": "<20140923162947.GA22463@sivswdev02.ir.intel.com>", "References": "<1410809031-19114-1-git-send-email-nhorman@tuxdriver.com>\n\t<1410809031-19114-2-git-send-email-nhorman@tuxdriver.com>\n\t<20140923103923.GA4642@sivswdev02.ir.intel.com>\n\t<20140923145829.GB12884@hmsreliant.think-freely.org>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=us-ascii", "Content-Disposition": "inline", "In-Reply-To": "<20140923145829.GB12884@hmsreliant.think-freely.org>", "User-Agent": "Mutt/1.5.20 (2009-06-14)", "Cc": "dev@dpdk.org", "Subject": "Re: [dpdk-dev] [PATCH 1/4] compat: Add infrastructure to support\n\tsymbol versioning", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "patches and discussions about DPDK <dev.dpdk.org>", "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://dpdk.org/ml/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "addressed": null }, { "id": 937, "web_url": "https://patches.dpdk.org/comment/937/", "msgid": "<20140923145829.GB12884@hmsreliant.think-freely.org>", "list_archive_url": "https://inbox.dpdk.org/dev/20140923145829.GB12884@hmsreliant.think-freely.org", "date": "2014-09-23T14:58:29", "subject": "Re: [dpdk-dev] [PATCH 1/4] compat: Add infrastructure to support\n\tsymbol versioning", "submitter": { "id": 32, "url": "https://patches.dpdk.org/api/people/32/?format=api", "name": "Neil Horman", "email": "nhorman@tuxdriver.com" }, "content": "On Tue, Sep 23, 2014 at 11:39:29AM +0100, Sergio Gonzalez Monroy wrote:\n> Hi Neil,\n> \n> On Mon, Sep 15, 2014 at 03:23:48PM -0400, Neil Horman wrote:\n> > Add initial pass header files to support symbol versioning.\n> > \n> > Signed-off-by: Neil Horman <nhorman@tuxdriver.com>\n> > CC: Thomas Monjalon <thomas.monjalon@6wind.com>\n> > CC: \"Richardson, Bruce\" <bruce.richardson@intel.com>\n> > ---\n> > lib/Makefile | 1 +\n> > lib/librte_compat/Makefile | 38 +++++++++++++++++++\n> > lib/librte_compat/rte_compat.h | 86 ++++++++++++++++++++++++++++++++++++++++++\n> > mk/rte.lib.mk | 6 +++\n> > 4 files changed, 131 insertions(+)\n> > create mode 100644 lib/librte_compat/Makefile\n> > create mode 100644 lib/librte_compat/rte_compat.h\n> > \n> > diff --git a/lib/Makefile b/lib/Makefile\n> > index 10c5bb3..a85b55b 100644\n> > --- a/lib/Makefile\n> > +++ b/lib/Makefile\n> > @@ -32,6 +32,7 @@\n> > include $(RTE_SDK)/mk/rte.vars.mk\n> > \n> > DIRS-$(CONFIG_RTE_LIBC) += libc\n> > +DIRS-y += librte_compat\n> > DIRS-$(CONFIG_RTE_LIBRTE_EAL) += librte_eal\n> > DIRS-$(CONFIG_RTE_LIBRTE_MALLOC) += librte_malloc\n> > DIRS-$(CONFIG_RTE_LIBRTE_RING) += librte_ring\n> > diff --git a/lib/librte_compat/Makefile b/lib/librte_compat/Makefile\n> > new file mode 100644\n> > index 0000000..a61511a\n> > --- /dev/null\n> > +++ b/lib/librte_compat/Makefile\n> > @@ -0,0 +1,38 @@\n> > +# BSD LICENSE\n> > +#\n> > +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved.\n> > +# All rights reserved.\n> > +#\n> > +# Redistribution and use in source and binary forms, with or without\n> > +# modification, are permitted provided that the following conditions\n> > +# are met:\n> > +#\n> > +# * Redistributions of source code must retain the above copyright\n> > +# notice, this list of conditions and the following disclaimer.\n> > +# * Redistributions in binary form must reproduce the above copyright\n> > +# notice, this list of conditions and the following disclaimer in\n> > +# the documentation and/or other materials provided with the\n> > +# distribution.\n> > +# * Neither the name of Intel Corporation nor the names of its\n> > +# contributors may be used to endorse or promote products derived\n> > +# from this software without specific prior written permission.\n> > +#\n> > +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n> > +# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n> > +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n> > +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n> > +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n> > +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n> > +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n> > +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n> > +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n> > +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n> > +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n> > +\n> > +include $(RTE_SDK)/mk/rte.vars.mk\n> > +\n> > +\n> > +# install includes\n> > +SYMLINK-y-include := rte_compat.h\n> > +\n> > +include $(RTE_SDK)/mk/rte.lib.mk\n> > diff --git a/lib/librte_compat/rte_compat.h b/lib/librte_compat/rte_compat.h\n> > new file mode 100644\n> > index 0000000..6d65a53\n> > --- /dev/null\n> > +++ b/lib/librte_compat/rte_compat.h\n> > @@ -0,0 +1,86 @@\n> > +/*-\n> > + * BSD LICENSE\n> > + *\n> > + * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.\n> > + * All rights reserved.\n> > + *\n> > + * Redistribution and use in source and binary forms, with or without\n> > + * modification, are permitted provided that the following conditions\n> > + * are met:\n> > + *\n> > + * * Redistributions of source code must retain the above copyright\n> > + * notice, this list of conditions and the following disclaimer.\n> > + * * Redistributions in binary form must reproduce the above copyright\n> > + * notice, this list of conditions and the following disclaimer in\n> > + * the documentation and/or other materials provided with the\n> > + * distribution.\n> > + * * Neither the name of Intel Corporation nor the names of its\n> > + * contributors may be used to endorse or promote products derived\n> > + * from this software without specific prior written permission.\n> > + *\n> > + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n> > + * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n> > + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n> > + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n> > + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n> > + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n> > + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n> > + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n> > + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n> > + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n> > + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n> > + */\n> > +\n> > +#ifndef _RTE_COMPAT_H_\n> > +#define _RTE_COMPAT_H_\n> > +\n> > +/*\n> > + * This is just a stringification macro for use below.\n> > + */\n> > +#define SA(x) #x\n> > +\n> > +#ifdef RTE_SYMBOL_VERSIONING\n> > +\n> > +/*\n> > + * Provides backwards compatibility when updating exported functions.\n> > + * When a symol is exported from a library to provide an API, it also provides a\n> > + * calling convention (ABI) that is embodied in its name, return type,\n> > + * arguments, etc. On occasion that function may need to change to accomodate\n> > + * new functionality, behavior, etc. When that occurs, it is desireable to\n> > + * allow for backwards compatibility for a time with older binaries that are\n> > + * dynamically linked to the dpdk. to support that the __vsym and\n> > + * VERSION_SYMBOL macros are created. They, in conjunction with the\n> > + * <library>_version.map file for a given library allow for multiple versions of\n> > + * a symbol to exist in a shared library so that older binaries need not be\n> > + * immediately recompiled. Their use is outlined in the following example:\n> > + * Assumptions: DPDK 1.(X) contains a function int foo(char *string)\n> > + * DPDK 1.(X+1) needs to change foo to be int foo(int index)\n> > + *\n> > + * To accomplish this:\n> > + * 1) Edit lib/<library>/library_version.map to add a DPDK_1.8 node, in which\n> > + * foo is exported as a global symbol\n> > + *\n> > + * 2) rename the existing function int foo(char *string) to \n> > + * \tint __vsym foo_v18(char *string)\n> > + *\n> > + * 3) Add this macro immediately below the function\n> > + * \tVERSION_SYMBOL(foo, _v18, 1.8);\n> > + *\n> > + */\n> > +#define VERSION_SYMBOL(b, e, v) __asm__(\".symver \" SA(b) SA(e) \", \"SA(b)\"@DPDK_\"SA(v))\n> > +#define __vsym __attribute__((used))\n> > +\n> \n> I may be missing something here but would it not be neccessary to define a\n> default symbol?\n> Otherwise there would be multiple definitions of a given symbol and the linker\n> won't know which symbol version to bind to.\n> \n> Following your example, something along these lines:\n> 4) Edit lib/<library>/library_version.map to add a DPDK_1.9 node that is a\n> successor to DPDK_1.8, in which foo is exported as a global symbol \n> DPDK_1.9 {\n> global: foo;\n> } DPDK_1.8;\n> \n> 5) rename new function int foo(int index) to\n> int __vsym foo_v19(int index)\n> \n> 6) Add this macro immediately below the function:\n> DEFAULT_SYMBOL(foo, _v19, 1.9);\n> \n> #define DEFAULT_SYMBOL(b, e, v) __asm__(\".symver \" SA(b) SA(e) \", \"SA(b)\"@@DPDK_\"SA(v))\n> \n\nYou're spot on (though the macro that I created in rte_compat.h is\nVERSION_SYMBOL). \n\nWhen you use a version script to create a DSO, at link time, the appropriate\nversion is appended to the symbol name (you can see it with objdump -t in a\nlinked binary). If you want to update the symbol to a new version, you do what\nI documented in the header file (though now that I re-read it, it could be more\nclear. Hows this for a change to the documentation:\n\nTo make a new version of a function foo in a DSO:\n\n1) Edit lib/<library>/library_version.map to add a DPDK_1.8 node, in which\n foo is exported as a global symbol\n\n2) rename the existing function int foo(char *string) to \n int __vsym foo_v18(char *string)\n\n3) Add this macro immediately below the function\n VERSION_SYMBOL(foo, _v18, 1.8);\n\n4) Implement the new version of the function foo.\n\n\nThose steps above will create two symbols in your export table of the DSO:\n\nfoo@@DPDK_1.8\nfoo@@DPDK_1.9\n\nAny application linked against this DSO will link against the latest version\n(DPDK_1.9). But if you look at the symbols referenced in a binary linked\nagainst an older version of the same DSO, you'll note they explicitly look for\nfoo@@DPDK_1.8. Thats how we provide backwards compatibility\n\nDoes that answer your questions?\n\nNeil\n\n> > +#else\n> > +/*\n> > + * No symbol versioning in use\n> > + */\n> > +#define VERSION_SYMBOL(b, e, v)\n> > +#define __vsym\n> > +\n> > +/*\n> > + * RTE_SYMBOL_VERSIONING\n> > + */\n> > +#endif\n> > +\n> > +\n> > +#endif /* _RTE_COMPAT_H_ */\n> > diff --git a/mk/rte.lib.mk b/mk/rte.lib.mk\n> > index f458258..82ac309 100644\n> > --- a/mk/rte.lib.mk\n> > +++ b/mk/rte.lib.mk\n> > @@ -40,8 +40,12 @@ VPATH += $(SRCDIR)\n> > \n> > ifeq ($(RTE_BUILD_SHARED_LIB),y)\n> > LIB := $(patsubst %.a,%.so,$(LIB))\n> > +\n> > +CPU_LDFLAGS += --version-script=$(EXPORT_MAP)\n> > +\n> > endif\n> > \n> > +\n> > _BUILD = $(LIB)\n> > _INSTALL = $(INSTALL-FILES-y) $(SYMLINK-FILES-y) $(RTE_OUTPUT)/lib/$(LIB)\n> > _CLEAN = doclean\n> > @@ -160,7 +164,9 @@ endif\n> > $(RTE_OUTPUT)/lib/$(LIB): $(LIB)\n> > \t@echo \" INSTALL-LIB $(LIB)\"\n> > \t@[ -d $(RTE_OUTPUT)/lib ] || mkdir -p $(RTE_OUTPUT)/lib\n> > +ifneq ($(LIB),)\n> > \t$(Q)cp -f $(LIB) $(RTE_OUTPUT)/lib\n> > +endif\n> > \n> > #\n> > # Clean all generated files\n> > -- \n> > 1.9.3\n> > \n> \n> Sergio\n>", "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 35B005920;\n\tTue, 23 Sep 2014 16:52:33 +0200 (CEST)", "from smtp.tuxdriver.com (charlotte.tuxdriver.com [70.61.120.58])\n\tby dpdk.org (Postfix) with ESMTP id C7C0B58FE\n\tfor <dev@dpdk.org>; Tue, 23 Sep 2014 16:52:31 +0200 (CEST)", "from [2001:470:8:a08:18c5:c64e:4bf:67a] (helo=localhost)\n\tby smtp.tuxdriver.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.63)\n\t(envelope-from <nhorman@tuxdriver.com>)\n\tid 1XWRXy-0007Jf-4F; Tue, 23 Sep 2014 10:58:37 -0400" ], "Date": "Tue, 23 Sep 2014 10:58:29 -0400", "From": "Neil Horman <nhorman@tuxdriver.com>", "To": "Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>", "Message-ID": "<20140923145829.GB12884@hmsreliant.think-freely.org>", "References": "<1410809031-19114-1-git-send-email-nhorman@tuxdriver.com>\n\t<1410809031-19114-2-git-send-email-nhorman@tuxdriver.com>\n\t<20140923103923.GA4642@sivswdev02.ir.intel.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=us-ascii", "Content-Disposition": "inline", "In-Reply-To": "<20140923103923.GA4642@sivswdev02.ir.intel.com>", "User-Agent": "Mutt/1.5.23 (2014-03-12)", "X-Spam-Score": "-2.9 (--)", "X-Spam-Status": "No", "Cc": "dev@dpdk.org", "Subject": "Re: [dpdk-dev] [PATCH 1/4] compat: Add infrastructure to support\n\tsymbol versioning", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "patches and discussions about DPDK <dev.dpdk.org>", "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://dpdk.org/ml/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "addressed": null }, { "id": 942, "web_url": "https://patches.dpdk.org/comment/942/", "msgid": "<20140923173114.GD12884@hmsreliant.think-freely.org>", "list_archive_url": "https://inbox.dpdk.org/dev/20140923173114.GD12884@hmsreliant.think-freely.org", "date": "2014-09-23T17:31:14", "subject": "Re: [dpdk-dev] [PATCH 1/4] compat: Add infrastructure to support\n\tsymbol versioning", "submitter": { "id": 32, "url": "https://patches.dpdk.org/api/people/32/?format=api", "name": "Neil Horman", "email": "nhorman@tuxdriver.com" }, "content": "On Tue, Sep 23, 2014 at 05:29:48PM +0100, Sergio Gonzalez Monroy wrote:\n> On Tue, Sep 23, 2014 at 10:58:29AM -0400, Neil Horman wrote:\n> > On Tue, Sep 23, 2014 at 11:39:29AM +0100, Sergio Gonzalez Monroy wrote:\n> > > Hi Neil,\n> > > \n> > > On Mon, Sep 15, 2014 at 03:23:48PM -0400, Neil Horman wrote:\n> > > > Add initial pass header files to support symbol versioning.\n> > > > \n> > > > Signed-off-by: Neil Horman <nhorman@tuxdriver.com>\n> > > > CC: Thomas Monjalon <thomas.monjalon@6wind.com>\n> > > > CC: \"Richardson, Bruce\" <bruce.richardson@intel.com>\n> > > > ---\n> > > > lib/Makefile | 1 +\n> > > > lib/librte_compat/Makefile | 38 +++++++++++++++++++\n> > > > lib/librte_compat/rte_compat.h | 86 ++++++++++++++++++++++++++++++++++++++++++\n> > > > mk/rte.lib.mk | 6 +++\n> > > > 4 files changed, 131 insertions(+)\n> > > > create mode 100644 lib/librte_compat/Makefile\n> > > > create mode 100644 lib/librte_compat/rte_compat.h\n> > > > \n> > > > diff --git a/lib/Makefile b/lib/Makefile\n> > > > index 10c5bb3..a85b55b 100644\n> > > > --- a/lib/Makefile\n> > > > +++ b/lib/Makefile\n> > > > @@ -32,6 +32,7 @@\n> > > > include $(RTE_SDK)/mk/rte.vars.mk\n> > > > \n> > > > DIRS-$(CONFIG_RTE_LIBC) += libc\n> > > > +DIRS-y += librte_compat\n> > > > DIRS-$(CONFIG_RTE_LIBRTE_EAL) += librte_eal\n> > > > DIRS-$(CONFIG_RTE_LIBRTE_MALLOC) += librte_malloc\n> > > > DIRS-$(CONFIG_RTE_LIBRTE_RING) += librte_ring\n> > > > diff --git a/lib/librte_compat/Makefile b/lib/librte_compat/Makefile\n> > > > new file mode 100644\n> > > > index 0000000..a61511a\n> > > > --- /dev/null\n> > > > +++ b/lib/librte_compat/Makefile\n> > > > @@ -0,0 +1,38 @@\n> > > > +# BSD LICENSE\n> > > > +#\n> > > > +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved.\n> > > > +# All rights reserved.\n> > > > +#\n> > > > +# Redistribution and use in source and binary forms, with or without\n> > > > +# modification, are permitted provided that the following conditions\n> > > > +# are met:\n> > > > +#\n> > > > +# * Redistributions of source code must retain the above copyright\n> > > > +# notice, this list of conditions and the following disclaimer.\n> > > > +# * Redistributions in binary form must reproduce the above copyright\n> > > > +# notice, this list of conditions and the following disclaimer in\n> > > > +# the documentation and/or other materials provided with the\n> > > > +# distribution.\n> > > > +# * Neither the name of Intel Corporation nor the names of its\n> > > > +# contributors may be used to endorse or promote products derived\n> > > > +# from this software without specific prior written permission.\n> > > > +#\n> > > > +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n> > > > +# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n> > > > +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n> > > > +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n> > > > +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n> > > > +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n> > > > +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n> > > > +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n> > > > +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n> > > > +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n> > > > +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n> > > > +\n> > > > +include $(RTE_SDK)/mk/rte.vars.mk\n> > > > +\n> > > > +\n> > > > +# install includes\n> > > > +SYMLINK-y-include := rte_compat.h\n> > > > +\n> > > > +include $(RTE_SDK)/mk/rte.lib.mk\n> > > > diff --git a/lib/librte_compat/rte_compat.h b/lib/librte_compat/rte_compat.h\n> > > > new file mode 100644\n> > > > index 0000000..6d65a53\n> > > > --- /dev/null\n> > > > +++ b/lib/librte_compat/rte_compat.h\n> > > > @@ -0,0 +1,86 @@\n> > > > +/*-\n> > > > + * BSD LICENSE\n> > > > + *\n> > > > + * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.\n> > > > + * All rights reserved.\n> > > > + *\n> > > > + * Redistribution and use in source and binary forms, with or without\n> > > > + * modification, are permitted provided that the following conditions\n> > > > + * are met:\n> > > > + *\n> > > > + * * Redistributions of source code must retain the above copyright\n> > > > + * notice, this list of conditions and the following disclaimer.\n> > > > + * * Redistributions in binary form must reproduce the above copyright\n> > > > + * notice, this list of conditions and the following disclaimer in\n> > > > + * the documentation and/or other materials provided with the\n> > > > + * distribution.\n> > > > + * * Neither the name of Intel Corporation nor the names of its\n> > > > + * contributors may be used to endorse or promote products derived\n> > > > + * from this software without specific prior written permission.\n> > > > + *\n> > > > + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n> > > > + * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n> > > > + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n> > > > + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n> > > > + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n> > > > + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n> > > > + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n> > > > + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n> > > > + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n> > > > + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n> > > > + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n> > > > + */\n> > > > +\n> > > > +#ifndef _RTE_COMPAT_H_\n> > > > +#define _RTE_COMPAT_H_\n> > > > +\n> > > > +/*\n> > > > + * This is just a stringification macro for use below.\n> > > > + */\n> > > > +#define SA(x) #x\n> > > > +\n> > > > +#ifdef RTE_SYMBOL_VERSIONING\n> > > > +\n> > > > +/*\n> > > > + * Provides backwards compatibility when updating exported functions.\n> > > > + * When a symol is exported from a library to provide an API, it also provides a\n> > > > + * calling convention (ABI) that is embodied in its name, return type,\n> > > > + * arguments, etc. On occasion that function may need to change to accomodate\n> > > > + * new functionality, behavior, etc. When that occurs, it is desireable to\n> > > > + * allow for backwards compatibility for a time with older binaries that are\n> > > > + * dynamically linked to the dpdk. to support that the __vsym and\n> > > > + * VERSION_SYMBOL macros are created. They, in conjunction with the\n> > > > + * <library>_version.map file for a given library allow for multiple versions of\n> > > > + * a symbol to exist in a shared library so that older binaries need not be\n> > > > + * immediately recompiled. Their use is outlined in the following example:\n> > > > + * Assumptions: DPDK 1.(X) contains a function int foo(char *string)\n> > > > + * DPDK 1.(X+1) needs to change foo to be int foo(int index)\n> > > > + *\n> > > > + * To accomplish this:\n> > > > + * 1) Edit lib/<library>/library_version.map to add a DPDK_1.8 node, in which\n> > > > + * foo is exported as a global symbol\n> > > > + *\n> > > > + * 2) rename the existing function int foo(char *string) to \n> > > > + * \tint __vsym foo_v18(char *string)\n> > > > + *\n> > > > + * 3) Add this macro immediately below the function\n> > > > + * \tVERSION_SYMBOL(foo, _v18, 1.8);\n> > > > + *\n> > > > + */\n> > > > +#define VERSION_SYMBOL(b, e, v) __asm__(\".symver \" SA(b) SA(e) \", \"SA(b)\"@DPDK_\"SA(v))\n> > > > +#define __vsym __attribute__((used))\n> > > > +\n> > > \n> > > I may be missing something here but would it not be neccessary to define a\n> > > default symbol?\n> > > Otherwise there would be multiple definitions of a given symbol and the linker\n> > > won't know which symbol version to bind to.\n> > > \n> > > Following your example, something along these lines:\n> > > 4) Edit lib/<library>/library_version.map to add a DPDK_1.9 node that is a\n> > > successor to DPDK_1.8, in which foo is exported as a global symbol \n> > > DPDK_1.9 {\n> > > global: foo;\n> > > } DPDK_1.8;\n> > > \n> > > 5) rename new function int foo(int index) to\n> > > int __vsym foo_v19(int index)\n> > > \n> > > 6) Add this macro immediately below the function:\n> > > DEFAULT_SYMBOL(foo, _v19, 1.9);\n> > > \n> > > #define DEFAULT_SYMBOL(b, e, v) __asm__(\".symver \" SA(b) SA(e) \", \"SA(b)\"@@DPDK_\"SA(v))\n> > > \n> > \n> > You're spot on (though the macro that I created in rte_compat.h is\n> > VERSION_SYMBOL). \n> > \n> > When you use a version script to create a DSO, at link time, the appropriate\n> > version is appended to the symbol name (you can see it with objdump -t in a\n> > linked binary). If you want to update the symbol to a new version, you do what\n> > I documented in the header file (though now that I re-read it, it could be more\n> > clear. Hows this for a change to the documentation:\n> > \n> > To make a new version of a function foo in a DSO:\n> > \n> > 1) Edit lib/<library>/library_version.map to add a DPDK_1.8 node, in which\n> > foo is exported as a global symbol\n> > \n> > 2) rename the existing function int foo(char *string) to \n> > int __vsym foo_v18(char *string)\n> > \n> > 3) Add this macro immediately below the function\n> > VERSION_SYMBOL(foo, _v18, 1.8);\n> > \n> > 4) Implement the new version of the function foo.\n> > \n> > \n> > Those steps above will create two symbols in your export table of the DSO:\n> > \n> > foo@@DPDK_1.8\n> > foo@@DPDK_1.9\n> > \n> > Any application linked against this DSO will link against the latest version\n> > (DPDK_1.9). But if you look at the symbols referenced in a binary linked\n> > against an older version of the same DSO, you'll note they explicitly look for\n> > foo@@DPDK_1.8. Thats how we provide backwards compatibility\n> > \n> > Does that answer your questions?\n> > \n> > Neil\n> > \n> Correct me if I am wrong but when we define multiple versions of a symbol we\n> need to specify a default one.\nYou are corrected :). The \"Default\" symbol is implicitly the latest version of\nthe symbol (where the ordinality of the symbol versions is defined by the map\nfile).\n\n> As an example, if we were to have three versions of foo the export table of the\n> DSO should look something like this:\n> \n> foo@VER_1.0\n> foo@VER_1.1\n> foo@@VER_1.2\n> \n> In the above example, foo VER_1.2 is the default one and is such based on the\nfact that it is ordinally the most recent in the version map file.\n\nIts the default symbol because its the latest one according to the map file (and\ndenoted by the double @'s). When linking that is the only symbol visibile to\nthe application being linked.\n\n> Effectively we would need two macros VERSION_SYMBOL and DEFAULT_VERSION_SYMBOL\n> (maybe this name is more appropriate).\n> \nNope, we don't, because as you note above, the default is implicit by the fact\nthat it is ordinally the latest, and the latest version of the symbol is the\nonly version that the linker \"sees\" when linking new applications. The\nVERSION_SYMBOL macro exists to tie older binary applications to the older\nversions of the symbol at _load_ time.\n\n> #define VERSION_SYMBOL(b, e, v) \\\n> __asm__(\".symver \" SA(b) SA(e) \", \"SA(b)\"@DPDK_\"SA(v))\n> #define DEFAULT_VERSION_SYMBOL(b, e, v) \\\n> __asm__(\".symver \" SA(b) SA(e) \", \"SA(b)\"@@DPDK_\"SA(v))\n> \nNope. Don't need it.\n\n> Following on the example, we should have something like:\n> \n> int __vsym foo_v18(char *string) {...}\n> VERSION_SYMBOL(foo, _v18, 1.8);\n> \n> int __vsym foo_v19(int index) {...}\n> DEFAULT_VERSION_SYMBOL(foo, _v19, 1.9);\n> \n\nNope. Lets start a bit further back. Assume we have the following map file:\n\nDPDK_1.8 {\n\tglobal:\n\tfoo;\n};\n\nAnd we have this in a C file:\n\nvoid foo(int num) {\n\t<implementation for version 1.8>\t\n}\n\nThen we want to update the foo function to something that is binary\nincompatible. We would change the version map file as follows:\n\nDPDK_1.8 {\n\tglobal:\n\tfoo;\n}\n\nDPDK_1.9 {\n\tglobal:\n\tfoo;\n} DPDK_1.8;\n\nThat construct makes the linker see DPDK_1.9 ad ordinally \"newer\" than DPDK_1.8,\nso symobls that are global in that version are exported rather than their older\ncounterparts in the DPDK_1.8 export set. When the linker links a new\napplication it only links to the latest version\n\nThen in the C file we do the following:\n\nvoid foo_v18(int num) {\n\t<implementation for version 1.8>\n}\nVERSION_SYMBOL(foo, _v18, 1.8);\n\nint foo(char *name) {\n\t<implementation for version 1.9>\n}\n\nWith this change, the new foo function is implicitly matched to version 1.9 in\nthe map file, and thats what gets linked to new application. The\nVERSION_SYMBOL macro exports an additional symbol, foo@@DPDK_1.9, so that\npreviously built applications, that were linked when the origional version of\nfoo was the latest, will still find the appropriate symbol as foo@@DPDK_1.8 \n\nWe could in fact something like what you are suggesting, in that we could use\nthe VERSION_SYMBOL macro on every exported function so that we explicitly tied\nevery version of every exported symbol to a statically defined version of the\nfunction with a variant name (i.e. we could have a foo_v18, a foo_v19, foo_vX,\nfor every supported API version if you wanted), but that creates alot more work\nfor us. for instance, when doing a non DSO build, you still have to map each\nsymbol to a specfic version, and you have to keep that updated. By doing it the\nway I did above, the actual function name is always the latest version, and you\nonly have to rename functions if you need to modify the api (I'm working under\nthe assumption that needing to do this is going to be somewhat rare).\n\nHope that helps\nNeil\n\n> The DSO export table would have the following symbols:\n> \n> foo@DPDK_1.8\n> foo@@DPDK_1.9\n> \n> Old binaries linked against DPDK 1.8 would have references to:\n> foo@@DPDK_1.8\n> \n> and new binaries linked against DPDK 1.9 would have to:\n> foo@@DPDK_1.9\n> \n> Sergio\n> \n> > > > +#else\n> > > > +/*\n> > > > + * No symbol versioning in use\n> > > > + */\n> > > > +#define VERSION_SYMBOL(b, e, v)\n> > > > +#define __vsym\n> > > > +\n> > > > +/*\n> > > > + * RTE_SYMBOL_VERSIONING\n> > > > + */\n> > > > +#endif\n> > > > +\n> > > > +\n> > > > +#endif /* _RTE_COMPAT_H_ */\n> > > > diff --git a/mk/rte.lib.mk b/mk/rte.lib.mk\n> > > > index f458258..82ac309 100644\n> > > > --- a/mk/rte.lib.mk\n> > > > +++ b/mk/rte.lib.mk\n> > > > @@ -40,8 +40,12 @@ VPATH += $(SRCDIR)\n> > > > \n> > > > ifeq ($(RTE_BUILD_SHARED_LIB),y)\n> > > > LIB := $(patsubst %.a,%.so,$(LIB))\n> > > > +\n> > > > +CPU_LDFLAGS += --version-script=$(EXPORT_MAP)\n> > > > +\n> > > > endif\n> > > > \n> > > > +\n> > > > _BUILD = $(LIB)\n> > > > _INSTALL = $(INSTALL-FILES-y) $(SYMLINK-FILES-y) $(RTE_OUTPUT)/lib/$(LIB)\n> > > > _CLEAN = doclean\n> > > > @@ -160,7 +164,9 @@ endif\n> > > > $(RTE_OUTPUT)/lib/$(LIB): $(LIB)\n> > > > \t@echo \" INSTALL-LIB $(LIB)\"\n> > > > \t@[ -d $(RTE_OUTPUT)/lib ] || mkdir -p $(RTE_OUTPUT)/lib\n> > > > +ifneq ($(LIB),)\n> > > > \t$(Q)cp -f $(LIB) $(RTE_OUTPUT)/lib\n> > > > +endif\n> > > > \n> > > > #\n> > > > # Clean all generated files\n> > > > -- \n> > > > 1.9.3\n> > > > \n> > > \n> > > Sergio\n> > > \n>", "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 3144EB349;\n\tTue, 23 Sep 2014 19:25:16 +0200 (CEST)", "from smtp.tuxdriver.com (charlotte.tuxdriver.com [70.61.120.58])\n\tby dpdk.org (Postfix) with ESMTP id 8CCEC68AF\n\tfor <dev@dpdk.org>; Tue, 23 Sep 2014 19:25:15 +0200 (CEST)", "from [2001:470:8:a08:18c5:c64e:4bf:67a] (helo=localhost)\n\tby smtp.tuxdriver.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.63)\n\t(envelope-from <nhorman@tuxdriver.com>)\n\tid 1XWTvn-0000FK-GZ; Tue, 23 Sep 2014 13:31:22 -0400" ], "Date": "Tue, 23 Sep 2014 13:31:14 -0400", "From": "Neil Horman <nhorman@tuxdriver.com>", "To": "Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>", "Message-ID": "<20140923173114.GD12884@hmsreliant.think-freely.org>", "References": "<1410809031-19114-1-git-send-email-nhorman@tuxdriver.com>\n\t<1410809031-19114-2-git-send-email-nhorman@tuxdriver.com>\n\t<20140923103923.GA4642@sivswdev02.ir.intel.com>\n\t<20140923145829.GB12884@hmsreliant.think-freely.org>\n\t<20140923162947.GA22463@sivswdev02.ir.intel.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=us-ascii", "Content-Disposition": "inline", "In-Reply-To": "<20140923162947.GA22463@sivswdev02.ir.intel.com>", "User-Agent": "Mutt/1.5.23 (2014-03-12)", "X-Spam-Score": "-2.9 (--)", "X-Spam-Status": "No", "Cc": "dev@dpdk.org", "Subject": "Re: [dpdk-dev] [PATCH 1/4] compat: Add infrastructure to support\n\tsymbol versioning", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "patches and discussions about DPDK <dev.dpdk.org>", "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://dpdk.org/ml/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "addressed": null } ]