Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add host_per_file_copt and host_per_file_ltobackendopt build options #12833

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,27 @@ public Label getPropellerOptimizeLabel() {
+ "except bar.cc.")
public List<PerLabelOptions> perFileCopts;

@Option(
name = "host_per_file_copt",
allowMultiple = true,
converter = PerLabelOptions.PerLabelOptionsConverter.class,
defaultValue = "null",
documentationCategory = OptionDocumentationCategory.OUTPUT_PARAMETERS,
effectTags = {OptionEffectTag.ACTION_COMMAND_LINES, OptionEffectTag.AFFECTS_OUTPUTS},
help =
"Additional options to selectively pass to gcc when compiling certain files for host. "
+ "This option can be passed multiple times. "
+ "Syntax: regex_filter@option_1,option_2,...,option_n. Where regex_filter stands "
+ "for a list of include and exclude regular expression patterns (Also see "
+ "--instrumentation_filter). option_1 to option_n stand for "
+ "arbitrary command line options. If an option contains a comma it has to be "
+ "quoted with a backslash. Options can contain @. Only the first @ is used to "
+ "split the string. Example: "
+ "--host_per_file_copt=//foo/.*\\.cc,-//foo/bar\\.cc@-O0 adds the -O0 "
+ "command line option to the gcc command line of all cc files in //foo/ "
+ "except bar.cc.")
public List<PerLabelOptions> hostPerFileCopts;

@Option(
name = "per_file_ltobackendopt",
allowMultiple = true,
Expand All @@ -590,6 +611,26 @@ public Label getPropellerOptimizeLabel() {
+ "except bar.o.")
public List<PerLabelOptions> perFileLtoBackendOpts;

@Option(
name = "host_per_file_ltobackendopt",
allowMultiple = true,
converter = PerLabelOptions.PerLabelOptionsConverter.class,
defaultValue = "null",
documentationCategory = OptionDocumentationCategory.OUTPUT_PARAMETERS,
effectTags = {OptionEffectTag.ACTION_COMMAND_LINES, OptionEffectTag.AFFECTS_OUTPUTS},
help =
"Additional options to selectively pass to LTO backend (under --features=thin_lto) when "
+ "compiling certain backend objects for host. This option can be passed multiple times. "
+ "Syntax: regex_filter@option_1,option_2,...,option_n. Where regex_filter stands "
+ "for a list of include and exclude regular expression patterns. "
+ "option_1 to option_n stand for arbitrary command line options. "
+ "If an option contains a comma it has to be quoted with a backslash. "
+ "Options can contain @. Only the first @ is used to split the string. Example: "
+ "--host_per_file_ltobackendopt=//foo/.*\\.o,-//foo/bar\\.o@-O0 adds the -O0 "
+ "command line option to the LTO backend command line of all o files in //foo/ "
+ "except bar.o.")
public List<PerLabelOptions> hostPerFileLtoBackendOpts;

/**
* The value of "--crosstool_top" to use for building tools.
*
Expand Down Expand Up @@ -1117,7 +1158,9 @@ public FragmentOptions getHost() {
host.coptList = coptListBuilder.addAll(hostCoptList).build();
host.cxxoptList = cxxoptListBuilder.addAll(hostCxxoptList).build();
host.conlyoptList = ImmutableList.copyOf(hostConlyoptList);
host.perFileCopts = ImmutableList.copyOf(hostPerFileCopts);
host.linkoptList = ImmutableList.copyOf(hostLinkoptList);
host.perFileLtoBackendOpts = ImmutableList.copyOf(hostPerFileLtoBackendOpts);

host.useStartEndLib = useStartEndLib;
host.stripBinaries = StripMode.ALWAYS;
Expand Down Expand Up @@ -1149,8 +1192,10 @@ public FragmentOptions getHost() {
host.hostCppCompiler = hostCppCompiler;
host.hostCrosstoolTop = hostCrosstoolTop;
host.hostCxxoptList = hostCxxoptList;
host.hostPerFileCopts = hostPerFileCopts;
host.hostLibcTopLabel = hostLibcTopLabel;
host.hostLinkoptList = hostLinkoptList;
host.hostPerFileLtoBackendOpts = hostPerFileLtoBackendOpts;

host.experimentalStarlarkCcImport = experimentalStarlarkCcImport;

Expand Down