是clang ++ ABI和g ++一样吗? [英] Is clang++ ABI same as g++?

查看:369
本文介绍了是clang ++ ABI和g ++一样吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

GCC 4.0,4.2和LLVM ABI兼容性





b $ b

根据主题,C ++ ABI是否兼容?

Ie



干杯

div class =h2_lin>解决方案

根据 clang libc ++页面, p>


ABI与gcc的libstdc ++兼容,用于某些低级功能,例如异常对象,rtti和内存分配。


这似乎意味着他们不是定位100%兼容性。例如,在那个页面上他们还说:


从多年的经验(包括以前实现的标准库)许多关于实现需要ABI断裂的标准容器以及如何实现它们的根本变化的事情。例如,一般认为使用短字符串优化而不是使用写入时复制(COW)构建std :: string是多核机器(特别是在具有右值引用的C ++'0x)的优越方法。打破ABI与旧版本库的兼容性被认为是实现libc ++的性能目标的关键。


我相信GCC仍然使用引用计数的COW,所以看起来clang不担心ABI与 std :: string 兼容(与旧的clang编译的二进制文件或与GCC)。


Possible Duplicate:
GCC 4.0, 4.2 and LLVM ABI Compatibility

As per subject, are both C++ ABIs compatible?
I.e. can a binary (Shared Object) generated with the former be used and linked with the latter (and vice-versa)?

Cheers

解决方案

According to the clang libc++ page, they're targeting

ABI compatibility with gcc's libstdc++ for some low-level features such as exception objects, rtti and memory allocation.

which seems to imply that they're not targeting 100% compatibility. For example, on that page they also say:

From years of experience (including having implemented the standard library before), we've learned many things about implementing the standard containers which require ABI breakage and fundamental changes to how they are implemented. For example, it is generally accepted that building std::string using the "short string optimization" instead of using Copy On Write (COW) is a superior approach for multicore machines (particularly in C++'0x, which has rvalue references). Breaking ABI compatibility with old versions of the library was determined to be critical to achieving the performance goals of libc++.

I believe that GCC is still using a reference-counted COW, so it appears that clang isn't worried about ABI compatibility with std::string (either with older clang compiled binaries or with GCC).

这篇关于是clang ++ ABI和g ++一样吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