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

add extern to function declarations #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jandryuk
Copy link

Code compiled with gcc10 will not link properly due to multiple
definition of the same function.

ld: /home/abuild/rpmbuild/BUILD/xen-4.8.20191211T160002.8db85532cb/non-dbg/stubdom/vtpm/vtpm.a(vtpm_cmd.o):(.bss+0x28): multiple definition of `tpm_malloc'; /home/abuild/rpmbuild/BUILD/xen-4.8.20191211T160002.8db85532cb/non-dbg/stubdom/vtpm/vtpm.a(vtpm.o):(.bss+0x728): first defined here

Signed-off-by: Olaf Hering [email protected]
Reviewed-by: Jason Andryuk [email protected]
Acked-by: Samuel Thibault [email protected]
Reviewed-by: Ian Jackson [email protected]
Release-acked-by: Paul Durrant [email protected]

Move over from xen repo.

Signed-off-by: Jason Andryuk [email protected]

Code compiled with gcc10 will not link properly due to multiple
definition of the same function.

ld: /home/abuild/rpmbuild/BUILD/xen-4.8.20191211T160002.8db85532cb/non-dbg/stubdom/vtpm/vtpm.a(vtpm_cmd.o):(.bss+0x28): multiple definition of `tpm_malloc'; /home/abuild/rpmbuild/BUILD/xen-4.8.20191211T160002.8db85532cb/non-dbg/stubdom/vtpm/vtpm.a(vtpm.o):(.bss+0x728): first defined here

Signed-off-by: Olaf Hering <[email protected]>
Reviewed-by: Jason Andryuk <[email protected]>
Acked-by: Samuel Thibault <[email protected]>
Reviewed-by: Ian Jackson <[email protected]>
Release-acked-by: Paul Durrant <[email protected]>

Move over from xen repo.

Signed-off-by: Jason Andryuk <[email protected]>
@Justin-Otto
Copy link

I was briefly confused by this, as functions are extern by default in C, but these are function pointers, so the extern makes a difference and resolves the issue.

@fmartinsons
Copy link

Thanks, I fall into this problem with gcc 11.4 and find that gcc 10 change its default behavior about global variable (defaulted to -fcommon for gcc < 10 and -fno-common for gcc >= 10).
You PR is the right way to correct that though

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.

4 participants