diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_llvm/lib.rs | 1 | ||||
| -rw-r--r-- | src/librustc_trans/context.rs | 1 | ||||
| -rw-r--r-- | src/rustllvm/PassWrapper.cpp | 10 |
3 files changed, 12 insertions, 0 deletions
diff --git a/src/librustc_llvm/lib.rs b/src/librustc_llvm/lib.rs index f14df2a7b48..4fc866752eb 100644 --- a/src/librustc_llvm/lib.rs +++ b/src/librustc_llvm/lib.rs @@ -2155,6 +2155,7 @@ extern { pub fn LLVMRustSetComdat(M: ModuleRef, V: ValueRef, Name: *const c_char); pub fn LLVMRustUnsetComdat(V: ValueRef); + pub fn LLVMRustSetModulePIELevel(M: ModuleRef); } // LLVM requires symbols from this library, but apparently they're not printed diff --git a/src/librustc_trans/context.rs b/src/librustc_trans/context.rs index aa60110fab3..2437fa954d1 100644 --- a/src/librustc_trans/context.rs +++ b/src/librustc_trans/context.rs @@ -352,6 +352,7 @@ unsafe fn create_context_and_module(sess: &Session, mod_name: &str) -> (ContextR let llvm_target = sess.target.target.llvm_target.as_bytes(); let llvm_target = CString::new(llvm_target).unwrap(); llvm::LLVMRustSetNormalizedTarget(llmod, llvm_target.as_ptr()); + llvm::LLVMRustSetModulePIELevel(llmod); (llcx, llmod) } diff --git a/src/rustllvm/PassWrapper.cpp b/src/rustllvm/PassWrapper.cpp index 64edc79a86a..edf83bf80d6 100644 --- a/src/rustllvm/PassWrapper.cpp +++ b/src/rustllvm/PassWrapper.cpp @@ -188,7 +188,10 @@ LLVMRustCreateTargetMachine(const char *triple, } TargetOptions Options; +#if LLVM_VERSION_MINOR <= 8 Options.PositionIndependentExecutable = PositionIndependentExecutable; +#endif + Options.FloatABIType = FloatABI::Default; if (UseSoftFloat) { Options.FloatABIType = FloatABI::Soft; @@ -411,3 +414,10 @@ extern "C" LLVMTargetDataRef LLVMRustGetModuleDataLayout(LLVMModuleRef M) { return wrap(&unwrap(M)->getDataLayout()); } + +extern "C" void +LLVMRustSetModulePIELevel(LLVMModuleRef M) { +#if LLVM_VERSION_MINOR >= 9 + unwrap(M)->setPIELevel(PIELevel::Level::Default); +#endif +} |
