Message ID | 1414511329-3948-1-git-send-email-sergio.gonzalez.monroy@intel.com (mailing list archive) |
---|---|
State | Accepted, archived |
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]) by dpdk.org (Postfix) with ESMTP id 282547E9A; Tue, 28 Oct 2014 16:42:52 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 160817E80 for <dev@dpdk.org>; Tue, 28 Oct 2014 16:42:49 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP; 28 Oct 2014 08:48:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,862,1389772800"; d="scan'208";a="407320245" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by FMSMGA003.fm.intel.com with ESMTP; 28 Oct 2014 08:40:49 -0700 Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com [10.237.217.46]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id s9SFmng1008341; Tue, 28 Oct 2014 15:48:49 GMT Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id s9SFmnKK003985; Tue, 28 Oct 2014 15:48:49 GMT Received: (from smonroy@localhost) by sivswdev02.ir.intel.com with id s9SFmnl5003981; Tue, 28 Oct 2014 15:48:49 GMT From: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com> To: dev@dpdk.org Date: Tue, 28 Oct 2014 15:48:49 +0000 Message-Id: <1414511329-3948-1-git-send-email-sergio.gonzalez.monroy@intel.com> X-Mailer: git-send-email 1.8.5.4 In-Reply-To: <1414078550-692-1-git-send-email-sergio.gonzalez.monroy@intel.com> References: <1414078550-692-1-git-send-email-sergio.gonzalez.monroy@intel.com> Subject: [dpdk-dev] [PATCH v2] mk: link combined shared lib using CC 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>, <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>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Commit Message
Sergio Gonzalez Monroy
Oct. 28, 2014, 3:48 p.m. UTC
If we set EXTRA_CFLAGS=-O0, build fails with following error:
/usr/bin/ld: test: hidden symbol `mknod' in /usr/lib64/libc_nonshared.a(mknod.oS) is referenced by DSO
Fix: link combined shared lib using CC if LINK_USING_CC is enabled.
Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
---
mk/rte.lib.mk | 1 -
mk/rte.sharelib.mk | 12 +++++++++++-
2 files changed, 11 insertions(+), 2 deletions(-)
Comments
> -----Original Message----- > From: Gonzalez Monroy, Sergio > Sent: Tuesday, October 28, 2014 3:49 PM > To: dev@dpdk.org > Cc: thomas.monjalon@6wind.com; De Lara Guarch, Pablo > Subject: [PATCH v2] mk: link combined shared lib using CC > > If we set EXTRA_CFLAGS=-O0, build fails with following error: > > /usr/bin/ld: test: hidden symbol `mknod' in > /usr/lib64/libc_nonshared.a(mknod.oS) is referenced by DSO > > Fix: link combined shared lib using CC if LINK_USING_CC is enabled. > > Signed-off-by: Sergio Gonzalez Monroy > <sergio.gonzalez.monroy@intel.com> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2014-10-28 15:48, Sergio Gonzalez Monroy: > If we set EXTRA_CFLAGS=-O0, build fails with following error: > > /usr/bin/ld: test: hidden symbol `mknod' in /usr/lib64/libc_nonshared.a(mknod.oS) is referenced by DSO > > Fix: link combined shared lib using CC if LINK_USING_CC is enabled. > > Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com> > --- > mk/rte.lib.mk | 1 - > mk/rte.sharelib.mk | 12 +++++++++++- [...] > --- a/mk/rte.lib.mk > +++ b/mk/rte.lib.mk > @@ -63,7 +63,6 @@ ifeq ($(LINK_USING_CC),1) > # Override the definition of LD here, since we're linking with CC > LD := $(CC) > LD_MULDEFS := $(call linkerprefix,-z$(comma)muldefs) > -CPU_LDFLAGS := $(call linkerprefix,$(CPU_LDFLAGS)) > endif Why are you removing this line? > --- a/mk/rte.sharelib.mk > +++ b/mk/rte.sharelib.mk [...]
2014-12-16 19:48, Thomas Monjalon: > 2014-10-28 15:48, Sergio Gonzalez Monroy: > > If we set EXTRA_CFLAGS=-O0, build fails with following error: > > > > /usr/bin/ld: test: hidden symbol `mknod' in /usr/lib64/libc_nonshared.a(mknod.oS) is referenced by DSO > > > > Fix: link combined shared lib using CC if LINK_USING_CC is enabled. > > > > Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com> > > --- > > mk/rte.lib.mk | 1 - > > mk/rte.sharelib.mk | 12 +++++++++++- > [...] > > --- a/mk/rte.lib.mk > > +++ b/mk/rte.lib.mk > > @@ -63,7 +63,6 @@ ifeq ($(LINK_USING_CC),1) > > # Override the definition of LD here, since we're linking with CC > > LD := $(CC) > > LD_MULDEFS := $(call linkerprefix,-z$(comma)muldefs) > > -CPU_LDFLAGS := $(call linkerprefix,$(CPU_LDFLAGS)) > > endif > > Why are you removing this line? If it's really needed, it could be another patch. > > --- a/mk/rte.sharelib.mk > > +++ b/mk/rte.sharelib.mk > [...] Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com> Applied without the change to rte.lib.mk. Thanks
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com] > Sent: Tuesday, December 16, 2014 11:43 PM > > 2014-12-16 19:48, Thomas Monjalon: > > 2014-10-28 15:48, Sergio Gonzalez Monroy: > > > If we set EXTRA_CFLAGS=-O0, build fails with following error: > > > > > > /usr/bin/ld: test: hidden symbol `mknod' in > > > /usr/lib64/libc_nonshared.a(mknod.oS) is referenced by DSO > > > > > > Fix: link combined shared lib using CC if LINK_USING_CC is enabled. > > > > > > Signed-off-by: Sergio Gonzalez Monroy > > > <sergio.gonzalez.monroy@intel.com> > > > --- > > > mk/rte.lib.mk | 1 - > > > mk/rte.sharelib.mk | 12 +++++++++++- > > [...] > > > --- a/mk/rte.lib.mk > > > +++ b/mk/rte.lib.mk > > > @@ -63,7 +63,6 @@ ifeq ($(LINK_USING_CC),1) # Override the > > > definition of LD here, since we're linking with CC LD := $(CC) > > > LD_MULDEFS := $(call linkerprefix,-z$(comma)muldefs) -CPU_LDFLAGS := > > > $(call linkerprefix,$(CPU_LDFLAGS)) endif > > > > Why are you removing this line? > Hi Thomas, Basically the problem is when CPU_LDFLAGS has a value, which in the currently only happens if we set CPU_LDFLAGS in the command line or build i686 (setting CPU_LDFLAGS=-melf_i386). In those cases, given the way the makefiles are being included, CPU_LDFLAGS is being 'linkerprefixed' twice, resulting in build error. Removing that line avoided the second linker prefix of the CPU_LDFLAGS (note that we reset the original var instead of using a different var name). There probably is a better way but I could not see an straightforward fix for it. I planned to improve the current build system (already sent an RFC) and was waiting until 1.8 release to resume the work on it. Thanks, Sergio > If it's really needed, it could be another patch. > > > > --- a/mk/rte.sharelib.mk > > > +++ b/mk/rte.sharelib.mk > > [...] > > Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com> > > Applied without the change to rte.lib.mk. > > Thanks > -- > Thomas
2014-12-17 10:41, Gonzalez Monroy, Sergio: > > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com] > > 2014-12-16 19:48, Thomas Monjalon: > > > 2014-10-28 15:48, Sergio Gonzalez Monroy: > > > > Fix: link combined shared lib using CC if LINK_USING_CC is enabled. > > > > > > > > Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com> > > > > --- > > > > mk/rte.lib.mk | 1 - > > > > mk/rte.sharelib.mk | 12 +++++++++++- > > > [...] > > > > --- a/mk/rte.lib.mk > > > > +++ b/mk/rte.lib.mk > > > > @@ -63,7 +63,6 @@ ifeq ($(LINK_USING_CC),1) > > > > # Override the definition of LD here, since we're linking with CC > > > > LD := $(CC) > > > > LD_MULDEFS := $(call linkerprefix,-z$(comma)muldefs) > > > > -CPU_LDFLAGS := $(call linkerprefix,$(CPU_LDFLAGS)) > > > > endif > > > > > > Why are you removing this line? > > > Hi Thomas, > > Basically the problem is when CPU_LDFLAGS has a value, which in the > currently only happens if we set CPU_LDFLAGS in the command line or > build i686 (setting CPU_LDFLAGS=-melf_i386). > In those cases, given the way the makefiles are being included, These 2 files don't include each other. rte.sharelib.mk is included only in lib/Makefile and rte.lib.mk is included in each lib Makefile. I think the problem is not about how the files are included but how this variable is exported. CPU_LDFLAGS is modified in lib/Makefile via rte.sharelib.mk, then exported (see mk/arch/*/rte.vars.mk) then modified again in libs via rte.lib.mk. > CPU_LDFLAGS is being 'linkerprefixed' twice, resulting in build error. > Removing that line avoided the second linker prefix of the CPU_LDFLAGS > (note that we reset the original var instead of using a different var name). > > There probably is a better way but I could not see an straightforward fix for it. I suggest 2 possible fixes: - do not export this variable (why is it exported?) - or do not override the variable, i.e. use a different variable for prefixing > I planned to improve the current build system (already sent an RFC) > and was waiting until 1.8 release to resume the work on it. I agree we should work on improvements after 1.8. > > If it's really needed, it could be another patch. [...] > > > > Applied without the change to rte.lib.mk. It definitely deserves another patch with a proper fix.
2014-12-17 15:01, Thomas Monjalon: > 2014-12-17 10:41, Gonzalez Monroy, Sergio: > > > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com] > > > 2014-12-16 19:48, Thomas Monjalon: > > > > 2014-10-28 15:48, Sergio Gonzalez Monroy: > > > > > Fix: link combined shared lib using CC if LINK_USING_CC is enabled. > > > > > > > > > > Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com> > > > > > --- > > > > > mk/rte.lib.mk | 1 - > > > > > mk/rte.sharelib.mk | 12 +++++++++++- > > > > [...] > > > > > --- a/mk/rte.lib.mk > > > > > +++ b/mk/rte.lib.mk > > > > > @@ -63,7 +63,6 @@ ifeq ($(LINK_USING_CC),1) > > > > > # Override the definition of LD here, since we're linking with CC > > > > > LD := $(CC) > > > > > LD_MULDEFS := $(call linkerprefix,-z$(comma)muldefs) > > > > > -CPU_LDFLAGS := $(call linkerprefix,$(CPU_LDFLAGS)) > > > > > endif > > > > > > > > Why are you removing this line? > > > > > Hi Thomas, > > > > Basically the problem is when CPU_LDFLAGS has a value, which in the > > currently only happens if we set CPU_LDFLAGS in the command line or > > build i686 (setting CPU_LDFLAGS=-melf_i386). > > In those cases, given the way the makefiles are being included, > > These 2 files don't include each other. > rte.sharelib.mk is included only in lib/Makefile > and rte.lib.mk is included in each lib Makefile. > > I think the problem is not about how the files are included > but how this variable is exported. > CPU_LDFLAGS is modified in lib/Makefile via rte.sharelib.mk, > then exported (see mk/arch/*/rte.vars.mk) then modified > again in libs via rte.lib.mk. > > > CPU_LDFLAGS is being 'linkerprefixed' twice, resulting in build error. > > Removing that line avoided the second linker prefix of the CPU_LDFLAGS > > (note that we reset the original var instead of using a different var name). > > > > There probably is a better way but I could not see an straightforward fix for it. > > I suggest 2 possible fixes: > - do not export this variable (why is it exported?) > - or do not override the variable, i.e. use a different variable for prefixing I'm preparing a patch with the second approach. It raised other problems like error when linking examples with combined library. Patchset to come. > > I planned to improve the current build system (already sent an RFC) > > and was waiting until 1.8 release to resume the work on it. > > I agree we should work on improvements after 1.8. > > > > If it's really needed, it could be another patch. > [...] > > > > > > Applied without the change to rte.lib.mk. > > It definitely deserves another patch with a proper fix.
When trying to fix the use of combined library, some bugs have been raised. This patchset fix and clean some link options. Thomas Monjalon (3): mk: fix link examples to combined library mk: forbid multiple definitions mk: fix link with CC mk/rte.app.mk | 5 ++--- mk/rte.lib.mk | 9 +++++---- mk/rte.shared.mk | 6 ++---- mk/rte.sharelib.mk | 9 +++++---- mk/rte.vars.mk | 9 +++++---- 5 files changed, 19 insertions(+), 19 deletions(-)
2014-12-17 22:59, Thomas Monjalon: > When trying to fix the use of combined library, some bugs have been > raised. This patchset fix and clean some link options. > > Thomas Monjalon (3): > mk: fix link examples to combined library > mk: forbid multiple definitions > mk: fix link with CC Applied quickly to validate building before the release.
diff --git a/mk/rte.lib.mk b/mk/rte.lib.mk index d83e808..a6abd6d 100644 --- a/mk/rte.lib.mk +++ b/mk/rte.lib.mk @@ -63,7 +63,6 @@ ifeq ($(LINK_USING_CC),1) # Override the definition of LD here, since we're linking with CC LD := $(CC) LD_MULDEFS := $(call linkerprefix,-z$(comma)muldefs) -CPU_LDFLAGS := $(call linkerprefix,$(CPU_LDFLAGS)) endif O_TO_A = $(AR) crus $(LIB) $(OBJS-y) diff --git a/mk/rte.sharelib.mk b/mk/rte.sharelib.mk index c0a811a..1fac0ad 100644 --- a/mk/rte.sharelib.mk +++ b/mk/rte.sharelib.mk @@ -29,6 +29,8 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +include $(RTE_SDK)/mk/internal/rte.build-pre.mk + # VPATH contains at least SRCDIR VPATH += $(SRCDIR) @@ -45,7 +47,15 @@ sharelib: $(LIB_ONE) FORCE OBJS = $(wildcard $(RTE_OUTPUT)/build/lib/*.o) -O_TO_S = $(LD) $(CPU_LDFLAGS) -shared $(OBJS) -o $(RTE_OUTPUT)/lib/$(LIB_ONE) +ifeq ($(LINK_USING_CC),1) +# Override the definition of LD here, since we're linking with CC +LD := $(CC) $(CPU_CFLAGS) +LD_MULDEFS := $(call linkerprefix,-z$(comma)muldefs) +CPU_LDFLAGS := $(call linkerprefix,$(CPU_LDFLAGS)) +endif + +O_TO_S = $(LD) $(CPU_LDFLAGS) $(LD_MULDEFS) -shared $(OBJS)\ + -o $(RTE_OUTPUT)/lib/$(LIB_ONE) O_TO_S_STR = $(subst ','\'',$(O_TO_S)) #'# fix syntax highlight O_TO_S_DISP = $(if $(V),"$(O_TO_S_STR)"," LD $(@)") O_TO_S_CMD = "cmd_$@ = $(O_TO_S_STR)"