[llvm] 2f21a27 - [JITLink] Expose x86-64 pointer jump stub block construction.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Wed May 12 22:28:24 PDT 2021


Author: Lang Hames
Date: 2021-05-12T22:28:14-07:00
New Revision: 2f21a272af69321555cdc2794664b5eba8fc3276

URL: https://github.com/llvm/llvm-project/commit/2f21a272af69321555cdc2794664b5eba8fc3276
DIFF: https://github.com/llvm/llvm-project/commit/2f21a272af69321555cdc2794664b5eba8fc3276.diff

LOG: [JITLink] Expose x86-64 pointer jump stub block construction.

This can be useful for clients who want to define their own symbol for the
stub, or re-use some existing symbol.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ExecutionEngine/JITLink/x86_64.h b/llvm/include/llvm/ExecutionEngine/JITLink/x86_64.h
index d818234b2946..95ac614de82e 100644
--- a/llvm/include/llvm/ExecutionEngine/JITLink/x86_64.h
+++ b/llvm/include/llvm/ExecutionEngine/JITLink/x86_64.h
@@ -369,20 +369,30 @@ inline Symbol &createAnonymousPointer(LinkGraph &G, Section &PointerSection,
   return G.addAnonymousSymbol(B, 0, 8, false, false);
 }
 
-/// Create a jump stub that jumps via the pointer at the given symbol, returns
-/// an anonymous symbol pointing to it.
+/// Create a jump stub block that jumps via the pointer at the given symbol.
 ///
 /// The stub block will have the following default values:
 ///   alignment: 8-bit
 ///   alignment-offset: 0
 ///   address: highest allowable: (~5U)
-inline Symbol &createAnonymousPointerJumpStub(LinkGraph &G,
-                                              Section &StubSection,
-                                              Symbol &PointerSymbol) {
+inline Block &createPointerJumpStubBlock(LinkGraph &G, Section &StubSection,
+                                         Symbol &PointerSymbol) {
   auto &B =
       G.createContentBlock(StubSection, PointerJumpStubContent, ~5ULL, 1, 0);
   B.addEdge(Delta32, 2, PointerSymbol, -4);
-  return G.addAnonymousSymbol(B, 0, 6, true, false);
+  return B;
+}
+
+/// Create a jump stub that jumps via the pointer at the given symbol and
+/// an anonymous symbol pointing to it. Return the anonymous symbol.
+///
+/// The stub block will be created by createPointerJumpStubBlock.
+inline Symbol &createAnonymousPointerJumpStub(LinkGraph &G,
+                                              Section &StubSection,
+                                              Symbol &PointerSymbol) {
+  return G.addAnonymousSymbol(
+      createPointerJumpStubBlock(G, StubSection, PointerSymbol), 0, 6, true,
+      false);
 }
 
 } // namespace x86_64


        


More information about the llvm-commits mailing list