[1/3] examples/vhost_blk: fix building with GCC 10

Message ID e5806189663a5bec0c326bae9ab0ed7b8f2865df.1580910264.git.tredaelli@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series examples: fix building with GCC 10 |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-nxp-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS

Commit Message

Timothy Redaelli Feb. 5, 2020, 1:47 p.m. UTC
  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.

Fixes: c19beb3f38cd ("examples/vhost_blk: introduce vhost storage sample")
Cc: jin.yu@intel.com
Cc: stable@dpdk.org
Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
---
 examples/vhost_blk/vhost_blk.c | 2 ++
 examples/vhost_blk/vhost_blk.h | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)
  

Comments

Maxime Coquelin Feb. 5, 2020, 3:12 p.m. UTC | #1
On 2/5/20 2:47 PM, Timothy Redaelli wrote:
> 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.
> 
> Fixes: c19beb3f38cd ("examples/vhost_blk: introduce vhost storage sample")
> Cc: jin.yu@intel.com
> Cc: stable@dpdk.org
> Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
> ---
>  examples/vhost_blk/vhost_blk.c | 2 ++
>  examples/vhost_blk/vhost_blk.h | 4 ++--
>  2 files changed, 4 insertions(+), 2 deletions(-)
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime
  

Patch

diff --git a/examples/vhost_blk/vhost_blk.c b/examples/vhost_blk/vhost_blk.c
index e1036bf3a..143ae19f3 100644
--- a/examples/vhost_blk/vhost_blk.c
+++ b/examples/vhost_blk/vhost_blk.c
@@ -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;
diff --git a/examples/vhost_blk/vhost_blk.h b/examples/vhost_blk/vhost_blk.h
index 933e2b7c5..17258d284 100644
--- a/examples/vhost_blk/vhost_blk.h
+++ b/examples/vhost_blk/vhost_blk.h
@@ -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);