Skip to content

Commit c8562e8

Browse files
[llvm-jitlink] Avoid assertion failure in make_error parameter
If GOTSym is not defined, we cannot call `GOTSym.getBlock()`. It failed with: ``` Assertion failed: (Base->isDefined() && "Not a defined symbol"), function getBlock, file JITLink.h, line 554. ```
1 parent 7eeedc1 commit c8562e8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

llvm/tools/llvm-jitlink/llvm-jitlink-elf.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@ static Expected<Symbol &> getELFStubTarget(LinkGraph &G, Block &B) {
5555
if (!E)
5656
return E.takeError();
5757
auto &GOTSym = E->getTarget();
58-
if (!GOTSym.isDefined() || !isELFGOTSection(GOTSym.getBlock().getSection()))
58+
if (!GOTSym.isDefined())
59+
return make_error<StringError>("Stubs entry in " + G.getName() +
60+
" does not point to GOT entry",
61+
inconvertibleErrorCode());
62+
if (!isELFGOTSection(GOTSym.getBlock().getSection()))
5963
return make_error<StringError>(
6064
"Stubs entry in " + G.getName() + ", \"" +
6165
GOTSym.getBlock().getSection().getName() +

0 commit comments

Comments
 (0)