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

PC: make build using gcc 10 work. #490

Merged
merged 1 commit into from
Jan 28, 2021

Conversation

enrikb
Copy link
Contributor

@enrikb enrikb commented Nov 21, 2020

  • declare firmware_version extern in fido2/version.h

  • declare RK_STORE 'weak' in fido2/device.c, like the functions
    operating on it

Tested on Ubuntu 20.10 using gcc-9 and gcc-10.

@enrikb
Copy link
Contributor Author

enrikb commented Nov 24, 2020

BTW, the root cause can be found in the gcc 10 release notes:

GCC now defaults to -fno-common. As a result, global variable accesses are more efficient on various targets. In C, global variables with multiple tentative definitions now result in linker errors. With -fcommon such definitions are silently merged during linking.

Therefore, specifying -fcommon for gcc builds explicitly somehow might also fix the issue.

gcc 10 changed its default behavior from `-fcommon' to `-fno-common' for
C code. (see https://gcc.gnu.org/gcc-10/changes.html). This makes
linking the PC version of the solo firmware fail due to duplicate
symbols.

This change adds '-fcommon' to CFLAGS to restore the old behavior. It
works using older compiler versions, too.

Tested to build successfully on Ubuntu 20.10 using gcc-8, gcc-9, gcc-10
(default), clang-9, clang-10 and clang-11 (default).
@enrikb enrikb force-pushed the bugfix/make_PC_build_gcc_10_work branch from 5ede368 to fbd1824 Compare November 24, 2020 18:18
@enrikb
Copy link
Contributor Author

enrikb commented Nov 24, 2020

I changed the PR to set `-fcommon' in the Makefile, as it addresses the root cause more directly. No code changes.

@ghost
Copy link

ghost commented Nov 25, 2020

make all Confirmed working on Fedora 33.
gcc (GCC) 10.2.1 20201016 (Red Hat 10.2.1-6)

@conorpp
Copy link
Member

conorpp commented Jan 28, 2021

Thank you!

@conorpp conorpp merged commit a01a6c0 into solokeys:master Jan 28, 2021
@conorpp
Copy link
Member

conorpp commented Jan 28, 2021

@all-contributors please add @enrikb for code, maintenance, ideas

@allcontributors
Copy link
Contributor

@conorpp

I've put up a pull request to add @enrikb! 🎉

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.

2 participants