CppLink actions having access to fdo_profile_path variable #17277
Labels
P2
We'll consider working on this in future. (Assignee optional)
team-Rules-CPP
Issues for C++ rules
type: feature request
Description of the feature request:
C++ rules explicitly pipes
//command_line_option:fdo_profile
tofdo_profile_path
build variable for CppCompileAction.fdo_profile_path
build variable is then used in several features in cc toolchain. autofdo is one of the using features.autofdo
is implicitly enabled and expands some fdo-specific flags on c/c++ compile actions whenfdo_profile_path
is available. This works well in making sure we're able to expand the same set of flags in Bazel as in Soong for CFlags.In AOSP, Soong also sets some fdo-specific flags to
LdFlags
. AOSP has its own Bazel cc toolchain and we can modify our customautofdo
feature to expand the flags on the link actions as well. However, Bazel Cc++ rules doesn't not pipe thefdo_profile_path
variable forCppLinkAction
yet. Hence, the dynamic fdo-specific flags don't have access tofdo_profile_path
build variable to expand the flags correctly.It would be better if there's some mechanism to pipe build variables for C++ toolchain to use for this specific use case.
What underlying problem are you trying to solve with this feature?
There is a workaround to this problem. To set the flags on link actions, we can use
user_link_flags
andadditional_linker_inputs
attributes such asBut this is counter-intuitive to the existence of
fdo_profile
rule where we usefdo_profile
rule to set the compile flags correctly and use ^ to set the link flags correctly. Another problem is that this approach results to duplicate profiles.fdo_profile
symlinks the profile to a separate directory which is referenced in the compile flags. However, the link flags reference a different location though they should be the same.The text was updated successfully, but these errors were encountered: