From 6009da079419c9693fe4965ecacbd473c2553173 Mon Sep 17 00:00:00 2001 From: Gabriel Majeri Date: Wed, 26 Sep 2018 19:19:55 +0300 Subject: 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 --- src/rustllvm/RustWrapper.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/rustllvm/RustWrapper.cpp') 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"); } -- cgit 1.4.1-3-g733a5