[v3,7/7] build: fix linker warnings with Clang on Windows
diff mbox series

Message ID 20200218000229.86621-8-dmitry.kozliuk@gmail.com
State Superseded
Delegated to: Thomas Monjalon
Headers show
Series
  • MinGW-w64 support
Related show

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/travis-robot warning Travis build: failed
ci/checkpatch warning coding style issues

Commit Message

Dmitry Kozlyuk Feb. 18, 2020, 12:02 a.m. UTC
Clang on Windows doesn't use pthread for now, while MinGW does. Removing
`-pthread` option with MS linker fixes the following warning:

    clang: warning: argument unused during compilation: '-pthread' [-Wunused-command-line-argument]

Option `--no-as-needed` is meaningless for PE output. Disabling it on
Windows fixes the following warning:

    LINK : warning LNK4044: unrecognized option '/-no-as-needed'; ignored

Fixes: 98edcbb5a ("eal/windows: introduce Windows support")

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
---
 config/meson.build | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Patch
diff mbox series

diff --git a/config/meson.build b/config/meson.build
index 61eeec0de..69e53e41d 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -112,11 +112,15 @@  dpdk_conf.set('RTE_TOOLCHAIN_' + toolchain.to_upper(), 1)
 
 dpdk_conf.set('RTE_ARCH_64', cc.sizeof('void *') == 8)
 
-add_project_link_arguments('-Wl,--no-as-needed', language: 'c')
+if not is_windows
+	add_project_link_arguments('-Wl,--no-as-needed', language: 'c')
+endif
 
-# use pthreads
-add_project_link_arguments('-pthread', language: 'c')
-dpdk_extra_ldflags += '-pthread'
+# use pthreads if available for the platform
+if not is_ms_linker
+	add_project_link_arguments('-pthread', language: 'c')
+	dpdk_extra_ldflags += '-pthread'
+endif
 
 # on some OS, maths functions are in a separate library
 if cc.find_library('m', required : false).found()