[PATCH] D76081: [Object] object::ELFObjectFile::dynamic_symbol_begin(): skip symbol index 0
Xing via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 12 11:23:49 PDT 2020
Higuoxing created this revision.
Higuoxing added reviewers: grimar, jhenderson, MaskRay.
Herald added subscribers: llvm-commits, arphaman.
Herald added a project: LLVM.
Higuoxing edited the summary of this revision.
Note: This revision is very similar to D62296 <https://reviews.llvm.org/D62296>.
In D75756 <https://reviews.llvm.org/D75756>, we need `getDynamicSymbolIterators()` to skip first NULL symbol in `.dynsym`. And I believe it might be worth pointing this out in a separate patch to gather you experts' opinions.
I have checked that current code base will not be affected by this change.
dynamic_symbol_begin()
|- dynamic_symbol_end(): Ok
`- getDynamicSymbolIterators()
|- addDynamicElfSymbols(): llvm/tools/llvm-objdump/llvm-objdump.cpp, Line 934
| Ok, NULL symbol will be omitted by Line 945-947
| StringRef Name = unwrapOrError(Symbol.getName(), Obj->getName());
| if (Name.empty()) continue;
|- dumpSymbolNameFromObject(): llvm/tools/llvm-nm/llvm-nm.cpp, Line 1192
| There's no test for dumping dynamic debugging symbol. This patch helps improve llvm-nm behavior. (we should add test for this later)
`- computeSymbolSizes(): llvm/lib/Object/SymbolSize.cpp, Line 52
|- OProfileJITEventListener::notifyObjectLoaded(): llvm/lib/ExecutionEngine/OProfileJIT/OProfileJITEventListener.cpp, Line 92
| Ok, NULL symbol will be omitted by Line 94-95
| if (!Sym.getType() || *Sym.getType() != SF_Function) continue;
|- IntelJITEventListener::notifyObjectLoaded(): llvm/lib/ExecutionEngine/IntelJITEvents/IntelJITEventListener.cpp, Line 98
| Ok, NULL symbol will be omitted by Line 124-126 (same as previous one)
|- PerfJITEventListener::notifyObjectLoaded(): llvm/lib/ExecutionEngine/PerfJITEvents/PerfJITEventListener.cpp, Line 244
| Ok, NULL symbol will be omitted by Line 254-256, (same as previous one)
|- SymbolizableObjectFile::create(): llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp, Line 73
| Ok, NULL symbol will be omitted by Line 75
| res->addSymbol()
| In addSymbol(), Line 167-168
| if (!Sec || (Obj && Obj->section_end() == *Sec)) return std::error_code();
|- dumpCXXData(): llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp, Line 189
| Ok, NULL symbol will be omitted by Line 199-202
| object::section_iterator SecI = *SecIOrErr;
| // Skip external symbols.
| if (SecI == Obj->section_end())
| continue;
`- printLineInfoForInput(): llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp, Line 418
Ok, NULL symbol will be omitted by Line 430-477
if (Type == object::SymbolRef::ST_Function) {
...
}
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D76081
Files:
llvm/include/llvm/Object/ELFObjectFile.h
Index: llvm/include/llvm/Object/ELFObjectFile.h
===================================================================
--- llvm/include/llvm/Object/ELFObjectFile.h
+++ llvm/include/llvm/Object/ELFObjectFile.h
@@ -1019,7 +1019,9 @@
template <class ELFT>
elf_symbol_iterator ELFObjectFile<ELFT>::dynamic_symbol_begin() const {
- DataRefImpl Sym = toDRI(DotDynSymSec, 0);
+ DataRefImpl Sym =
+ toDRI(DotDynSymSec,
+ DotDynSymSec && DotDynSymSec->sh_size >= sizeof(Elf_Sym) ? 1 : 0);
return symbol_iterator(SymbolRef(Sym, this));
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76081.249991.patch
Type: text/x-patch
Size: 553 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200312/c4075fbd/attachment.bin>
More information about the llvm-commits
mailing list