Bug 27408 - nm: Have a way to suppress 'no symbols'
Summary: nm: Have a way to suppress 'no symbols'
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.37
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-12 17:52 UTC by Fangrui Song
Modified: 2021-08-15 03:16 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fangrui Song 2021-02-12 17:52:59 UTC
In https://reviews.llvm.org/D83152 , someone wants to have an llvm-nm option to suppress 'no symbols' diagnostic when the symbol table is absent. I think this is an area binutils may likely have an opinion so I am asking here. I can think of several choices.

* Add --no-warning-for-no-symbols.
  macOS libtool has an option named -no_warning_for_no_symbols
* Add --quiet
* Drop 'no symbols' without an option. This has potential risk to make existing scripts expecting the output unhappy.

nm can also choose to do nothing but promise that it will not intentionally be incompatible with llvm-nm, i.e. if llvm-nm picks --quiet, nm will not pick --quiet for other purposes.
Comment 2 Nick Clifton 2021-02-26 14:47:01 UTC
(In reply to Fangrui Song from comment #1)
> Patch: https://sourceware.org/pipermail/binutils/2021-February/115340.html

Patch approved - please apply.

For some strange reason I cannot find your posts for this patch in my email queue, so I was unaware that you had asked for a review.  So sorry for the delay and please go ahead and apply.

Cheers
  Nick
Comment 3 Sourceware Commits 2021-02-26 17:27:18 UTC
The master branch has been updated by Fangrui Song <maskray@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7fe1b1388ff80f10e932cde5d82d7268742ef336

commit 7fe1b1388ff80f10e932cde5d82d7268742ef336
Author: Fangrui Song <maskray@google.com>
Date:   Fri Feb 26 09:25:45 2021 -0800

    nm: Add --quiet to suppress "no symbols" diagnostic
    
            PR binutils/27408
            * readelf.c (quiet): New option flag.
            (enum long_option_values): New enum to hold long option value.
            (long_options): Add --quiet.
            (usage): Mention --quiet.
            (display_rel_file): If quiet is enabled, suppress "no symbols".
            (main): Handle the new option.
            * NEWS: Mention --quiet.
            * docs/binutils.texi: Document --quiet.
Comment 4 Fangrui Song 2021-08-15 03:16:08 UTC
Implemented for binutils 2.37