[release/9.0-staging] Add flags when the clang's major version is > 20.0#121151
Conversation
|
Tagging subscribers to this area: @hoyosjs |
There was a problem hiding this comment.
Pull Request Overview
This PR updates compiler flags for Clang version 20 and above on Unix hosts. When Clang 20+ is detected, it switches from using -fwrapv to using -fno-strict-overflow (which implies -fwrapv and -fwrapv-pointer in Clang 20+) and also adds -fno-strict-aliasing to match MSVC behavior.
Key changes:
- Adds version detection for Clang 20.0 and above
- Uses
-fno-strict-overflowand-fno-strict-aliasingfor Clang 20+ - Maintains existing
-fwrapvflag for older compiler versions
|
Does this need to include the fix for the debugger build break as well? cc @tmds |
|
This is missing the |
We should fix anything that is in dotnet/dotnet that ends up in the distro's DOTNET_ROOT. It's not needed to fix sources that Microsoft compiles (with clang < 21) and ships through nuget.org. |
|
@jkotas I hope my reply was sufficient to know if other changes should be backported. We only provide to our users what goes into |
|
@AaronRobinsonMSFT I built .NET with these changes (and same for .NET 8 PR). It builds, and crashes we observed when running the dotnet/dotnet test suite are fixed. Thanks for making these backports! |
|
/ba-g Unrelated timeouts |
d4ff345
into
dotnet:release/9.0-staging
…0.0 (#121150) ## Customer Impact - [x] Customer reported - [ ] Found internally These issues were reported in #119706 as problems with clang-21 on Fedora 43. The investigation uncovered that clang introduced a potentially breaking change in clang-20 that we do not currently consume. These build changes impact VMR related builds when linux distrobutions performing source build adopt clang-21. clang-20 breaking change log - https://releases.llvm.org/20.1.0/tools/clang/docs/ReleaseNotes.html#potentially-breaking-changes. This PR contains the minimal changes needed to fix issues from the following PR #120775. .NET 10: #121124 .NET 9: #121151 ## Regression - [ ] Yes - [x] No Build with the new clang-21 compiler will cause the runtime to crash. ## Testing This has been validated using various legs and examples to demonstrate the usage of undefined behavior these flags convert into "defined" behavior in C/C++. ## Risk Low. This has zero impact on our production build since we specifically target clang-16. This is only valid for those partners that are using clang-20+.
Customer Impact
These issues were reported in #119706 as problems with clang-21 on Fedora 43. The investigation uncovered that clang introduced a potentially breaking change in clang-20 that we do not currently consume. These build changes impact VMR related builds when linux distrobutions performing source build adopt clang-21.
clang-20 breaking change log - https://releases.llvm.org/20.1.0/tools/clang/docs/ReleaseNotes.html#potentially-breaking-changes.
This PR contains the minimal changes needed to fix issues from the following PR #120775.
.NET 10: #121124
.NET 8: #121150
Regression
Build with the new clang-21 compiler will cause the runtime to crash.
Testing
This has been validated using various legs and examples to demonstrate the usage of undefined behavior these flags convert into "defined" behavior in C/C++.
Risk
Low. This has zero impact on our production build since we specifically target clang-18. This is only valid for those partners that are using clang-20+.