[FFmpeg-devel] [PATCH] configure: add LTO optarg
J. Dekker
jdek at itanimul.li
Thu Mar 23 16:16:53 EET 2023
On 23 Mar 2023, at 14:56, Martin Storsjö wrote:
[...]
>>
>> @@ -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.
Since not all checks are working with only cflags checks.
>> }
>>
>> 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.
Thanks.
>> 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?
No, actually checking it. We might benefit from gcc's -ffat-lto-objects and/or -fwhole-program which is maybe more similar to LLVM's -flto=full. Seems like there is non-trivial mapping between LTO features.
>> 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.
>
Will do.
More information about the ffmpeg-devel
mailing list