nm and objdump when no symbols

Nick Clifton nickc@redhat.com
Sat Aug 10 06:41:00 GMT 2002

Hi Alan,

> nm and objdump both display "filename: no symbols" to stderr when
> given an object without any syms.  Why?  In particular, why print
> to stderr?

So that if the command is part of a pipe, the error message will be
seen.  Imagine the situation where you are doing:

        objdump -dw -mi8086 dumo.o | grep foo

Without the error message going to stderr you might think that there
are no occurences of the symbol 'foo', rather than realising that you
made a typo and that you actually wanted to examine the contents of
the file 'foo.o' and not dump.o.

> I propose changing the behavior to printing the "no symbols"
> message only when a symbol table dump is requested,

This seems very reasonable.

> and printing the message to stdout.  Objections?

I think that error messages should be sent to stderr and not stdout.


More information about the Binutils mailing list