Skip to contentSkip to conversation

fix build with GCC 10

PATCH In review Thomas Monjalon 4 participants 9 messages May 20, 2020 – May 21, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover fix build with GCC 10

These are supposed to be the last patches to support GCC 10.

Thomas Monjalon (4):
net/mvpp2: fix build with gcc 10 examples/vm_power: fix build with -fno-common examples/vm_power: drop Unix path limit redefinition
devtools: allow warnings in ABI reference build

 devtools/test-build.sh                      | 6 ++----
 devtools/test-meson-builds.sh               | 3 +--
 drivers/net/mvpp2/mrvl_flow.c               | 4 ++--
 examples/vm_power_manager/channel_manager.c | 3 ++-
 examples/vm_power_manager/channel_manager.h | 9 ++-------
 examples/vm_power_manager/power_manager.c   | 1 -
 6 files changed, 9 insertions(+), 17 deletions(-)
Signature · 1 line
2.26.2
#1 lore raw

PATCH 1/4 net/mvpp2: fix build with gcc 10

GCC 10 is detecting the enum mismatch when assigning UDP variables with MUSDK constants for TCP.

Fixes 7235341d7517 ("net/mrvl: support classifier")
---
 drivers/net/mvpp2/mrvl_flow.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/mvpp2/mrvl_flow.c +2 -2
index 381b54e291..ea43255284 100644
@@ -2511,14 +2511,14 @@ mrvl_create_cls_table(struct rte_eth_dev *dev, struct rte_flow *first_flow)
 
 	if (first_flow->pattern & F_UDP_SPORT) {
 		key->proto_field[key->num_fields].proto = MV_NET_PROTO_UDP;
-		key->proto_field[key->num_fields].field.tcp = MV_NET_TCP_F_SP;
+		key->proto_field[key->num_fields].field.udp = MV_NET_UDP_F_SP;
 		key->key_size += 2;
 		key->num_fields += 1;
 	}
 
 	if (first_flow->pattern & F_UDP_DPORT) {
 		key->proto_field[key->num_fields].proto = MV_NET_PROTO_UDP;
-		key->proto_field[key->num_fields].field.udp = MV_NET_TCP_F_DP;
+		key->proto_field[key->num_fields].field.udp = MV_NET_UDP_F_DP;
 		key->key_size += 2;
 		key->num_fields += 1;
 	}
Signature · 1 line
2.26.2
Acked-by on v1 1/4
#2 lore raw

Re: [dpdk-dev] [EXT] [PATCH 1/4] net/mvpp2: fix build with gcc 10

Regards,
Liron

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Wednesday, 20 May 2020 16:58
To: [email protected]
Cc: [email protected]; [email protected]; Liron Himi <[email protected]>; Natalie Samsonov <[email protected]>; Tomasz Duszynski <[email protected]>
Subject: [EXT] [PATCH 1/4] net/mvpp2: fix build with gcc 10

External Email

----------------------------------------------------------------------
GCC 10 is detecting the enum mismatch when assigning UDP variables with MUSDK constants for TCP.

Fixes 7235341d7517 ("net/mrvl: support classifier")
---
 drivers/net/mvpp2/mrvl_flow.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/mvpp2/mrvl_flow.c +2 -2
@@ -2511,14 +2511,14 @@ mrvl_create_cls_table(struct rte_eth_dev *dev, struct rte_flow *first_flow)
 
 	if (first_flow->pattern & F_UDP_SPORT) {
 		key->proto_field[key->num_fields].proto = MV_NET_PROTO_UDP;
-		key->proto_field[key->num_fields].field.tcp = MV_NET_TCP_F_SP;
+		key->proto_field[key->num_fields].field.udp = MV_NET_UDP_F_SP;
 		key->key_size += 2;
 		key->num_fields += 1;
 	}
 
 	if (first_flow->pattern & F_UDP_DPORT) {
 		key->proto_field[key->num_fields].proto = MV_NET_PROTO_UDP;
-		key->proto_field[key->num_fields].field.udp = MV_NET_TCP_F_DP;
+		key->proto_field[key->num_fields].field.udp = MV_NET_UDP_F_DP;
 		key->key_size += 2;
 		key->num_fields += 1;
 	}

--
2.26.2

#3 lore raw

PATCH 2/4 examples/vm_power: fix build with -fno-common

In reply to Thomas Monjalon

The variables of the same name are merged together
if compiled with -fcommon. It used to be the default.
This default behaviour allows to declare a variable in a header file and share the variable in every .o binaries thanks to merge at link-time.

If compiling with -fno-common (default in GCC 10), the variable must be shared as extern to avoid multiple re-definitions.

