Skip to content

A better fix for the calling convention madness. #1403

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

Merged
merged 2 commits into from
Sep 28, 2018
Merged
Changes from 1 commit
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
14 changes: 12 additions & 2 deletions src/ir/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -514,12 +514,19 @@ const HOST_TARGET: &'static str =
fn find_effective_target(clang_args: &[String]) -> (String, bool) {
use std::env;

for opt in clang_args {
let mut args = clang_args.iter();
while let Some(opt) = args.next() {
if opt.starts_with("--target=") {
let mut split = opt.split('=');
split.next();
return (split.next().unwrap().to_owned(), true);
}

if opt == "-target" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this also handle two -?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ clang --target foo
clang-6.0: error: unsupported option '--target'

So i think not.

if let Some(target) = args.next() {
return (target.clone(), true);
}
}
}

// If we're running from a build script, try to find the cargo target.
Expand Down Expand Up @@ -576,7 +583,10 @@ If you encounter an error missing from this list, please file an issue or a PR!"
{
if let Some(ref ti) = target_info {
if effective_target == HOST_TARGET {
assert_eq!(ti.pointer_width / 8, mem::size_of::<*mut ()>());
assert_eq!(
ti.pointer_width / 8, mem::size_of::<*mut ()>(),
"{:?} {:?}", effective_target, HOST_TARGET
);
}
}
}
Expand Down