Why are there duplicate symbols in the same static object file? What does it mean in practice?
after running nm /lib64/libc.so.6 | cut -d' ' -f 3 | uniq -c | sort -rn
, which looks at the symbols in the file and prints the number of times that the symbol occurs. I get the following output.
59 lock
38 buffer
15 free_mem
15 __elf_set___libc_subfreeres_element_free_mem__
2 __strftime_internal
2 startp_initialized.9864
2 startp_initialized.11643
2 null
2 nbits.11331
update
00000000003c1b98 b lock
00000000003c1bb0 b lock
...
00000000003c2690 b lock
00000000003c1710 b buffer
00000000003c1718 b buffer
...
00000000003c1720 b buffer
00000000003bc768 d __elf_set___libc_subfreeres_element_free_mem__
...
00000000003bc770 d __elf_set___libc_subfreeres_element_free_mem__
00000000003bc778 d __elf_set___libc_subfreeres_element_free_mem__
...
00000000001899de r null
0000000000191e70 r null
update 2(possibly helpful):
readelf -Ws /lib64/libc.so.6 | grep .*\ buffer$
Num: Value Size Type Bind Vis Ndx Name
1277: 00000000003c1710 8 OBJECT LOCAL DEFAULT 35 buffer
1289: 00000000003c1718 8 OBJECT LOCAL DEFAULT 35 buffer
1293: 00000000003c1720 8 OBJECT LOCAL DEFAULT 35 buffer
1298: 00000000003c1728 8 OBJECT LOCAL DEFAULT 35 buffer
1319: 00000000003c1730 8 OBJECT LOCAL DEFAULT 35 buffer
...