[PATCH] D76081: [Object] object::ELFObjectFile::dynamic_symbol_begin(): skip symbol index 0

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 25 03:13:12 PDT 2020


jhenderson added a comment.

We might want to change the iterators to use the fallible iterator pattern described in the programmer's manual <http://llvm.org/docs/ProgrammersManual.html#building-fallible-iterators-and-iterator-ranges>. That should ensure that all clients can cope with bad iteration somehow. I'm not sure I have any particular further insight into how to proceed here beyond that. I think imitating GNU's behaviour for now is a good start, and further improvements can be in later patches.



================
Comment at: llvm/test/tools/llvm-nm/dynamic.test:33
+
+## Test llvm-nm dumping ELF file without .dynsym section.
+# RUN: yaml2obj --docnum=2 %s -o %t2.o
----------------
"... without a .dynsym section"


================
Comment at: llvm/test/tools/llvm-nm/dynamic.test:65
+## Test llvm-nm dumping ELF file with malformed .dynsym section header
+## whose sh_size doesn't match dynamic symbol entries (sh_size % sizeof(Elf_Sym) != 0).
+## gnu-nm will dump as much symbol as (sh_size / sizeof(Elf_Sym) indicates. We are imitating this behavior.
----------------
doesn't match dynamic symbol entries -> isn't a maultiple of the dynamic symbol size


================
Comment at: llvm/test/tools/llvm-nm/dynamic.test:66
+## whose sh_size doesn't match dynamic symbol entries (sh_size % sizeof(Elf_Sym) != 0).
+## gnu-nm will dump as much symbol as (sh_size / sizeof(Elf_Sym) indicates. We are imitating this behavior.
+# RU: yaml2obj --docnum=4 -DBITS=32 -DSIZE=33 %s -o %t4-32.o
----------------
as much symbol -> as many symbols
`(sh_size / sizeof(Elf_Sym)` is missing a closing ')'


================
Comment at: llvm/test/tools/llvm-nm/dynamic.test:67-69
+# RU: yaml2obj --docnum=4 -DBITS=32 -DSIZE=33 %s -o %t4-32.o
+# RU: llvm-nm --dynamic %t4-32.o 2>&1 | \
+# RU:   FileCheck %s --match-full-lines --strict-whitespace -DFILE=%t4-32.o --check-prefix MALFORMED
----------------
`RU` -> `RUN`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76081





More information about the llvm-commits mailing list