Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

cc(1)

dump(1)

ld(1)

a.out(4)

ar(4)

nm(1)                                                                 nm(1)

NAME
     nm - print name list of an object file

SYNOPSIS
     nm [option...] file...

DESCRIPTION
     The nm command (name list) displays the symbol table of each ELF or
     COFF object file, specified by file. The file may be a relocatable or
     absolute ELF or COFF object file; or it may be an archive of relocat-
     able or absolute ELF or COFF object files. For each symbol, the fol-
     lowing information will be printed:

     Lib/Obj
          Library or object name (only for -A)

     Name The name of the symbol.

     Type Symbol type:

          A    global absolute symbol

          a    local absolute symbol

          B    global bss symbol

          b    local bss symbol

          D    global data symbol

          d    local data symbol

          T    global text symbol

          t    local text symbol

          U    undefined symbol

     Value
          The value of the symbol is one of the following: a section offset
          for defined symbols in a relocatable file; alignment constraints
          for symbols whose section index is SHNCOMMON; a virtual address
          in executable and dynamic library files.

     Size The size in bytes of the associated object.

     Index
          The index of the symbol, which appears in brackets.

     Bind The symbol's binding attributes. OCAL symbols have a scope lim-
          ited to the object file containing their definition; GLOBAL sym-
          bols are visible to all object files being combined; and WEAK



Page 1                       Reliant UNIX 5.44                Printed 11/98

nm(1)                                                                 nm(1)

          symbols are essentially global symbols with a lower precedence
          than GLOBAL.

     Other
          A field reserved for future use, currently containing 0.

     Shndx
          Except for three special values, this is the section header table
          index in relation to which the symbol is defined. The following
          special values exist: ABS indicates the symbol's value will not
          change through relocation; COMMON indicates an unallocated block
          and the value provides alignment constraints; and UNDEF indicates
          an undefined symbol.









































Page 2                       Reliant UNIX 5.44                Printed 11/98

nm(1)                                                                 nm(1)

     The output of nm may be controlled using the following options:

     -A   Print the full pathname or library name of an object on each line

     -e   See NOTES section.

     -f   See NOTES section.

     -g   Print external symbols information only.

     -h   Do not display the output heading data.

     -l   Distinguishes between WEAK and GLOBAL symbols by appending a * to
          the key letter for WEAK symbols.

     -n   Sort external symbols by name before they are printed.

     -o   Print the value and size of a symbol in octal instead of decimal
          (same as -t o).

     -p   Produce terse output that can be parsed easily. Each symbol name
          is preceded by its value (blanks if undefined) and one of the
          letters U (undefined), N (symbol has no type), D (data object
          symbol), T (text symbol), S (section symbol), or F (file symbol).
          If the symbol's binding attribute is LOCAL, the key letter is
          lower case; if the symbol's binding attribute is WEAK, the key
          letter is upper case; if the -l modifier is specified, the upper
          case key letter is followed by a *; if the symbol's binding
          attribute is GLOBAL, the key letter is upper case.

     -P   Print output in a portable format. If the -A option is also
          specified, a line in the following format is displayed for each
          symbol:

          <Library name/object name> <Symbol name> <Type> <Value> <Size>

          If -A is not specified, the library or object name is written to
          a separate line. If the -t is not specified, -t x is accepted
          implicitly.

     -r   Prepend the name of the object file or archive to each output
          line.

     -t format
          Specifies the output format of a symbol value and size:

          d    The value and size are written in decimal format (default)

          o    The value and size are written in octal format (same as -o)

          x    The value and size are written in hexadecimal format (same
               as -x)


Page 3                       Reliant UNIX 5.44                Printed 11/98

nm(1)                                                                 nm(1)

     -T   See NOTES section.

     -u   Print undefined symbols only.

     -v   Sort external symbols by value before they are printed (instead
          of alphabetically).

     -V   Prints the version of the nm command executing on the standard
          error output. (Should not be used in portable scripts.)

     -x   Print the value and size of a symbol in hexadecimal instead of
          decimal (same as -t x).

     --   If the first filename begins with a dash (-), the end of the
          command-line options must be marked with --.

     Options may be used in any order, either singly or in combination.
     When conflicting options are specified (such as nm -v -n) the first is
     taken and the second ignored with a warning message to the user.



































Page 4                       Reliant UNIX 5.44                Printed 11/98

nm(1)                                                                 nm(1)

NOTES
     The following options are obsolete because of changes to the object
     file format.

     -e   Print only external and static symbols.

          Automatic symbols no longer appear in the symbol table. They do
          appear in the debugging information produced by cc -g, which may
          be examined using dump(1).

     -f   Produces full output. Redundant symbols (such as .text, .data,
          etc). which existed previously do not exist and producing full
          output will be identical to the default output.

     -T   By default, nm prints the entire name of the symbols listed.
          Since symbol names have been moved to the last column, the prob-
          lem of overflow is removed and it is no longer necessary to trun-
          cate the symbol name.

LOCALE
     The language of the message texts is governed by the environment vari-
     able LCALL, LCMESSAGES or LANG.

     When the default is set, the system behaves as if it were not interna-
     tionalized, i.e. the message texts are in English. You must change one
     of these variables in order to change the language of the message
     texts.

     Detailed information on the dependencies of the environment variables
     and on internationalization in general can be found in the manual
     "Programmer's Guide: Internationalization - Localization". Refer also
     to environ(5) for information on setting the user environment.

SEE ALSO
     cc(1), dump(1), ld(1), a.out(4), ar(4).



















Page 5                       Reliant UNIX 5.44                Printed 11/98

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026