summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2024-11-24 08:23:38 -0500
committerSolomon Peachy <pizza@shaftnet.org>2024-11-24 08:23:38 -0500
commitbdf1690cb2e30d12ba2fbce18eb9198f06297eb8 (patch)
tree74ecddaf071905176d0fae48274457a2fbf7171e
parent200529532b01026e974c62aa82042e10d7d165d5 (diff)
downloadrockbox-bdf1690cb2.tar.gz
rockbox-bdf1690cb2.zip
build: Allow LTO to work globally, not just codecs/plugins
IMPORTANT: There is no guarantee this will compile cleanly much less _work_ on any given target. This is purely to enable future hackery. Change-Id: Ib58f21b717719fd4325622b446a60779406ae035
-rw-r--r--apps/plugins/plugins.make4
-rw-r--r--firmware/firmware.make5
-rw-r--r--lib/rbcodec/codecs/codecs.make4
-rwxr-xr-xtools/configure2
4 files changed, 10 insertions, 5 deletions
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"