fix(scons): strip RHEL annobin/hardened specs from all compile flags#16
Merged
movingpictures83 merged 1 commit intoJun 12, 2026
Merged
Conversation
The annobin spec (`-specs=...redhat-annobin-cc1`) injected by perl ccopts makes gcc load gcc-annobin.so, a plugin version-locked to the compiler it was built for. Under a gcc-toolset/devtoolset mismatch (e.g. plugin built for gcc 8.5.0 but compiling with gcc 9.5.0) cc1plus aborts with "fail to initialize plugin gcc-annobin.so". The previous `_remove_annobin_flag` only removed an exact-match token from CCFLAGS. Filter both the annobin and hardened specs from every compile-flag list (CCFLAGS, CXXFLAGS, SHCCFLAGS, SHCXXFLAGS, CPPFLAGS), since the spec can land in any of them depending on which config injected it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2 tasks
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
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.
Problem
On RHEL/Fedora with a
gcc-toolset/devtoolsetenabled,sconsfails to compile with:The
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1spec — injected into the build via perl'sExtUtils::Embedccopts— tells gcc to loadgcc-annobin.so. That plugin is version-locked to the compiler it was built for (the base system gcc 8.5.0), so compiling with a newer toolset gcc (9.5.0) aborts before any source is processed.--without-javahas no effect because the spec comes from the Perl config, not Java.Fix
_remove_annobin_flagpreviously removed only an exact-match token fromCCFLAGS. This:redhat-annobin-cc1andredhat-hardened-cc1specs, andCCFLAGS,CXXFLAGS,SHCCFLAGS,SHCXXFLAGS,CPPFLAGS), since the spec can land in any of them depending on which config injected it.This mirrors the existing
_strip_lto_flagshelper's multi-list approach.Users who actually want RHEL hardening metadata in their binaries should instead match the compiler to the installed annobin plugin (e.g.
dnf install gcc-toolset-9-annobin-plugin-gcc); this change only affects builds where the spec would otherwise break compilation.🤖 Generated with Claude Code