Skip to contentSkip to conversation

ndctl/lib: fix symbol redefinitions reported by GCC10

PATCH Superseded Vishal Verma 2 participants 2 messages Jan 31, 2020 libnvdimm: non-volatile memory device

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Vishal Verma

author maintainer
#0 lore raw

PATCH v2 1/1 ndctl/lib: fix symbol redefinitions reported by GCC10

A toolchain update in Fedora 32 caused new compile errors due to multiple definitions of dimm_ops structures. The declarations in 'private.h' for the various NFIT families are present so that libndctl can find all the per-family dimm-ops. However they need to be declared as extern because the actual definitions are in <family>.c. Additionally, 'param' instances in list.c and monitor.c need to be marked as static.

---

Tested with a F32 mockbuild

 ndctl/Makefile.am   | 4 +++-
 ndctl/lib/private.h | 8 ++++----
 ndctl/list.c        | 2 +-
 ndctl/monitor.c     | 2 +-
 4 files changed, 9 insertions(+), 7 deletions(-)
ndctl/Makefile.am +3 -1
index 264c4ed..49c6c4a 100644
@@ -18,7 +18,9 @@ ndctl_SOURCES = ndctl.c \
 		check.c \
 		region.c \
 		dimm.c \
-		 ../util/log.c \
+		../util/log.c \
+		../util/filter.c \
+		../util/filter.h \
 		list.c \
 		../util/json.c \
 		../util/json.h \
ndctl/lib/private.h +4 -4
index e445301..16bf8f9 100644
@@ -343,10 +343,10 @@ struct ndctl_dimm_ops {
 	int (*xlat_firmware_status)(struct ndctl_cmd *);
 };
 
-struct ndctl_dimm_ops * const intel_dimm_ops;
-struct ndctl_dimm_ops * const hpe1_dimm_ops;
-struct ndctl_dimm_ops * const msft_dimm_ops;
-struct ndctl_dimm_ops * const hyperv_dimm_ops;
+extern struct ndctl_dimm_ops * const intel_dimm_ops;
+extern struct ndctl_dimm_ops * const hpe1_dimm_ops;
+extern struct ndctl_dimm_ops * const msft_dimm_ops;
+extern struct ndctl_dimm_ops * const hyperv_dimm_ops;
 
 static inline struct ndctl_bus *cmd_to_bus(struct ndctl_cmd *cmd)
 {
ndctl/list.c +1 -1
index 125a9fe..12d78d8 100644
@@ -59,7 +59,7 @@ static unsigned long listopts_to_flags(void)
 	return flags;
 }
 
-struct util_filter_params param;
+static struct util_filter_params param;
 
 static int did_fail;
 
ndctl/monitor.c +1 -1
index b8ee27f..1755b87 100644
@@ -45,7 +45,7 @@ struct monitor_dimm {
 	struct list_node list;
 };
 
-struct util_filter_params param;
+static struct util_filter_params param;
 
 static int did_fail;
 
Signature · 4 lines
2.21.1
_______________________________________________
Linux-nvdimm mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Reviewed-by on v2 1/1
#1 lore raw
Quoted 11 lines · Vishal Verma

A toolchain update in Fedora 32 caused new compile errors due to multiple definitions of dimm_ops structures. The declarations in 'private.h' for the various NFIT families are present so that libndctl can find all the per-family dimm-ops. However they need to be declared as extern because the actual definitions are in <family>.c. Additionally, 'param' instances in list.c and monitor.c need to be marked as static.

_______________________________________________
Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]