Merge remote-tracking branch 'origin/main' into linux64

This commit is contained in:
Richard Feldman 2023-07-11 11:30:02 -04:00
commit 1d5c5b25ec
No known key found for this signature in database
GPG key ID: F1F21AA5B1D9E43B
328 changed files with 11845 additions and 9244 deletions

View file

@ -87,12 +87,12 @@ pub fn target_zig_str(target: &Triple) -> &'static str {
architecture: Architecture::X86_64,
operating_system: OperatingSystem::Darwin,
..
} => "x86_64-apple-darwin",
} => "x86_64-macos-gnu",
Triple {
architecture: Architecture::Aarch64(_),
operating_system: OperatingSystem::Darwin,
..
} => "aarch64-apple-darwin",
} => "aarch64-macos-gnu",
_ => internal_error!("TODO gracefully handle unsupported target: {:?}", target),
}
}
@ -149,13 +149,27 @@ pub fn target_machine(
init_arch(target);
// We used to have a problem that LLVM 12 would not compile our programs without a large code model.
// The reason was not totally clear to us, but one guess is a few special-cases in
// llvm/lib/Target/AArch64/AArch64ISelLowering.cpp (instructions)
// llvm/lib/Target/AArch64/AArch64Subtarget.cpp (GoT tables)
// Revisit when upgrading to LLVM 13.
//
// Most recently, we seem to only see this problem on macOS ARM64; removing this
// failed macOS CI here: https://github.com/roc-lang/roc/pull/5644
#[cfg(all(target_arch = "aarch64", target_os = "macos"))]
let code_model = CodeModel::Large;
#[cfg(not(all(target_arch = "aarch64", target_os = "macos")))]
let code_model = CodeModel::Default;
Target::from_name(arch).unwrap().create_target_machine(
&TargetTriple::create(target_triple_str(target)),
"generic",
"",
opt,
reloc,
CodeModel::Default,
code_model,
)
}