Quantcast

[RFC] Possible ABI break for libc++ built with -fno-rtti and -D_LIBCPP_BUILD_STATIC

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[RFC] Possible ABI break for libc++ built with -fno-rtti and -D_LIBCPP_BUILD_STATIC

Martin J. O'Riordan via cfe-dev
Hi All,

Libc++ currently has an ABI incompatibility when built as a static library with no RTTI. Specifically some std::shared_ptr internals have different vtable layouts in this configuration.

I would like to fix this by making the vtable definition consistent across all configurations, but that requires breaking the ABI of a very rare configuration of libc++. I suspect all users of this configuration can take the ABI break immediately, but I would like to confirm this before proceeding.

The configuration in question is a static libc++ library built with -DLIBCXX_ENABLE_RTTI=OFF and -D_LIBCPP_BUILD_STATIC,

Is anybody using this configuration and can't take an ABI break?

Note that `_LIBCPP_BUILD_STATIC` must be manually defined by the user at both when building and using libc++, and it is not supported by the CMake build system. This should mean that almost nobody is defining it.

The proposed changes can be found here: https://reviews.llvm.org/D32838

/Eric




_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [RFC] Possible ABI break for libc++ built with -fno-rtti and -D_LIBCPP_BUILD_STATIC

Martin J. O'Riordan via cfe-dev
SGTM.

On 2017-May-03, at 16:42, Eric Fiselier <[hidden email]> wrote:

Hi All,

Libc++ currently has an ABI incompatibility when built as a static library with no RTTI. Specifically some std::shared_ptr internals have different vtable layouts in this configuration.

I would like to fix this by making the vtable definition consistent across all configurations, but that requires breaking the ABI of a very rare configuration of libc++. I suspect all users of this configuration can take the ABI break immediately, but I would like to confirm this before proceeding.

The configuration in question is a static libc++ library built with -DLIBCXX_ENABLE_RTTI=OFF and -D_LIBCPP_BUILD_STATIC,

Is anybody using this configuration and can't take an ABI break?

Note that `_LIBCPP_BUILD_STATIC` must be manually defined by the user at both when building and using libc++, and it is not supported by the CMake build system. This should mean that almost nobody is defining it.

The proposed changes can be found here: https://reviews.llvm.org/D32838

/Eric





_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [RFC] Possible ABI break for libc++ built with -fno-rtti and -D_LIBCPP_BUILD_STATIC

Martin J. O'Riordan via cfe-dev
In reply to this post by Martin J. O'Riordan via cfe-dev

Hi Eric,

 

In the email I sent on the 27th April (“[LibC++] Bug in implementation of 'std::shared_ptr'”), the problem I was seeing was:

 

  o  LibC++ library built with -DLIBCXX_ENABLE_RTTI=ON and -D_LIBCPP_BUILD_STATIC.

  o  User code compiled with ‘-fno-rtti -D_LIBCPP_BUILD_STATIC’.

 

Having ‘_LIBCPP_BUILD_STATIC’ defined by both the library builder and the library user was where it broke.  I removed ‘-D_LIBCPP_BUILD_STATIC’ from the user and it worked.  But I wasn’t building the static library with RTTI disabled because it is stated as an unsupported configuration.

 

So are you advising that with the proposed fix, that I should revert to defining ‘_LIBCPP_BUILD_STATIC’ as the user?

 

Thanks,

 

            MartinO

 

From: Eric Fiselier [mailto:[hidden email]]
Sent: 04 May 2017 00:43
To: clang developer list <[hidden email]>
Cc: Marshall Clow <[hidden email]>; Duncan P. N. Exon Smith <[hidden email]>; Ed Maste <[hidden email]>; Martin J. O'Riordan <[hidden email]>; Anton Korobeynikov <[hidden email]>
Subject: [RFC] Possible ABI break for libc++ built with -fno-rtti and -D_LIBCPP_BUILD_STATIC

 

Hi All,

 

Libc++ currently has an ABI incompatibility when built as a static library with no RTTI. Specifically some std::shared_ptr internals have different vtable layouts in this configuration.

 

I would like to fix this by making the vtable definition consistent across all configurations, but that requires breaking the ABI of a very rare configuration of libc++. I suspect all users of this configuration can take the ABI break immediately, but I would like to confirm this before proceeding.

 

The configuration in question is a static libc++ library built with -DLIBCXX_ENABLE_RTTI=OFF and -D_LIBCPP_BUILD_STATIC,

 

Is anybody using this configuration and can't take an ABI break?

 

Note that `_LIBCPP_BUILD_STATIC` must be manually defined by the user at both when building and using libc++, and it is not supported by the CMake build system. This should mean that almost nobody is defining it.

 

