From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id B76874574F for ; Thu, 23 Mar 2023 13:56:44 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6174A68C2DF; Thu, 23 Mar 2023 15:56:41 +0200 (EET) Received: from mail8.parnet.fi (mail8.parnet.fi [77.234.108.134]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CC6A568C28B for ; Thu, 23 Mar 2023 15:56:34 +0200 (EET) Received: from mail9.parnet.fi (mail9.parnet.fi [77.234.108.21]) by mail8.parnet.fi with ESMTP id 32NDuXVV020340-32NDuXVW020340 for ; Thu, 23 Mar 2023 15:56:33 +0200 Received: from foo.martin.st (host-97-187.parnet.fi [77.234.97.187]) by mail9.parnet.fi (Postfix) with ESMTPS id 7E2D7A1428 for ; Thu, 23 Mar 2023 15:56:33 +0200 (EET) Date: Thu, 23 Mar 2023 15:56:32 +0200 (EET) From: =?ISO-8859-15?Q?Martin_Storsj=F6?= To: FFmpeg development discussions and patches In-Reply-To: <20230323134628.88073-1-jdek@itanimul.li> Message-ID: <5756ea80-9378-ab4a-8334-8e403435ca86@martin.st> References: <20230323134628.88073-1-jdek@itanimul.li> MIME-Version: 1.0 X-FE-Policy-ID: 3:14:2:SYSTEM Subject: Re: [FFmpeg-devel] [PATCH] configure: add LTO optarg X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Thu, 23 Mar 2023, J. Dekker wrote: > This allows users to call with './configure --enable-lto' (or more > explicitly './configure --enable-lto=full') for the old functionality or > specify './configure --enable-lto=thin' to use ThinLTO. > > Signed-off-by: J. Dekker > --- > configure | 23 ++++++++++++++--------- > 1 file changed, 14 insertions(+), 9 deletions(-) > > diff --git a/configure b/configure > index 8980cec7ee..b65001d39d 100755 > --- a/configure > +++ b/configure > @@ -412,7 +412,7 @@ Toolchain options: > --build-suffix=SUFFIX library name suffix [] > --enable-pic build position-independent code > --enable-thumb compile for Thumb instruction set > - --enable-lto use link-time optimization > + --enable-lto[=arg] use link-time optimization > --env="ENV=override" override the environment variables > > Advanced options (experts only): > @@ -2524,7 +2524,6 @@ CMDLINE_SELECT=" > debug > extra_warnings > logging > - lto > optimizations > rpath > stripping > @@ -4170,6 +4169,12 @@ for opt do > --enable-sdl) > enable sdl2 > ;; > + --enable-lto) > + lto=full > + ;; > + --enable-lto=*) > + lto="$optval" > + ;; > --enable-*=*|--disable-*=*) > eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/') > is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt" > @@ -4639,7 +4644,7 @@ icl_flags(){ > # on Windows, does enable remarks so disable them here. > -Wall) echo $flag -Qdiag-disable:remark ;; > -std=c99) echo -Qstd=c99 ;; > - -flto) echo -ipo ;; > + -flto*) echo -ipo ;; > esac > done > } > @@ -4647,7 +4652,7 @@ icl_flags(){ > icc_flags(){ > for flag; do > case $flag in > - -flto) echo -ipo ;; > + -flto*) echo -ipo ;; > *) echo $flag ;; > esac > done > @@ -7182,17 +7187,17 @@ fi > > check_optflags(){ > check_cflags "$@" > - enabled lto && check_ldflags "$@" > + [ -z "$lto" ] || check_ldflags "$@" With [ -n "$lto" ] you could retain the old logic with && instead of ||, although I don't think it matters much. Also, this extra check when LTO is enabled, mirrors kinda what we've seen that we could need in meson, if LTO would be enabled surprisingly there. > } > > check_optflags $optflags > check_optflags -fno-math-errno > check_optflags -fno-signed-zeros > > -if enabled lto; then > +if [ ! -z "$lto" ]; then This can be [ -n "$lto" ] to avoid the negation. > test "$cc_type" != "$ld_type" && die "LTO requires same compiler and linker" > - check_cflags -flto > - check_ldflags -flto $cpuflags > + check_cflags -flto=$lto > + check_ldflags -flto=$lto $cpuflags Does GCC support -flto=full too, and is that the same thing as just -flto? Or should we stick to just passing -flto to the compiler without any argument if the user configured with plain --enable-lto? > disable inline_asm_direct_symbol_refs > fi > > @@ -7223,7 +7228,7 @@ if enabled icc; then > # icc 11.0 and 11.1 work with ebp_available, but don't pass the test > enable ebp_available > # The test above does not test linking > - enabled lto && disable symver_asm_label > + [ -z "$lto" ] || disable symver_asm_label [ -n "$lto" ] would retain the previous code structure, making the patch even clearer. // Martin _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".