<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Jun 9, 2014 at 6:32 PM, Jorgen Tjerno <span dir="ltr"><<a href="mailto:jorgen@uberent.com" target="_blank">jorgen@uberent.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I've noticed that Xcode 4.6 and Xcode 5.1 ship with headers that have<br>
different layouts for std::ifstream. sizeof(std::ifstream) is 448 for<br>
4.6, and 576 on 5.1. You can see my test case here:<br>
<a href="https://gist.github.com/anonymous/bd0db5e4bcb307b70506" target="_blank">https://gist.github.com/anonymous/bd0db5e4bcb307b70506</a><br>
<br>
How does clang/libc++ ensure that the executable runs with the right<br>
libc++ version for headers it was built with? I can run the binaries<br>
produced by Xcode 4.6 on a machine that has a newer libc++, and I can<br>
run the binaries produced by 5.1 on a machine that has an older<br>
libc++. I would assume that if I built with headers that give me a<br>
smaller size than what is expected by libc++, that would be cause the<br>
newer libc++ to trash memory beyond the end of my object. Am I missing<br>
something?<br>
<br>
I was unable to find any resources on how libc++ ABI versioning works<br>
other than the "major ABI version" -- which is 1.<br>
<br>
The specific problem I'm seeing is that it seems that when I link with<br>
a static library that was built with the older libc++ version, a<br>
translation unit built with the new libc++ ends up using the wrong<br>
(old) value for the construction symbol at runtime<br>
(__ZTCNSt3__114basic_ifstreamIcNS_11char_traitsIcEEEE0_NS_13basic_istreamIcS2_EE,<br>
or '<br>
   construction vtable for std::__1::basic_istream<char,<br>
std::__1::char_traits<char> >-in-std::__1::basic_ifstream<char,<br>
std::__1::char_traits<char> >' according to c++filt).</blockquote><div><br></div><div>Looks like the difference is probably due to the std::filebuf subobject. Did that type also change size? Did std::basic_streambuf<char>?</div>
</div></div></div>