[llvm] c8562e8 - [llvm-jitlink] Avoid assertion failure in make_error parameter
Stefan Gränitz via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 24 06:11:24 PST 2023
Author: Stefan Gränitz
Date: 2023-11-24T15:04:00+01:00
New Revision: c8562e81bce36f45f03ba059a58c3a1762a77ebe
URL: https://github.com/llvm/llvm-project/commit/c8562e81bce36f45f03ba059a58c3a1762a77ebe
DIFF: https://github.com/llvm/llvm-project/commit/c8562e81bce36f45f03ba059a58c3a1762a77ebe.diff
LOG: [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.
```
Added:
Modified:
llvm/tools/llvm-jitlink/llvm-jitlink-elf.cpp
Removed:
################################################################################
diff --git a/llvm/tools/llvm-jitlink/llvm-jitlink-elf.cpp b/llvm/tools/llvm-jitlink/llvm-jitlink-elf.cpp
index 7881660d1a73851..4b7b3f9be701785 100644
--- a/llvm/tools/llvm-jitlink/llvm-jitlink-elf.cpp
+++ b/llvm/tools/llvm-jitlink/llvm-jitlink-elf.cpp
@@ -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() +
More information about the llvm-commits
mailing list