Added ARM32 support
This commit is contained in:
1 parent
df792729ef
commit
1212cb9dbe
36 files changed
+2381
-783
No files matched your search
@@ -2,7 +2,7 @@
|
||||
* @file Plugin.cpp
|
||||
* @brief PluginV1 -- "before your edit". See PluginV2/src/Plugin.cpp for
|
||||
* "after"; the two deliberately export the identical set of names
|
||||
* (minus plugin_legacy_feature, removed in V2) so HotReloadContext can
|
||||
* (minus plugin_legacy_feature, removed in V2) so Context can
|
||||
* line them up. See ../Shared/PluginApi.h for what each export is
|
||||
* there to demonstrate (and for the documentation of every function
|
||||
* defined here).
|
||||
@@ -24,7 +24,16 @@ int plugin_legacy_feature(int input)
|
||||
return input;
|
||||
}
|
||||
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#if defined(__arm__) || defined(_M_ARM)
|
||||
// See Shared/PluginApi.h's doc comment on plugin_tiny_function for why ARM32 needs this, rather
|
||||
// than the plain empty body every other architecture uses below.
|
||||
__asm__(
|
||||
".global plugin_tiny_function\n"
|
||||
".type plugin_tiny_function, %function\n"
|
||||
"plugin_tiny_function:\n"
|
||||
"\tbx lr\n"
|
||||
".size plugin_tiny_function, . - plugin_tiny_function\n");
|
||||
#elif defined(__GNUC__) || defined(__clang__)
|
||||
void plugin_tiny_function(void)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -26,7 +26,16 @@ int plugin_new_feature(int input)
|
||||
return result;
|
||||
}
|
||||
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#if defined(__arm__) || defined(_M_ARM)
|
||||
// See Shared/PluginApi.h's doc comment on plugin_tiny_function for why ARM32 needs this, rather
|
||||
// than the plain empty body every other architecture uses below.
|
||||
__asm__(
|
||||
".global plugin_tiny_function\n"
|
||||
".type plugin_tiny_function, %function\n"
|
||||
"plugin_tiny_function:\n"
|
||||
"\tbx lr\n"
|
||||
".size plugin_tiny_function, . - plugin_tiny_function\n");
|
||||
#elif defined(__GNUC__) || defined(__clang__)
|
||||
void plugin_tiny_function(void)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -67,6 +67,19 @@ extern "C"
|
||||
* and the library can only estimate one from the distance to the next
|
||||
* export. MSVC has no equivalent per-function override this demo could
|
||||
* apply, so this one only exists on GCC/Clang.
|
||||
*
|
||||
* ARM32 needs a different implementation underneath this same
|
||||
* declaration (see PluginV1/src/Plugin.cpp): an ordinary empty C++
|
||||
* body there, even with patchable-function-entry overridden to zero,
|
||||
* still picks up an unoptimized build's full frame-pointer prologue
|
||||
* and epilogue -- confirmed directly, 8 bytes on this architecture at
|
||||
* `-O0`, tying this library's own ARM-state jump size exactly rather
|
||||
* than falling safely under it. A single hand-written `bx lr`, at file
|
||||
* scope rather than inside a C++ function body (sidestepping a
|
||||
* separate GCC quirk: an asm statement inside a naked function body
|
||||
* is followed by an unconditional extra NOP, confirmed directly),
|
||||
* reliably stays under every ARM32 jump size this library ever
|
||||
* writes, in both instruction sets, at every optimization level.
|
||||
*/
|
||||
__attribute__((patchable_function_entry(0))) void plugin_tiny_function(void);
|
||||
#endif
|
||||
|
||||
@@ -68,8 +68,8 @@ exact workflow (keep the Host running, rebuild the DLL it already
|
||||
loaded) fail with the linker unable to write its output. This example
|
||||
avoids that for a reason that already exists elsewhere in this
|
||||
library, not anything specific to this demo:
|
||||
`HotReloadContext::stagePathForLoad()` (`source/HotReload/src/
|
||||
HotReloadContext.cpp`) copies a plugin to a fresh, uniquely-named file
|
||||
`Context::stagePathForLoad()` (`source/HotReload/src/
|
||||
Context.cpp`) copies a plugin to a fresh, uniquely-named file
|
||||
before ever calling `LoadLibrary`/`dlopen` on it -- built originally to
|
||||
sidestep a dlopen caching gotcha on POSIX (see that function's
|
||||
comment) -- so the path this example's build actually writes to is
|
||||
@@ -108,7 +108,7 @@ genuine full clean.
|
||||
## Leftover `hotreload_live_plugin.dll.hotreload.live.N` files
|
||||
|
||||
Each reload stages the plugin through a fresh, uniquely-named copy
|
||||
before loading it (`HotReloadContext::stagePathForLoad()`, needed for
|
||||
before loading it (`Context::stagePathForLoad()`, needed for
|
||||
reasons unrelated to this -- see that function's comment). On Linux/
|
||||
macOS, the copy is deleted right after loading and nothing
|
||||
accumulates. On Windows, that deletion fails for as long as the module
|
||||
|
||||
Reference in new issue
Block a user