Feature #10942

want nm option to not sort symbols

Added by Robert Mustacchi 7 months ago. Updated 6 months ago.

cmd - userland programs
Start date:
Due date:
% Done:


Estimated time:


Sometimes when using nm, you want to output symbols just based on the order in the symbol table. While it's possible to use sed and then sort to get there, it'd be useful to add support for this by default. I suggest we use the '-i' flag for index. This complements the -v and -n options which sort by values and names. Other nm implementations use -p for that, but we use -p for something else entirely. The nm option set is pretty arbitrary.

To test the -i option I went through and just used nm on several different files and made sure the index was in the right order. I also verified that combining -i with -n or -v created the appropriate warnings.

Next, I decided to regression test every option due to some of the clean up involved in this change. For that I went and used every option to nm on libraries like libgcc_s/libstdc++ and made sure that we had the same output for the other options. I used each option on its own.



Updated by Electric Monk 6 months ago

  • Status changed from New to Closed

git commit 6f214831a73efcf0c7ce197b21d38588265645a1

commit  6f214831a73efcf0c7ce197b21d38588265645a1
Author: Robert Mustacchi <>
Date:   2019-06-03T13:09:10.000Z

    10942 want nm option to not sort symbols
    10943 nm should be smatch and CERRWARN clean
    Reviewed by: Patrick Mooney <>
    Reviewed by: Jason King <>
    Reviewed by: Richard Lowe <>
    Reviewed by: Andy Fiddaman <>
    Reviewed by: Gergő Doma <>
    Reviewed by: Peter Tribble <>
    Reviewed by: C Fraire <>
    Approved by: Dan McDonald <>

Also available in: Atom PDF