Fixes dff22404aaad ("examples/vm_power_mgr: add VCPU to PCPU mapping")
---
 examples/vm_power_manager/channel_manager.c | 2 ++
 examples/vm_power_manager/channel_manager.h | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)
examples/vm_power_manager/channel_manager.c +2 -0
index 4ac21f02c1..4d13697208 100644
@@ -35,6 +35,8 @@
 
 #define RTE_LOGTYPE_CHANNEL_MANAGER RTE_LOGTYPE_USER1
 
+struct libvirt_vm_info lvm_info[MAX_CLIENTS];
+
 /* Global pointer to libvirt connection */
 static virConnectPtr global_vir_conn_ptr;
 
examples/vm_power_manager/channel_manager.h +1 -1
index 8284be0a18..a2a2f2bba0 100644
@@ -41,7 +41,7 @@ struct libvirt_vm_info {
 	uint8_t num_cpus;
 };
 
-struct libvirt_vm_info lvm_info[MAX_CLIENTS];
+extern struct libvirt_vm_info lvm_info[MAX_CLIENTS];
 /* Communication Channel Status */
 enum channel_status { CHANNEL_MGR_CHANNEL_DISCONNECTED = 0,
 	CHANNEL_MGR_CHANNEL_CONNECTED,
Signature · 1 line
2.26.2
#4 lore raw

PATCH 3/4 examples/vm_power: drop Unix path limit redefinition

In reply to Thomas Monjalon

The Unix socket path may be as long as UNIX_PATH_MAX. This constant is supposed to be defined in sys/un.h. On Linux, it appears to be in linux/un.h.

This constant was re-defined locally, based on a variable declaration. It is breaking compilation with -fno-common (default in GCC 10) We could avoid the variable declaration by using NULL struct, but it looks simpler not redefining this system constant.

As the power library and its examples are restricted to Linux only, the Linux header file is directly included.

Fixes 0d74597c1b4f ("examples/vm_power: fix max length of unix socket path")
---
 examples/vm_power_manager/channel_manager.c | 1 -
 examples/vm_power_manager/channel_manager.h | 7 +------
 examples/vm_power_manager/power_manager.c   | 1 -
 3 files changed, 1 insertion(+), 8 deletions(-)
examples/vm_power_manager/channel_manager.c +0 -1
index 4d13697208..74a2a677e8 100644
@@ -4,7 +4,6 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <sys/un.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <inttypes.h>
examples/vm_power_manager/channel_manager.h +1 -6
index a2a2f2bba0..e55376fcdb 100644
@@ -10,7 +10,7 @@ extern "C" {
 #endif
 
 #include <linux/limits.h>
-#include <sys/un.h>
+#include <linux/un.h>
 #include <rte_atomic.h>
 #include <stdbool.h>
 
@@ -26,11 +26,6 @@ extern "C" {
 /* FIFO file name template */
 #define CHANNEL_MGR_FIFO_PATTERN_NAME   "fifo"
 
-#ifndef UNIX_PATH_MAX
-struct sockaddr_un _sockaddr_un;
-#define UNIX_PATH_MAX sizeof(_sockaddr_un.sun_path)
-#endif
-
 #define MAX_CLIENTS 64
 #define MAX_VCPUS 20
 
examples/vm_power_manager/power_manager.c +0 -1
index 7b4f4b3c4d..cd51d4741f 100644
@@ -6,7 +6,6 @@
 #include <stdlib.h>
 #include <stdint.h>
 #include <inttypes.h>
-#include <sys/un.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <dirent.h>
Signature · 1 line
2.26.2
#5 lore raw

PATCH 4/4 devtools: allow warnings in ABI reference build

In reply to Thomas Monjalon

There is no point in forcing warning-free compilation when building an ABI reference. It is only preventing from compiling ABI reference of old releases with recent compilers.

Note: DPDK 20.02 is built (with warnings) by GCC 10 if using -fcommon.

---
 devtools/test-build.sh        | 6 ++----
 devtools/test-meson-builds.sh | 3 +--
 2 files changed, 3 insertions(+), 6 deletions(-)
devtools/test-build.sh +2 -4
index 6e53f86fc8..f013656024 100755
@@ -68,8 +68,6 @@ J=$DPDK_MAKE_JOBS
 builds_dir=${DPDK_BUILD_TEST_DIR:-.}
 short=false
 unset verbose
-# for ABI checks, we need debuginfo
-test_cflags="-Wfatal-errors -g"
 while getopts hj:sv ARG ; do
 	case $ARG in
 		j ) J=$OPTARG ;;
@@ -248,7 +246,7 @@ for conf in $configs ; do
 	config $dir $target $options
 
 	echo "================== Build $conf"
-	${MAKE} -j$J EXTRA_CFLAGS="$test_cflags $DPDK_DEP_CFLAGS" \
+	${MAKE} -j$J EXTRA_CFLAGS="-Wfatal-errors -g $DPDK_DEP_CFLAGS" \
 		EXTRA_LDFLAGS="$DPDK_DEP_LDFLAGS" $verbose O=$dir
 	! $short || break
 	export RTE_TARGET=$target
@@ -282,7 +280,7 @@ for conf in $configs ; do
 			echo -n "================== Build $conf "
 			echo "($DPDK_ABI_REF_VERSION)"
 			${MAKE} -j$J \
-				EXTRA_CFLAGS="$test_cflags $DPDK_DEP_CFLAGS" \
+				EXTRA_CFLAGS="-Wno-error -g $DPDK_DEP_CFLAGS" \
 				EXTRA_LDFLAGS="$DPDK_DEP_LDFLAGS" $verbose \
 				O=$abirefdir/build
 			export RTE_TARGET=$target
devtools/test-meson-builds.sh +1 -2
index e8df017596..18b874fac5 100755
@@ -74,7 +74,6 @@ config () # <dir> <builddir> <meson options>
 		return
 	fi
 	options=
-	options="$options --werror"
 	if echo $* | grep -qw -- '--default-library=shared' ; then
 		options="$options -Dexamples=all"
 	else
@@ -127,7 +126,7 @@ build () # <directory> <target compiler> <meson options>
 	# skip build if compiler not available
 	command -v ${CC##* } >/dev/null 2>&1 || return 0
 	load_env $targetcc || return 0
-	config $srcdir $builds_dir/$targetdir $*
+	config $srcdir $builds_dir/$targetdir --werror $*
 	compile $builds_dir/$targetdir
 	if [ -n "$DPDK_ABI_REF_VERSION" ]; then
 		abirefdir=${DPDK_ABI_REF_DIR:-reference}/$DPDK_ABI_REF_VERSION
Signature · 1 line
2.26.2
Acked-by on the v1 series
#6 lore raw
In reply to Thomas Monjalon
Quoted 9 lines · Thomas Monjalon

These are supposed to be the last patches to support GCC 10.

Thomas Monjalon (4):
net/mvpp2: fix build with gcc 10 examples/vm_power: fix build with -fno-common examples/vm_power: drop Unix path limit redefinition
devtools: allow warnings in ABI reference build

Quoted 7 lines
 devtools/test-build.sh                      | 6 ++----
 devtools/test-meson-builds.sh               | 3 +--
 drivers/net/mvpp2/mrvl_flow.c               | 4 ++--
 examples/vm_power_manager/channel_manager.c | 3 ++-
 examples/vm_power_manager/channel_manager.h | 9 ++-------
 examples/vm_power_manager/power_manager.c   | 1 -
 6 files changed, 9 insertions(+), 17 deletions(-)

For the series,

Signature · 1 line
David Marchand
Acked-by on the v1 series
#7 lore raw
In reply to Thomas Monjalon
Quoted 8 lines · Thomas Monjalon

These are supposed to be the last patches to support GCC 10.

Thomas Monjalon (4):
net/mvpp2: fix build with gcc 10 examples/vm_power: fix build with -fno-common examples/vm_power: drop Unix path limit redefinition
devtools: allow warnings in ABI reference build

Quoted 8 lines
 devtools/test-build.sh                      | 6 ++----
 devtools/test-meson-builds.sh               | 3 +--
 drivers/net/mvpp2/mrvl_flow.c               | 4 ++--
 examples/vm_power_manager/channel_manager.c | 3 ++-
 examples/vm_power_manager/channel_manager.h | 9 ++-------
 examples/vm_power_manager/power_manager.c   | 1 -
 6 files changed, 9 insertions(+), 17 deletions(-)

For series:

author Applied
#8 lore raw

20/05/2020 18:45, Kevin Traynor:

Quoted 17 lines · Thomas Monjalon
Quoted 8 lines

These are supposed to be the last patches to support GCC 10.

Thomas Monjalon (4):
net/mvpp2: fix build with gcc 10 examples/vm_power: fix build with -fno-common examples/vm_power: drop Unix path limit redefinition
devtools: allow warnings in ABI reference build

Quoted 8 lines
 devtools/test-build.sh                      | 6 ++----
 devtools/test-meson-builds.sh               | 3 +--
 drivers/net/mvpp2/mrvl_flow.c               | 4 ++--
 examples/vm_power_manager/channel_manager.c | 3 ++-
 examples/vm_power_manager/channel_manager.h | 9 ++-------
 examples/vm_power_manager/power_manager.c   | 1 -
 6 files changed, 9 insertions(+), 17 deletions(-)
Quoted 2 lines

For series:

Applied