configure_build() {
local build_arch="${1}"
+ # Determine parallelism
+ # We assume that each process consumes about
+ # 128MB of memory. Therefore we find out how
+ # many processes fit into memory.
+ local mem_max=$(( ${SYSTEM_MEMORY} / 128 ))
+ local cpu_max=$(( ${SYSTEM_PROCESSORS} + 1 ))
+
+ local parallelism
+ if [ ${mem_max} -lt ${cpu_max} ]; then
+ parallelism=${mem_max}
+ else
+ parallelism=${cpu_max}
+ fi
+
if [ "${build_arch}" = "default" ]; then
build_arch="$(configure_build_guess)"
fi
CFLAGS="-O2 -pipe -Wall -fexceptions -fPIC ${CFLAGS_ARCH}"
CXXFLAGS="${CFLAGS}"
- # Determine parallelism
- # We assume that each process consumes about
- # 128MB of memory. Therefore we find out how
- # many processes fit into memory.
- local mem_max=$(( ${SYSTEM_MEMORY} / 128 ))
- local cpu_max=$(( ${SYSTEM_PROCESSORS} + 1 ))
-
- local parallelism
- if [ ${mem_max} -lt ${cpu_max} ]; then
- parallelism=${mem_max}
- else
- parallelism=${cpu_max}
- fi
+ # Enable LTO
+ CFLAGS_LTO="-flto=${parallelism} -ffat-lto-objects"
# Use this as default PARALLELISM
DEFAULT_PARALLELISM="${parallelism}"
CONFIG_ROOT="${CONFIG_ROOT}" \
CFLAGS="${CFLAGS} ${HARDENING_CFLAGS}" \
CXXFLAGS="${CXXFLAGS} ${HARDENING_CFLAGS}" \
+ CFLAGS_LTO="${CFLAGS_LTO}" \
RUSTFLAGS="${RUSTFLAGS}" \
BUILDTARGET="${BUILDTARGET}" \
CROSSTARGET="${CROSSTARGET}" \