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

Fix static data to link with -fno-common. #9943

Merged
merged 1 commit into from Feb 6, 2020

Conversation

rdolbeau
Copy link
Contributor

@rdolbeau rdolbeau commented Feb 4, 2020

-fno-common is the new default in GCC 10, replacing -fcommon in GCC <= 9, so static data must only be allocated once.

Signed-off-by: Romain Dolbeau romain.dolbeau@european-processor-initiative.eu

Motivation and Context

GCC 10 will change the default from -fcommon to -fno-common (https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html), preventing the linking of any variables with multiple definitions.

This remove multiple definitions of variables, allowing compilation with GCC 10 (or older GCC using -fno-common).

Description

Remove multiple definitions: variables are defined in a single .c file, and .h only contains 'extern' declarations.

How Has This Been Tested?

It compiles and allow using a pool on RISC-V a x86-64.

Types of changes

  • [X ] Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (a change to man pages or other documentation)

Checklist:

  • [X ] My code follows the ZFS on Linux code style requirements.
  • I have updated the documentation accordingly.
  • [X ] I have read the contributing document.
  • I have added tests to cover my changes.
  • [X ] I have run the ZFS Test Suite with this change applied.
  • [X ] All commit messages are properly formatted and contain Signed-off-by.

-fno-common is the new default in GCC 10, replacing -fcommon in GCC <= 9, so static data must only be allocated once.

Signed-off-by: Romain Dolbeau <romain.dolbeau@european-processor-initiative.eu>
@behlendorf behlendorf added the Status: Code Review Needed Ready for review and testing label Feb 4, 2020
Copy link
Contributor

@behlendorf behlendorf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for cleaning this up. The kernel.org build failure appears unrelated and is probably due to a recently mainline kernel change which will need to be investigated.

@codecov
Copy link

codecov bot commented Feb 4, 2020

Codecov Report

Merging #9943 into master will decrease coverage by <1%.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff            @@
##           master    #9943    +/-   ##
========================================
- Coverage      80%      79%   -<1%     
========================================
  Files         384      384            
  Lines      121788   121788            
========================================
- Hits        96900    96744   -156     
- Misses      24888    25044   +156
Flag Coverage Δ
#kernel 80% <ø> (ø) ⬇️
#user 67% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a340316...71427f5. Read the comment docs.

@behlendorf behlendorf added Status: Accepted Ready to integrate (reviewed, tested) and removed Status: Code Review Needed Ready for review and testing labels Feb 5, 2020
@behlendorf behlendorf merged commit af09c05 into openzfs:master Feb 6, 2020
tonyhutter pushed a commit to tonyhutter/zfs that referenced this pull request Apr 15, 2020
-fno-common is the new default in GCC 10, replacing -fcommon in
GCC <= 9, so static data must only be allocated once.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Romain Dolbeau <romain.dolbeau@european-processor-initiative.eu>
Closes openzfs#9943
tonyhutter pushed a commit to tonyhutter/zfs that referenced this pull request Apr 22, 2020
-fno-common is the new default in GCC 10, replacing -fcommon in
GCC <= 9, so static data must only be allocated once.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Romain Dolbeau <romain.dolbeau@european-processor-initiative.eu>
Closes openzfs#9943
tonyhutter pushed a commit to tonyhutter/zfs that referenced this pull request Apr 22, 2020
-fno-common is the new default in GCC 10, replacing -fcommon in
GCC <= 9, so static data must only be allocated once.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Romain Dolbeau <romain.dolbeau@european-processor-initiative.eu>
Closes openzfs#9943
tonyhutter pushed a commit to tonyhutter/zfs that referenced this pull request Apr 28, 2020
-fno-common is the new default in GCC 10, replacing -fcommon in
GCC <= 9, so static data must only be allocated once.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Romain Dolbeau <romain.dolbeau@european-processor-initiative.eu>
Closes openzfs#9943
tonyhutter pushed a commit that referenced this pull request May 12, 2020
-fno-common is the new default in GCC 10, replacing -fcommon in
GCC <= 9, so static data must only be allocated once.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Romain Dolbeau <romain.dolbeau@european-processor-initiative.eu>
Closes #9943
jsai20 pushed a commit to jsai20/zfs that referenced this pull request Mar 30, 2021
-fno-common is the new default in GCC 10, replacing -fcommon in
GCC <= 9, so static data must only be allocated once.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Romain Dolbeau <romain.dolbeau@european-processor-initiative.eu>
Closes openzfs#9943
mihalicyn pushed a commit to mihalicyn/zfs that referenced this pull request Dec 7, 2023
-fno-common is the new default in GCC 10, replacing -fcommon in
GCC <= 9, so static data must only be allocated once.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Romain Dolbeau <romain.dolbeau@european-processor-initiative.eu>
Closes openzfs#9943
(cherry picked from commit af09c05)
Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
mihalicyn pushed a commit to mihalicyn/zfs that referenced this pull request Dec 7, 2023
-fno-common is the new default in GCC 10, replacing -fcommon in
GCC <= 9, so static data must only be allocated once.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Romain Dolbeau <romain.dolbeau@european-processor-initiative.eu>
Closes openzfs#9943
(cherry picked from commit af09c05)
Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Accepted Ready to integrate (reviewed, tested)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants