diff --git a/src/flags.rs b/src/flags.rs index 96049a42..93391633 100644 --- a/src/flags.rs +++ b/src/flags.rs @@ -209,17 +209,6 @@ impl<'this> RustcCodegenFlags<'this> { push_if_supported(format!("-mguard={cc_val}").into()); } } - // https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-flto - if let Some(value) = self.lto { - let cc_val = match value { - "y" | "yes" | "on" | "true" | "fat" => Some("full"), - "thin" => Some("thin"), - _ => None, - }; - if let Some(cc_val) = cc_val { - push_if_supported(format!("-flto={cc_val}").into()); - } - } // https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fPIC // https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fPIE // https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-mdynamic-no-pic @@ -234,11 +223,6 @@ impl<'this> RustcCodegenFlags<'this> { push_if_supported(cc_flag.into()); } } - // https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fembed-bitcode - if let Some(value) = self.embed_bitcode { - let cc_val = if value { "all" } else { "off" }; - push_if_supported(format!("-fembed-bitcode={cc_val}").into()); - } // https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fno-omit-frame-pointer // https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fomit-frame-pointer if let Some(value) = self.force_frame_pointers { @@ -285,6 +269,24 @@ impl<'this> RustcCodegenFlags<'this> { if let Some(value) = self.profile_use { push_if_supported(format!("-fprofile-use={value}").into()); } + + // https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fembed-bitcode + if let Some(value) = self.embed_bitcode { + let cc_val = if value { "all" } else { "off" }; + push_if_supported(format!("-fembed-bitcode={cc_val}").into()); + } + + // https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-flto + if let Some(value) = self.lto { + let cc_val = match value { + "y" | "yes" | "on" | "true" | "fat" => Some("full"), + "thin" => Some("thin"), + _ => None, + }; + if let Some(cc_val) = cc_val { + push_if_supported(format!("-flto={cc_val}").into()); + } + } } ToolFamily::Gnu { .. } => {} ToolFamily::Msvc { .. } => {