Project

General

Profile

Feature #10942

want nm option to not sort symbols

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

Status:
Closed
Priority:
Normal
Category:
cmd - userland programs
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:

Description

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.

History

#1

Updated by Electric Monk 6 months ago

  • Status changed from New to Closed

git commit 6f214831a73efcf0c7ce197b21d38588265645a1

commit  6f214831a73efcf0c7ce197b21d38588265645a1
Author: Robert Mustacchi <rm@joyent.com>
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 <patrick.mooney@joyent.com>
    Reviewed by: Jason King <jason.king@joyent.com>
    Reviewed by: Richard Lowe <richlowe@richlowe.net>
    Reviewed by: Andy Fiddaman <andy@omniosce.org>
    Reviewed by: Gergő Doma <domag02@gmail.com>
    Reviewed by: Peter Tribble <peter.tribble@gmail.com>
    Reviewed by: C Fraire <cfraire@me.com>
    Approved by: Dan McDonald <danmcd@joyent.com>

Also available in: Atom PDF