Merge pull request #5644 from roc-lang/aarch64-code-model-fix

aarch64 linux error fix
This commit is contained in:
Richard Feldman 2023-07-11 11:22:57 -04:00 committed by GitHub
commit 19fc7775c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -149,20 +149,17 @@ pub fn target_machine(
init_arch(target); init_arch(target);
let code_model = match target.architecture { // workaround for issue:
// LLVM 12 will not compile our programs without a large code model. #[cfg(all(target_arch = "aarch64", target_os = "macos"))]
// The reason is not totally clear to me, but my guess is a few special-cases in let code_model = CodeModel::Large;
// llvm/lib/Target/AArch64/AArch64ISelLowering.cpp (instructions)
// llvm/lib/Target/AArch64/AArch64Subtarget.cpp (GoT tables) #[cfg(not(all(target_arch = "aarch64", target_os = "macos")))]
// Revisit when upgrading to LLVM 13. let code_model = CodeModel::Default;
Architecture::Aarch64(..) => CodeModel::Large,
_ => CodeModel::Default,
};
Target::from_name(arch).unwrap().create_target_machine( Target::from_name(arch).unwrap().create_target_machine(
&TargetTriple::create(target_triple_str(target)), &TargetTriple::create(target_triple_str(target)),
"generic", "generic",
"", // TODO: this probably should be TargetMachine::get_host_cpu_features() to enable all features. "",
opt, opt,
reloc, reloc,
code_model, code_model,