[Scummvm-git-logs] scummvm master -> 199a2b078e5f0d2a4871577d11bfc7e7413a9abe
lephilousophe
noreply at scummvm.org
Sat Oct 17 14:35:25 UTC 2026
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
199a2b078e BASE: Fix __dso_handle definition
Commit: 199a2b078e5f0d2a4871577d11bfc7e7413a9abe
https://github.com/scummvm/scummvm/commit/199a2b078e5f0d2a4871577d11bfc7e7413a9abe
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2026-10-17T16:35:09+02:00
Commit Message:
BASE: Fix __dso_handle definition
Type is void * and its value must be an address pointing inside the
DSO.
Changed paths:
backends/plugins/elf/cxa-atexit.cpp
backends/plugins/psp2/plugin.cpp
base/plugins.h
diff --git a/backends/plugins/elf/cxa-atexit.cpp b/backends/plugins/elf/cxa-atexit.cpp
index 4865a691962..9e8384bf048 100644
--- a/backends/plugins/elf/cxa-atexit.cpp
+++ b/backends/plugins/elf/cxa-atexit.cpp
@@ -54,13 +54,6 @@ static int s_count;
extern "C" {
-// GCC with -fuse-cxa-atexit emits references to __dso_handle in every TU that
-// has function-local statics with non-trivial destructors. It is normally
-// provided by crtbegin.o; on targets whose startup files don't supply one,
-// define it here for the main executable. Its address uniquely identifies
-// the main DSO.
-void *__dso_handle = &__dso_handle;
-
int __cxa_atexit(void (*destructor)(void *), void *arg, void *dso_handle) {
if (s_count >= CXA_ATEXIT_MAX) {
warning("elfloader: cxa-atexit table full (max=%d), dropping dtor %p dso=%p",
diff --git a/backends/plugins/psp2/plugin.cpp b/backends/plugins/psp2/plugin.cpp
index ec80e4d371c..5be9fd6e7ca 100644
--- a/backends/plugins/psp2/plugin.cpp
+++ b/backends/plugins/psp2/plugin.cpp
@@ -32,6 +32,9 @@
#include "base/plugins.h"
#include "backends/plugins/psp2/psp2-plugin.h"
+// hacks to make libc work
+extern void *__dso_handle __attribute__((weak));
+
extern "C" {
int32 PLUGIN_getVersion();
@@ -47,10 +50,6 @@ static PSP2FunctionPointers PSP2Functions = {
PLUGIN_getObject,
};
-// hacks to make libc work
-//void* __dso_handle = (void*) &__dso_handle;
-extern void *__dso_handle __attribute__((weak));
-
/* These magic symbols are provided by the linker. */
extern void (*__preinit_array_start []) (void) __attribute__((weak));
extern void (*__preinit_array_end []) (void) __attribute__((weak));
diff --git a/base/plugins.h b/base/plugins.h
index 12bc01aaba1..e95023a7433 100644
--- a/base/plugins.h
+++ b/base/plugins.h
@@ -67,7 +67,7 @@ extern const int pluginTypeVersions[PLUGIN_TYPE_MAX];
// see comments in backends/plugins/elf/elf-provider.cpp
#if defined(USE_ELF_LOADER) && defined(ELF_LOADER_CXA_ATEXIT)
#define PLUGIN_DYNAMIC_DSO_HANDLE \
- uint32 __dso_handle __attribute__((visibility("hidden"))) = 0;
+ __attribute__((visibility("hidden"))) void *__dso_handle = &__dso_handle;
// Exported helper that runs __cxa_finalize from inside the plugin, so the
// &__dso_handle argument is the plugin's own resolved address -- the same one
// GCC embedded in its __cxa_atexit calls. Calling __cxa_finalize from the host
@@ -115,8 +115,8 @@ extern const int pluginTypeVersions[PLUGIN_TYPE_MAX];
* @see REGISTER_PLUGIN_STATIC
*/
#define REGISTER_PLUGIN_DYNAMIC(ID,TYPE,PLUGINCLASS) \
+ PLUGIN_DYNAMIC_DSO_HANDLE \
extern "C" { \
- PLUGIN_DYNAMIC_DSO_HANDLE \
PLUGIN_DYNAMIC_FINALIZE \
PLUGIN_DYNAMIC_BUILD_DATE \
PLUGIN_EXPORT int32 PLUGIN_getVersion() { return PLUGIN_VERSION; } \
More information about the Scummvm-git-logs
mailing list