Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

nm - write the name list of an object file

&pagelevel(4)&pagelevel

The utility nm displays symbolic information appearing in the object file, executable file or object-file library named by file.

If no symbolic information is available for a valid input file, the nm utility will report that fact, but not consider it an error condition.


Syntax


nm[ -APv][ -efox][ -g| -u][ -t format] file...

options:

-A

Write the full pathname or library name of an object on each line.

-e

Write only external (global) and static symbol information.

-f

Produce full output. Write redundant symbols (.text, .data and .bss), normally suppressed.

-g

Write only external (global) symbols.

-o

Write numeric values in octal (equivalent to -t o)

-P

Write information in a portable output file, as specified in Standard output.

-t format

Write each numeric value in the specified format. The format is dependent on the single character used as the format option-argument:

dThe offset is written in decimal (default)
oThe offset is written in octal (corresponds to -o)

x

The offset is written in hexadecimal (corresponds to -x)

-u

Write only undefined symbols.

-v

Sort output by value instead of alphabetically.

-x

Write numeric values in hexadecimal (equivalent to -t x).

file

A pathname of an object file, executable file or object-file library.

Standard output

If symbolic information is present in the input files, for each file or for each member of an archive, the nm utility will write the following information to standard output:

  • Library or object name, if -A is specified.

  • Symbol name.

  • Symbol type, which is one of the following single characters: 

    AGlobal absolute symbol
    aLocal absolute symbol
    BGlobal "bss" symbol
    bLocal "bss" symbol
    DGlobal data symbol
    dLocal data symbol
    TGlobal text symbol
    tLocal text symbol

    U

    Undefined symbol

  • Value of the symbol

  • The size in bytes associated with the symbol, if applicable.


If the -P option is specified, the previous information is displayed using the following portable format. The three versions differ depending on whether was specified in decimal, octal or hexadecimal format.
If -t is not specified, the format is as if -t x has been specified.


"%s%s %s %d %d\n", library-/object name , name , type , value , size

"%s%s %s %o %o\n", library-/object name , name , type , value , size

"%s%s %s %x %x\n", library-/object name , name , type , value , size


where library-/object name is formatted as follows:


  • If -A is not specified, library-/objekt name is an empty string.

  • If -A is specified and the corresponding file operand does not name a library:
    "%s: ", file

  • If -A is specified and the corresponding file operand names a library. In this case, object file names the object in the library containing the symbol being described:
    "%s[%s]: ", file , objekt file

Locale

The following environment variables affect the execution of nm:

LANG

Provide a default value for the internationalization variables that are unset or null. If LANG is unset of null, the corresponding value from the implementation-specific default locale will be used. If any of the internationalization variables contains an invalid setting, the utility will behave as if none of the variables had been defined.

LC_ALL

If set to a non-empty string value, override the values of all the other internationalization variables.

LC_COLLATE

Determine the locale for character collation information for the symbol name and symbol-value collation sequence.

LC_CTYPE

Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters in arguments and input files), the classification of characters as upper- to lower-case, and the mapping of characters from one case to the other.

LC_MESSAGES

Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.

NLSPATH

Determine the location of message catalogs for the processing of LC_MESSAGES.

See also

ar

c89 [5]