From b8efa211799d186310fb30979f8d871b94d9ba90 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 11 Sep 2017 12:57:10 -0700 Subject: [PATCH] Only pass -Oz to clang Closes #241 --- src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 575db68..4c5e724 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -158,7 +158,7 @@ pub struct Tool { /// Each family of tools differs in how and what arguments they accept. /// /// Detection of a family is done on best-effort basis and may not accurately reflect the tool. -#[derive(Copy, Clone, Debug)] +#[derive(Copy, Clone, Debug, PartialEq)] enum ToolFamily { /// Tool is GNU Compiler Collection-like. Gnu, @@ -961,7 +961,7 @@ impl Build { ToolFamily::Clang => { // arm-linux-androideabi-gcc 4.8 shipped with Android NDK does // not support '-Oz' - if target.contains("android") && opt_level == "z" { + if opt_level == "z" && cmd.family != ToolFamily::Clang { cmd.args.push("-Os".into()); } else { cmd.args.push(format!("-O{}", opt_level).into());