[cfe-dev] libc++ ABI versioning

Richard Smith richard at metafoo.co.uk
Mon Jun 9 18:56:07 PDT 2014


On Mon, Jun 9, 2014 at 6:32 PM, Jorgen Tjerno <jorgen at uberent.com> wrote:

> I've noticed that Xcode 4.6 and Xcode 5.1 ship with headers that have
> different layouts for std::ifstream. sizeof(std::ifstream) is 448 for
> 4.6, and 576 on 5.1. You can see my test case here:
> https://gist.github.com/anonymous/bd0db5e4bcb307b70506
>
> How does clang/libc++ ensure that the executable runs with the right
> libc++ version for headers it was built with? I can run the binaries
> produced by Xcode 4.6 on a machine that has a newer libc++, and I can
> run the binaries produced by 5.1 on a machine that has an older
> libc++. I would assume that if I built with headers that give me a
> smaller size than what is expected by libc++, that would be cause the
> newer libc++ to trash memory beyond the end of my object. Am I missing
> something?
>
> I was unable to find any resources on how libc++ ABI versioning works
> other than the "major ABI version" -- which is 1.
>
> The specific problem I'm seeing is that it seems that when I link with
> a static library that was built with the older libc++ version, a
> translation unit built with the new libc++ ends up using the wrong
> (old) value for the construction symbol at runtime
>
> (__ZTCNSt3__114basic_ifstreamIcNS_11char_traitsIcEEEE0_NS_13basic_istreamIcS2_EE,
> or '
>    construction vtable for std::__1::basic_istream<char,
> std::__1::char_traits<char> >-in-std::__1::basic_ifstream<char,
> std::__1::char_traits<char> >' according to c++filt).


Looks like the difference is probably due to the std::filebuf subobject.
Did that type also change size? Did std::basic_streambuf<char>?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140609/ee3309b7/attachment.html>


More information about the cfe-dev mailing list