* [PATCH] fix multiple definition linking error due to missing extern
@ 2022-02-06 20:51 Dirk Müller
2022-02-07 7:48 ` Paul Menzel
2022-02-08 5:45 ` Song Liu
0 siblings, 2 replies; 5+ messages in thread
From: Dirk Müller @ 2022-02-06 20:51 UTC (permalink / raw)
To: linux-raid; +Cc: Dirk Müller
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 <dmueller@suse.de>
---
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;
char *dataptrs[NDISKS];
char data[NDISKS][PAGE_SIZE] __attribute__((aligned(PAGE_SIZE)));
--
2.35.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] fix multiple definition linking error due to missing extern
2022-02-06 20:51 [PATCH] fix multiple definition linking error due to missing extern Dirk Müller
@ 2022-02-07 7:48 ` Paul Menzel
2022-02-08 5:45 ` Song Liu
1 sibling, 0 replies; 5+ messages in thread
From: Paul Menzel @ 2022-02-07 7:48 UTC (permalink / raw)
To: Dirk Müller; +Cc: linux-raid
Dear Dirk,
Am 06.02.22 um 21:51 schrieb Dirk Müller:
It’d be great of you added a prefix in the commit message summary. Maybe:
> lib/raid6/test: 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
Nit: Without
> 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 <dmueller@suse.de>
Thank you for properly analyzing and fixing it in a better way than my
(non-working) attempt [1].
Should it be tagged for the stable series, that means CC’ed to
<stable@vger.kernel.org>?
> ---
> 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;
>
> char *dataptrs[NDISKS];
> char data[NDISKS][PAGE_SIZE] __attribute__((aligned(PAGE_SIZE)));
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
Kind regards,
Paul
[1]:
https://lore.kernel.org/linux-raid/20220126114144.370517-3-pmenzel@molgen.mpg.de/T/#u
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] fix multiple definition linking error due to missing extern
2022-02-06 20:51 [PATCH] fix multiple definition linking error due to missing extern Dirk Müller
2022-02-07 7:48 ` Paul Menzel
@ 2022-02-08 5:45 ` Song Liu
2022-02-08 16:51 ` Dirk Müller
1 sibling, 1 reply; 5+ messages in thread
From: Song Liu @ 2022-02-08 5:45 UTC (permalink / raw)
To: Dirk Müller; +Cc: linux-raid
On Sun, Feb 6, 2022 at 12:59 PM Dirk Müller <dmueller@suse.de> wrote:
>
> 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 <dmueller@suse.de>
> ---
> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] fix multiple definition linking error due to missing extern
2022-02-08 5:45 ` Song Liu
@ 2022-02-08 16:51 ` Dirk Müller
0 siblings, 0 replies; 5+ messages in thread
From: Dirk Müller @ 2022-02-08 16:51 UTC (permalink / raw)
To: Song Liu; +Cc: linux-raid
On Dienstag, 8. Februar 2022 06:45:45 CET Song Liu wrote:
Hi Song,
> > -struct raid6_calls raid6_call;
> > +extern struct raid6_calls raid6_call;
>
> Can we just remove this line?
oh yes indeed, it is already declared in the header file. that is much simpler.
I've sent a PATCH v2 just now.
Thank you,
Dirk
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] fix multiple definition linking error due to missing extern
@ 2021-12-29 15:38 Dirk Müller
0 siblings, 0 replies; 5+ messages in thread
From: Dirk Müller @ 2021-12-29 15:38 UTC (permalink / raw)
To: linux-raid; +Cc: Dirk Müller
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
Signed-off-by: Dirk Müller <dmueller@suse.de>
---
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;
char *dataptrs[NDISKS];
char data[NDISKS][PAGE_SIZE] __attribute__((aligned(PAGE_SIZE)));
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-02-08 16:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-06 20:51 [PATCH] fix multiple definition linking error due to missing extern Dirk Müller
2022-02-07 7:48 ` Paul Menzel
2022-02-08 5:45 ` Song Liu
2022-02-08 16:51 ` Dirk Müller
-- strict thread matches above, loose matches on Subject: below --
2021-12-29 15:38 Dirk Müller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.