Skip to content

toolchains_llvm: x_compile.patch does not apply extra_cxx_flags to C++20 module actions #145

Description

@phlax

Context

toolchains_llvm/1.9.1.envoy was added in 81606e3 and is being rolled out via envoyproxy/envoy#47658. Both Envoy patches (allow_nonroot.patch, x_compile.patch) were reviewed against the upstream v1.9.0…v1.9.1 diff and are still required and correctly rebased. This gap fell out of that review.

x_compile.patch does not cover C++20 module actions

x_compile.patch adds cxx_cross_lib and injects per-target -nostdinc++ -isystem <libc++ include> via extra_cxx_flags. Upstream only wires extra_cxx_flags to @rules_cc//cc/toolchains/actions:cpp_compile_actions. The new cpp_modules feature in v1.9.1 adds CPP_MODULE_ACTIONS to the msan/nomsan cc_args, but our cross-lib flags are not applied to:

  • cpp20_module_compile
  • cpp20_module_codegen
  • cpp_module_deps_scanning

Consequence: cross-compiling with --experimental_cpp_modules --features=cpp_modules would fail to find libc++ headers for PCM/scan actions. Not a problem for Envoy today (we don't enable C++20 named modules), but it needs to be recorded so it doesn't bite later.

Action:

  • Add a note to MODULE.bazel and/or a preamble in x_compile.patch documenting the gap (text before the first diff line is ignored by patch; source.json patch sha must be regenerated).
  • When/if we enable C++20 modules: extend the patch so the extra_cxx_flags cc_args also target CPP_MODULE_ACTIONS, and re-check the stdlib = "libc" auto-fallback for cross targets against the module actions.

References

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions