[JITLink][ELF/x86-64] When building PLT stub, use -4 offset for PCRel32.

This is required for ELF where PCRel32 doesn't implicitly subtract 4.

No test case yet: I haven't figured out a good way to test stub
generation -- this may required extensions to jitlink-check.
This commit is contained in:
Lang Hames 2021-01-26 23:46:33 +11:00
parent 4a63e53373
commit b3e0135a6f
1 changed files with 1 additions and 1 deletions

View File

@ -70,7 +70,7 @@ public:
G.createContentBlock(getStubsSection(), getStubBlockContent(), 0, 1, 0);
// Re-use GOT entries for stub targets.
auto &GOTEntrySymbol = getGOTEntrySymbol(Target);
StubContentBlock.addEdge(PCRel32, 2, GOTEntrySymbol, 0);
StubContentBlock.addEdge(PCRel32, 2, GOTEntrySymbol, -4);
return G.addAnonymousSymbol(StubContentBlock, 0, 6, true, false);
}