c++ - GCC 手册中提到的 "C++ ABI Specification"是什么?

标签 c++ gcc x86 language-lawyer x86-64

我在查看 C++ 的 GCC 手册时,发现了以下引述:

Version 0 refers to the version conforming most closely to the C++ ABI specification. Therefore, the ABI obtained using version 0 will change in different versions of G++ as ABI bugs are fixed. (source)

可以看出,上述段落引用了某种看似标准的 C++ ABI。然而,据我了解,不存在这样的 ABI。这段话在说什么?一个好的答案将给出尽可能详尽的解释。将“C++ ABI 规范”放入我首选的搜索引擎中没有任何用处。

最佳答案

从WG21的提案中可以看出N4028 Defining a Portable C++ ABI gcc 指的是 Common Vendor ABI (Itanium C++ ABI) :

Existing Practice

Examples of existing practice include:

  • The Common Vendor ABI (Itanium C++ ABI) is a step in this direction, to specify an ABI for the language on some platforms. It is supported today by compilers such as GCC and EDG. It does not specify an ABI for the standard library, so this is necessary but insufficient to, for example, use std::string on a stable API boundary
  • Microsoft VC++ likewise has long had a de facto stable, though undocumented, ABI for the language. It does not have a stable ABI for the standard library, but rather intentionally breaks ABI compatibility on every major release, for example in order to allow continuous improvements to the implementation and to quickly implement a new standard library that contains ABI breaking changes.
  • ...

gcc 在他们的 ABI Policy and Guidelines 中也介绍了这一点:

... Furthermore, C++ source that is compiled into object files is transformed by the compiler: it arranges objects with specific alignment and in a particular layout, mangling names according to a well-defined algorithm, has specific arrangements for the support of virtual functions, etc. These details are defined as the compiler Application Binary Interface, or ABI. From GCC version 3 onwards the GNU C++ compiler uses an industry-standard C++ ABI, the Itanium C++ ABI. ...

关于c++ - GCC 手册中提到的 "C++ ABI Specification"是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52903807/

相关文章:

c++ - 我怎么知道 boost::regex_replace 是否进行了更改?

c++ - 大规模使用 Meyer 的建议以偏爱非成员(member)、非 friend 功能?

c - 为什么默认编译器标志未显示在 gcc 行中?

c++ - 使用 g++ 编译变量名为 new 的 C 代码时出错

assembly - `dup (?)` 在 TASM 中是什么意思?

assembly - 气体 : too many memory reference

c++ - 可以使用 thread_local 在 dll 中为每个线程提供一个静态全局变量吗?

c++ - 如何使用非类型参数重载类模板的 << 运算符?

c++ - 不明确的成员访问表达式 : is Clang rejecting valid code?

assembly - 如何将 libc6 中的函数导入 ELF 可执行文件?