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 -mcpu option for 32-bit x86 targets #59

Merged
merged 1 commit into from
Sep 11, 2022
Merged
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
6 changes: 6 additions & 0 deletions src/zig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ impl Zig {
.map(|x| x.contains("windows-msvc"))
.unwrap_or_default();
let is_arm = target.map(|x| x.starts_with("arm")).unwrap_or_default();
let is_i386 = target.map(|x| x.starts_with("i386")).unwrap_or_default();
let is_macos = target.map(|x| x.contains("macos")).unwrap_or_default();

let rustc_ver = rustc_version::version()?;
Expand Down Expand Up @@ -119,6 +120,9 @@ impl Zig {
if is_arm && arg.starts_with("-march=") {
return None;
}
if is_i386 && arg.starts_with("-march=") {
return None;
}
Some(arg.to_string())
};
let has_undefined_dynamic_lookup = |args: &[String]| {
Expand Down Expand Up @@ -564,6 +568,8 @@ pub fn prepare_zig_linker(target: &str) -> Result<ZigWrapper> {
},
"armv5te" => ("arm", "-mcpu=generic+soft_float+strict_align"),
"armv7" => ("arm", "-mcpu=generic+v7a+vfp3-d32+thumb2-neon"),
"i586" => ("i386", "-mcpu=pentium"),
"i686" => ("i386", "-mcpu=pentium4"),
_ => (arch.as_str(), ""),
};
format!(
Expand Down