diff --git a/litex/soc/software/libcompiler_rt/Makefile b/litex/soc/software/libcompiler_rt/Makefile index 4516f83e9..f688365a9 100644 --- a/litex/soc/software/libcompiler_rt/Makefile +++ b/litex/soc/software/libcompiler_rt/Makefile @@ -14,14 +14,10 @@ OBJECTS=umodsi3.o udivsi3.o divsi3.o modsi3.o comparesf2.o comparedf2.o negsf2.o clzsi2.o ctzsi2.o udivdi3.o umoddi3.o moddi3.o ucmpdi2.o ifeq ($(CPUFAMILY), arm) -OBJECTS += aeabi_div0.o aeabi_uldivmod.o aeabi_uidivmod.o aeabi_idivmod.o \ - udivmodsi4.o divmodsi4.o aeabi_ldivmod.o divmoddi4.o - -%.o: $(COMPILER_RT_DIRECTORY)/lib/builtins/arm/%.c - $(call compile,-fno-lto) - -%.o: $(COMPILER_RT_DIRECTORY)/lib/builtins/arm/%.S - $(call compile,-fno-lto) +OBJECTS += aeabi_uidivmod.o aeabi_idivmod.o udivmodsi4.o divmodsi4.o divmoddi4.o +ifneq ($(CPU), cortex_m1) +OBJECTS += aeabi_div0.o aeabi_uldivmod.o aeabi_ldivmod.o +endif endif all: libcompiler_rt.a @@ -32,10 +28,16 @@ libcompiler_rt.a: $(OBJECTS) mulsi3.o # pull in dependency info for *existing* .o files -include $(OBJECTS:.o=.d) -mulsi3.o: $(SOC_DIRECTORY)/software/libcompiler_rt/mulsi3.c +VPATH = $(SOC_DIRECTORY)/software/libcompiler_rt:$(COMPILER_RT_DIRECTORY)/lib/builtins + +ifeq ($(CPUFAMILY), arm) +VPATH += $(COMPILER_RT_DIRECTORY)/lib/builtins/arm +endif + +%.o: %.c $(call compile,-fno-lto) -%.o: $(COMPILER_RT_DIRECTORY)/lib/builtins/%.c +%.o: %.S $(call compile,-fno-lto) .PHONY: all clean