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 --- apps/plugins/plugins.make | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'apps/plugins/plugins.make') diff --git a/apps/plugins/plugins.make b/apps/plugins/plugins.make index b430bd2792..4a126f812c 100644 --- a/apps/plugins/plugins.make +++ b/apps/plugins/plugins.make @@ -37,6 +37,12 @@ PLUGINLIB_OBJ := $(PLUGINLIB_SRC:.c=.o) PLUGINLIB_OBJ := $(PLUGINLIB_OBJ:.S=.o) PLUGINLIB_OBJ := $(call full_path_subst,$(ROOTDIR)/%,$(BUILDDIR)/%,$(PLUGINLIB_OBJ)) +ifdef USE_LTO +# We do NOT want LTO on the GCC support file. +$(BUILDDIR)/apps/plugins/lib/gcc-support.o: PLUGINFLAGS += -fno-lto +$(BUILDDIR)/apps/plugins/plugin_crt0.o: PLUGINFLAGS += -fno-lto +endif + ### build data / rules ifndef APP_TYPE CONFIGFILE := $(FIRMDIR)/export/config/$(MODELNAME).h @@ -147,6 +153,12 @@ else endif PLUGINLDFLAGS += $(GLOBAL_LDOPTS) +ifdef USE_LTO + PLUGINFLAGS += -flto -fno-builtin -ffreestanding + PLUGINLDFLAGS += -flto -fno-builtin -ffreestanding + PLUGINLDFLAGS += -e plugin_start +endif + $(BUILDDIR)/%.rock: $(call PRINTS,LD $(@F))$(CC) $(PLUGINFLAGS) -o $(BUILDDIR)/$*.elf \ $(filter %.o, $^) \ -- cgit v1.2.3