From 73f40d8a2385543464d79d4461ab68eb56783d26 Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Sun, 2 Jul 2023 20:43:01 -0400 Subject: build: Experimental LTO support, phase one * Only codecs and plugins are enabled * Only native builds (so far) * Only tested on xDuoo X3 (MIPS, monochrome) * opus & speex generate some warnings * Significant compile time impact Change-Id: I519b0d179631a54b2103cd67225bd5ec6ad3bd2f --- lib/rbcodec/codecs/codecs.make | 7 +++++++ lib/rbcodec/codecs/lib/libcodec.make | 5 +++++ 2 files changed, 12 insertions(+) (limited to 'lib') diff --git a/lib/rbcodec/codecs/codecs.make b/lib/rbcodec/codecs/codecs.make index 27ba73ab3c..83dc784ee3 100644 --- a/lib/rbcodec/codecs/codecs.make +++ b/lib/rbcodec/codecs/codecs.make @@ -33,6 +33,13 @@ else endif CODECLDFLAGS += $(GLOBAL_LDOPTS) +ifdef USE_LTO + CODECLDFLAGS += -flto -fno-builtin -ffreestanding + CODECFLAGS += -flto -fno-builtin -ffreestanding + CODECLDFLAGS += -e __header +endif + + # the codec libraries include $(RBCODECLIB_DIR)/codecs/demac/libdemac.make include $(RBCODECLIB_DIR)/codecs/liba52/liba52.make diff --git a/lib/rbcodec/codecs/lib/libcodec.make b/lib/rbcodec/codecs/lib/libcodec.make index 0788dd6705..b197464528 100644 --- a/lib/rbcodec/codecs/lib/libcodec.make +++ b/lib/rbcodec/codecs/lib/libcodec.make @@ -23,6 +23,11 @@ ifneq ($(findstring sdl-sim, $(APP_TYPE)), sdl-sim) CODECLIBFLAGS += -ffunction-sections endif +ifdef USE_LTO +# We do NOT want LTO on the GCC support file +$(CODECDIR)/lib/codeclib.o: CODECLIBFLAGS += -fno-lto +endif + $(CODECDIR)/lib/%.o: $(RBCODECLIB_DIR)/codecs/lib/%.c $(SILENT)mkdir -p $(dir $@) $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) \ -- cgit v1.2.3