LinuxCommandLibrary

gcc-nm-4.8

List symbols from object files (gcc-4.8)

SYNOPSIS

gcc-nm-4.8 [option]... [objfile]...

PARAMETERS

-a, --debug-syms
    Display debug symbols

-A, --print-file-name
    Precede symbol with filename

-B
    Use BSD output format

-C, --demangle[=STYLE]
    Demangle low-level symbol names

-D, --dynamic
    Display dynamic symbols

-f FORMAT
    Specify output format (bsd, posix, sysv)

--format=FORMAT
    Same as -f

-g, --extern-only
    Show only external symbols

-l, --line-numbers
    Include line numbers

-n, --numeric-sort
    Sort by symbol address

-o
    Same as -t o (octal)

-p, --no-sort
    Do not sort

-P, --portability
    POSIX.2 output

-r, --reverse-sort
    Reverse sort order

-s, --print-size
    Print size of symbols

-S, --print-size-sorted
    Sort by size

-t RADIX, --radix=RADIX
    Use radix d/D (decimal), o/O (octal), x/X (hex)

-T
    Display stab section

-u, --undefined-only
    Show only undefined symbols

-U, --defined-only
    Show only defined symbols

-V, --version
    Display version info

--target-bfd=NAME
    Specify BFD target

--help
    Show usage summary

--no-demangle
    Do not demangle symbols

DESCRIPTION

The gcc-nm-4.8 command is the nm utility from the GCC 4.8 compiler toolchain. It lists symbols (names of functions, variables, etc.) stored in object files, executable files, shared libraries, or core dumps. Symbols include addresses, types (e.g., text 'T', data 'D', bss 'B'), and names.

It supports common formats like ELF, a.out, and COFF, optimized for binaries produced by GCC 4.8. Output can be sorted, demangled, or filtered by type, making it essential for debugging, reverse engineering, and build analysis.

Typical use: inspect undefined symbols ('U') for linking issues or verify exported functions. Unlike objdump, it focuses solely on symbol tables. This version matches binutils nm but is tied to GCC 4.8's target architectures and ABIs, useful in cross-compilation environments like multilib setups on Debian/Ubuntu.

CAVEATS

Limited to formats/binutils version in GCC 4.8 (2013); may not handle newer ELF features. Deprecated in modern GCC; use system nm or eu-nm. No color output.

OUTPUT EXAMPLE

$ gcc-nm-4.8 a.out
00000000004004d6 T main
U printf
Shows address T(type) name.

ARCHIVES

Processes .a files by listing each member's symbols, prefixed with archive name.

HISTORY

Part of GCC 4.8.0 (March 2013), bundling binutils ~2.22. Developed by GNU Project for compiler toolchain; gcc-nm-VERSION packaging common in distros like Ubuntu 12.04+ for multilib support.

SEE ALSO

nm(1), objdump(1), readelf(1), gcc(1), ld(1)

Copied to clipboard