230 Commits

Author SHA1 Message Date
Miro Kropacek 7d5c708f54 JANITORIAL: Move basepage.h include to the right place
This should make m68k-loader.cpp truly platform-agnostic.
2026-05-06 08:45:37 +10:00
Miro Kropacek 3a6a355c20 BACKENDS: SDL: Add plugins support for Atari/FireBee 2026-04-27 02:05:36 +10:00
Miro Kropacek b02c2de70f BACKENDS: ATARI: Match other platforms' plugin.ld ctors/dtors layout
Revert the folding of .init_array / .fini_array into ___plugin_ctors /
___plugin_dtors. Other ELF-loader backends (3ds, riscos, wii, ds, psp)
keep these as separate sections, and the cross-platform migration to
walk .init_array / .fini_array directly from the loader will be done in
the future (see https://github.com/scummvm/scummvm/pull/7446).

m68k-atari-mintelf-gcc emits .init_array / .fini_array rather than
.ctors / .dtors. I have verified it two ways: scummvm.prg has populated
.init_array (6 entries) and .fini_array (1 entry); and adding a single
namespace-scope `static Foo g;` to an engine TU produces an .init_array
entry in the resulting .plg that lives outside ___plugin_ctors ..
___plugin_ctors_end. So with this layout, such an entry is silently
never run (same of every other ELF backend?). Fortunately, no engine has
such a static today (every built plugin has empty ctor/dtor ranges), so
nothing currently breaks.
2026-04-27 02:05:36 +10:00
Miro Kropacek 83ebddc748 BACKENDS: ATARI: Implement plugins 2026-04-27 02:05:36 +10:00
Miro Kropacek e09b9dfad6 PLUGINS: Provide __cxa_atexit & __cxa_finalize
Atari's mintelf platform has ELF support but its libc does not provide
__cxa_atexit / __cxa_finalize, so -fuse-cxa-atexit cannot be used out of
the box. Add a minimal shim (plus a __dso_handle definition for the main
executable) so plugins can register and finalize their function-local
static destructors per DSO on unload.

Note: earlier version ran __cxa_finalize from the host via
findSymbol("__dso_handle"). That works as long as exactly one
__dso_handle ends up in the plugin's symtab (the plugin's own).

When the main binary also defines __dso_handle (so the host's
function-local statics can link with -fuse-cxa-atexit), it breaks: the
plugin link uses --just-symbols=<main binary> and imports that as a
second __dso_handle, and findSymbol can then return the host-imported
one instead of the plugin's own. The two addresses differ, so
__cxa_finalize matches nothing.

The plugin-side helper avoids the ambiguity on every target by using
whichever __dso_handle the plugin's own code already resolved against --
the same one embedded in its __cxa_atexit calls. (PSP2's plugin runtime
has always called __cxa_finalize from inside the plugin for the same
reason; see backends/plugins/psp2/plugin.cpp.)
2026-04-27 02:05:36 +10:00
Alexander Reim ea6881d515 WII: Fix compilation problems with the latest version of devkitPPC (R48) 2026-01-30 10:31:09 +01:00
Donovan Watteau 2ae50a5059 JANITORIAL: Update some old URLs, and use web.archive.org for deleted content 2025-10-29 14:22:37 +01:00
Christian Kündig 0c039741e5 BACKENDS: SDL: Fix SDLPlugin for SDL3 2025-08-03 22:52:23 +02:00
Le Philousophe 8ed733994f VITA: Fix build 2024-09-17 08:29:05 +02:00
sluicebox c4822373b6 WIN32: Fix Win32Plugin by updating for Common::Path 2024-08-19 12:04:26 -07:00
Donovan Watteau 42b2760f43 BACKENDS: Fix -Wformat warning 2024-08-11 16:33:53 +02:00
Le Philousophe 09729ac9de PLUGINS: Use override keyword
This silences a clang warning
2024-06-30 18:39:06 +02:00
Le Philousophe c9d701884b PLUGINS: Reset pointer after deletion
This avoids error on double unload.
2024-06-30 18:39:06 +02:00
Donovan Watteau 81c0503008 MACOSX: Fix macOS builds with plugins (as used for OSX PPC releases) 2024-06-16 09:12:16 +02:00
Le Philousophe 2a7241a97c PLUGINS: Implement NONE relocations
ARM emit them in some cases and add it to MIPS for completeness

Fixes: #14905
2024-02-24 20:48:21 +01:00
Vladimir Serbinenko 0b10743566 KOLIBRI: Replace kos32sys.h
kos32sys.h is no longer available. Just declare DLL-related functions ourselves
like other programs do.
2024-01-20 23:52:50 +01:00
Cameron Cawley 288e1aaa3f COMMON: Remove use of fmin/fmax/fminf/fmaxf 2024-01-08 13:07:05 +01:00
Le Philousophe f156e3a0c2 VITA: Hopefully really fix the build 2023-12-29 08:35:08 +01:00
Le Philousophe 2fdd7ce9d0 VITA: Add missing function for plugins 2023-12-28 18:18:31 +01:00
Le Philousophe b3fbce7782 BACKENDS: Migrate plugins to Path API 2023-12-24 13:19:25 +01:00
Cameron Cawley 3a6566c1f0 DS: Hack to work around ARM/Thumb relocation issues in the SCUMM engine 2023-11-05 22:01:40 +01:00
Le Philousophe fa450e060e PSP2: Add missing function for plugins 2023-08-29 12:45:30 +02:00
Kaloyan Chehlarski 3a31521b27 RISCOS: Add log2f to function to link 2023-08-22 13:30:34 +03:00
sluicebox dc0ba4e14a WIN32: Re-enable Win32PluginProvider
In 2006, Win32PluginProvider was removed from Windows builds:
df5be19409

