Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH v2] configure: add LTO optarg
@ 2023-03-24 13:35 J. Dekker
  2023-03-24 14:06 ` Martin Storsjö
  0 siblings, 1 reply; 3+ messages in thread
From: J. Dekker @ 2023-03-24 13:35 UTC (permalink / raw)
  To: ffmpeg-devel

This allows users to specify an argument such as './configure
--enable-lto=thin' to use ThinLTO with Clang. The old functionality with
'./configure --enable-lto' is preserved.

Signed-off-by: J. Dekker <jdek@itanimul.li>
---
 configure | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/configure b/configure
index 8980cec7ee..bf5ad540cf 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,9 @@ for opt do
         --enable-sdl)
             enable sdl2
         ;;
+        --enable-lto|--enable-lto=*)
+            lto=-f${opt#--enable-}
+        ;;
         --enable-*=*|--disable-*=*)
             eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
             is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
@@ -4639,7 +4641,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 +4649,7 @@ icl_flags(){
 icc_flags(){
     for flag; do
         case $flag in
-            -flto)                echo -ipo ;;
+            -flto*)               echo -ipo ;;
             *)                    echo $flag ;;
         esac
     done
@@ -7182,17 +7184,17 @@ fi
 
 check_optflags(){
     check_cflags "$@"
-    enabled lto && check_ldflags "$@"
+    [ -n "$lto" ] && check_ldflags "$@"
 }
 
 check_optflags $optflags
 check_optflags -fno-math-errno
 check_optflags -fno-signed-zeros
 
-if enabled lto; then
+if [ -n "$lto" ]; then
     test "$cc_type" != "$ld_type" && die "LTO requires same compiler and linker"
-    check_cflags  -flto
-    check_ldflags -flto $cpuflags
+    check_cflags  $lto
+    check_ldflags $lto $cpuflags
     disable inline_asm_direct_symbol_refs
 fi
 
@@ -7223,7 +7225,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
+    [ -n "$lto" ] && disable symver_asm_label
     if enabled x86_32; then
         icc_version=$($cc -dumpversion)
         test ${icc_version%%.*} -ge 11 &&
-- 
2.37.1 (Apple Git-137.1)

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2] configure: add LTO optarg
  2023-03-24 13:35 [FFmpeg-devel] [PATCH v2] configure: add LTO optarg J. Dekker
@ 2023-03-24 14:06 ` Martin Storsjö
  2023-03-27  6:54   ` J. Dekker
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Storsjö @ 2023-03-24 14:06 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On Fri, 24 Mar 2023, J. Dekker wrote:

> This allows users to specify an argument such as './configure
> --enable-lto=thin' to use ThinLTO with Clang. The old functionality with
> './configure --enable-lto' is preserved.
>
> Signed-off-by: J. Dekker <jdek@itanimul.li>
> ---
> configure | 20 +++++++++++---------
> 1 file changed, 11 insertions(+), 9 deletions(-)
>
> diff --git a/configure b/configure
> index 8980cec7ee..bf5ad540cf 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,9 @@ for opt do
>         --enable-sdl)
>             enable sdl2
>         ;;
> +        --enable-lto|--enable-lto=*)
> +            lto=-f${opt#--enable-}
> +        ;;
>         --enable-*=*|--disable-*=*)
>             eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
>             is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
> @@ -4639,7 +4641,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 +4649,7 @@ icl_flags(){
> icc_flags(){
>     for flag; do
>         case $flag in
> -            -flto)                echo -ipo ;;
> +            -flto*)               echo -ipo ;;
>             *)                    echo $flag ;;
>         esac
>     done
> @@ -7182,17 +7184,17 @@ fi
>
> check_optflags(){
>     check_cflags "$@"
> -    enabled lto && check_ldflags "$@"
> +    [ -n "$lto" ] && check_ldflags "$@"
> }
>
> check_optflags $optflags
> check_optflags -fno-math-errno
> check_optflags -fno-signed-zeros
>
> -if enabled lto; then
> +if [ -n "$lto" ]; then
>     test "$cc_type" != "$ld_type" && die "LTO requires same compiler and linker"
> -    check_cflags  -flto
> -    check_ldflags -flto $cpuflags
> +    check_cflags  $lto
> +    check_ldflags $lto $cpuflags
>     disable inline_asm_direct_symbol_refs
> fi
>
> @@ -7223,7 +7225,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
> +    [ -n "$lto" ] && disable symver_asm_label
>     if enabled x86_32; then
>         icc_version=$($cc -dumpversion)
>         test ${icc_version%%.*} -ge 11 &&
> -- 
> 2.37.1 (Apple Git-137.1)

LGTM, thanks.

I didn't test this patch myself but it looks to me like it would work, and 
I presume you've tested it with GCC (in the default mode) and Clang (in 
both the old default mode and with specific arguments like =thin).

// 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".

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2] configure: add LTO optarg
  2023-03-24 14:06 ` Martin Storsjö
@ 2023-03-27  6:54   ` J. Dekker
  0 siblings, 0 replies; 3+ messages in thread
From: J. Dekker @ 2023-03-27  6:54 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On 24 Mar 2023, at 15:06, Martin Storsjö wrote:
> [...]
>
> LGTM, thanks.
>
> I didn't test this patch myself but it looks to me like it would work, and I presume you've tested it with GCC (in the default mode) and Clang (in both the old default mode and with specific arguments like =thin).

Tested with --enable-lto/--enable-lto=thin on clang/macOS, and --enable-lto/--enable-lto=2 on gcc/linux. Pushed with a minor improvement to the check.

-- 
jd
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-03-27  6:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-24 13:35 [FFmpeg-devel] [PATCH v2] configure: add LTO optarg J. Dekker
2023-03-24 14:06 ` Martin Storsjö
2023-03-27  6:54   ` J. Dekker

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git