c++ - Apple clang 编译器版本控制架构?

标签 c++ xcode clang clang++ abi

前段时间,GCC >= 5Clang >= 4编译器更改了其版本号的语义,因此主要版本号将在任何非错误修复版本上增加。

Apple 在 ABI 兼容性或任何其他范围方面是否遵循任何带有 clang 编译器的版本控制架构?我想知道 apple-clang 9.0 是否与 9.1 的 ABI 兼容等等。

最佳答案

Apple 在每个 Xcode 版本中都会增加其编译器版本号,因此查找 ABI 更改的适当位置是 Xcode release notes . 我能找到的最新 ABI 更改是 Xcode 6:

The libc++ headers in Xcode 6 include a change to make std::pair have a trivial constructor. This fix is important for performance and compliance with the C++ standard, but it changes the ABI for C++ code using std::pair.

这意味着自 2014 年以来 ABI 没有变化。

编辑:clang 和 apple-clang 之间的映射似乎是(取自 here 并通过功能测试自己添加了最后一行):

5.1 -> 3.4
6.0 -> 3.5
7.0 -> 3.7
7.3 -> 3.8
8.0 -> 3.9
9.0 -> 4.0
9.1 -> 5.0

所以我猜,每当苹果在 Xcode 主要版本之间集成来自主线 clang 的更改时,它就会碰撞次要版本的 apple-clang。

但是对于最初的问题,这无关紧要:语言的 ABI 兼容性在他们说之前不会改变,这对于标准库是可能的(但很少发生),对于核心语言来说几乎是不可想象的。对于 GCC,苹果甚至 guaranteed to not do the latter ,但可能在切换到 clang 时忘记更新文档:

Because GCC 4.0 conforms to the Itanium C++ ABI, C++ objects are link-compatible with objects built by other OS X compilers that conform to this specification. Apple guarantees that future releases of GCC for OS X will also conform to the Itanium C++ ABI. This means that developers may safely ship dynamic shared libraries whose interfaces involve C++ classes, albeit with some caveats:

  • Apple guarantees ABI stability only for core language features. It does not guarantee stability for library classes, including std::string, std::map, and std::ostream among others.

但由于 gcc 命令链接到任何最近安装的 Xcode 的 apple-clang,因此该保证也适用于后者。

关于c++ - Apple clang 编译器版本控制架构?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49609107/

相关文章:

c++ - 不同类型的Typedef重定义(Emscripten SDL2+OpenGL)

c++ - 外部库应该被包装吗?

推送到 Github 时 Xcode 错误消息 "The remote repository rejected commits"

ios - 无法修复签名问题 Xcode 7.3.1

c - OSX/Clang 版本的 __progname 获取可执行文件的绝对路径?

c++ - 为什么我不能移动 std::ofstream?

c++ - 为什么模板参数包必须在最后?

c++ - 进程保护

c++ - 模板模板参数中的模板参数过多

iOS 构建错误 : exportArchive: Lunch. 应用程序需要配置文件