[dpdk-dev] mk: link combined lib using CC

Message ID 1414078550-692-1-git-send-email-sergio.gonzalez.monroy@intel.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Sergio Gonzalez Monroy Oct. 23, 2014, 3:35 p.m. UTC
  Building combined shared libs fails if we set EXTRA_CFLAGS=-O0.

/usr/bin/ld: test: hidden symbol `mknod' in /usr/lib64/libc_nonshared.a(mknod.oS) is referenced by DSO
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status

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

De Lara Guarch, Pablo Oct. 28, 2014, 11:45 a.m. UTC | #1
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Sergio Gonzalez
> Monroy
> Sent: Thursday, October 23, 2014 4:36 PM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] mk: link combined lib using CC
> 
> Building combined shared libs fails if we set EXTRA_CFLAGS=-O0.
> 
> /usr/bin/ld: test: hidden symbol `mknod' in
> /usr/lib64/libc_nonshared.a(mknod.oS) is referenced by DSO
> /usr/bin/ld: final link failed: Bad value
> collect2: error: ld returned 1 exit status
> 
> 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(-)
> 
> 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) $(CPU_CFLAGS)
>  LD_MULDEFS := $(call linkerprefix,-z$(comma)muldefs)
> -CPU_LDFLAGS := $(call linkerprefix,$(CPU_LDFLAGS))
>  endif

Patch does not apply cleanly, due to context mismatch. 
Could you send a V2, based on the current branch status?

Plus, should we include compilation errors in commits? 
They are quite useful to identify the problem that 
the patch is solving, but not sure if this should be shown in the git log.

Thanks,
Pablo
  
Sergio Gonzalez Monroy Oct. 28, 2014, 2:51 p.m. UTC | #2
On Tue, Oct 28, 2014 at 11:45:28AM +0000, De Lara Guarch, Pablo wrote:
> 
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Sergio Gonzalez
> > Monroy
> > Sent: Thursday, October 23, 2014 4:36 PM
> > To: dev@dpdk.org
> > Subject: [dpdk-dev] [PATCH] mk: link combined lib using CC
> > 
> > Building combined shared libs fails if we set EXTRA_CFLAGS=-O0.
> > 
> > /usr/bin/ld: test: hidden symbol `mknod' in
> > /usr/lib64/libc_nonshared.a(mknod.oS) is referenced by DSO
> > /usr/bin/ld: final link failed: Bad value
> > collect2: error: ld returned 1 exit status
> > 
> > Fix: link combined shared lib using CC if LINK_USING_CC is enabled.
> > 
> > Signed-off-by: Sergio Gonzalez Monroy
> > <sergio.gonzalez.monroy@intel.com>
> 
> Plus, should we include compilation errors in commits? 
> They are quite useful to identify the problem that 
> the patch is solving, but not sure if this should be shown in the git log.
> 
I was wondering about it myself. I think it is useful info but maybe t is more
appropiate to have it as a comment or cover letter just on the mailing list.
I don't have a strong preference for including it, maybe someone else has an
opinion about this?

Thanks,
Sergio

> Thanks,
> Pablo
>
  
Thomas Monjalon Oct. 28, 2014, 3:33 p.m. UTC | #3
2014-10-28 14:51, Sergio Gonzalez Monroy:
> On Tue, Oct 28, 2014 at 11:45:28AM +0000, De Lara Guarch, Pablo wrote:
> > > Building combined shared libs fails if we set EXTRA_CFLAGS=-O0.
> > > 
> > > /usr/bin/ld: test: hidden symbol `mknod' in
> > > /usr/lib64/libc_nonshared.a(mknod.oS) is referenced by DSO
> > > /usr/bin/ld: final link failed: Bad value
> > > collect2: error: ld returned 1 exit status
> > > 
> > > Fix: link combined shared lib using CC if LINK_USING_CC is enabled.
> > > 
> > > Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
> > 
> > Plus, should we include compilation errors in commits? 
> > They are quite useful to identify the problem that 
> > the patch is solving, but not sure if this should be shown in the git log.
> > 
> I was wondering about it myself. I think it is useful info but maybe t is more
> appropiate to have it as a comment or cover letter just on the mailing list.
> I don't have a strong preference for including it, maybe someone else has an
> opinion about this?

We are not limited in characters in the commit log. So every useful information
(like error output) is more than welcome.
The only thing which needs to be shorter than a twitter post, is the title.
Because short and clear titles help to scroll commits.

That said, don't put things which have no interest at all. Here I'd put only this:
	ld: test: hidden symbol `mknod' in /usr/lib64/libc_nonshared.a(mknod.oS) is referenced by DSO
  
Sergio Gonzalez Monroy Oct. 28, 2014, 3:39 p.m. UTC | #4
On Tue, Oct 28, 2014 at 04:33:18PM +0100, Thomas Monjalon wrote:
> 2014-10-28 14:51, Sergio Gonzalez Monroy:
> > On Tue, Oct 28, 2014 at 11:45:28AM +0000, De Lara Guarch, Pablo wrote:
> > > > Building combined shared libs fails if we set EXTRA_CFLAGS=-O0.
> > > > 
> > > > /usr/bin/ld: test: hidden symbol `mknod' in
> > > > /usr/lib64/libc_nonshared.a(mknod.oS) is referenced by DSO
> > > > /usr/bin/ld: final link failed: Bad value
> > > > collect2: error: ld returned 1 exit status
> > > > 
> > > > Fix: link combined shared lib using CC if LINK_USING_CC is enabled.
> > > > 
> > > > Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
> > > 
> > > Plus, should we include compilation errors in commits? 
> > > They are quite useful to identify the problem that 
> > > the patch is solving, but not sure if this should be shown in the git log.
> > > 
> > I was wondering about it myself. I think it is useful info but maybe t is more
> > appropiate to have it as a comment or cover letter just on the mailing list.
> > I don't have a strong preference for including it, maybe someone else has an
> > opinion about this?
> 
> We are not limited in characters in the commit log. So every useful information
> (like error output) is more than welcome.
> The only thing which needs to be shorter than a twitter post, is the title.
> Because short and clear titles help to scroll commits.
> 
> That said, don't put things which have no interest at all. Here I'd put only this:
> 	ld: test: hidden symbol `mknod' in /usr/lib64/libc_nonshared.a(mknod.oS) is referenced by DSO
>
Thanks for the tips!

I'll send a v2 with changes.

Sergio

> -- 
> Thomas
  

Patch

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) $(CPU_CFLAGS)
 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)"