diff options
-rw-r--r-- | backends/platform/dc/dcloader.cpp | 7 | ||||
-rw-r--r-- | backends/platform/dc/dcloader.h | 2 | ||||
-rw-r--r-- | backends/platform/dc/plugin.syms | 1 | ||||
-rw-r--r-- | backends/platform/dc/plugin.x | 1 |
4 files changed, 10 insertions, 1 deletions
diff --git a/backends/platform/dc/dcloader.cpp b/backends/platform/dc/dcloader.cpp index bc5e3a733b..2627773b13 100644 --- a/backends/platform/dc/dcloader.cpp +++ b/backends/platform/dc/dcloader.cpp @@ -26,6 +26,8 @@ #include "dcloader.h" +#include <cxxabi.h> + #ifdef DL_DEBUG #define DBG(x) reportf x #else @@ -345,6 +347,7 @@ bool DLObject::open(const char *path) ctors_end = symbol("__plugin_ctors_end"); dtors_start = symbol("__plugin_dtors"); dtors_end = symbol("__plugin_dtors_end"); + dso_handle = symbol("__dso_handle"); if (ctors_start == NULL || ctors_end == NULL || dtors_start == NULL || dtors_end == NULL) { @@ -364,6 +367,10 @@ bool DLObject::open(const char *path) bool DLObject::close() { + if (dso_handle != NULL) { + __cxxabiv1::__cxa_finalize(dso_handle); + dso_handle = NULL; + } if (dtors_start != NULL && dtors_end != NULL) for (void (**f)(void) = (void (**)(void))dtors_start; f != dtors_end; f++) (**f)(); diff --git a/backends/platform/dc/dcloader.h b/backends/platform/dc/dcloader.h index 074ae7aa29..daa2802ec4 100644 --- a/backends/platform/dc/dcloader.h +++ b/backends/platform/dc/dcloader.h @@ -34,7 +34,7 @@ class DLObject { void *segment, *symtab; char *strtab; int symbol_cnt; - void *dtors_start, *dtors_end; + void *dtors_start, *dtors_end, *dso_handle; void seterror(const char *fmt, ...); void unload(); diff --git a/backends/platform/dc/plugin.syms b/backends/platform/dc/plugin.syms index 2cab08c9c7..9340ca20b8 100644 --- a/backends/platform/dc/plugin.syms +++ b/backends/platform/dc/plugin.syms @@ -6,3 +6,4 @@ ___plugin_ctors ___plugin_ctors_end ___plugin_dtors ___plugin_dtors_end +___dso_handle diff --git a/backends/platform/dc/plugin.x b/backends/platform/dc/plugin.x index 2c8469a335..039fca81cf 100644 --- a/backends/platform/dc/plugin.x +++ b/backends/platform/dc/plugin.x @@ -9,6 +9,7 @@ SECTIONS . = 0; .text : { + ___dso_handle = .; *(.text .stub .text.* .gnu.linkonce.t.*) *(.gnu.warning) } :plugin =0 |