[PATCH] D41657: Do not look up symbol names when n_strx == 0

Michael Trent via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 2 11:36:49 PST 2018

mtrent marked 2 inline comments as done.
mtrent added a comment.

In https://reviews.llvm.org/D41657#965799, @davide wrote:

> I wonder whether you can use something like `yaml2obj` to craft the object? (or, assuming it's valid, `llvm-mc`)?
>  That would improve the readability a lot IMHO.
>  If not, can you at least add comments to the test (e.g. source file + compiler/linker version etc..) in case we need to regenerate this in the future?

llvm-objdump and llvm-nm commonly use binary tests when working with bad binaries, so this test isn't unusual. It's not clear to me how you would regenerate this mach-o with lld.

Comment at: lib/Object/MachOObjectFile.cpp:1662-1665
+  if (Entry.n_strx == 0) {
+    // contents of the StringTable at n_strx 0 are not defined
+    return StringRef();
+  }
davide wrote:
> No `{}` around single line ifs.
will fix.

Comment at: test/tools/llvm-nm/X86/macho-dwarf.test:2
+# RUN: llvm-nm -ap %p/Inputs/macho-dwarf-x86_64 | cat -e | FileCheck %s
davide wrote:
> Do you need `cat` ? Can't you just pipe the nm output to `FileCheck`?
Good point, will fix.


More information about the llvm-commits mailing list