Auto merge of #83044 - kubo39:set-llvm-code-model, r=nikic
Add support for storing code model to LLVM module IR This patch avoids undefined behavior by linking different object files. Also this would it could be propagated properly to LTO. See https://reviews.llvm.org/D52322 and https://reviews.llvm.org/D52323. This patch is based on https://github.com/rust-lang/rust/pull/74002
This commit is contained in:
commit
84c08f82b4
5 changed files with 38 additions and 1 deletions
|
@ -1264,6 +1264,14 @@ extern "C" void LLVMRustSetModulePIELevel(LLVMModuleRef M) {
|
|||
unwrap(M)->setPIELevel(PIELevel::Level::Large);
|
||||
}
|
||||
|
||||
extern "C" void LLVMRustSetModuleCodeModel(LLVMModuleRef M,
|
||||
LLVMRustCodeModel Model) {
|
||||
auto CM = fromRust(Model);
|
||||
if (!CM.hasValue())
|
||||
return;
|
||||
unwrap(M)->setCodeModel(*CM);
|
||||
}
|
||||
|
||||
// Here you'll find an implementation of ThinLTO as used by the Rust compiler
|
||||
// right now. This ThinLTO support is only enabled on "recent ish" versions of
|
||||
// LLVM, and otherwise it's just blanket rejected from other compilers.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue