c++ - abi-compliance-checker 中的扩展选项有什么用?

标签 c++ c abi

abi-compliance-checker 是一个 perl 程序,可以检查 linux 上库的 ABI ( https://lvc.github.io/abi-compliance-checker/ )

该工具有一个-extended 选项,这是手册中关于它的内容:

If your library A is supposed to be used by other library B and you want to control the ABI of B, then you should enable this option. The tool will check for changes in all data types, even if they are not used by any function in the library A. Such data types are not part of the A library ABI, but may be a part of the ABI of the B library. The short scheme is: app C (broken) -> lib B (broken ABI) -> lib A (stable ABI)

即使在尝试使用和不使用选项检查 ABI 之后,我仍然不真正理解选项的含义以及它如何改变我得到的结果。

这是我没有选择的结果的片段:

Test Results
Total Header Files  177
Total Libraries 1
Total Symbols / Types   96 / 57
Compatibility   100%

Added Symbols  1 
demangle.h, libtoolbox.so.16.0.0.27
namespace mdw
demangle ( std::__cxx11::string const& iMangledString )

Problems with Symbols, Low Severity  1 
BufferMgr.h
namespace toolbox
[+] kDefaultMaxBufferSize [data]  1 

下面是激活选项后的结果:

Test Results
Total Header Files  177
Total Symbols / Types   158 / 375
Compatibility   99.8%

Added Symbols  2 
demangle.h
namespace mdw
demangle ( std::__cxx11::string const& iMangledString )

StaticInit.h
namespace toolbox
_SymbolDefinedInStaticInitOnly_StaticInit ( )

Removed Symbols  1 
StaticInit.h
namespace toolbox
_SymbolDefinedInStaticInitOnly ( )

Problems with Symbols, Low Severity  1 
BufferMgr.h
namespace toolbox
[+] kDefaultMaxBufferSize [data]  1 

有谁能解释这个选项的含义,以及从 ABI 的角度来看输出的差异意味着什么?

最佳答案

默认情况下,该工具会检查所分析二进制文件的导出符号所使用的数据类型(作为参数、返回值或参数字段或返回值等)。默认情况下不检查未使用的数据类型。在 -extended 模式下,该工具将检查所有数据类型,包括未使用的数据类型。

在你的例子中,我看到在扩展模式下选中的符号数量不同,但根据选项的描述应该是相同的。添加/删除 _SymbolDefinedInStaticInitOnly* 的检测对我来说看起来像是工具中的回归错误。

目前,-extended 选项隐式启用了 -headers-only 选项,它可以分析 header 中的所有内联符号。我认为在这种情况下我们不应该启用 -headers-only 选项。

看起来 -extended 选项目前没有按预期工作。我们需要修复它。

关于c++ - abi-compliance-checker 中的扩展选项有什么用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45595723/

相关文章:

c++ - 带有指向参数的指针的基本函数重载给出错误

c++ - 如何高效地将大量元素追加到 stxxl vector 中?

assembly - x86-64 汇编中的 RET x 与 ADD RSP、x

android - 如何选择 Android 应用程序包中包含的架构?

c++ - 将数字转换为其 POSTNET 代码

C++ : passing ofstream& to function to continually append to . txt 文件

c - 为什么将指向字符串的指针传递给函数时是 2 星

c - 什么是内存块?

android - 不同语言的两个进程是否可以使用UDP进行通信

安卓NDK : How to build for ARM64-v8a with minimumSdkVersion = 19