From 1afc2d2704568e5d587eb2ceb18802a4d9bdf7af Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Fri, 1 Oct 2021 21:11:39 +0000 Subject: 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 Change-Id: Ibc19a3670127dde211fb20d247c1284d0aec5f61 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3199739 Reviewed-by: Jack Rosenthal --- core/cortex-m0/config_core.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 -- cgit v1.2.1