Instead, SdlPluginProvider became the provider used in Window builds.
Currently, no code uses Win32PluginProvider.

The two classes are small and effectively do the same thing, but
Win32PluginProvider has the advantage of using our Windows string
conversion functions for paths, just like the rest of backend code.
We've seen problems before where SDL handles encoding differently:
0ab9653556
2023-08-06 14:16:16 +02:00
Cameron Cawley a12c007e92 RISCOS: Don't force the use of dynamic areas on RISC OS 5 2023-02-28 22:46:03 +00:00
Le Philousophe 57e759e05d RISCOS: Use dynamic areas for data and application space for plugins
We only use application space in 26-bits (legacy) mode.
2023-02-07 22:13:32 +00:00
Vladimir Serbinenko 4bcd4671ab KOLIBRI: Add kolibrios backend 2023-02-05 22:55:40 +01:00
Vladimir Serbinenko bfd7f91d5c COMMON: Fix 3DS compilation with newer toolchain that emits PREL31 relocs 2022-12-13 13:41:18 +01:00
Le Philousophe 2a84d3e988 VITA: Add plugins support 2022-08-07 18:15:09 +02:00
Cameron Cawley 05a5e44729 RISCOS: Add log10f and strcoll to functions to link 2022-06-19 00:34:58 +01:00
Le Philousophe a591c8b6bf RISCOS: Add expf to functions to link 2022-06-18 16:10:22 +02:00
Le Philousophe b065158898 RISCOS: Don't build SDLPluginProvider: it doesn't work for us
And it fails to build with VFP because libdl is not compiled with VFP
2022-06-18 16:10:22 +02:00
Cameron Cawley 038579d0d9 PLUGINS: Improve warnings when allocation fails 2022-06-17 20:38:37 +01:00
Cameron Cawley b862b55822 RISCOS: Ensure that functions used by plugins can be found in the main executable 2022-06-17 21:31:04 +02:00
Cameron Cawley f9e64f2293 RISCOS: Use OS_SynchroniseCodeAreas to flush the cache 2022-06-17 21:31:04 +02:00
Le Philousophe 02808a019a RISCOS: Add an ELF plugin provider
This will allow do dynamically load plugins and not be limited by
24-bits relocations
2022-06-17 21:31:04 +02:00
Le Philousophe 87f515a6e0 PLUGINS: Force export of __dso_handle
Some toolchains (RiscOS) may not export it in certain conditions.
This list does not enforce the symbol to be here so it shouldn't fail
build on platforms without this symbol.
2022-06-17 21:31:04 +02:00
Le Philousophe f60d229c78 PLUGINS: Implement R_ARM_PC24 relocations
These relocations are used in RiscOS even when using long calls.
As it's a relative relocation, nothing is to be done.
2022-06-17 21:31:04 +02:00
Donovan Watteau 4672ba71dd PLUGINS: Let macOS use its resource bundle as a valid plugin directory 2022-05-22 23:42:45 +01:00
Francisco Javier Trujillo Mata 9aa4485137 PSP: Update executable start position 2022-05-02 17:11:10 -05:00
Cameron Cawley 57abc6b86f PSP: Remove .MIPS.abiflags* sections from plugins 2022-04-29 13:29:25 -05:00
Le Philousophe 675695c708 PSP: Fix build failures with latest PSP toolchain
The new PSP toolchain automatically links system libraries which wasn't
the case before. The ordering of libraries builtin in GCC and our spec
file collided. This fixes the order.
PSP SDK includes time.h so it needs an exemption.
A warning was emitted about a if without curly braces which are needed.
2021-12-31 09:50:53 +01:00
Eugene Sandulenko abea37c9bb ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
Orgad Shaneh b11c5ace90 BACKENDS: JANITORIAL: Remove 'virtual' when override is specified 2021-11-14 14:31:41 +02:00
Cameron Cawley d540054c0a DS: Remove .ARM.exidx* and .ARM.extab* sections from plugins
Thanks to @lephilousophe for helping out with this.
2021-08-27 17:45:37 +01:00
sluicebox 006b91f45b WIN32: Fix #includes in plugin provider 2021-07-07 01:20:25 -05:00
sluicebox 7deb79efab WIN32: Make Win32Plugin UNICODE compatible 2021-06-29 12:38:01 -05:00
Orgad Shaneh a05e54f00c JANITORIAL: Remove trailing whitespaces 2021-05-04 11:46:30 +03:00
Cameron Cawley a900337952 DS: Fix default search paths 2021-02-04 01:59:14 +01:00
Alexander Reim 901032db9f WII: Update linkscript and fix for linker false error message 2020-10-19 11:21:22 +02:00