summaryrefslogtreecommitdiffstats
path: root/src/target/firmware/lib/ctors.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/target/firmware/lib/ctors.c')
-rw-r--r--src/target/firmware/lib/ctors.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/target/firmware/lib/ctors.c b/src/target/firmware/lib/ctors.c
new file mode 100644
index 0000000..982169d
--- /dev/null
+++ b/src/target/firmware/lib/ctors.c
@@ -0,0 +1,15 @@
+
+/* iterate over list of constructor functions and call each element */
+void do_global_ctors(const char *_ctors_start, const char *ctors_end)
+{
+ typedef void (*func_ptr)(void);
+ func_ptr *func, *ctors_start = (func_ptr *) _ctors_start;
+
+ /* skip the first entry, as it contains the number of
+ * constructors which we don't use */
+ ctors_start++;
+
+ for (func = ctors_start;
+ *func && (func != (func_ptr *) ctors_end); func++)
+ (*func)();
+}