[configure] Fix detecting -fno-lto support#2045
Conversation
mtl1979
commented
Dec 7, 2025
- Previously -fno-lto support was assumed to be supported on non-gcc compatible or unsupported compilers. Support for it was never tested on those cases. Set the default to not supported.
* Previously -fno-lto support was assumed to be supported on non-gcc compatible or unsupported compilers. Support for it was never tested on those cases. Set the default to not supported.
WalkthroughThe PR modifies the configure script to change how link-time optimization disabling is handled. The Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
configure (1)
138-139: Defaultingnoltoflagto empty is correct and matches optional-flag policyInitializing
noltoflagto an empty string and letting the detection logic fill it only when supported avoids untested-fno-ltoon non-GCC-compatible compilers and aligns with the repo’s “optional flags default to empty; configure detects support” convention. Consider slightly rewording the comment to reflect that we now always start empty and only set it when a GCC‑compatible compiler passes the check (e.g., “Set default for noltoflag; GCC-compatible compilers may enable it below”).Based on learnings, optional feature flags should default to empty strings.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
configure(2 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: mtl1979
Repo: zlib-ng/zlib-ng PR: 1925
File: arch/loongarch/lasxintrin_ext.h:38-65
Timestamp: 2025-07-04T16:59:44.725Z
Learning: In zlib-ng, the policy for supporting old compilers is to maintain compatibility for up to two years after GitHub removes support for them in CI, or when there is no long-time contributor left testing for the architecture if the architecture was not supported by GitHub Actions at all.
Learnt from: mtl1979
Repo: zlib-ng/zlib-ng PR: 1904
File: arch/riscv/Makefile.in:12-14
Timestamp: 2025-04-15T09:20:52.333Z
Learning: Optional feature flags in Makefile.in templates should default to empty strings. The configure script should detect feature support and update these variables accordingly during the configuration process.
📚 Learning: 2025-04-15T09:20:52.333Z
Learnt from: mtl1979
Repo: zlib-ng/zlib-ng PR: 1904
File: arch/riscv/Makefile.in:12-14
Timestamp: 2025-04-15T09:20:52.333Z
Learning: Optional feature flags in Makefile.in templates should default to empty strings. The configure script should detect feature support and update these variables accordingly during the configuration process.
Applied to files:
configure
📚 Learning: 2025-04-15T09:30:10.081Z
Learnt from: mtl1979
Repo: zlib-ng/zlib-ng PR: 1904
File: arch/riscv/Makefile.in:12-14
Timestamp: 2025-04-15T09:30:10.081Z
Learning: Feature detection modules like riscv_features.c should not be compiled with feature-specific flags (like RVVFLAG) because they need to be compilable on all systems regardless of feature support. These modules perform runtime detection and must initialize feature availability flags to zero on unsupported systems.
Applied to files:
configure
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (75)
- GitHub Check: Windows MSVC ARM No Test
- GitHub Check: Windows MSVC 2022 v140 Win32
- GitHub Check: EL10 GCC S390X DFLTCC UBSAN
- GitHub Check: Ubuntu GCC AARCH64 Compat No Opt UBSAN
- GitHub Check: Ubuntu GCC C17
- GitHub Check: macOS GCC UBSAN (ARM64)
- GitHub Check: Windows MSVC 2022 v140 Win64
- GitHub Check: Windows MSVC ARM No Test
- GitHub Check: Windows MSVC 2022 v140 Win32
- GitHub Check: EL10 GCC S390X DFLTCC UBSAN
- GitHub Check: Ubuntu GCC AARCH64 Compat No Opt UBSAN
- GitHub Check: Ubuntu GCC C17
- GitHub Check: macOS GCC UBSAN (ARM64)
- GitHub Check: Windows MSVC 2022 v140 Win64
- GitHub Check: Windows MSVC ARM No Test
- GitHub Check: Windows MSVC 2022 v140 Win32
- GitHub Check: EL10 GCC S390X DFLTCC UBSAN
- GitHub Check: Ubuntu GCC AARCH64 Compat No Opt UBSAN
- GitHub Check: Ubuntu GCC C17
- GitHub Check: macOS GCC UBSAN (ARM64)
- GitHub Check: Windows ClangCl Win64 Native Instructions (AVX)
- GitHub Check: Windows MSVC 2022 v140 Win64
- GitHub Check: Windows MSVC ARM No Test
- GitHub Check: Windows MSVC 2022 v140 Win32
- GitHub Check: EL10 GCC S390X DFLTCC UBSAN
- GitHub Check: Ubuntu GCC AARCH64 Compat No Opt UBSAN
- GitHub Check: Ubuntu GCC C17
- GitHub Check: macOS GCC UBSAN (ARM64)
- GitHub Check: Windows ClangCl Win64 Native Instructions (AVX)
- GitHub Check: Windows MSVC 2022 v140 Win64
- GitHub Check: Windows MSVC ARM No Test
- GitHub Check: Windows MSVC 2022 v140 Win32
- GitHub Check: EL10 GCC S390X DFLTCC UBSAN
- GitHub Check: Ubuntu GCC AARCH64 Compat No Opt UBSAN
- GitHub Check: Ubuntu GCC C17
- GitHub Check: macOS GCC UBSAN (ARM64)
- GitHub Check: Windows ClangCl Win64 Native Instructions (AVX)
- GitHub Check: Windows MSVC 2022 v140 Win64
- GitHub Check: Windows MSVC ARM No Test
- GitHub Check: Windows MSVC 2022 v140 Win32
- GitHub Check: EL10 GCC S390X DFLTCC UBSAN
- GitHub Check: Ubuntu GCC AARCH64 Compat No Opt UBSAN
- GitHub Check: Ubuntu GCC C17
- GitHub Check: macOS GCC UBSAN (ARM64)
- GitHub Check: Windows ClangCl Win64 Native Instructions (AVX)
- GitHub Check: Windows MSVC 2022 v140 Win64
- GitHub Check: Windows MSVC ARM No Test
- GitHub Check: Windows MSVC 2022 v140 Win32
- GitHub Check: EL10 GCC S390X DFLTCC UBSAN
- GitHub Check: Ubuntu GCC AARCH64 Compat No Opt UBSAN
- GitHub Check: Ubuntu GCC C17
- GitHub Check: macOS GCC UBSAN (ARM64)
- GitHub Check: Windows ClangCl Win64 Native Instructions (AVX)
- GitHub Check: Windows MSVC 2022 v140 Win64
- GitHub Check: Windows MSVC ARM No Test
- GitHub Check: Windows MSVC 2022 v140 Win32
- GitHub Check: EL10 GCC S390X DFLTCC UBSAN
- GitHub Check: Ubuntu GCC AARCH64 Compat No Opt UBSAN
- GitHub Check: Ubuntu GCC C17
- GitHub Check: macOS GCC UBSAN (ARM64)
- GitHub Check: Windows ClangCl Win64 Native Instructions (AVX)
- GitHub Check: Windows MSVC 2022 v140 Win64
- GitHub Check: Windows MSVC ARM No Test
- GitHub Check: Windows MSVC 2022 v140 Win32
- GitHub Check: EL10 GCC S390X DFLTCC UBSAN
- GitHub Check: Ubuntu GCC AARCH64 Compat No Opt UBSAN
- GitHub Check: Ubuntu GCC C17
- GitHub Check: macOS GCC UBSAN (ARM64)
- GitHub Check: Windows ClangCl Win64 Native Instructions (AVX)
- GitHub Check: Windows MSVC 2022 v140 Win64
- GitHub Check: Windows MSVC ARM No Test
- GitHub Check: Windows MSVC 2022 v140 Win32
- GitHub Check: EL10 GCC S390X DFLTCC UBSAN
- GitHub Check: Ubuntu GCC AARCH64 Compat No Opt UBSAN
- GitHub Check: Ubuntu GCC C17
🔇 Additional comments (1)
configure (1)
1034-1045:-fno-ltoprobe correctly gates support to GCC-compatible compilersThe updated probe now only assigns
noltoflag="-fno-lto"when a GCC‑compatible compiler actually accepts the flag, and leaves it empty otherwise, fixing the previous assumption that non‑GCC compilers supported-fno-ltowithout testing. The extra guard onwithout_optimizationspreserves the “no extra flags when optimizations are disabled” behavior. This looks semantically sound and consistent with how other optional flags are handled.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #2045 +/- ##
===========================================
+ Coverage 80.64% 82.35% +1.71%
===========================================
Files 162 163 +1
Lines 12883 12935 +52
Branches 3174 3192 +18
===========================================
+ Hits 10389 10653 +264
+ Misses 1455 1190 -265
- Partials 1039 1092 +53 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|