[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.
```
This commit is contained in:
Stefan Gränitz
2023-10-18 14:27:51 +02:00
parent 7eeedc124f
commit c8562e81bc

View File

@@ -55,7 +55,11 @@ static Expected<Symbol &> getELFStubTarget(LinkGraph &G, Block &B) {
if (!E)
return E.takeError();
auto &GOTSym = E->getTarget();
if (!GOTSym.isDefined() || !isELFGOTSection(GOTSym.getBlock().getSection()))
if (!GOTSym.isDefined())
return make_error<StringError>("Stubs entry in " + G.getName() +
" does not point to GOT entry",
inconvertibleErrorCode());
if (!isELFGOTSection(GOTSym.getBlock().getSection()))
return make_error<StringError>(
"Stubs entry in " + G.getName() + ", \"" +
GOTSym.getBlock().getSection().getName() +