[PATCH] D82449: [llvm-readobj] - Don't crash when a broken GNU hash table is dumped with --hash-symbols.
James Henderson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 24 04:49:55 PDT 2020
jhenderson accepted this revision.
jhenderson added a comment.
This revision is now accepted and ready to land.
LGTM, with nit.
================
Comment at: llvm/tools/llvm-readobj/ELFDumper.cpp:4072
- // Try printing .gnu.hash
- if (auto GnuHash = this->dumper()->getGnuHashTable()) {
- OS << "\n Symbol table of .gnu.hash for image:\n";
- if (ELFT::Is64Bits)
- OS << " Num Buc: Value Size Type Bind Vis Ndx Name";
- else
- OS << " Num Buc: Value Size Type Bind Vis Ndx Name";
- OS << "\n";
- auto Buckets = GnuHash->buckets();
- for (uint32_t Buc = 0; Buc < GnuHash->nbuckets; Buc++) {
- if (Buckets[Buc] == ELF::STN_UNDEF)
- continue;
- uint32_t Index = Buckets[Buc];
- uint32_t GnuHashable = Index - GnuHash->symndx;
- // Print whole chain
- while (true) {
- printHashedSymbol(Obj, &DynSyms[0], Index++, StringTable, Buc);
- // Chain ends at symbol with stopper bit
- if ((GnuHash->values(DynSyms.size())[GnuHashable++] & 1) == 1)
- break;
- }
+ // Try printing .gnu.hash table.
+ const Elf_GnuHash *GnuHash = this->dumper()->getGnuHashTable();
----------------
I'd change "printing" to "printing the" if you are making the other change.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D82449/new/
https://reviews.llvm.org/D82449
More information about the llvm-commits
mailing list