[llvm] 3a83b8b - [JITLink] Add a setProtectionFlags method to jitlink::Section.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 30 18:02:55 PDT 2021


Author: Lang Hames
Date: 2021-03-30T17:56:29-07:00
New Revision: 3a83b8b2d29e020b8ccde42d0949db45c7eb356a

URL: https://github.com/llvm/llvm-project/commit/3a83b8b2d29e020b8ccde42d0949db45c7eb356a
DIFF: https://github.com/llvm/llvm-project/commit/3a83b8b2d29e020b8ccde42d0949db45c7eb356a.diff

LOG: [JITLink] Add a setProtectionFlags method to jitlink::Section.

This allows clients to modify the memory protection settings on sections via
jitlink passes. This can be used to, for example, override the default settings
on text pages and make them Read/Write/Executable under the JIT.

Added: 
    

Modified: 
    llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h b/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
index c2335b0241987..c145c99ef0dce 100644
--- a/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
+++ b/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
@@ -596,6 +596,11 @@ class Section {
   /// Returns the protection flags for this section.
   sys::Memory::ProtectionFlags getProtectionFlags() const { return Prot; }
 
+  /// Set the protection flags for this section.
+  void setProtectionFlags(sys::Memory::ProtectionFlags Prot) {
+    this->Prot = Prot;
+  }
+
   /// Returns the ordinal for this section.
   SectionOrdinal getOrdinal() const { return SecOrdinal; }
 


        


More information about the llvm-commits mailing list