@@ -641,6 +641,31 @@ inline Symbol &createAnonymousPointerJumpStub(LinkGraph &G,
641641 false );
642642}
643643
644+ // / x86-64 reentry trampoline.
645+ // /
646+ // / Contains the instruction sequence for a trampoline that stores its return
647+ // / address on the stack and calls <reentry-symbol>:
648+ // / call <reentry-symbol>
649+ extern const char ReentryTrampolineContent[5 ];
650+
651+ // / Create a block of N reentry trampolines.
652+ inline Block &createReentryTrampolineBlock (LinkGraph &G,
653+ Section &TrampolineSection,
654+ Symbol &ReentrySymbol) {
655+ auto &B = G.createContentBlock (TrampolineSection, ReentryTrampolineContent,
656+ orc::ExecutorAddr (~uint64_t (7 )), 1 , 0 );
657+ B.addEdge (BranchPCRel32, 1 , ReentrySymbol, 0 );
658+ return B;
659+ }
660+
661+ inline Symbol &createAnonymousReentryTrampoline (LinkGraph &G,
662+ Section &TrampolineSection,
663+ Symbol &ReentrySymbol) {
664+ return G.addAnonymousSymbol (
665+ createReentryTrampolineBlock (G, TrampolineSection, ReentrySymbol), 0 ,
666+ sizeof (ReentryTrampolineContent), true , false );
667+ }
668+
644669// / Global Offset Table Builder.
645670class GOTTableManager : public TableManager <GOTTableManager> {
646671public:
0 commit comments