[dpdk-stable] [PATCH 18.11 4/4] app/testpmd: disable gcc 10 -fno-common build errors

Kevin Traynor ktraynor at redhat.com
Tue Jun 16 15:51:37 CEST 2020


gcc 10 defaults to -fno-common and as a result when building
testpmd, there are errors.

These could be fixed with a rebased version of
commit f6e63e59e7e2 ("app/testpmd: fix global variable multiple definitions")
but there are conflicts with that patch.

When DPDK 18.11 was released -fcommon was the default on gcc, so disable
the warnings for testpmd.

Signed-off-by: Kevin Traynor <ktraynor at redhat.com>
---
 app/test-pmd/Makefile    | 6 ++++++
 app/test-pmd/meson.build | 5 +++++
 2 files changed, 11 insertions(+)

diff --git a/app/test-pmd/Makefile b/app/test-pmd/Makefile
index d5258eae4a..f36137fd44 100644
--- a/app/test-pmd/Makefile
+++ b/app/test-pmd/Makefile
@@ -16,4 +16,10 @@ CFLAGS += $(WERROR_FLAGS)
 CFLAGS += -Wno-deprecated-declarations
 
+ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
+ifeq ($(shell test $(GCC_VERSION) -ge 100 && echo 1), 1)
+CFLAGS += -fcommon
+endif
+endif
+
 #
 # all source are stored in SRCS-y
diff --git a/app/test-pmd/meson.build b/app/test-pmd/meson.build
index 6006c60f99..adeeeeedba 100644
--- a/app/test-pmd/meson.build
+++ b/app/test-pmd/meson.build
@@ -6,4 +6,9 @@ name = 'testpmd'
 allow_experimental_apis = true
 cflags += '-Wno-deprecated-declarations'
+
+if (toolchain == 'gcc' and cc.version().version_compare('>=10.0.0'))
+       cflags += '-fcommon'
+endif
+
 sources = files('cmdline.c',
 	'cmdline_flow.c',
-- 
2.21.3



More information about the stable mailing list