[PATCH] D63779: [llvm-objdump] Warn if no user specified sections (-j) are found.

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 1 02:45:15 PDT 2019


jhenderson added a comment.

Not that I think it is a likely case, but does GNU objdump allow -j with an empty section name? In other words, can you do this: `objdump -D -j "" test.o` to dump the contents of all unnamed sections, for example? Since the section index 0 section always has no name, we don't need to (and shouldn't) warn for this case, so we need a test for that too.



================
Comment at: llvm/tools/llvm-objdump/llvm-objdump.cpp:349
     return false;
-  return is_contained(FilterSections, String);
+  // StringSet does not allow empty key so avoid adding section 0 here.
+  if (!SecName.empty())
----------------
Actually, it's theoretically valid for other sections to have no name too, so perhaps the comment needs updating to say "so avoid adding sections with no name (such as the section with index 0) here". I'd also recommend making the index term explicit like I just did.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63779





More information about the llvm-commits mailing list