[pacman-dev] LTO and PGO build options

Allan McRae allan at archlinux.org
Sun Mar 20 11:20:56 UTC 2016


On 20/03/16 20:16, Que Quotion wrote:
>> Adding -flto to CFLAGS and forgetting also is fine.  Remove it when the
> software is broken with LTO.
> 
> The only way this makes logical sense is if you mean for *packagers*
> to do so, but I have never known any to do so. I don't think it's any
> more appropriate to distribute PKGBUILDs with optimizations enabled by
> default. Much better to leave that to users; much too troublesome to
> ask them to edit each PKGBUILD they want to optimize. Doing this in
> makepkg works better than a wrapper script, and involves less work for
> both users and packagers--who would also have the opportunity to
> specify packages that must not use LTO.
> 
>> Add -flto to CFLAGS, report broken software upstream.  I am not adding
> this to makepkg.
> 
> That's dissapointing. There's practically no downside to having LTO
> available in makepkg.

LTO is available in makepkg.  You can add it to your system makepkg.conf
CFLAGS, to your ~/.makepkg.conf CFLAGS, or even add it to the CFLAGS in
the PKGBUILD itself.  We don't need more options.  Use the tools already
available to you.

If any of that breaks, it is not makepkg's place to fix it...

>I was talking about the patch you provided being
> untested.  You appear
> to have understood that as you have fixed it....
> 
> Yeah, and you were right--but you came to that conclusion on a whim.

A clearly broken patch means that you have not tested - no whim involved.

>> upx is dropped. optipng is dropped.
> 
> Oh, I see. Sorry to hear about that. makepkg's automated (opt-in)
> optimization of packages is one of the features I considered vastly
> superior to other package creation tools.
> 

And it is still available - libmakepkg allows anybody to distribute
additions like those to makepkg.  These sort of optimizations need to be
provided at a distribution (or repo) level, not in makepkg itself.

>> I am not adding an option to makepkg that does non-deterministic
> optimisation.
> 
> It always would have been an option for users to choose, not a policy,
> ie "enable at your own (negligible) risk".
> 
> I don't think I have the constitution to maintain a makepkg fork for
> extra optimization features, but its sounding like a good idea.

Create two makepkg.conf files.  One with CFLAGS for PGO pass 1 and one
with CLFAGS for PGO pass 2.  Use the --config switch to point at the one
needed for that build.  That could even be done in a tiny wrapper.

Allan


More information about the pacman-dev mailing list