From 7fb1f78f6f219f58e56e420acea43773a007408d Mon Sep 17 00:00:00 2001 From: Romain Goyet Date: Thu, 8 Dec 2016 14:49:35 +0100 Subject: [PATCH] [libaxx] Define __cxa_atexit In practice, it does nothing! Change-Id: I5fb92299c4672d1635d0b77c2fc5de4e666c7213 --- libaxx/Makefile | 2 +- libaxx/src/cxxabi/atexit.cpp | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 libaxx/src/cxxabi/atexit.cpp diff --git a/libaxx/Makefile b/libaxx/Makefile index b4c97c60f..6911cbcb3 100644 --- a/libaxx/Makefile +++ b/libaxx/Makefile @@ -1,2 +1,2 @@ objs += $(addprefix libaxx/src/, new.o) -objs += $(addprefix libaxx/src/cxxabi/, pure_virtual.o) +objs += $(addprefix libaxx/src/cxxabi/, atexit.o pure_virtual.o) diff --git a/libaxx/src/cxxabi/atexit.cpp b/libaxx/src/cxxabi/atexit.cpp new file mode 100644 index 000000000..ee32fc39c --- /dev/null +++ b/libaxx/src/cxxabi/atexit.cpp @@ -0,0 +1,14 @@ +/* C++ expects the __dso_handle symbol to be defined to some unique value in + * each dynamic shared object. Even though we're not using dynamic loading, + * we still have to define __dso_handle. */ + +void * __dso_handle = nullptr; + +/* The __cxa_atexit function registers a function to be called when the program + * exits or when a shared library is unloaded. + * We don't support shared libraries and our program should never exit, so we + * can simply do nothing and return zero. */ + +extern "C" int __cxa_atexit(void (*dtor)(void *), void * object, void * handle) { + return 0; +}