Skip to content

Commit 7fe4127

Browse files
committed
Make -Zprofile set codegen-units to 1
1 parent 8d67f57 commit 7fe4127

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/librustc_session/config.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1655,7 +1655,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
16551655
let output_types = parse_output_types(&debugging_opts, matches, error_format);
16561656

16571657
let mut cg = build_codegen_options(matches, error_format);
1658-
let (disable_thinlto, codegen_units) = should_override_cgus_and_disable_thinlto(
1658+
let (disable_thinlto, mut codegen_units) = should_override_cgus_and_disable_thinlto(
16591659
&output_types,
16601660
matches,
16611661
error_format,
@@ -1672,6 +1672,16 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
16721672
"can't instrument with gcov profiling when compiling incrementally",
16731673
);
16741674
}
1675+
if debugging_opts.profile {
1676+
match codegen_units {
1677+
Some(1) => {}
1678+
None => codegen_units = Some(1),
1679+
Some(_) => early_error(
1680+
error_format,
1681+
"can't instrument with gcov profiling with multiple codegen units",
1682+
),
1683+
}
1684+
}
16751685

16761686
if cg.profile_generate.enabled() && cg.profile_use.is_some() {
16771687
early_error(

0 commit comments

Comments
 (0)