diff options
Diffstat (limited to 'core/cortex-m0/build.mk')
-rw-r--r-- | core/cortex-m0/build.mk | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/core/cortex-m0/build.mk b/core/cortex-m0/build.mk index 40764f53c6..8d2002bad5 100644 --- a/core/cortex-m0/build.mk +++ b/core/cortex-m0/build.mk @@ -15,6 +15,8 @@ $(call set-option,CROSS_COMPILE,\ CFLAGS_CPU+=-mthumb ifeq ($(cc-name),clang) CFLAGS_CPU+=-Oz # Like -Os (and thus -O2), but reduces code size further. +# Link compiler-rt when using clang, so clang finds the builtins it provides. +LDFLAGS_EXTRA+=-lclang_rt.builtins-arm else CFLAGS_CPU+=-Os CFLAGS_CPU+=-mno-sched-prolog @@ -26,8 +28,17 @@ CFLAGS_CPU+=-flto LDFLAGS_EXTRA+=-flto endif -core-y=cpu.o debug.o init.o thumb_case.o div.o lmul.o ldivmod.o mula.o uldivmod.o -core-y+=vecttable.o __builtin.o +core-y=cpu.o debug.o init.o thumb_case.o mula.o +# When using clang, we get these as builtins from compiler-rt. +ifneq ($(cc-name),clang) +core-y+=div.o lmul.o ldivmod.o uldivmod.o +endif + +core-y+=vecttable.o +# When using clang, we get these as builtins from compiler-rt. +ifneq ($(cc-name),clang) +core-y+=__builtin.o +endif core-$(CONFIG_COMMON_PANIC_OUTPUT)+=panic.o core-$(CONFIG_COMMON_RUNTIME)+=switch.o task.o |