Bug 29135 - nm: add --no-weak
Summary: nm: add --no-weak
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2022-05-10 04:16 UTC by Fangrui Song
Modified: 2022-05-18 12:16 UTC (History)
2 users (show)

See Also:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description Fangrui Song 2022-05-10 04:16:50 UTC
Since 2018-07 (https://reviews.llvm.org/D48751), https://llvm.org/docs/CommandGuide/llvm-nm.html supports --no-weak for listing non-weak symbols. The short option -W is added as an alias. I think the option is mildly useful and perhaps binutils can consider adding it as well.

llvm-nm aims for being compatible with GNU nm, so taking -W without asking for binutils opinions was not great. (Due to the recent -U conflict, llvm-nm folks should be more aware of using short options and will handle such issues better.)
Comment 1 Sourceware Commits 2022-05-18 12:16:01 UTC
The master branch has been updated by Nick Clifton <nickc@sourceware.org>:


commit 2c3cc81e068464b5a3d5bf19a9cf3cf3dd6b7b55
Author: Nick Clifton <nickc@redhat.com>
Date:   Wed May 18 13:15:22 2022 +0100

    Add a --no-weak option to nm.
            PR 29135
            * nm.c (non_weak): New variable.
            (filter_symbols): When non-weak is true, ignore weak symbols.
            (long_options): Add --no-weak.
            (usage): Mention --no-weak.
            (main): Handle -W/--no-weak.
            * doc/binutils.texi: Document new feature.
            * NEWS: Mention the new feature.
            * testsuite/binutils-all/nm.exp: Add test of new feature.
            * testsuite/binutils-all/no-weak.s: New test source file.
Comment 2 Nick Clifton 2022-05-18 12:16:58 UTC
I have added the --no-weak option to nm.