inspect-library: Parse ELF header to check for version definitions
As noted on !491 (merged), we could make inspect-library more robust as follows:
- if there is a verdef
SOME_VERSION@SOME_VERSION
in the.symbols
file:- parse the ELF header looking for the verdefs section
- if
SOME_VERSION
is found, OK - else, flag an issue about the missing version definition
- if there is no verdefs section at all, perhaps flag a different issue about the library being unversioned
There's code in libcapsule/utils/library-cmp.c
to do something very similar.
To do this, we would have to link libelf into inspect-library, which means accepting that if libelf is broken or there is a missing dependency on libelf, we'll be unable to diagnose that clearly. I think that's probably OK though.