Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: "alice" <alice@ptrc.gay>
To: "FFmpeg development discussions and patches" <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH] configure: add LTO optarg
Date: Fri, 24 Mar 2023 00:38:06 +0100
Message-ID: <CRE5PQVEAZRS.1N968GZC2I7UE@sumire> (raw)
In-Reply-To: <E27844FB-8D5E-4288-9073-8445E478B5FA@itanimul.li>

On Thu Mar 23, 2023 at 3:16 PM CET, J. Dekker wrote:
> On 23 Mar 2023, at 14:56, Martin Storsjö wrote:
> >>     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.

-ffat-lto-objects is only about keeping non-lto object code as well as the
intermediate (lto) code in the .o objects.

this is 'required' if one wants to then later link the resulting .a's *without*
using lto, as having only the 'intermediate' output forces using lto during the
link step.

by default for gcc, the only difference between -flto and -flto=[n]/auto is the
amount of threads used during linking. =auto is generally preferred, since under
the gnu make jobserver it controls the jobs instead (or defaults to nproc). the
existing `-flto` forces 1-thread link under gcc, and it prints a warning for
this:

 lto-wrapper: warning: using serial compilation of 12 LTRANS jobs
 lto-wrapper: note: see the '-flto' option documentation for more information

(the gcc(1) manpage documents this quite well.)

however, i'd say the existing behaviour here is fine. there are indeed a lot of
toolchain-specifics between all this- and people building that care about this
would usually know better than a 'magic' configure script that tries to learn
all of it. simply respecting -flto[=arg] with a user-supplied arg is all that is
generally needed.

as for -fwhole-program, i'm not sure it has any use:

 With -flto this option has a limited use. In most cases the precise list of
 symbols used or exported from the binary is known the resolution info passed to
 the link-time optimizer by the linker plugin. It is still useful if no linker
 plugin is used or during incremental link step when final code is produced (with
 -flto -flinker-output=nolto-rel).

(by default, the linker plugin is automatically used for modern-ish gcc (since
maybe 4.9?))

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

      reply	other threads:[~2023-03-23 23:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-23 13:46 J. Dekker
2023-03-23 13:56 ` Martin Storsjö
2023-03-23 14:16   ` J. Dekker
2023-03-23 23:38     ` alice [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CRE5PQVEAZRS.1N968GZC2I7UE@sumire \
    --to=alice@ptrc.gay \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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