[dpdk-dev] [PATCH] mk: add EXTRA_CFLAGS to link step for shared library
Thomas Monjalon
thomas at monjalon.net
Mon Nov 25 23:56:00 CET 2019
05/11/2019 02:56, Stephen Hemminger:
> When doing a cross compiling it is common to use EXTRA_CFLAGS with
> --sysroot option to point to alternate root filesystem. This already
> works as expected for objects and executables, it just doesn't work
> correctly for shared libraries.
>
> When a shared library is linked using CC this flag needs to
> be passed in order for libraries to be found.
>
> Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
> ---
> --- a/mk/rte.shared.mk
> +++ b/mk/rte.shared.mk
> -O_TO_SO = $(CC) $(call linkerprefix,$(LDFLAGS)) $(LDFLAGS_$(@)) $(EXTRA_LDFLAGS) \
> +O_TO_SO = $(CC) $(EXTRA_CFLAGS) $(call linkerprefix,$(LDFLAGS)) $(LDFLAGS_$(@)) $(EXTRA_LDFLAGS) \
> -shared -o $@ $(OBJS-y) $(call linkerprefix,$(LDLIBS))
After several thoughts, I am afraid of the possible side effects
of such a change.
I think only LDFLAGS should be used when linking.
If you need the same parameters at compilation and linking,
you should pass the same parameters to CFLAGS and LDFLAGS.
More information about the dev
mailing list