Rollup merge of #66062 - smaeul:patch/pic-level, r=estebank
Configure LLVM module PIC level As of LLVM 9, this is required for 32-bit PowerPC to properly generate PLT references. Previously, only BigPIC was supported; now LLVM supports both BigPIC and SmallPIC, and there is no default value provided.
This commit is contained in:
commit
98cbe17903
@ -203,6 +203,10 @@ pub unsafe fn create_module(
|
||||
let llvm_target = SmallCStr::new(&sess.target.target.llvm_target);
|
||||
llvm::LLVMRustSetNormalizedTarget(llmod, llvm_target.as_ptr());
|
||||
|
||||
if get_reloc_model(sess) == llvm::RelocMode::PIC {
|
||||
llvm::LLVMRustSetModulePICLevel(llmod);
|
||||
}
|
||||
|
||||
if is_pie_binary(sess) {
|
||||
llvm::LLVMRustSetModulePIELevel(llmod);
|
||||
}
|
||||
|
@ -1807,6 +1807,7 @@ extern "C" {
|
||||
|
||||
pub fn LLVMRustSetComdat(M: &'a Module, V: &'a Value, Name: *const c_char);
|
||||
pub fn LLVMRustUnsetComdat(V: &Value);
|
||||
pub fn LLVMRustSetModulePICLevel(M: &Module);
|
||||
pub fn LLVMRustSetModulePIELevel(M: &Module);
|
||||
pub fn LLVMRustModuleBufferCreate(M: &Module) -> &'static mut ModuleBuffer;
|
||||
pub fn LLVMRustModuleBufferPtr(p: &ModuleBuffer) -> *const u8;
|
||||
|
@ -755,6 +755,10 @@ LLVMRustSetDataLayoutFromTargetMachine(LLVMModuleRef Module,
|
||||
unwrap(Module)->setDataLayout(Target->createDataLayout());
|
||||
}
|
||||
|
||||
extern "C" void LLVMRustSetModulePICLevel(LLVMModuleRef M) {
|
||||
unwrap(M)->setPICLevel(PICLevel::Level::BigPIC);
|
||||
}
|
||||
|
||||
extern "C" void LLVMRustSetModulePIELevel(LLVMModuleRef M) {
|
||||
unwrap(M)->setPIELevel(PIELevel::Level::Large);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user