* [dpdk-dev] [PATCH 1/2] mk: clean up application linker flags
@ 2016-07-13 7:42 Thomas Monjalon
2016-07-13 7:42 ` [dpdk-dev] [PATCH 2/2] mk: fix dependency on toolchain libraries Thomas Monjalon
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Monjalon @ 2016-07-13 7:42 UTC (permalink / raw)
To: dev
Make some cleaning before fixing the link dependency ordering
in the next commit.
- Move flags for creating a map file in the variable MAPFLAGS.
- Make only one call to linkerprefix macro.
- Group linker flags on the same line.
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
mk/rte.app.mk | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index ea22961..f9acb74 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -176,6 +176,8 @@ ifeq ($(RTE_DEVEL_BUILD)$(CONFIG_RTE_BUILD_SHARED_LIB),yy)
LDFLAGS += -rpath=$(RTE_SDK_BIN)/lib
endif
+MAPFLAGS = -Map=$@.map --cref
+
.PHONY: all
all: install
@@ -190,13 +192,13 @@ build: _postbuild
exe2cmd = $(strip $(call dotfile,$(patsubst %,%.cmd,$(1))))
ifeq ($(LINK_USING_CC),1)
-override EXTRA_LDFLAGS := $(call linkerprefix,$(EXTRA_LDFLAGS))
-O_TO_EXE = $(CC) $(CFLAGS) $(LDFLAGS_$(@)) \
- -Wl,-Map=$(@).map,--cref -o $@ $(OBJS-y) $(call linkerprefix,$(LDFLAGS)) \
- $(EXTRA_LDFLAGS) $(call linkerprefix,$(LDLIBS))
+O_TO_EXE = $(CC) -o $@ $(CFLAGS) $(OBJS-y) $(call linkerprefix, \
+ $(LDFLAGS) $(LDFLAGS_$(@)) $(EXTRA_LDFLAGS) $(LDLIBS) \
+ $(MAPFLAGS))
else
-O_TO_EXE = $(LD) $(LDFLAGS) $(LDFLAGS_$(@)) $(EXTRA_LDFLAGS) \
- -Map=$(@).map --cref -o $@ $(OBJS-y) $(LDLIBS)
+O_TO_EXE = $(LD) -o $@ $(OBJS-y) \
+ $(LDFLAGS) $(LDFLAGS_$(@)) $(EXTRA_LDFLAGS) $(LDLIBS) \
+ $(MAPFLAGS)
endif
O_TO_EXE_STR = $(subst ','\'',$(O_TO_EXE)) #'# fix syntax highlight
O_TO_EXE_DISP = $(if $(V),"$(O_TO_EXE_STR)"," LD $(@)")
--
2.7.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [dpdk-dev] [PATCH 2/2] mk: fix dependency on toolchain libraries
2016-07-13 7:42 [dpdk-dev] [PATCH 1/2] mk: clean up application linker flags Thomas Monjalon
@ 2016-07-13 7:42 ` Thomas Monjalon
2016-07-15 15:22 ` Thomas Monjalon
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Monjalon @ 2016-07-13 7:42 UTC (permalink / raw)
To: dev
The -l options specifying libraries to link with are in LDLIBS.
But it can happen to have some libraries in other variables.
In case of a low level dependency specified in some environments
via EXTRA_LDFLAGS, there can be an unresolved issue due to a
wrong linking order. Indeed the libraries must be specified from
the higher level (dependency consumers) to the lower level (dependencies).
It is fixed by moving LDLIBS before LDFLAGS variables in the link
command line.
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Tested-by: Raslan Darawsheh <rasland@mellanox.com>
---
mk/rte.app.mk | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index f9acb74..886dbdd 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -193,11 +193,11 @@ exe2cmd = $(strip $(call dotfile,$(patsubst %,%.cmd,$(1))))
ifeq ($(LINK_USING_CC),1)
O_TO_EXE = $(CC) -o $@ $(CFLAGS) $(OBJS-y) $(call linkerprefix, \
- $(LDFLAGS) $(LDFLAGS_$(@)) $(EXTRA_LDFLAGS) $(LDLIBS) \
+ $(LDLIBS) $(LDFLAGS) $(LDFLAGS_$(@)) $(EXTRA_LDFLAGS) \
$(MAPFLAGS))
else
O_TO_EXE = $(LD) -o $@ $(OBJS-y) \
- $(LDFLAGS) $(LDFLAGS_$(@)) $(EXTRA_LDFLAGS) $(LDLIBS) \
+ $(LDLIBS) $(LDFLAGS) $(LDFLAGS_$(@)) $(EXTRA_LDFLAGS) \
$(MAPFLAGS)
endif
O_TO_EXE_STR = $(subst ','\'',$(O_TO_EXE)) #'# fix syntax highlight
--
2.7.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH 2/2] mk: fix dependency on toolchain libraries
2016-07-13 7:42 ` [dpdk-dev] [PATCH 2/2] mk: fix dependency on toolchain libraries Thomas Monjalon
@ 2016-07-15 15:22 ` Thomas Monjalon
0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2016-07-15 15:22 UTC (permalink / raw)
To: dev
2016-07-13 09:42, Thomas Monjalon:
> The -l options specifying libraries to link with are in LDLIBS.
> But it can happen to have some libraries in other variables.
> In case of a low level dependency specified in some environments
> via EXTRA_LDFLAGS, there can be an unresolved issue due to a
> wrong linking order. Indeed the libraries must be specified from
> the higher level (dependency consumers) to the lower level (dependencies).
>
> It is fixed by moving LDLIBS before LDFLAGS variables in the link
> command line.
>
> Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
> Tested-by: Raslan Darawsheh <rasland@mellanox.com>
Series applied
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-07-15 15:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-13 7:42 [dpdk-dev] [PATCH 1/2] mk: clean up application linker flags Thomas Monjalon
2016-07-13 7:42 ` [dpdk-dev] [PATCH 2/2] mk: fix dependency on toolchain libraries Thomas Monjalon
2016-07-15 15:22 ` Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).