Bug 4275 - nm does not list dynamic symbols on AIX
Summary: nm does not list dynamic symbols on AIX
Status: NEW
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: pre-2.15
: P2 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-03-26 01:22 UTC by Kyle Stemen
Modified: 2021-11-20 07:28 UTC (History)
2 users (show)

See Also:
Host: powerpc-ibm-aix5.3.0.0
Target: powerpc-ibm-aix5.3.0.0
Build: powerpc-ibm-aix5.3.0.0
Last reconfirmed:


Attachments
The hello world program from AIX already stripped (15.12 KB, application/octet-stream)
2007-03-26 01:23 UTC, Kyle Stemen
Details
hello world source code (79 bytes, text/plain)
2007-03-26 01:23 UTC, Kyle Stemen
Details
likely incomplete patch (762 bytes, patch)
2021-11-20 07:28 UTC, Alan Modra
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kyle Stemen 2007-03-26 01:22:09 UTC
This repros with the nm from the AIX toolbox (version 2.14), but it also repros
with a copy of nm I built as part of a cross compiler (version 2.17 from FC6
64bit to AIX 5.3.0.0).

On Linux, even after a binary has been stripped, the dynamic symbols can still
be retrieved. The following commands show this with hello world:
[kyle@ryoko ~]$ gcc hello.c -o hello
[kyle@ryoko ~]$ strip hello
[kyle@ryoko ~]$ nm hello
nm: hello: no symbols
[kyle@ryoko ~]$ nm -D hello
                 w __gmon_start__
                 U __libc_start_main
                 U puts
[kyle@ryoko ~]$ 

On AIX, nm does not display these symbols, even though the native dump program
can still access them:
[testuser@aix64build ~]$ gcc hello.c -o hello
[testuser@aix64build ~]$ /opt/freeware/bin/nm hello | head
00000000100001f0 t 
00000000100069fc T .$RESTF14
0000000010006a00 T .$RESTF15
0000000010006a04 T .$RESTF16
0000000010006a08 T .$RESTF17
0000000010006a0c T .$RESTF18
0000000010006a10 T .$RESTF19
0000000010006a14 T .$RESTF20
0000000010006a18 T .$RESTF21
0000000010006a1c T .$RESTF22
[testuser@aix64build ~]$ /opt/freeware/bin/nm hello -D | head
/opt/freeware/bin/nm: hello: No symbols
[testuser@aix64build ~]$ strip hello
[testuser@aix64build ~]$ /opt/freeware/bin/nm hello | head
/opt/freeware/bin/nm: hello: no symbols
[testuser@aix64build ~]$ /opt/freeware/bin/nm hello -D | head
/opt/freeware/bin/nm: hello: No symbols
[testuser@aix64build ~]$ dump -T hello       

hello:

                        ***Loader Section***

                        ***Loader Symbol Table Information***
[Index]      Value      Scn     IMEX Sclass   Type           IMPid Name

[0]     0x20000b9c   0x0002     0x00   0x05    0x1          0x0000 __rtinit
[1]     0x0000e008   0x0000     0x08   0x07    0x0          0x0001 ___memset
[2]     0x0000f000   0x0000     0x08   0x07    0x0          0x0001 ___memmove
[3]     0x00000000   0x0000     0x08   0x05    0x0          0x0001 errno
[4]     0x00000000   0x0000     0x08   0x0a    0x0          0x0001 malloc
[5]     0x00000000   0x0000     0x08   0x0a    0x0          0x0001 free
[6]     0x00000000   0x0000     0x08   0x0a    0x0          0x0001 exit
[7]     0x00000000   0x0000     0x08   0x0a    0x0          0x0001 strlen
[8]     0x00000000   0x0000     0x08   0x0a    0x0          0x0001 abort
[9]     0x00000000   0x0000     0x08   0x0a    0x0          0x0001 printf
[10]    0x00000000   0x0000     0x08   0x0a    0x0          0x0001 __strtollmax
[11]    0x00000000   0x0000     0x08   0x0a    0x0          0x0001 __mod_init
[12]    0x00000000   0x0000     0x08   0x05    0x0          0x0001 __crt0v
[13]    0x00000000   0x0000     0x08   0x05    0x0          0x0001
__malloc_user_defined_name
[14]    0x20000c00   0x0002     0x04   0x0a    0x1          0x0000 __start
[testuser@aix64build ~]$
Comment 1 Kyle Stemen 2007-03-26 01:23:29 UTC
Created attachment 1649 [details]
The hello world program from AIX already stripped
Comment 2 Kyle Stemen 2007-03-26 01:23:47 UTC
Created attachment 1650 [details]
hello world source code
Comment 3 Alan Modra 2021-11-20 07:28:50 UTC
Created attachment 13800 [details]
likely incomplete patch