diff --git a/litex/soc/software/common.mak b/litex/soc/software/common.mak index a2d90b96d..6d8486b5a 100644 --- a/litex/soc/software/common.mak +++ b/litex/soc/software/common.mak @@ -52,10 +52,11 @@ INCLUDES = -I$(PICOLIBC_DIRECTORY)/newlib/libc/tinystdio \ -I$(BUILDINC_DIRECTORY) \ -I$(BUILDINC_DIRECTORY)/../libc \ -I$(CPU_DIRECTORY) +PICOLIBC_SPECS = --specs=$(BUILDINC_DIRECTORY)/../libc/picolibc.specs -DPICOLIBC_INTEGER_PRINTF_SCANF COMMONFLAGS = $(DEPFLAGS) -Os $(CPUFLAGS) -g3 -fomit-frame-pointer -Wall -fno-builtin -fno-stack-protector -flto $(INCLUDES) CFLAGS = $(COMMONFLAGS) -fexceptions -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes CXXFLAGS = $(COMMONFLAGS) -std=c++11 -I$(SOC_DIRECTORY)/software/include/basec++ -fexceptions -fno-rtti -ffreestanding -LDFLAGS = -nostdlib -nodefaultlibs -Wl,--no-dynamic-linker -Wl,--build-id=none $(CFLAGS) -L$(BUILDINC_DIRECTORY) +LDFLAGS = -nostdlib -nodefaultlibs -Wl,--no-dynamic-linker -Wl,--build-id=none $(CFLAGS) -L$(BUILDINC_DIRECTORY) $(PICOLIBC_SPECS) define compilexx $(CX) -c $(CXXFLAGS) $(1) $< -o $@ diff --git a/litex/soc/software/libc/Makefile b/litex/soc/software/libc/Makefile index ab55e33c8..d57587649 100644 --- a/litex/soc/software/libc/Makefile +++ b/litex/soc/software/libc/Makefile @@ -1,7 +1,7 @@ include ../include/generated/variables.mak include $(SOC_DIRECTORY)/software/common.mak -all: libc.a iob.c.o missing.c.o exchange.c.o arc4random.c.o +all: libc.a iob.c.o missing.c.o CPUFAMILY= @@ -35,8 +35,8 @@ cpu = '$(CPU)' endian = '$(CPUENDIANNESS)' [built-in options] -c_args = [ '-DPRINTF_LEVEL=1', $(foreach flag,$(filter-out $(DEPFLAGS),$(CFLAGS)),'$(flag)',) ] -c_link_args = [ '-DPRINTF_LEVEL=1', $(foreach flag,$(LDFLAGS),'$(flag)',) ] +c_args = [ $(foreach flag,$(filter-out $(DEPFLAGS) -flto,$(CFLAGS)),'$(flag)',) ] +c_link_args = [ $(foreach flag,$(filter-out -flto,$(LDFLAGS)),'$(flag)',) ] endef export CROSSFILE @@ -68,11 +68,3 @@ missing.c.o: $(LIBC_DIRECTORY)/missing.c $(compile) $(AR) csr libc.a $@ -exchange.c.o: $(PICOLIBC_DIRECTORY)/newlib/libc/tinystdio/exchange.c - $(call compile,-fno-lto) - $(AR) csr libc.a $@ - -arc4random.c.o: $(PICOLIBC_DIRECTORY)/newlib/libc/stdlib/arc4random.c - $(call compile,-fno-lto) - $(AR) csr libc.a $@ -