nm: missing .rodata.*.str1.1 symbols

Clément Péron peron.clem@gmail.com
Thu Feb 23 13:36:00 GMT 2017


Hi,
I compile a project but i don't see any .rodata.*.str1.1 symbols in nm.

I made a simple example. Nm displays 2 symbols but the map file
contains 4 symbols
and the sum of the symbols size in the map file match with the .rodata size.

I'm not quite sure how nm works, maybe some debuging symbols of the
.rodata.*str1.1 are missing.
Do you know how to add them or maybe it's an issue with nm ?

Thanks for your help,
Clement

*NM output only 2 .rodata symbols :
$>nm -fs -n app.elf
_IO_stdin_used      |00000000000007a0|   R  |
OBJECT|0000000000000004|     |.rodata
str                 |00000000000007b0|   R  |
OBJECT|0000000000000017|     |.rodata

But app.elf.map have 4 symbols and match with size :
.rodata         0x00000000000007a0       0x27
 *(.rodata .rodata.* .gnu.linkonce.r.*)
 .rodata.cst4   0x00000000000007a0        0x4
/usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/Scrt1.o
                0x00000000000007a0                _IO_stdin_used
 .rodata.str1.1
                0x00000000000007a4        0xb /tmp/ccbpZVpr.o
 *fill*         0x00000000000007af        0x1
 .rodata        0x00000000000007b0       0x17 /tmp/ccbpZVpr.o
                0x00000000000007b0                str
 .rodata.str1.1
                0x00000000000007c7        0x8 /tmp/cc9j6Kh2.o

$>size -A app.elf
.rodata                39      1952

*Using :
gcc (Ubuntu 6.2.0-5ubuntu12) 6.2.0 20161005
GNU nm (GNU Binutils for Ubuntu) 2.27

*Compile with:
$>gcc main.c test.c -Wall -Os -g -Wl,-Map,app.elf.map -o app.elf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.c
Type: text/x-csrc
Size: 56 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20170223/3821154f/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.c
Type: text/x-csrc
Size: 188 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20170223/3821154f/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: app.elf.map
Type: application/octet-stream
Size: 19277 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20170223/3821154f/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: app.elf
Type: application/octet-stream
Size: 13536 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20170223/3821154f/attachment-0001.obj>


More information about the Binutils mailing list