[JITLink] Add a setProtectionFlags method to jitlink::Section.
authorLang Hames <lhames@gmail.com>
Wed, 31 Mar 2021 00:53:59 +0000 (17:53 -0700)
committerLang Hames <lhames@gmail.com>
Wed, 31 Mar 2021 00:56:29 +0000 (17:56 -0700)
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.

llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h

index c2335b0..c145c99 100644 (file)
@@ -596,6 +596,11 @@ public:
   /// 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; }