From b346fa58b15b9880b714c6f0cc4dddaf84d3da6f Mon Sep 17 00:00:00 2001 From: Chris Packham Date: Sun, 29 Aug 2021 21:27:29 +1200 Subject: [PATCH] cc/gcc: Add options for zstd usage GCC can support using zstd compression for LTO object files. By default GCC's configure will enable this if libzstd is installed on the machine building the toolchain. This may be undesirable if the toolchain is to be used on a different machine. Add an option to control zstd usage and set the default to the same as the current behaviour (i.e. auto). Fixes #1579 Signed-off-by: Chris Packham --- config/cc/gcc.in | 19 +++++++++++++++++++ scripts/build/cc/gcc.sh | 5 +++++ 2 files changed, 24 insertions(+) diff --git a/config/cc/gcc.in b/config/cc/gcc.in index 4d0a3eef..f4b0b7ef 100644 --- a/config/cc/gcc.in +++ b/config/cc/gcc.in @@ -179,6 +179,25 @@ config CC_GCC_USE_LTO help Enable the Link Time Optimisations. +config CC_GCC_LTO_ZSTD + tristate + prompt "Support LTO compression with zstd" + default m + depends on CC_GCC_USE_LTO + depends on GCC_10_or_later + depends on ! STATIC_TOOLCHAIN + help + Support zstd compression for LTO object files. This will require + libzstd to be installed when using the toolchain + + Option | ZSTD use | Associated ./configure switch + ---------+--------------------+-------------------------------- + Y | forcibly used | --with-zstd + M | auto | (none, ./configure decides) + N | forcibly not used | --without-zstd + + If unsure, say 'M' + #----------------------------------------------------------------------------- comment "Settings for libraries running on target" diff --git a/scripts/build/cc/gcc.sh b/scripts/build/cc/gcc.sh index 4e0def05..fdfa7d65 100644 --- a/scripts/build/cc/gcc.sh +++ b/scripts/build/cc/gcc.sh @@ -1130,6 +1130,11 @@ do_gcc_backend() { else extra_config+=("--disable-lto") fi + case "${CT_CC_GCC_LTO_ZSTD}" in + y) extra_config+=("--with-zstd");; + m) ;; + *) extra_config+=("--without-zstd");; + esac if [ ${#host_libstdcxx_flags[@]} -ne 0 ]; then extra_config+=("--with-host-libstdcxx=${host_libstdcxx_flags[*]}")