From: Nadav Har'El <n...@scylladb.com> Committer: Waldemar Kozaczuk <jwkozac...@gmail.com> Branch: master
Fix __cxa_finalize() signature Starting in gcc 11, <cxxabi.h> declares the __cxa_finalize() function to return void, not an int as it was previously. The change has no practical importance (our implementation always returned 0 anyway, there was never any interesting integer to returned). But to get our implementation to compile against both gcc-11 and pre-gcc-11's version of cxxabi.h, we need to hide cxxabi.h's declaration. Signed-off-by: Nadav Har'El <n...@scylladb.com> Message-Id: <20210614062057.1998552-3-...@scylladb.com> --- diff --git a/runtime.cc b/runtime.cc --- a/runtime.cc +++ b/runtime.cc @@ -11,7 +11,6 @@ #include <cstring> #include <string.h> #include <exception> -#include <cxxabi.h> #include <sys/mman.h> #include <unistd.h> #include <link.h> @@ -62,6 +61,14 @@ #include <pty.h> #include <osv/pid.h> +// cxxabi.h from gcc 10 and earlier used to say that __cxa_finalize returns +// an int, while it should return void (and does so on gcc 11). To allow us +// to define __cxa_finalize with neither gcc 10 or 11 complaining, we need +// to hide the declaration in the header file +#define __cxa_finalize __cxa_finalize_ignore +#include <cxxabi.h> +#undef __cxa_finalize + #define __LC_LAST 13 #define __ALIAS(old, new) \ @@ -169,11 +176,11 @@ int __cxa_atexit(destructor_t destructor, void *arg, void *dso) return 0; } -int __cxa_finalize(void *dso) +void __cxa_finalize(void *dso) { if (!dso || dso == &__dso_handle) { debug("__cxa_finalize() running kernel's destructors not supported\n"); - return 0; + return; } std::vector<std::pair<destructor_t,void*>> my_destructors; WITH_LOCK(destructors_mutex) { @@ -183,7 +190,7 @@ int __cxa_finalize(void *dso) for (auto d : boost::adaptors::reverse(my_destructors)) { d.first(d.second); } - return 0; + return; } } -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to osv-dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/osv-dev/00000000000054361f05c4bdef56%40google.com.