-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Linux: Clang build fixes #17954
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
Open
robn
wants to merge
3
commits into
openzfs:master
Choose a base branch
from
robn:clang-build-fixes
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Linux: Clang build fixes #17954
+3
−3
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
amotin
approved these changes
Nov 19, 2025
behlendorf
requested changes
Nov 19, 2025
Linux switched from -std=gnu89 to -std=gnu11 in 5.18 (torvalds/linux@e8c07082a810f). We've always overridden that with gnu99 because we use some newer features. More recent kernels are using C11 features in headers that we include. GCC generally doesn't seem to care, but more recent versions of Clang seem to be enforcing our gnu99 override more strictly, which breaks the build in some configurations. Just bumping our "override" to match the kernel seems to be the easiest workaround. It's an effective no-op since 5.18, while still allowing us to build on older kernels. Sponsored-by: https://despairlabs.com/sponsor/ Signed-off-by: Rob Norris <[email protected]>
Using strlen() in an static array declaration is a GCC extension. Clang calls it "gnu-folding-constant" and warns about it, which breaks the build. If it were widespread we could just turn off the warning, but since there's only one case, lets just change the array to an explicit size. Sponsored-by: https://despairlabs.com/sponsor/ Signed-off-by: Rob Norris <[email protected]>
6.18 changes kmap_atomic() to take a const pointer. This is no problem for the places we use it, but Clang fails the test due to a warning about being unable to guarantee that uninitialised data will definitely not change. Easily solved by forcibly initialising it. Sponsored-by: https://despairlabs.com/sponsor/ Signed-off-by: Rob Norris <[email protected]>
fc9e6bb to
8fbbeab
Compare
|
Tested it without the -std=gnu99 and now with -std=gnu11 change and both work. Solves the #17951, thanks. |
behlendorf
approved these changes
Nov 19, 2025
Contributor
behlendorf
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming the CI gives it a clean bill of health this looks good.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation and Context
Recent Clang is a little upset with a handful of things on the Linux side. This sorts it out.
Fixes #17951
Fixes #17959
Description
See commit messages. Summary:
How Has This Been Tested?
Compiled and basic sanity runs done with GCC 14.2 and Clang 17, 19 and 22 against Linux 6.1.x, 6.16.x and 6.18-rc.
Not my usual comprehensive set, but recompiling kernels as well adds a lot of time and building with Clang is more difficult the older they get.
Types of changes
Checklist:
Signed-off-by.