Reputation: 290
Given an ELF file, I run readelf -sV bin/my_app | grep \ glob
on it. This returns:
205: 0000000000000000 0 FUNC GLOBAL DEFAULT UND glob@GLIBC_2.27 (6)
326: 0000000000000000 0 FUNC GLOBAL DEFAULT UND glob@GLIBC_2.17 (2)
334: 0000000000000000 0 FUNC GLOBAL DEFAULT UND globfree@GLIBC_2.17 (2)
21011: 0000000000cd2748 8 OBJECT LOCAL DEFAULT 26 global_mask
21968: 0000000000000000 0 FILE LOCAL DEFAULT ABS globals_io.o
40039: 0000000000000000 0 FUNC GLOBAL DEFAULT UND glob@@GLIBC_2.27
46623: 0000000000000000 0 FUNC GLOBAL DEFAULT UND glob@GLIBC_2.17
47377: 0000000000000000 0 FUNC GLOBAL DEFAULT UND globfree@@GLIBC_2.17
With the information in this output, can I find the location in my source files where this glob symbol is invoked? I would like to find the location to understand why two different versions of GLIBC are linked for the same symbol.
Upvotes: 0
Views: 1080
Reputation: 213526
With the information in this output, can I find the location in my source files where this glob symbol is invoked?
No.
You could do: objdump -d bin/my_app
, find CALL
s to the two versions of glob
, and that will tell you what functions the calls are coming from.
I would like to find the location to understand why two different versions of GLIBC are linked for the same symbol.
It's not "two different versions of GLIBC", it's "two different glob
symbols with different ABIs".
I didn't think it was possible to reference different versions of glob
in the same ELF binary, unless you do some creative symbol aliasing with asm(".symver ...")
directives. Once you know which function references the (old) glob@GLIBC_2.17
symbol, run preprocessor on the file in which that function is defined, and I'd be very surprised if there is no asm(".symversion...")
in that file.
Upvotes: 1