mk: add EXTRA_CFLAGS to link step for shared library
diff mbox series

Message ID
State New
Delegated to: Thomas Monjalon
Headers show
  • mk: add EXTRA_CFLAGS to link step for shared library
Related show


Context Check Description
ci/travis-robot success Travis build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-compilation success Compile Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/checkpatch success coding style OK

Commit Message

Stephen Hemminger Nov. 5, 2019, 1:56 a.m. UTC
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 <>
 mk/ | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff mbox series

diff --git a/mk/ b/mk/
index 2b501ddb8480..a0620a3eb233 100644
--- a/mk/
+++ b/mk/
@@ -31,7 +31,7 @@  exe2cmd = $(strip $(call dotfile,$(patsubst %,%.cmd,$(1))))
 ifeq ($(LINK_USING_CC),1)
 override EXTRA_LDFLAGS := $(call linkerprefix,$(EXTRA_LDFLAGS))
-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))