[PATCH] D25553: [ELF] - Check that .dynsym is present in DSO if SHT_GNU_versym section is.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 14 04:01:00 PDT 2016


grimar added inline comments.


================
Comment at: ELF/InputFiles.cpp:540
+  if (this->VersymSec && !this->Symtab)
+    error("SHT_GNU_versym should be associated with symbol table");
+
----------------
ruiu wrote:
> Can this actually happen?
I was able to get it using yaml2obj. That is the only produccer I know, but that seems enough to fix ?
Updated testcase.


================
Comment at: ELF/SymbolTable.cpp:79
     F->parseSoName();
-    if (!SoNames.insert(F->getSoName()).second)
+    if (HasError || !SoNames.insert(F->getSoName()).second)
       return;
----------------
I used this check so we able to error() instead of fatal().
fatal() is more consistent for broken inputs, but I think error() is still more preferable sometimes (at least it is better for case when lld used as a lib) ?


https://reviews.llvm.org/D25553





More information about the llvm-commits mailing list