forked from len0rd/rockbox
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
This commit is contained in:
parent
7b12cc3927
commit
73f40d8a23
4 changed files with 31 additions and 1 deletions
|
@ -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, $^) \
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) \
|
||||
|
|
8
tools/configure
vendored
8
tools/configure
vendored
|
@ -945,13 +945,14 @@ whichadvanced () {
|
|||
echo ""
|
||||
printf "Enter your developer options (press only enter when done)\n\
|
||||
(D)EBUG, (L)ogf, Boot(c)hart, (S)imulator, (P)rofiling, (V)oice, (U)SB Serial, (W)in32 crosscompile,\n\
|
||||
Win(6)4 crosscompile, (T)est plugins, (O)mit plugins, S(m)all C lib, Logf to Ser(i)al port:"
|
||||
Win(6)4 crosscompile, (T)est plugins, (O)mit plugins, S(m)all C lib, Logf to Ser(i)al port, LTO (B)uild "
|
||||
if [ "$modelname" = "iaudiom5" ]; then
|
||||
printf ", (F)M radio MOD"
|
||||
fi
|
||||
if [ "$modelname" = "iriverh120" ]; then
|
||||
printf ", (R)TC MOD"
|
||||
fi
|
||||
printf ":"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
|
@ -1043,6 +1044,10 @@ Win(6)4 crosscompile, (T)est plugins, (O)mit plugins, S(m)all C lib, Logf to Ser
|
|||
win32crosscompile="yes"
|
||||
win64="yes"
|
||||
;;
|
||||
[Bb])
|
||||
echo "LTO build enabled"
|
||||
LTO_ARG="export USE_LTO=y"
|
||||
;;
|
||||
"") # Match enter press when finished with advanced options
|
||||
cont=0
|
||||
;;
|
||||
|
@ -4806,6 +4811,7 @@ export ANDROID_PLATFORM_VERSION=${ANDROID_PLATFORM_VERSION}
|
|||
export TOOLSET=${toolset}
|
||||
export PIPER_MODEL_DIR=${PIPER_MODEL_DIR}
|
||||
$CCACHE_ARG
|
||||
$LTO_ARG
|
||||
|
||||
CONFIGURE_OPTIONS=${cmdline}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue