From: Sergio Gonzalez Monroy Date: Tue, 28 Oct 2014 15:48:49 +0000 (+0000) Subject: mk: fix link of combined shared library using CC X-Git-Tag: spdx-start~9945 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=815cfb7925bb6de;p=dpdk.git mk: fix link of combined shared library 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 Acked-by: Pablo de Lara [Thomas: remove change to rte.lib.mk] Acked-by: Thomas Monjalon --- diff --git a/mk/rte.sharelib.mk b/mk/rte.sharelib.mk index df6c268dc9..d0ec12a327 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) $(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)"