Skip to contentSkip to conversation

fix multiple definition linking error due to missing extern

PATCH New Dirk Müller 1 participant 1 message Dec 29, 2021 MD RAID

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix multiple definition linking error due to missing extern

GCC 10+ defaults to -fno-common, which enforces proper declaration of external references using "extern". without this change a link would fail with:

  ld: raid6.a(algos.o):lib/raid6/test/algos.c:28: multiple definition of `raid6_call';
                       lib/raid6/test/test.c:22: first defined here
---
 lib/raid6/test/test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/raid6/test/test.c +1 -1
index a3cf071941ab..ab0459150a61 100644
@@ -19,7 +19,7 @@
 #define NDISKS		16	/* Including P and Q */
 
 const char raid6_empty_zero_page[PAGE_SIZE] __attribute__((aligned(PAGE_SIZE)));
-struct raid6_calls raid6_call;
+extern struct raid6_calls raid6_call;
 
 char *dataptrs[NDISKS];
 char data[NDISKS][PAGE_SIZE] __attribute__((aligned(PAGE_SIZE)));
Signature · 1 line
2.34.1