Thread (4 messages) 4 messages, 3 authors, 2022-02-08

Re: [PATCH] fix multiple definition linking error due to missing extern

From: Song Liu <song@kernel.org>
Date: 2022-02-08 05:46:03

On Sun, Feb 6, 2022 at 12:59 PM Dirk Müller [off-list ref] wrote:
quoted hunk ↗ jump to hunk
GCC 10+ defaults to -fno-common, which enforces proper declaration of
external references using "extern". without this change a link would
fail with:

  lib/raid6/test/algos.c:28: multiple definition of `raid6_call';
  lib/raid6/test/test.c:22: first defined here

Signed-off-by: Dirk Müller <redacted>
---
 lib/raid6/test/test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/raid6/test/test.c b/lib/raid6/test/test.c
index a3cf071941ab..ab0459150a61 100644
--- a/lib/raid6/test/test.c
+++ b/lib/raid6/test/test.c
@@ -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;
Can we just remove this line?

Thanks,
Song
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help