examples: fix building with GCC 10
cover examples: fix building with GCC 10
GCC 10 defaults to -fno-common, this means a linker error will now be reported if the same global variable is defined in more than one compilation unit.
See https://gcc.gnu.org/gcc-10/porting_to.html for more informations.
I didn't put -fcommon to CFLAGS since:
Compiling with -fno-common is useful on targets for which it provides better performance, or if you wish to verify that the program will work on other systems that always treat uninitialized variable definitions this way.
from gcc man page
Timothy Redaelli (3):
examples/vhost_blk: fix building with GCC 10 examples/eventdev_pipeline: fix building with GCC 10 examples/qos_sched: fix building with GCC 10
examples/eventdev_pipeline/main.c | 2 ++ examples/eventdev_pipeline/pipeline_common.h | 4 ++-- examples/qos_sched/cfg_file.c | 3 +++ examples/qos_sched/main.h | 4 ++-- examples/vhost_blk/vhost_blk.c | 2 ++ examples/vhost_blk/vhost_blk.h | 4 ++-- 6 files changed, 13 insertions(+), 6 deletions(-)
Signature · 1 line
2.24.1
PATCH 1/3 examples/vhost_blk: fix building with GCC 10
GCC 10 defaults to -fno-common, this means a linker error will now be reported if the same global variable is defined in more than one compilation unit.
--- examples/vhost_blk/vhost_blk.c | 2 ++ examples/vhost_blk/vhost_blk.h | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-)
examples/vhost_blk/vhost_blk.c +2 -0
@@ -31,6 +31,8 @@ (1ULL << VIRTIO_F_NOTIFY_ON_EMPTY) | \ (1ULL << VHOST_USER_F_PROTOCOL_FEATURES)) +struct vhost_blk_ctrlr *g_vhost_ctrlr; +/* Path to folder where character device will be created. Can be set by user. */ static char dev_pathname[PATH_MAX ] ="" ;static sem_t exit_sem;
examples/vhost_blk/vhost_blk.h +2 -2
@@ -112,8 +112,8 @@ struct inflight_blk_task {struct rte_vhost_inflight_info_packed *inflight_packed; }; -struct vhost_blk_ctrlr *g_vhost_ctrlr; -struct vhost_device_ops vhost_blk_device_ops; +extern struct vhost_blk_ctrlr *g_vhost_ctrlr; +extern struct vhost_device_ops vhost_blk_device_ops;int vhost_bdev_process_blk_commands (struct vhost_block_dev *bdev,struct vhost_blk_task *task);
Signature · 1 line
2.24.1
Re: [dpdk-dev] [PATCH 1/3] examples/vhost_blk: fix building with GCC 10
Quoted 4 lines · Timothy Redaelli
GCC 10 defaults to -fno-common, this means a linker error will now be reported if the same global variable is defined in more than one compilation unit.
Quoted 9 lines
Fixes c19beb3f38cd ("examples/vhost_blk: introduce vhost storage sample")Signed-off-by Timothy Redaelli <[email protected]>--- examples/vhost_blk/vhost_blk.c | 2 ++ examples/vhost_blk/vhost_blk.h | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-)
Thanks,
Maxime
PATCH v2 3/3 app/test-pipeline: fix building with GCC 10
In reply to Timothy RedaelliGCC 10 defaults to -fno-common, this means a linker error will now be reported if the same global variable is defined in more than one compilation unit.
---
v2:
app is already declared as extern in main.h. (as reported by David)
--- app/test-pipeline/config.c | 2 -- 1 file changed, 2 deletions(-)
app/test-pipeline/config.c +0 -2
@@ -42,8 +42,6 @@#include "main.h" -struct app_params app; -static const char usage[] ="\n" ;void
Signature · 1 line
2.24.1
Re: [dpdk-dev] [PATCH v2 3/3] app/test-pipeline: fix building with GCC 10
Quoted 41 lines
-----Original Message-----
From: Timothy Redaelli <[email protected]>
Sent: Wednesday, February 5, 2020 2:12 PM
To: [email protected]
Cc: [email protected]; [email protected]; Dumitrescu, Cristian <[email protected]>
Subject: [PATCH v2 3/3] app/test-pipeline: fix building with GCC 10GCC 10 defaults to -fno-common, this means a linker error will now be reported if the same global variable is defined in more than one compilation unit.
Fixes 48f31ca50cc4 ("app/pipeline: packet framework benchmark")Signed-off-by Timothy Redaelli <[email protected]>---
v2:
app is already declared as extern inmain.h. (as reported by David)--- app/test-pipeline/config.c | 2 -- 1 file changed, 2 deletions(-)app/test-pipeline/config.c +0
-3@@ -42,8 +42,6 @@#include "main.h" -struct app_params app; -static const char usage[] ="\n" ;void --
Quoted 1 line
2.24.1
Yes, app is declared in main.h and defined & initialized in init.c, no need to have it defined the second time in config.c.
PATCH 2/3 examples/eventdev_pipeline: fix building with GCC 10
In reply to Timothy Redaelli--- examples/eventdev_pipeline/main.c | 2 ++ examples/eventdev_pipeline/pipeline_common.h | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-)
examples/eventdev_pipeline/main.c +2 -0
@@ -10,6 +10,8 @@#include "pipeline_common.h" +struct fastpath_data *fdata; +struct config_data cdata = { .num_packets = (1L <<25 ),/* do ~32M packets */ .num_fids =512 ,
examples/eventdev_pipeline/pipeline_common.h +2 -2
@@ -93,8 +93,8 @@ struct port_link {uint8_t priority; }; -struct fastpath_data *fdata; -struct config_data cdata; +extern struct fastpath_data *fdata; +extern struct config_data cdata; static __rte_always_inline voidexchange_mac (struct rte_mbuf *m)
Signature · 1 line
2.24.1
PATCH 3/3 examples/qos_sched: fix building with GCC 10
In reply to Timothy RedaelliGCC 10 defaults to -fno-common, this means a linker error will now be reported if the same global variable is defined in more than one compilation unit.
--- examples/qos_sched/cfg_file.c | 3 +++ examples/qos_sched/main.h | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-)
examples/qos_sched/cfg_file.c +3 -0
@@ -20,6 +20,9 @@* for new entries do we add in */ #define CFG_ALLOC_ENTRY_BATCH 16 +uint32_t active_queues[RTE_SCHED_QUEUES_PER_PIPE ]; +uint32_t n_active_queues; +int cfg_load_port (struct rte_cfgfile *cfg,struct rte_sched_port_params *port_params) {
examples/qos_sched/main.h +2 -2
@@ -148,8 +148,8 @@ extern struct burst_conf burst_conf;extern struct ring_thresh rx_thresh;extern struct ring_thresh tx_thresh; -uint32_t active_queues[RTE_SCHED_QUEUES_PER_PIPE ]; -uint32_t n_active_queues; +extern uint32_t active_queues[RTE_SCHED_QUEUES_PER_PIPE ]; +extern uint32_t n_active_queues;extern struct rte_sched_port_params port_params;extern struct rte_sched_subport_params subport_params[MAX_SCHED_SUBPORTS ];
Signature · 1 line
2.24.1
Quoted 5 lines · Timothy Redaelli
GCC 10 defaults to -fno-common, this means a linker error will now be reported if the same global variable is defined in more than one compilation unit.
Quoted 8 lines
See https://gcc.gnu.org/gcc-10/porting_to.html for more informations.
I didn't put -fcommon to CFLAGS since:
Compiling with -fno-common is useful on targets for which it provides better performance, or if you wish to verify that the program will work on other systems that always treat uninitialized variable definitions this way.
from gcc man page
For the series,
Signature · 1 line
David Marchand
Quoted 16 lines · David Marchand
Quoted 5 lines · Timothy Redaelli
GCC 10 defaults to -fno-common, this means a linker error will now be reported if the same global variable is defined in more than one compilation unit.
Quoted 8 lines
See https://gcc.gnu.org/gcc-10/porting_to.html for more informations.
I didn't put -fcommon to CFLAGS since:
Compiling with -fno-common is useful on targets for which it provides better performance, or if you wish to verify that the program will work on other systems that always treat uninitialized variable definitions this way.
from gcc man page
Quoted 2 lines
For the series,
Acked-by David Marchand <[email protected]>
Series applied, thanks.
Signature · 1 line
David Marchand