|
@ -105,6 +105,7 @@ pub struct Build { |
|
|
out_dir: Option<PathBuf>, |
|
|
out_dir: Option<PathBuf>, |
|
|
opt_level: Option<String>, |
|
|
opt_level: Option<String>, |
|
|
debug: Option<bool>, |
|
|
debug: Option<bool>, |
|
|
|
|
|
force_frame_pointer: Option<bool>, |
|
|
env: Vec<(OsString, OsString)>, |
|
|
env: Vec<(OsString, OsString)>, |
|
|
compiler: Option<PathBuf>, |
|
|
compiler: Option<PathBuf>, |
|
|
archiver: Option<PathBuf>, |
|
|
archiver: Option<PathBuf>, |
|
@ -209,8 +210,17 @@ impl ToolFamily { |
|
|
} |
|
|
} |
|
|
ToolFamily::Gnu | ToolFamily::Clang => { |
|
|
ToolFamily::Gnu | ToolFamily::Clang => { |
|
|
cmd.push_cc_arg("-g".into()); |
|
|
cmd.push_cc_arg("-g".into()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// What the flag to force frame pointers.
|
|
|
|
|
|
fn add_force_frame_pointer(&self, cmd: &mut Tool) { |
|
|
|
|
|
match *self { |
|
|
|
|
|
ToolFamily::Gnu | ToolFamily::Clang => { |
|
|
cmd.push_cc_arg("-fno-omit-frame-pointer".into()); |
|
|
cmd.push_cc_arg("-fno-omit-frame-pointer".into()); |
|
|
} |
|
|
} |
|
|
|
|
|
_ => (), |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -286,6 +296,7 @@ impl Build { |
|
|
out_dir: None, |
|
|
out_dir: None, |
|
|
opt_level: None, |
|
|
opt_level: None, |
|
|
debug: None, |
|
|
debug: None, |
|
|
|
|
|
force_frame_pointer: None, |
|
|
env: Vec::new(), |
|
|
env: Vec::new(), |
|
|
compiler: None, |
|
|
compiler: None, |
|
|
archiver: None, |
|
|
archiver: None, |
|
@ -758,6 +769,17 @@ impl Build { |
|
|
self |
|
|
self |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// Configures whether the compiler will emit instructions to store
|
|
|
|
|
|
/// frame pointers during codegen.
|
|
|
|
|
|
///
|
|
|
|
|
|
/// This option is automatically enabled when debug information is emitted.
|
|
|
|
|
|
/// Otherwise the target platform compiler's default will be used.
|
|
|
|
|
|
/// You can use this option to force a specific setting.
|
|
|
|
|
|
pub fn force_frame_pointer(&mut self, force: bool) -> &mut Build { |
|
|
|
|
|
self.force_frame_pointer = Some(force); |
|
|
|
|
|
self |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/// Configures the output directory where all object files and static
|
|
|
/// Configures the output directory where all object files and static
|
|
|
/// libraries will be located.
|
|
|
/// libraries will be located.
|
|
|
///
|
|
|
///
|
|
@ -1348,6 +1370,11 @@ impl Build { |
|
|
family.add_debug_flags(cmd); |
|
|
family.add_debug_flags(cmd); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if self.get_force_frame_pointer() { |
|
|
|
|
|
let family = cmd.family; |
|
|
|
|
|
family.add_force_frame_pointer(cmd); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// Target flags
|
|
|
// Target flags
|
|
|
match cmd.family { |
|
|
match cmd.family { |
|
|
ToolFamily::Clang => { |
|
|
ToolFamily::Clang => { |
|
@ -2227,6 +2254,10 @@ impl Build { |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fn get_force_frame_pointer(&self) -> bool { |
|
|
|
|
|
self.force_frame_pointer.unwrap_or_else(|| self.get_debug()) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
fn get_out_dir(&self) -> Result<PathBuf, Error> { |
|
|
fn get_out_dir(&self) -> Result<PathBuf, Error> { |
|
|
match self.out_dir.clone() { |
|
|
match self.out_dir.clone() { |
|
|
Some(p) => Ok(p), |
|
|
Some(p) => Ok(p), |
|
|