tags:

views:

114

answers:

1
+1  Q: 

ELF file versions

Hi guys, I'm working on a clone of the elfdump command.

My program works fine when running 'elfdump -ecps file` on all executables. However, when I run my program on a library file, say libc.so, it prints out an incorrect version number for all symbols in the .symtab section (specifically they are all zero). I've looked over the documentation tons of times, but I can't figure out why this is happening...

Can someone please provide some tips? Or possibly how to detect whether its a library or not so I could just hard-code a 0 in?

Thanks!

+2  A: 

You can determine if you're running against a shared library by checking to see if the e_type field is ET_DYN, I believe. (man elf(5))

There is an article by Ulrich Drepper that covers the glibc per-symbol versioning tricks in ELF. Perhaps there is additional information there which you've not encountered before. The man pages on linux don't appear to cover the per-symbol versioning information in the ELF docs.

Arcane