[PATCH] D52810: [llvm-nm] Print an explicit "no symbols" message when an object file has no symbols

Jordan Rupprecht via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 13 14:39:35 PST 2020


rupprecht added a comment.

In D52810#1818001 <https://reviews.llvm.org/D52810#1818001>, @MaskRay wrote:

> In D52810#1817883 <https://reviews.llvm.org/D52810#1817883>, @sbc100 wrote:
>
> > I it seems that the printing of this error message only occurs with GNU nm if the object doesn't have a symbols table at all.  Have no symbols in the table does not print the error message.
> >
> >   $ touch foo.c
> >   $ gcc -c foo.c
> >   $ nm foo.o  <- no error output here.
> >   $ strip foo.o
> >   $ nm foo.o
> >   nm: foo.o: no symbols
> >
>
>
> Interesting (subtle) behavior...
>
> @rupprecht Do we know what projects parse `"no symbols"` from `llvm-nm` output?


The one case I remember fixing was an integration test that ran something like `strip <file>; nm <file> |& grep "no symbols"` to make sure the strip step actually ran. So, the second case in the example above. There were a surprising number of other uses like this that I can't find anymore.

I think we should update it to not print "no symbols" if there is an empty symbol table, then. Nice find.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D52810





More information about the llvm-commits mailing list