diff --git a/apps/plugins/plugins.make b/apps/plugins/plugins.make index 4a126f812c..4dd55134c9 100644 --- a/apps/plugins/plugins.make +++ b/apps/plugins/plugins.make @@ -154,8 +154,8 @@ endif PLUGINLDFLAGS += $(GLOBAL_LDOPTS) ifdef USE_LTO - PLUGINFLAGS += -flto -fno-builtin -ffreestanding - PLUGINLDFLAGS += -flto -fno-builtin -ffreestanding + PLUGINFLAGS += -fno-builtin -ffreestanding + PLUGINLDFLAGS += -fno-builtin -ffreestanding PLUGINLDFLAGS += -e plugin_start endif diff --git a/firmware/firmware.make b/firmware/firmware.make index e2babca594..e70de7c881 100644 --- a/firmware/firmware.make +++ b/firmware/firmware.make @@ -47,6 +47,11 @@ $(BUILDDIR)/sysfont.o: $(SYSFONTX) $(BUILDDIR)/sysfont.h $(call PRINTS,CONVBDF $(subst $(ROOTDIR)/,,$<))$(TOOLSDIR)/convbdf -l $(MAXCHAR) -c -o $(BUILDDIR)/sysfont.c $< $(call PRINTS,CC $(subst $(ROOTDIR)/,,$(BUILDDIR)/sysfont.c))$(CC) $(CFLAGS) -c $(BUILDDIR)/sysfont.c -o $@ +ifdef USE_LTO +$(BUILDDIR)/firmware/asm/%.o: CFLAGS += -fno-lto +$(BUILDDIR)/firmware/kernel/%.o: CFLAGS += -fno-lto +endif + # GNU make (at least) has a bug/feature that exported variable are not available # in the shell function (but are in recipe). Thus we need to explicitely pass # the VERSION environement variable diff --git a/lib/rbcodec/codecs/codecs.make b/lib/rbcodec/codecs/codecs.make index 67bbcee5a5..fbb71f11a8 100644 --- a/lib/rbcodec/codecs/codecs.make +++ b/lib/rbcodec/codecs/codecs.make @@ -34,8 +34,8 @@ endif CODECLDFLAGS += $(GLOBAL_LDOPTS) ifdef USE_LTO - CODECLDFLAGS += -flto -fno-builtin -ffreestanding - CODECFLAGS += -flto -fno-builtin -ffreestanding + CODECLDFLAGS += -fno-builtin -ffreestanding + CODECFLAGS += -fno-builtin -ffreestanding CODECLDFLAGS += -e __header endif diff --git a/tools/configure b/tools/configure index 57d17d0074..8800d0d924 100755 --- a/tools/configure +++ b/tools/configure @@ -1079,7 +1079,7 @@ S(m)all C lib, Logf to Ser(i)al port, LTO Build(X), (E)rror on warnings" [Xx]) echo "LTO build enabled" LTO_ARG="export USE_LTO=y" -# GCCOPTS="$GCCOPTS -flto" + GCCOPTS="$GCCOPTS -flto" ;; [Ee]) echo "Treating all warnings as errors"