It appeared in commit
21cdc2e77a4ca999 ("fix 32-bit link with gcc")
that linker options must be prefixed by -Wl, when using CC.
So CPU_LDFLAGS is prefixed in rte.lib.mk.
Then commit
815cfb7925bb6de ("fix link of combined shared library using CC")
introduced another prefixing of CPU_LDFLAGS in rte.sharelib.mk,
included in lib/Makefile.
Because CPU_LDFLAGS is an exported variable, the prefixing is done twice.
Initial patch of commit
815cfb7925bb6de had a workaround but it hasn't
been applied in favor of this proper fix.
Now variables are not overriden when prefixing.
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
endif
ifeq ($(LINK_USING_CC),1)
-LDLIBS := $(call linkerprefix,$(LDLIBS))
-LDFLAGS := $(call linkerprefix,$(LDFLAGS))
override EXTRA_LDFLAGS := $(call linkerprefix,$(EXTRA_LDFLAGS))
O_TO_EXE = $(CC) $(CFLAGS) $(LDFLAGS_$(@)) \
- -Wl,-Map=$(@).map,--cref -o $@ $(OBJS-y) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDLIBS)
+ -Wl,-Map=$(@).map,--cref -o $@ $(OBJS-y) $(call linkerprefix,$(LDFLAGS)) \
+ $(EXTRA_LDFLAGS) $(call linkerprefix,$(LDLIBS))
else
O_TO_EXE = $(LD) $(LDFLAGS) $(LDFLAGS_$(@)) $(EXTRA_LDFLAGS) \
-Map=$(@).map --cref -o $@ $(OBJS-y) $(LDLIBS)
ifeq ($(LINK_USING_CC),1)
# Override the definition of LD here, since we're linking with CC
LD := $(CC) $(CPU_CFLAGS)
-CPU_LDFLAGS := $(call linkerprefix,$(CPU_LDFLAGS))
+_CPU_LDFLAGS := $(call linkerprefix,$(CPU_LDFLAGS))
+else
+_CPU_LDFLAGS := $(CPU_LDFLAGS)
endif
O_TO_A = $(AR) crus $(LIB) $(OBJS-y)
$(O_TO_A) && \
echo $(O_TO_A_CMD) > $(call exe2cmd,$(@))
-O_TO_S = $(LD) $(CPU_LDFLAGS) -shared $(OBJS-y) -o $(LIB)
+O_TO_S = $(LD) $(_CPU_LDFLAGS) -shared $(OBJS-y) -o $(LIB)
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_DO = @set -e; \
exe2cmd = $(strip $(call dotfile,$(patsubst %,%.cmd,$(1))))
ifeq ($(LINK_USING_CC),1)
-LDLIBS := $(call linkerprefix,$(LDLIBS))
-LDFLAGS := $(call linkerprefix,$(LDFLAGS))
override EXTRA_LDFLAGS := $(call linkerprefix,$(EXTRA_LDFLAGS))
-O_TO_SO = $(CC) $(LDFLAGS) $(LDFLAGS_$(@)) $(EXTRA_LDFLAGS) \
- -shared -o $@ $(OBJS-y) $(LDLIBS)
+O_TO_SO = $(CC) $(call linkerprefix,$(LDFLAGS)) $(LDFLAGS_$(@)) $(EXTRA_LDFLAGS) \
+ -shared -o $@ $(OBJS-y) $(call linkerprefix,$(LDLIBS))
else
O_TO_SO = $(LD) $(LDFLAGS) $(LDFLAGS_$(@)) $(EXTRA_LDFLAGS) \
-shared -o $@ $(OBJS-y) $(LDLIBS)
ifeq ($(LINK_USING_CC),1)
# Override the definition of LD here, since we're linking with CC
LD := $(CC) $(CPU_CFLAGS)
-CPU_LDFLAGS := $(call linkerprefix,$(CPU_LDFLAGS))
+O_TO_S = $(LD) $(call linkerprefix,$(CPU_LDFLAGS)) \
+ -shared $(OBJS) -o $(RTE_OUTPUT)/lib/$(LIB_ONE)
+else
+O_TO_S = $(LD) $(CPU_LDFLAGS) \
+ -shared $(OBJS) -o $(RTE_OUTPUT)/lib/$(LIB_ONE)
endif
-O_TO_S = $(LD) $(CPU_LDFLAGS) -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)"