summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Hughes <tomhughes@chromium.org>2021-10-01 21:11:39 +0000
committerCommit Bot <commit-bot@chromium.org>2021-11-03 22:59:53 +0000
commit1afc2d2704568e5d587eb2ceb18802a4d9bdf7af (patch)
tree096da1b2e939eb287c7a41ef2dba69c9c8d7de98
parentd6271635b6a8cdc875626433cef4faed4d068fcc (diff)
downloadchrome-ec-1afc2d2704568e5d587eb2ceb18802a4d9bdf7af.tar.gz
core/cortex-m0: Use compiler_rt version of clz and ctz
Use __clzsi2 and __ctzsi2 from compiler_rt instead of our own version. Using the compiler_rt versions result in a slightly smaller image. servo_micro before this change: RO: 18744 bytes in flash remaining RW: 23192 bytes in flash remaining servo_micro after this change: RO: 18808 bytes in flash remaining RW: 23256 bytes in flash remaining BRANCH=none BUG=b:172020503 TEST=CC=clang make BOARD=servo_micro TEST=make buildall Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Ibc19a3670127dde211fb20d247c1284d0aec5f61 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3199739 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
-rw-r--r--core/cortex-m0/config_core.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/core/cortex-m0/config_core.h b/core/cortex-m0/config_core.h
index c31adc471c..a40756fb49 100644
--- a/core/cortex-m0/config_core.h
+++ b/core/cortex-m0/config_core.h
@@ -10,9 +10,14 @@
#define BFD_ARCH arm
#define BFD_FORMAT "elf32-littlearm"
-/* Emulate the CLZ/CTZ instructions since the CPU core is lacking support */
+/*
+ * Emulate the CLZ/CTZ instructions since the CPU core is lacking support.
+ * When building with clang, we rely on compiler_rt to provide this support.
+ */
+#ifndef __clang__
#define CONFIG_SOFTWARE_CLZ
#define CONFIG_SOFTWARE_CTZ
+#endif /* __clang__ */
#define CONFIG_SOFTWARE_PANIC
#define CONFIG_ASSEMBLY_MULA32