Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugins/nd: Fix building with CFLAGS=-fno-common #49

Merged
merged 1 commit into from May 28, 2020
Merged

plugins/nd: Fix building with CFLAGS=-fno-common #49

merged 1 commit into from May 28, 2020

Conversation

jer-gentoo
Copy link
Contributor

With the GCC -fno-common flag, enabled by default in GCC >=10, the
linker fails with messages like these:

ld: plugins/nd/1b87e75@@nd@sha/src_notification.c.o:(.bss+0x0): multiple
definition of eventd_nd_backends_names'; plugins/nd/1b87e75@@nd@sha/src_nd.c.o:(.data.rel.local+0x20): first defined here ld: plugins/nd/1b87e75@@nd@sha/src_backends.c.o:(.bss+0x0): multiple definition of eventd_nd_backends_names';
plugins/nd/1b87e75@@nd@sha/src_nd.c.o:(.data.rel.local+0x20): first
defined here
collect2: error: ld returned 1 exit status

Fix this by declaring eventd_nd_backends_names as extern.

Signed-off-by: Jeroen Roovers jer@gentoo.org

@sardemff7
Copy link
Owner

Thanks for the patch!

I’ll just be nitpicky on the commit message: although I don’t always succeed, I try to describe the actual issue in the summary for this kind of fixes.
The flag breaking the build is a symptom here. I would go with “Avoid a possible multiple definition”, what do you think?

Also, I use "nd:" as the prefix (IOW, just the plugin name), "plugins:" is for commits that affects many plugins at once for a generic change.

With the GCC flag -fno-common, which is enabled by default in GCC >=10,
the linker fails with messages like these:

ld: plugins/nd/1b87e75@@nd@sha/src_notification.c.o:(.bss+0x0): multiple
definition of `eventd_nd_backends_names';
plugins/nd/1b87e75@@nd@sha/src_nd.c.o:(.data.rel.local+0x20): first
defined here
ld: plugins/nd/1b87e75@@nd@sha/src_backends.c.o:(.bss+0x0): multiple
definition of `eventd_nd_backends_names';
plugins/nd/1b87e75@@nd@sha/src_nd.c.o:(.data.rel.local+0x20): first
defined here
collect2: error: ld returned 1 exit status

Fix this by declaring eventd_nd_backends_names as extern.

Signed-off-by: Jeroen Roovers <jer@gentoo.org>
@jer-gentoo
Copy link
Contributor Author

I adjusted the commit message.

@sardemff7
Copy link
Owner

Perfect! Thanks again :-)

@sardemff7 sardemff7 merged commit 5a38177 into sardemff7:master May 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants