diff options
| author | Jan-Erik Rediger <janerik@fnordig.de> | 2016-07-13 00:41:40 +0200 |
|---|---|---|
| committer | Jan-Erik Rediger <janerik@fnordig.de> | 2016-07-29 10:29:44 +0200 |
| commit | 9e706f90cbc844bb09187e01acd4ae075130bc81 (patch) | |
| tree | 61cf2b6522b113e4ea758e58bb24e362606a0f60 /src | |
| parent | dbb4178f4effa2f7686aca70d5fdfa0eff94e692 (diff) | |
| download | rust-9e706f90cbc844bb09187e01acd4ae075130bc81.tar.gz rust-9e706f90cbc844bb09187e01acd4ae075130bc81.zip | |
[LLVM-3.9] Configure PIE at the module level instead of compilation unit level
This was deleted here[1] which appears to be replaced by this[2] which is a new setPIELevel function on the LLVM module itself. [1]: http://reviews.llvm.org/D19753 [2]: http://reviews.llvm.org/D19671
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 +} |
