[PATCH] D96930: [elfabi] Fix a bug when elfabi is supplied with an empty symbol table

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 17 20:59:06 PST 2021


MaskRay added a comment.

> an empty symbol table

It is not empty. It contains exactly one entry, a local symbol with index 0.



================
Comment at: llvm/lib/InterfaceStub/ELFObjHandler.cpp:306
     SymTab.Shdr.sh_offset = SymTab.Offset;
-    SymTab.Shdr.sh_info = SymTab.Size / sizeof(Elf_Sym) > 1 ? 1 : 0;
+    // Only non-local symbols are included, so sh_info should be always 1.
+    SymTab.Shdr.sh_info = 1;
----------------
// The number of local symbols, which is exactly 1 (the undefined symbol at index 0)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96930/new/

https://reviews.llvm.org/D96930



More information about the llvm-commits mailing list