summaryrefslogtreecommitdiffstats
path: root/apps/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/plugin.lds1
-rw-r--r--apps/plugins/plugin_crt0.c6
2 files changed, 7 insertions, 0 deletions
diff --git a/apps/plugins/plugin.lds b/apps/plugins/plugin.lds
index f150b9d168..653b8bae87 100644
--- a/apps/plugins/plugin.lds
+++ b/apps/plugins/plugin.lds
@@ -278,6 +278,7 @@ SECTIONS
.bss (NOLOAD) :
{
plugin_bss_start = .;
+ _plugin_bss_start = .;
*(.bss*)
#if defined(IRAMSIZE) && IRAMSIZE == 0
*(.ibss)
diff --git a/apps/plugins/plugin_crt0.c b/apps/plugins/plugin_crt0.c
index 536eccaffa..e34124c5a2 100644
--- a/apps/plugins/plugin_crt0.c
+++ b/apps/plugins/plugin_crt0.c
@@ -32,6 +32,8 @@ PLUGIN_HEADER
#define EXIT_MAGIC 0x0CDEBABE
extern enum plugin_status plugin_start(const void*);
+extern unsigned char plugin_bss_start[];
+extern unsigned char plugin_end_addr[];
static jmp_buf __exit_env;
/* only 1 atexit handler for now, chain in the exit handler if you need more */
@@ -61,6 +63,10 @@ enum plugin_status plugin__start(const void *param)
int exit_ret;
enum plugin_status ret;
+ /* zero out the bss section */
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
+ rb->memset(plugin_bss_start, 0, plugin_end_addr - plugin_bss_start);
+#endif
/* we come back here if exit() was called or the plugin returned normally */
exit_ret = setjmp(__exit_env);
if (exit_ret == 0)