Skip to content

Fix binary stripping on Bazel <9#2888

Merged
adincebic merged 1 commit intomainfrom
adin/fix-binary-stripping
Mar 7, 2026
Merged

Fix binary stripping on Bazel <9#2888
adincebic merged 1 commit intomainfrom
adin/fix-binary-stripping

Conversation

@adincebic
Copy link
Copy Markdown
Contributor

In #2868 we gated binary stripping behavior by looking at objc fragment, more specifically objc.builtin_objc_strip_action. builtin_objc_strip_action is available only in Bazel 9+:

This means that binary stripping action is never executed on Bazel versions <9 since the following code in compilation_support.bzl would never resolve to true:

def _emit_builtin_objc_strip_action(ctx):
    return (
        getattr(ctx.fragments.objc, "builtin_objc_strip_action", False) and # Not present on bazel versions < 9
        ctx.fragments.objc.builtin_objc_strip_action and
        ctx.fragments.cpp.objc_enable_binary_stripping() and
        ctx.fragments.cpp.compilation_mode() == "opt"
    )

Changing it to rely on ctx.fragments.cpp.objc_should_strip_binary fixes it across supported bazel versions since that symbol is available.

@adincebic adincebic merged commit e0eab89 into main Mar 7, 2026
10 checks passed
@adincebic adincebic deleted the adin/fix-binary-stripping branch March 7, 2026 12:03
@adincebic
Copy link
Copy Markdown
Contributor Author

CC @Fhugues @luispadron

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants