Bug 118415

Summary: nm -D fails if a file has no symbols
Product: Base System Reporter: Nate Eldredge <neldredge>
Component: gnuAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed Overcome By Events    
Severity: Affects Only Me    
Priority: Normal    
Version: 6.2-RELEASE   
Hardware: Any   
OS: Any   

Description Nate Eldredge 2007-12-04 07:20:01 UTC
If nm -D is given multiple files, one of which has no symbols (perhaps because it's statically linked), it exits after processing that file without processing the rest.  This is inconvenient and probably not what was intended.

Fix: 

Probably simple, but didn't look.
How-To-Repeat: nate@vulcan:/tmp$ file /usr/bin/true /rescue/sh /usr/bin/false 
/usr/bin/true:  ELF 64-bit LSB executable, AMD x86-64, version 1 (FreeBSD), dynamically linked (uses shared libs), stripped
/rescue/sh:     ELF 64-bit LSB executable, AMD x86-64, version 1 (FreeBSD), statically linked, stripped
/usr/bin/false: ELF 64-bit LSB executable, AMD x86-64, version 1 (FreeBSD), dynamically linked (uses shared libs), stripped
nate@vulcan:/tmp$ nm -D /usr/bin/true /rescue/sh /usr/bin/false 

/usr/bin/true:
00000000005007b8 A _DYNAMIC
0000000000500910 A _GLOBAL_OFFSET_TABLE_
                 w _Jv_RegisterClasses
0000000000500940 A __bss_start
                 w __deregister_frame_info
00000000005006c0 D __progname
                 w __register_frame_info
0000000000500940 A _edata
0000000000500998 A _end
0000000000400618 T _fini
0000000000400448 T _init
                 U _init_tls
                 U atexit
0000000000500990 B environ
                 U exit

/rescue/sh:
nm: /rescue/sh: No symbols
nate@vulcan:/tmp$ nm -D /usr/bin/true  /usr/bin/false /rescue/sh 

/usr/bin/true:
00000000005007b8 A _DYNAMIC
0000000000500910 A _GLOBAL_OFFSET_TABLE_
                 w _Jv_RegisterClasses
0000000000500940 A __bss_start
                 w __deregister_frame_info
00000000005006c0 D __progname
                 w __register_frame_info
0000000000500940 A _edata
0000000000500998 A _end
0000000000400618 T _fini
0000000000400448 T _init
                 U _init_tls
                 U atexit
0000000000500990 B environ
                 U exit

/usr/bin/false:
00000000005007b8 A _DYNAMIC
0000000000500910 A _GLOBAL_OFFSET_TABLE_
                 w _Jv_RegisterClasses
0000000000500940 A __bss_start
                 w __deregister_frame_info
00000000005006c0 D __progname
                 w __register_frame_info
0000000000500940 A _edata
0000000000500998 A _end
0000000000400618 T _fini
0000000000400448 T _init
                 U _init_tls
                 U atexit
0000000000500990 B environ
                 U exit

/rescue/sh:
nm: /rescue/sh: No symbols
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2012-07-09 07:06:40 UTC
Responsible Changed
From-To: freebsd-bugs->eadler

I'll take it.
Comment 2 Eitan Adler freebsd_committer freebsd_triage 2012-11-08 20:54:33 UTC
Responsible Changed
From-To: eadler->freebsd-bugs

I won't be dealing with this PR for some time, so give it back to the 
pool
Comment 3 Baptiste Daroussin freebsd_committer freebsd_triage 2016-12-10 14:48:27 UTC
Cannot reproduce with BSD nm