The proposed changes can be found here: https://reviews.llvm.org/D32838

 

/Eric

 

 

 


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [RFC] Possible ABI break for libc++ built with -fno-rtti and -D_LIBCPP_BUILD_STATIC

Martin J. O'Riordan via cfe-dev


On Sun, May 7, 2017 at 7:50 AM, Martin J. O'Riordan <[hidden email]> wrote:

Hi Eric,

 

In the email I sent on the 27th April (“[LibC++] Bug in implementation of 'std::shared_ptr'”), the problem I was seeing was:

 

  o  LibC++ library built with -DLIBCXX_ENABLE_RTTI=ON and -D_LIBCPP_BUILD_STATIC.

  o  User code compiled with ‘-fno-rtti -D_LIBCPP_BUILD_STATIC’.

 

Having ‘_LIBCPP_BUILD_STATIC’ defined by both the library builder and the library user was where it broke.  I removed ‘-D_LIBCPP_BUILD_STATIC’ from the user and it worked.  But I wasn’t building the static library with RTTI disabled because it is stated as an unsupported configuration.

 

So are you advising that with the proposed fix, that I should revert to defining ‘_LIBCPP_BUILD_STATIC’ as the user?


`_LIBCPP_BUILD_STATIC` has been removed entirely by the change. It fixes your bug by making the vtable consistent across all configurations.

 /Eric


 

Thanks,

 

            MartinO

 

From: Eric Fiselier [mailto:[hidden email]]
Sent: 04 May 2017 00:43
To: clang developer list <[hidden email]>
Cc: Marshall Clow <[hidden email]>; Duncan P. N. Exon Smith <[hidden email]>; Ed Maste <[hidden email]>; Martin J. O'Riordan <[hidden email]>; Anton Korobeynikov <[hidden email]>
Subject: [RFC] Possible ABI break for libc++ built with -fno-rtti and -D_LIBCPP_BUILD_STATIC

 

Hi All,

 

Libc++ currently has an ABI incompatibility when built as a static library with no RTTI. Specifically some std::shared_ptr internals have different vtable layouts in this configuration.

 

I would like to fix this by making the vtable definition consistent across all configurations, but that requires breaking the ABI of a very rare configuration of libc++. I suspect all users of this configuration can take the ABI break immediately, but I would like to confirm this before proceeding.

 

The configuration in question is a static libc++ library built with -DLIBCXX_ENABLE_RTTI=OFF and -D_LIBCPP_BUILD_STATIC,

 

Is anybody using this configuration and can't take an ABI break?

 

Note that `_LIBCPP_BUILD_STATIC` must be manually defined by the user at both when building and using libc++, and it is not supported by the CMake build system. This should mean that almost nobody is defining it.

 

The proposed changes can be found here: https://reviews.llvm.org/D32838

 

/Eric

 

 

 



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [RFC] Possible ABI break for libc++ built with -fno-rtti and -D_LIBCPP_BUILD_STATIC

Martin J. O'Riordan via cfe-dev

Sounds like the perfect solution - no opportunity for error :-)

 

Thanks Eric,

 

            MartinO

 

From: Eric Fiselier [mailto:[hidden email]]
Sent: 07 May 2017 20:59
To: Martin J. O'Riordan <[hidden email]>
Cc: clang developer list <[hidden email]>; Marshall Clow <[hidden email]>; Duncan P. N. Exon Smith <[hidden email]>; Ed Maste <[hidden email]>; Anton Korobeynikov <[hidden email]>
Subject: Re: [RFC] Possible ABI break for libc++ built with -fno-rtti and -D_LIBCPP_BUILD_STATIC

 

On Sun, May 7, 2017 at 7:50 AM, Martin J. O'Riordan <[hidden email]> wrote:

Hi Eric,

In the email I sent on the 27th April (“[LibC++] Bug in implementation of 'std::shared_ptr'”), the problem I was seeing was:

  o  LibC++ library built with -DLIBCXX_ENABLE_RTTI=ON and -D_LIBCPP_BUILD_STATIC.

  o  User code compiled with ‘-fno-rtti -D_LIBCPP_BUILD_STATIC’.

Having ‘_LIBCPP_BUILD_STATIC’ defined by both the library builder and the library user was where it broke.  I removed ‘-D_LIBCPP_BUILD_STATIC’ from the user and it worked.  But I wasn’t building the static library with RTTI disabled because it is stated as an unsupported configuration.

So are you advising that with the proposed fix, that I should revert to defining ‘_LIBCPP_BUILD_STATIC’ as the user?

 

`_LIBCPP_BUILD_STATIC` has been removed entirely by the change. It fixes your bug by making the vtable consistent across all configurations.

 

 /Eric


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Loading...