Bug 200863

Summary: Added missing '__cxa_deleted_virtual' into libcxxrt
Product: Base System Reporter: Yuri Victorovich <yuri>
Component: miscAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me CC: dim, emaste, theraven
Priority: ---    
Version: 10.1-STABLE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
patch none

Description Yuri Victorovich freebsd_committer freebsd_triage 2015-06-15 00:10:43 UTC
Created attachment 157742 [details]
patch

This symbol wasn't exported from libcxxrt.so, but clang sometimes produces references to it during the normal build process:
> undefined reference to `__cxa_deleted_virtual'

Spotted on 10.1 during some plain C++ port update.
Must be MFCd to 10.X.
Comment 1 Ed Maste freebsd_committer freebsd_triage 2015-06-15 13:30:06 UTC
Which Clang version, and perhaps special options, are involved here?  The patch should be good; I'm just curious why this wasn't encountered before.
Comment 2 Yuri Victorovich freebsd_committer freebsd_triage 2015-06-15 17:09:58 UTC
Virtual function deletion triggered the problem (http://stackoverflow.com/questions/3910083/deleting-virtual-functions-in-c0x)

This is relatively new feature introduced in c++11. Maybe it isn't used much yet, that's why this went unnoticed.
Comment 3 Yuri Victorovich freebsd_committer freebsd_triage 2015-06-15 17:12:46 UTC
I had to create the copy of this function in the port patch to solve the problem. But if more and more port projects begin to use this feature, this will turn into a problem that all released 10.X systems having clang won't be able to compile them.
Comment 4 Dimitry Andric freebsd_committer freebsd_triage 2015-06-17 16:55:26 UTC
Note that newer versions of libsupc++ expose this with CXXABI_1.3.6:

__cxa_deleted_virtual@@CXXABI_1.3.6

See also here: https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=183870

Maybe it's best to also put 'our' symbol under this namespace, for the sake of compatibility?
Comment 5 Ed Maste freebsd_committer freebsd_triage 2015-06-17 17:24:16 UTC
> Maybe it's best to also put 'our' symbol under this namespace, for the sake of compatibility?

Yes, probably makes sense make it easy to swap in libsupc++ for testing.
Comment 6 Dimitry Andric freebsd_committer freebsd_triage 2015-06-17 18:59:24 UTC
Put up a review on https://reviews.freebsd.org/D2850 .
Comment 7 Yuri Victorovich freebsd_committer freebsd_triage 2015-06-17 19:19:42 UTC
libsupc++ is for gcc-compiled C++, and libcxxer is for clang-compiled C++. They aren't compatible much anyway, can't really be mixed.
Comment 8 Ed Maste freebsd_committer freebsd_triage 2015-06-17 19:27:00 UTC
Here's a useful comment on ABI compat on various c++ support libs:
http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-February/082620.html
Comment 9 David Chisnall freebsd_committer freebsd_triage 2015-06-18 08:58:41 UTC
(In reply to yuri from comment #7)

They are intended to be ABI compatible (or, rather, libcxxrt intends to support a superset of the libsupc++ ABI).  In the base system, we link both libstdc++ and libc++ to libcxxrt, allowing you to use both in the same program and to throw exceptions through both (though not to pass standard library types other than exception objects across library boundaries).  We compile libstdc++ as a filter library so that the definitions of the libsupc++ symbols that it exports actually come from libcxxrt.

If the gcc ports are not doing this with their versions of libstdc++, then please file a bug with the gcc port maintainers.
Comment 10 commit-hook freebsd_committer freebsd_triage 2015-06-23 17:54:53 UTC
A commit references this bug:

Author: dim
Date: Tue Jun 23 17:54:25 UTC 2015
New revision: 284732
URL: https://svnweb.freebsd.org/changeset/base/284732

Log:
  Add __cxa_deleted_virtual to libcxxrt's version map.

  This symbol can sometimes be emitted by clang++, and was not yet
  exported from libcxxrt.  Attempt to be compatible with libsupc++ by
  using the same CXXABI_1.3.6 symbol version.

  Reported by:	yuri@rawbw.com
  PR:		200863
  Reviewed by:	emaste
  MFC after:	3 days
  Differential Revision: https://reviews.freebsd.org/D2850

Changes:
  head/lib/libcxxrt/Version.map
Comment 11 commit-hook freebsd_committer freebsd_triage 2015-07-03 20:29:25 UTC
A commit references this bug:

Author: dim
Date: Fri Jul  3 20:29:05 UTC 2015
New revision: 285109
URL: https://svnweb.freebsd.org/changeset/base/285109

Log:
  MFC r284732:

  Add __cxa_deleted_virtual to libcxxrt's version map.

  This symbol can sometimes be emitted by clang++, and was not yet
  exported from libcxxrt.  Attempt to be compatible with libsupc++ by
  using the same CXXABI_1.3.6 symbol version.

  Approved by:	re (kib)
  Reported by:	yuri@rawbw.com
  PR:		200863
  Reviewed by:	emaste
  Differential Revision: https://reviews.freebsd.org/D2850

Changes:
  stable/10/lib/libcxxrt/Version.map
Comment 12 commit-hook freebsd_committer freebsd_triage 2015-07-03 20:32:27 UTC
A commit references this bug:

Author: dim
Date: Fri Jul  3 20:31:27 UTC 2015
New revision: 285110
URL: https://svnweb.freebsd.org/changeset/base/285110

Log:
  MFC r284732:

  Add __cxa_deleted_virtual to libcxxrt's version map.

  This symbol can sometimes be emitted by clang++, and was not yet
  exported from libcxxrt.  Attempt to be compatible with libsupc++ by
  using the same CXXABI_1.3.6 symbol version.

  Reported by:	yuri@rawbw.com
  PR:		200863
  Reviewed by:	emaste
  Differential Revision: https://reviews.freebsd.org/D2850

Changes:
_U  stable/9/
_U  stable/9/lib/
_U  stable/9/lib/libcxxrt/
  stable/9/lib/libcxxrt/Version.map