ABI compatibility header/library cross check

依然范特西╮ 提交于 2019-12-03 20:51:58

If you assume you have only libfoo.so coded in C (without having its header files, which you should also have), there is no way to know e.g. the signature of the functions inside, because the symbol table of a shared object don't contain any typing information (e.g. nothing except conventional wisdom prevent a library to contain a malloc function which adds two integers and return their sum, instead of doing the usual heap allocation).

So the libfoo.so can be abused. However, there are usually versions associated with symbols in some shared libraries (and you can query that programmatically thru dlvsym if you dlopen-ed a library). There is some way to generate the versions.

If the library is pure C++, then symbols are mangled so their encoding contain their signature.

The best practice is to have some functions inside your library which return the version of the library. Look at glib version information functions for a good example.

It seems that the ABI compliance checker also supports checking an application for its exposure to any changes between two libraries.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!