Pass use_pic when creating module codegen actions Copybara Import from https://github.com/bazelbuild/rules_cc/pull/788 BEGIN_PUBLIC Pass use_pic when creating module codegen actions (#788) Module codegen actions (`header_module_codegen`) compile a module file into an object file. `_create_module_codegen_action` computes `use_pic` from the module file's name but didn't forward it to `_create_compile_action`, so Bazel's `CppCompileActionBuilder` treats the action as non-PIC even for PIC module files — and e.g. looks up the non-PIC transitive modules as mandatory inputs, which are empty in PIC-only builds. Closes #788 END_PUBLIC Startblock: * // Put other blockers before this line to avoid churning. * has lgtm * is approved * and then * all comments are resolved * and then *[] allows unknown commit COPYBARA_INTEGRATE_REVIEW=https://github.com/bazelbuild/rules_cc/pull/788 from fmeum:module-codegen-inputs f249d3f2ec321e4c726e93a88b274d1716bd270b PiperOrigin-RevId: 956453977 Change-Id: I700b49c3881c707408201b96e518cced11215477
diff --git a/cc/private/compile/compile.bzl b/cc/private/compile/compile.bzl index 9f52c91..d1ca4ad 100644 --- a/cc/private/compile/compile.bzl +++ b/cc/private/compile/compile.bzl
@@ -2081,6 +2081,7 @@ needs_include_validation = _starlark_cc_semantics.needs_include_validation(language), toolchain_type = _starlark_cc_semantics.toolchain, progress_message_prefix = progress_message_prefix, + use_pic = use_pic, ) if use_pic: outputs["pic_objects"].append(object_file)