summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorTom Hughes <tomhughes@chromium.org>2022-12-02 15:58:36 -0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-12-10 00:06:19 +0000
commitde8908e10a76bd627df93c393f17115140cd23ce (patch)
tree9579ad670ec2cddbc0351ed61f5cdc2fb29b165a /core
parent6720e20dae9c6636bd5a089d8d21c64f66511c8c (diff)
downloadchrome-ec-de8908e10a76bd627df93c393f17115140cd23ce.tar.gz
core/cortex-m: Call constructors of global objects
BRANCH=none BUG=b:261636413 TEST=./test/run_device_tests.py -b dartmonkey -t global_initialization => PASS Cq-Depend: chromium:4083816 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Ia7e9069a6a030c81cb0697346baa9a08861e56cb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4081571 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Bobby Casey <bobbycasey@google.com>
Diffstat (limited to 'core')
-rw-r--r--core/cortex-m/ec.lds.S2
-rw-r--r--core/cortex-m/init.S8
2 files changed, 10 insertions, 0 deletions
diff --git a/core/cortex-m/ec.lds.S b/core/cortex-m/ec.lds.S
index 8ea35911df..c11dc8f0a5 100644
--- a/core/cortex-m/ec.lds.S
+++ b/core/cortex-m/ec.lds.S
@@ -352,7 +352,9 @@ SECTIONS
* https://developer.arm.com/documentation/dui0475/c/the-arm-c-and-c---libraries/c---initialization--construction-and-destruction
*/
. = ALIGN(4);
+ __init_array_start = .;
*(.init_array*)
+ __init_array_end = .;
/*
* Empty C++ exception index table. The exception index
diff --git a/core/cortex-m/init.S b/core/cortex-m/init.S
index 5cde406a58..a947b2e9d1 100644
--- a/core/cortex-m/init.S
+++ b/core/cortex-m/init.S
@@ -98,6 +98,14 @@ data_loop:
isb /* Reset pipeline */
#endif /* CONFIG_DEBUG_DISABLE_WRITE_BUFFER */
+#if !defined(USE_BUILTIN_STDLIB)
+ /*
+ * Constructors of global objects.
+ * https://developer.arm.com/documentation/dui0475/c/the-arm-c-and-c---libraries/c---initialization--construction-and-destruction
+ */
+ bl __libc_init_array
+#endif
+
/* Jump to C code */
bl main