[PATCH] D123985: [ELF] Assert on invalid GOT or PLT relocations
Shoaib Meenai via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 20 10:46:38 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG610a0e8b5368: [ELF] Assert on invalid GOT or PLT relocations (authored by smeenai).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D123985/new/
https://reviews.llvm.org/D123985
Files:
lld/ELF/SyntheticSections.cpp
Index: lld/ELF/SyntheticSections.cpp
===================================================================
--- lld/ELF/SyntheticSections.cpp
+++ lld/ELF/SyntheticSections.cpp
@@ -1589,9 +1589,13 @@
}
uint32_t DynamicReloc::getSymIndex(SymbolTableBaseSection *symTab) const {
- if (needsDynSymIndex())
- return symTab->getSymbolIndex(sym);
- return 0;
+ if (!needsDynSymIndex())
+ return 0;
+
+ size_t index = symTab->getSymbolIndex(sym);
+ assert((index != 0 || type != target->gotRel && type != target->pltRel) &&
+ "GOT or PLT relocation must refer to symbol in dynamic symbol table");
+ return index;
}
RelocationBaseSection::RelocationBaseSection(StringRef name, uint32_t type,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123985.423961.patch
Type: text/x-patch
Size: 708 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220420/215b6bf1/attachment.bin>
More information about the llvm-commits
mailing list