[cfe-dev] Does clang now emit [abi:cxx11] unconditionally when used with libstdc++?

Richard Smith via cfe-dev cfe-dev at lists.llvm.org
Mon Aug 15 13:48:30 PDT 2016


On Mon, Aug 15, 2016 at 1:30 PM, Maria Gottschalk via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> I did a little experiment. I've built 3.9.0rc1 with gcc-4.9.2 and then let
> this 3.9.0rc1 rebuild itself (using again headers and  libstdc++ from
> gcc-4.9.2).
>
> $ nm -C libLLVMCore.a  | grep cxx11
> 0000000000000000 W std::_Rb_tree<std::string, std::pair<std::string const,
> std::string>, std::_Select1st<std::pair<std::string const, std::string>
> >, std::less<std::string>, std::allocator<std::pair<std::string const,
> std::string> > >::erase[abi:cxx11](std::_Rb_tree_iterator<std::pair<std::string
> const, std::string> >)
> 0000000000000000 W std::_Rb_tree<std::string, std::pair<std::string const,
> std::string>, std::_Select1st<std::pair<std::string const, std::string>
> >, std::less<std::string>, std::allocator<std::pair<std::string const,
> std::string> > >::erase[abi:cxx11](std::_Rb_tree_const_iterator<std::pair<std::string
> const, std::string> >)
>
> That's two times  [abi:cxx11]. But libstdc++ from gcc-4.9.2 doesn't use
> abi tags, does it?
>

*shrug* If an ABI tag appears in a mangling, then the code fed to Clang
contained an __attribute__((abi_tag)). There's no other way for it to get
there. You could try preprocessing the relevant source file (with -E) and
see if the abi_tag attribute appears somewhere in the output if you're
curious how it's getting into your build.

(How sure are you that Clang is using libstdc++ 4.9.2 and not a later
version?)


> (The build completes anyway and all tests succeed!)
>
> M.
>
>
>
> Andrey Bokhanko <andreybokhanko at gmail.com> schrieb am 20:53 Montag,
> 15.August 2016:
>
>
> To clarify, this is obviously a compiler flag, but the macro is consumed
> by the library (not compiler) and doesn't affect how gcc/clang work. Thus,
> if you want old mangling, just pass this flag either to gcc or clang.
>
> Yours,
> Andrey
>
> On Monday, August 15, 2016, Andrey Bokhanko <andreybokhanko at gmail.com>
> wrote:
>
> As I understand, -D_GLIBCXX_USE_CXX11_ABI is a library flag, not compiler
> one, so clang should work with libstdc++ *exactly* as gcc5+ do. See http://developers.redhat.com/
> blog/2015/02/05/gcc5-and-the- c11-abi/
> <http://developers.redhat.com/blog/2015/02/05/gcc5-and-the-c11-abi/> for
> details.
>
> Yours,
> Andrey
>
> On Monday, August 15, 2016, Renato Golin <renato.golin at linaro.org> wrote:
>
> On 15 August 2016 at 15:58, Maria Gottschalk via cfe-dev
> <cfe-dev at lists.llvm.org> wrote:
> > So, is it correct that clang-3.9.0 unconditionally compiles for the new
> abi? That gcc 4.x.y is no longer usable and that you must have gcc 5+ if
> you want to use libstdc++?
>
> Oh bother! Adding Dmitry, as he wrote the code [1].
>
> I was under the impression that, if you didn't use the tag, nothing
> would have changed.
>
> We don't have many compile-time options like GCC, so this would have
> to be a run-time option, if needed.
>
> cheers,
> --renato
>
> [1] https://reviews.llvm.org/D1803 5 <https://reviews.llvm.org/D18035>
> and https://reviews.llvm.org/D1756 7 <https://reviews.llvm.org/D17567>
>
>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160815/14e57aba/attachment-0001.html>


More information about the cfe-dev mailing list