Skip to content

Commit 544c494

Browse files
committed
Apple: Remove redundant architecture flags
The architecture is specified for Clang with the --target option, and both -arch and -m32/-m64 are passed to GCC elsewhere (should probably be changed to -march, but that's a different issue).
1 parent 4fc7f95 commit 544c494

File tree

1 file changed

+1
-33
lines changed

1 file changed

+1
-33
lines changed

src/lib.rs

+1-33
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,6 @@ pub struct Build {
319319
enum ErrorKind {
320320
/// Error occurred while performing I/O.
321321
IOError,
322-
/// Invalid architecture supplied.
323-
ArchitectureInvalid,
324322
/// Environment variable not found, with the var in question as extra info.
325323
EnvVarNotFound,
326324
/// Error occurred while using external tools (ie: invocation of compiler).
@@ -2130,7 +2128,7 @@ impl Build {
21302128
}
21312129
}
21322130
ToolFamily::Gnu => {
2133-
if target.os == "macos" {
2131+
if target.vendor == "apple" {
21342132
let arch = map_darwin_target_from_rust_to_compiler_architecture(target);
21352133
cmd.args.push("-arch".into());
21362134
cmd.args.push(arch.into());
@@ -2529,37 +2527,7 @@ impl Build {
25292527
fn apple_flags(&self, cmd: &mut Tool) -> Result<(), Error> {
25302528
let target = self.get_target()?;
25312529

2532-
let arch = match &*target.full_arch {
2533-
"arm64" | "aarch64" | "arm64e" if target.os == "macos" => "-m64",
2534-
"x86_64" | "x86_64h" if target.os == "macos" => "-m64",
2535-
"arm" | "armv7" | "thumbv7" => "armv7",
2536-
"arm64_32" => "arm64_32",
2537-
"arm64" | "aarch64" => "arm64",
2538-
"arm64e" => "arm64e",
2539-
"armv7k" => "armv7k",
2540-
"armv7s" | "thumbv7s" => "armv7s",
2541-
"i386" | "i686" => "-m32",
2542-
"x86_64" | "x86_64h" => "-m64",
2543-
_ => {
2544-
return Err(Error::new(
2545-
ErrorKind::ArchitectureInvalid,
2546-
format!("unknown architecture {} for Apple target", target.full_arch),
2547-
));
2548-
}
2549-
};
2550-
25512530
let min_version = self.apple_deployment_target(&target);
2552-
2553-
if target.os != "macos" && target.abi != "macabi" {
2554-
if arch.starts_with('-') {
2555-
// -m32 or -m64
2556-
cmd.args.push(arch.into());
2557-
} else {
2558-
cmd.args.push("-arch".into());
2559-
cmd.args.push(arch.into());
2560-
}
2561-
}
2562-
25632531
let version_flag = match (&*target.os, &*target.abi) {
25642532
("macos", "") => Some("-mmacosx-version-min"),
25652533
("ios", "") => Some("-miphoneos-version-min"),

0 commit comments

Comments
 (0)