Re: git: bf0af791ab80 - main - lang/rust: add LTO option

From: Piotr Kubaj <pkubaj_at_anongoth.pl>
Date: Sun, 16 Jul 2023 15:19:40 UTC
I don't have any numbers, just tried to build rust and saw it seems to
work fine.

As for plans to switch it by default, I think it should be talked first
with other rust@ committers.

On 23-07-16 14:29:00, Nuno Teixeira wrote:
> Hello Piotr,
> 
> Very curious to see the effect of rust with lto compiling ports need it,
> memory, cpu speed, etc.
> 
> Since LTO is on by default on ports using cargo, is there any plans to turn
> LTO on on rust himself?
> 
> Cheers,
> 
> Piotr Kubaj <pkubaj@freebsd.org> escreveu no dia domingo, 16/07/2023 à(s)
> 11:59:
> 
> > The branch main has been updated by pkubaj:
> >
> > URL:
> > https://cgit.FreeBSD.org/ports/commit/?id=bf0af791ab80f4f109bfecf4a954bcf94f00947d
> >
> > commit bf0af791ab80f4f109bfecf4a954bcf94f00947d
> > Author:     Piotr Kubaj <pkubaj@FreeBSD.org>
> > AuthorDate: 2023-07-16 10:57:56 +0000
> > Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
> > CommitDate: 2023-07-16 10:58:20 +0000
> >
> >     lang/rust: add LTO option
> > ---
> >  lang/rust/Makefile | 8 +++++++-
> >  1 file changed, 7 insertions(+), 1 deletion(-)
> >
> > diff --git a/lang/rust/Makefile b/lang/rust/Makefile
> > index 184c0768b95f..71d8416d34b8 100644
> > --- a/lang/rust/Makefile
> > +++ b/lang/rust/Makefile
> > @@ -48,7 +48,7 @@ CONFLICTS_INSTALL?=   rust-nightly
> >  # ?= to allow users to still overwrite it in make.conf.
> >  TMPDIR?=       ${WRKDIR}
> >
> > -OPTIONS_DEFINE=                DOCS GDB SOURCES WASM
> > +OPTIONS_DEFINE=                DOCS GDB LTO SOURCES WASM
> >  OPTIONS_DEFAULT=       SOURCES WASM
> >
> >  GDB_DESC=      Install ports gdb (necessary for debugging rust programs)
> > @@ -191,7 +191,13 @@ do-configure:
> >         @${ECHO_CMD} 'deny-warnings=false' >> ${WRKSRC}/config.toml
> >         @${ECHO_CMD} 'verbose-tests=true' >> ${WRKSRC}/config.toml
> >         @${ECHO_CMD} 'lld=${_RUST_BUILD_WASM}' >> ${WRKSRC}/config.toml
> > +.if ${PORT_OPTIONS:MLTO}
> > +       @${ECHO_CMD} 'lto="thin"' >> ${WRKSRC}/config.toml
> > +.endif
> >         @${ECHO_CMD} '[llvm]' >> ${WRKSRC}/config.toml
> > +.if ${PORT_OPTIONS:MLTO}
> > +       @${ECHO_CMD} 'thin-lto=true' >> ${WRKSRC}/config.toml
> > +.endif
> >  .if defined(WITH_CCACHE_BUILD) && !defined(NO_CCACHE)
> >         @${ECHO_CMD} 'ccache="${CCACHE_BIN}"' >> ${WRKSRC}/config.toml
> >  .else
> >
> 
> 
> -- 
> Nuno Teixeira
> FreeBSD Committer (ports)