Browse Source

dselect: Implement local abi::__cxa_pure_virtual

When using g++ if we provide our version of this function we can avoid
the dependency on either libstdc++ or libsup++.
Guillem Jover 7 years ago
parent
commit
ed6cbcf7a1
3 changed files with 26 additions and 0 deletions
  1. 12 0
      configure.ac
  2. 3 0
      debian/changelog
  3. 11 0
      dselect/cxx-support.cc

+ 12 - 0
configure.ac

@@ -109,6 +109,12 @@ AC_CHECK_HEADERS([\
   linux/fiemap.h \
 ])
 
+AS_IF([test "x$build_dselect" = "xyes"], [
+  AC_LANG_PUSH([C++])
+  AC_CHECK_HEADERS([cxxabi.h])
+  AC_LANG_POP([C++])
+])
+
 # Checks for typedefs, structures, and compiler characteristics.
 AC_C_BIGENDIAN
 AC_C_CONST
@@ -164,6 +170,12 @@ AC_CHECK_FUNCS([\
   posix_fadvise \
 ])
 
+AS_IF([test "x$build_dselect" = "xyes"], [
+  AC_LANG_PUSH([C++])
+  AC_CHECK_FUNCS([__cxa_pure_virtual])
+  AC_LANG_POP([C++])
+])
+
 DPKG_MMAP
 
 # Checks for the build machinery.

+ 3 - 0
debian/changelog

@@ -42,6 +42,9 @@ dpkg (1.18.11) UNRELEASED; urgency=medium
     libdpkg. Regression introduced in dpkg 1.18.7. Closes: #842004
   * Move C++ support code into its own file.
   * Add replacement new and delete array operators to C++ support code.
+  * Implement local abi::__cxa_pure_virtual. When using g++ if we provide our
+    version of this function we can avoid the dependency on either libstdc++
+    or libsup++.
   * Architecture support:
     - Add support for AIX operating system.
   * Portability:

+ 11 - 0
dselect/cxx-support.cc

@@ -26,6 +26,9 @@
 
 #include <assert.h>
 #include <stdlib.h>
+#ifdef HAVE_CXXABI_H
+#include <cxxabi.h>
+#endif
 
 #include <dpkg/dpkg.h>
 
@@ -74,3 +77,11 @@ operator delete[](void *a, size_t size) DPKG_ATTR_NOEXCEPT
 {
 	free(a);
 }
+
+#ifdef HAVE___CXA_PURE_VIRTUAL
+extern "C" void
+abi::__cxa_pure_virtual()
+{
+	internerr("pure virtual function called");
+}
+#endif