Align action configs with legacy ones to allow LtoBackend actions to succeed#528
Align action configs with legacy ones to allow LtoBackend actions to succeed#528dzbarsky wants to merge 2 commits intobazelbuild:mainfrom
Conversation
697fbbb to
9d855a2
Compare
| ":linkstamp_compile", | ||
| ":preprocess_assemble", | ||
| ], | ||
| ) |
There was a problem hiding this comment.
i was testing a local version of this with:
cc_action_type_set(
name = "non_lto_compile_actions",
actions = [
":assembly_actions",
":c_compile_actions",
":clif_match",
":cpp_compile",
":cpp_header_parsing",
":cpp_module_codegen",
":cpp_module_compile",
":linkstamp_compile",
":objc_compile",
":objcpp_compile",
],
)
not sure if it's entirely correct tho
There was a problem hiding this comment.
certainly seems more correct :) I'm not sure why the legacy configs don't include the objc actions (and I guess cpp_module actions are too new and legacy config was never updated?)
I don't have super strong opinions here, happy to do whatever's best as long as we can LTO working properly
There was a problem hiding this comment.
Internally, the list I'm seeing says this:
"preprocess-assemble",
"linkstamp-compile",
"c-compile",
"c++-compile",
"c++-header-parsing",
"c++-header-analysis",
"c++-module-compile",
"clif-match",
"objc-compile",
"objc++-compile",
Which omits cpp_module_codegen and adds c++-header-analysis. There are few people that actually understand all of this. @lberki might know who to ask to understand the nuances.
There was a problem hiding this comment.
I think the header analysis stuff may have not made it into open-source world? (See https://github.com/search?q=repo%3Abazelbuild%2Frules_cc+cpp_header_analysis&type=code and https://github.com/search?q=repo%3Abazelbuild%2Fbazel%20cpp_header_analysis&type=code). I guess it doesn't hurt to add if Bazel/rules_cc aren't generating these actions anyway, though I also thought the the header analysis isn't aware of the preprocessor. Or maybe that's the header parsing. Or something else I'm misremembering :)
armandomontanez
left a comment
There was a problem hiding this comment.
Good opportunity to update //cc/toolchains/variables/BUILD to ensure the problematic variables cannot be used by argument collections that apply to lto_backend.
| # TODO(zbarsky): Feels like this is wrong but it matches legacy config | ||
| # and avoids crashes due to inaccessible variables | ||
| cc_action_type_set( | ||
| name = "non_lto_backend_compile_actions", |
There was a problem hiding this comment.
To make this as clear as possible:
- Place next to
compile_actions - Leave a comment that this should match
compile_actionsbut omit thelto_backendaction, and highlight the intent - Perhaps rename to
source_compile_actions
There was a problem hiding this comment.
thanks for the suggestions, addressed!
2e8646c to
505202d
Compare
This matches how it was previously setup:
rules_cc/cc/private/toolchain_config/legacy_features.bzl
Lines 169 to 187 in 9338446
Without this, we get:
I now have this fully working e2e at https://github.com/cerisier/toolchains_llvm_bootstrapped/pull/56/files#diff-cce4f0083471dff12279a3b4e3b3206404e4932a3d60f3443c0f60900706093e so happy to contribute those feature targets as well if someone tells me where to put them :)