about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorGabriel Majeri <gabriel.majeri6@gmail.com>2018-09-26 19:19:55 +0300
committerGabriel Majeri <gabriel.majeri6@gmail.com>2018-10-11 21:11:00 +0300
commit6009da079419c9693fe4965ecacbd473c2553173 (patch)
tree6d57deb8d993023a394c62d3fcc23cdd84319453 /src/rustllvm/RustWrapper.cpp
parent2243fabd8f25c46a4a76199f10a2cd9adbb5c418 (diff)
downloadrust-6009da079419c9693fe4965ecacbd473c2553173.tar.gz
rust-6009da079419c9693fe4965ecacbd473c2553173.zip
Support for disabling the PLT on ELF targets
Disable the PLT where possible to improve performance
for indirect calls into shared libraries.

This optimization is enabled by default where possible.

- Add the `NonLazyBind` attribute to `rustllvm`:
  This attribute informs LLVM to skip PLT calls in codegen.

- Disable PLT unconditionally:
  Apply the `NonLazyBind` attribute on every function.

- Only enable no-plt when full relro is enabled:
  Ensures we only enable it when we have linker support.

- Add `-Z plt` as a compiler option
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
-rw-r--r--src/rustllvm/RustWrapper.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp
index f1ab1d4ddfa..2b1bf1c0290 100644
--- a/src/rustllvm/RustWrapper.cpp
+++ b/src/rustllvm/RustWrapper.cpp
@@ -178,6 +178,8 @@ static Attribute::AttrKind fromRust(LLVMRustAttribute Kind) {
     return Attribute::SanitizeAddress;
   case SanitizeMemory:
     return Attribute::SanitizeMemory;
+  case NonLazyBind:
+    return Attribute::NonLazyBind;
   }
   report_fatal_error("bad AttributeKind");
 }