Blob Blame History Raw
From fc62d0dcc1b7e2f5c45fecacc3dddfa3ec600585 Mon Sep 17 00:00:00 2001
From: "Kaleb S. KEITHLEY" <kkeithle@redhat.com>
Date: Thu, 2 Jan 2020 10:10:40 -0500
Subject: [PATCH] core: multiple definitions of 'common' data compiling with
 gcc-10

Winter is coming.  So is gcc-10.

gcc-10 changes the way declared data is defined. Previously it was
defined as common data, now it is BSS.  Common data was silently
merged by the linker.

See https://review.gluster.org/#/c/glusterfs/+/23956/ for a specific
example. The variables fixed in this patch are similar.

There are many changes coming in gcc-10 described in
https://gcc.gnu.org/gcc-10/changes.html

See nm(1) and ld(1) for a description C (common) and B (BSS) and how
they are treated by the linker.

Note: there is still a small chance that gcc-10 will land in Fedora-32,
despite 31 Dec. 2019 having been the deadline for that to happen.

Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Change-Id: I212a9c82c4d79012f25b9a4803776ab7a5a8af6d
---
 src/FSAL/commonlib.c              | 2 ++
 src/MainNFSD/libganesha_nfsd.ver  | 3 ++-
 src/config_parsing/conf_yacc.y    | 4 +++-
 src/dbus/dbus_server.c            | 2 ++
 src/include/FSAL/fsal_commonlib.h | 8 ++++----
 src/include/nfs_init.h            | 2 +-
 6 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/src/FSAL/commonlib.c b/src/FSAL/commonlib.c
index a780ddc55..254c8fcdc 100644
--- a/src/FSAL/commonlib.c
+++ b/src/FSAL/commonlib.c
@@ -92,6 +92,8 @@
 static struct blkid_struct_cache *cache;
 #endif
 
+pthread_rwlock_t fs_lock;
+
 /* fsal_attach_export
  * called from the FSAL's create_export method with a reference on the fsal.
  */
diff --git a/src/MainNFSD/libganesha_nfsd.ver b/src/MainNFSD/libganesha_nfsd.ver
index 7291d84b3..0e5774915 100644
--- a/src/MainNFSD/libganesha_nfsd.ver
+++ b/src/MainNFSD/libganesha_nfsd.ver
@@ -51,7 +51,9 @@
   fridgethr_init;
   fridgethr_submit;
   fridgethr_sync_command;
+  fs_lock;
   fsal_acl_2_posix_acl;
+  fsal_acl_support;
   fsal_attach_export;
   fsal_common_is_referral;
   fsal_create;
diff --git a/src/config_parsing/conf_yacc.y b/src/config_parsing/conf_yacc.y
index 1911daea9..23403f24d 100644
--- a/src/config_parsing/conf_yacc.y
+++ b/src/config_parsing/conf_yacc.y
@@ -80,7 +80,7 @@ void ganesha_yyerror(YYLTYPE *yylloc_param,
 		     void *yyscanner,
 		     char*);
 
-struct glist_head all_blocks;
+extern struct glist_head all_blocks;
 
 struct config_node *config_block(char *blockname,
 				 struct config_node *list,
@@ -379,6 +379,8 @@ void ganesha_yyerror(YYLTYPE *yylloc_param,
  *  Create a block item with the given content
  */
 
+struct glist_head all_blocks;
+
 void dump_all_blocks(void)
 {
 	struct glist_head *glh;
diff --git a/src/dbus/dbus_server.c b/src/dbus/dbus_server.c
index 4e964baf1..fc665ce71 100644
--- a/src/dbus/dbus_server.c
+++ b/src/dbus/dbus_server.c
@@ -669,6 +669,8 @@ int32_t gsh_dbus_register_path(const char *name,
 	return code;
 }
 
+pthread_t gsh_dbus_thrid;
+
 void gsh_dbus_pkgshutdown(void)
 {
 	struct avltree_node *node, *next_node;
diff --git a/src/include/FSAL/fsal_commonlib.h b/src/include/FSAL/fsal_commonlib.h
index 1529f0d98..729d54e6d 100644
--- a/src/include/FSAL/fsal_commonlib.h
+++ b/src/include/FSAL/fsal_commonlib.h
@@ -97,12 +97,12 @@ void fsal_ds_handle_fini(struct fsal_ds_handle *dsh);
 
 int open_dir_by_path_walk(int first_fd, const char *path, struct stat *stat);
 
-struct avltree avl_fsid;
-struct avltree avl_dev;
+extern struct avltree avl_fsid;
+extern struct avltree avl_dev;
 
-struct glist_head posix_file_systems;
+extern struct glist_head posix_file_systems;
 
-pthread_rwlock_t fs_lock;
+extern pthread_rwlock_t fs_lock;
 
 void free_fs(struct fsal_filesystem *fs);
 
diff --git a/src/include/nfs_init.h b/src/include/nfs_init.h
index deef2084e..e32de26ce 100644
--- a/src/include/nfs_init.h
+++ b/src/include/nfs_init.h
@@ -50,7 +50,7 @@ struct nfs_init {
 
 extern struct nfs_init nfs_init;
 
-pthread_t gsh_dbus_thrid;
+extern pthread_t gsh_dbus_thrid;
 
 void nfs_init_init(void);
 void nfs_init_complete(void);
-- 
2.24.1