Remove sneaky injection of libiberty code into libstdc++ for the "mandated" (by whom?) __cxa_demangle pheature, at least pending audit of the code (which is 6k lines of typical gnu crap so not likely to happen). Cry some more. -jfw diff -ur a/libstdc++-v3/libsupc++/Makefile.am b/libstdc++-v3/libsupc++/Makefile.am --- a/libstdc++-v3/libsupc++/Makefile.am 2012-11-05 23:42:32.000000000 +0000 +++ b/libstdc++-v3/libsupc++/Makefile.am 2019-04-18 01:31:55.860817988 +0000 @@ -40,11 +40,6 @@ headers = $(std_HEADERS) $(bits_HEADERS) -if GLIBCXX_HOSTED - c_sources = \ - cp-demangle.c -endif - sources = \ array_type_info.cc \ atexit_arm.cc \ @@ -98,15 +93,6 @@ libsupc___la_SOURCES = $(sources) $(c_sources) libsupc__convenience_la_SOURCES = $(sources) $(c_sources) -cp-demangle.c: - rm -f $@ - $(LN_S) $(toplevel_srcdir)/libiberty/cp-demangle.c $@ -cp-demangle.lo: cp-demangle.c - $(LTCOMPILE) -DIN_GLIBCPP_V3 -Wno-error -c $< -cp-demangle.o: cp-demangle.c - $(C_COMPILE) -DIN_GLIBCPP_V3 -Wno-error -c $< - - # Use special rules for the C++0x sources so that the proper flags are passed. eh_ptr.lo: eh_ptr.cc $(LTCXXCOMPILE) -std=gnu++0x -c $< diff -ur a/libstdc++-v3/libsupc++/Makefile.in b/libstdc++-v3/libsupc++/Makefile.in --- a/libstdc++-v3/libsupc++/Makefile.in 2012-11-05 23:42:32.000000000 +0000 +++ b/libstdc++-v3/libsupc++/Makefile.in 2019-04-18 01:32:58.428817526 +0000 @@ -103,7 +103,6 @@ pbase_type_info.lo pmem_type_info.lo pointer_type_info.lo \ pure.lo si_class_type_info.lo tinfo.lo tinfo2.lo vec.lo \ vmi_class_type_info.lo vterminate.lo -@GLIBCXX_HOSTED_TRUE@am__objects_2 = cp-demangle.lo am_libsupc___la_OBJECTS = $(am__objects_1) $(am__objects_2) libsupc___la_OBJECTS = $(am_libsupc___la_OBJECTS) libsupc__convenience_la_LIBADD = @@ -353,8 +352,6 @@ exception_defines.h exception_ptr.h hash_bytes.h nested_exception.h headers = $(std_HEADERS) $(bits_HEADERS) -@GLIBCXX_HOSTED_TRUE@c_sources = \ -@GLIBCXX_HOSTED_TRUE@ cp-demangle.c sources = \ array_type_info.cc \ @@ -773,14 +770,6 @@ uninstall-toolexeclibLTLIBRARIES -cp-demangle.c: - rm -f $@ - $(LN_S) $(toplevel_srcdir)/libiberty/cp-demangle.c $@ -cp-demangle.lo: cp-demangle.c - $(LTCOMPILE) -DIN_GLIBCPP_V3 -Wno-error -c $< -cp-demangle.o: cp-demangle.c - $(C_COMPILE) -DIN_GLIBCPP_V3 -Wno-error -c $< - # Use special rules for the C++0x sources so that the proper flags are passed. eh_ptr.lo: eh_ptr.cc $(LTCXXCOMPILE) -std=gnu++0x -c $< diff -ur a/libstdc++-v3/libsupc++/cxxabi.h b/libstdc++-v3/libsupc++/cxxabi.h --- a/libstdc++-v3/libsupc++/cxxabi.h 2011-12-16 18:43:06.000000000 +0000 +++ b/libstdc++-v3/libsupc++/cxxabi.h 2019-04-18 01:34:50.884816697 +0000 @@ -148,51 +148,6 @@ void __cxa_bad_typeid() __attribute__((__noreturn__)); - - /** - * @brief Demangling routine. - * ABI-mandated entry point in the C++ runtime library for demangling. - * - * @param __mangled_name A NUL-terminated character string - * containing the name to be demangled. - * - * @param __output_buffer A region of memory, allocated with - * malloc, of @a *__length bytes, into which the demangled name is - * stored. If @a __output_buffer is not long enough, it is - * expanded using realloc. @a __output_buffer may instead be NULL; - * in that case, the demangled name is placed in a region of memory - * allocated with malloc. - * - * @param __length If @a __length is non-NULL, the length of the - * buffer containing the demangled name is placed in @a *__length. - * - * @param __status @a *__status is set to one of the following values: - * 0: The demangling operation succeeded. - * -1: A memory allocation failure occurred. - * -2: @a mangled_name is not a valid name under the C++ ABI mangling rules. - * -3: One of the arguments is invalid. - * - * @return A pointer to the start of the NUL-terminated demangled - * name, or NULL if the demangling fails. The caller is - * responsible for deallocating this memory using @c free. - * - * The demangling is performed using the C++ ABI mangling rules, - * with GNU extensions. For example, this function is used in - * __gnu_cxx::__verbose_terminate_handler. - * - * See http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt12ch39.html - * for other examples of use. - * - * @note The same demangling functionality is available via - * libiberty (@c and @c libiberty.a) in GCC - * 3.1 and later, but that requires explicit installation (@c - * --enable-install-libiberty) and uses a different API, although - * the ABI is unchanged. - */ - char* - __cxa_demangle(const char* __mangled_name, char* __output_buffer, - size_t* __length, int* __status); - #ifdef __cplusplus } } // namespace __cxxabiv1 diff -ur a/libstdc++-v3/libsupc++/vterminate.cc b/libstdc++-v3/libsupc++/vterminate.cc --- a/libstdc++-v3/libsupc++/vterminate.cc 2011-01-30 22:39:36.000000000 +0000 +++ b/libstdc++-v3/libsupc++/vterminate.cc 2019-04-18 01:36:17.388816058 +0000 @@ -59,20 +59,9 @@ // Note that "name" is the mangled name. char const *name = t->name(); { - int status = -1; - char *dem = 0; - - dem = __cxa_demangle(name, 0, 0, &status); - fputs("terminate called after throwing an instance of '", stderr); - if (status == 0) - fputs(dem, stderr); - else - fputs(name, stderr); + fputs(name, stderr); fputs("'\n", stderr); - - if (status == 0) - free(dem); } // If the exception is derived from std::exception, we can