Don't use CodeModel::Large anymore

This breaks certain use cases of building with --no-link
and an aarch64 target and then linking with lld (via zig cc)
(see "aarch64 linux target" thread on Zulip)

Also it seems to be unnecessary in practice on LLVM 13,
as the comment suggests!
This commit is contained in:
Richard Feldman 2023-06-21 10:46:52 -04:00
parent 9a7877cf29
commit b8d723edcb
No known key found for this signature in database
GPG key ID: CBD53FB13784937E

View file

@ -149,23 +149,13 @@ pub fn target_machine(
init_arch(target);
let code_model = match target.architecture {
// LLVM 12 will not compile our programs without a large code model.
// The reason is not totally clear to me, but my 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.
Architecture::Aarch64(..) => CodeModel::Large,
_ => CodeModel::Default,
};
Target::from_name(arch).unwrap().create_target_machine(
&TargetTriple::create(target_triple_str(target)),
"generic",
"", // TODO: this probably should be TargetMachine::get_host_cpu_features() to enable all features.
"",
opt,
reloc,
code_model,
CodeModel::Default,
)
}