Bug 258536 - Mk/bsd.lto.mk: Add Link-Time Optimization (LTO) support
Summary: Mk/bsd.lto.mk: Add Link-Time Optimization (LTO) support
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Ports Framework (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Piotr Kubaj
URL:
Keywords: feature, performance
Depends on:
Blocks:
 
Reported: 2021-09-16 15:04 UTC by Piotr Kubaj
Modified: 2021-10-01 11:04 UTC (History)
5 users (show)

See Also:


Attachments
patch (869 bytes, patch)
2021-09-16 15:04 UTC, Piotr Kubaj
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Piotr Kubaj freebsd_committer 2021-09-16 15:04:55 UTC
Created attachment 227939 [details]
patch

It's well known that LTO provides both performance and size benefits for binaries.

Add preliminary, opt-in support for global LTO enforcement to ports. Ports that provide LTO option on their own and the ones that don't work with LTO will need to set LTO_UNSAFE in the future.

When the LTO is switched by default, it will need to be excluded on the platforms where LTO does not work, but the purpose of the patch is to give opt-in support.
Comment 1 Piotr Kubaj freebsd_committer 2021-09-16 15:05:28 UTC
Adding jbeich@ since he seems to be interested in LTO as well.
Comment 2 commit-hook freebsd_committer 2021-09-30 18:35:13 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=fb5f03a87cf432751fae1f0ae7f29c9d4fc65917

commit fb5f03a87cf432751fae1f0ae7f29c9d4fc65917
Author:     Piotr Kubaj <pkubaj@FreeBSD.org>
AuthorDate: 2021-09-30 18:27:50 +0000
Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
CommitDate: 2021-09-30 18:27:50 +0000

    Mk/bsd.lto.mk: add global LTO support for ports

    It's well known that LTO provides both performance and size benefits for
    binaries.

    Add preliminary, opt-in support for global LTO enforcement to ports. Ports that
    provide LTO option on their own and the ones that don't work with LTO will need
    to set LTO_UNSAFE in the future.

    PR:     258536

 Mk/bsd.lto.mk (new) | 10 ++++++++++
 Mk/bsd.port.mk      |  4 ++++
 2 files changed, 14 insertions(+)
Comment 3 Kubilay Kocak freebsd_committer freebsd_triage 2021-10-01 00:53:56 UTC
^Triage: Assign to committer that resolved
Comment 4 Evgeniy Khramtsov 2021-10-01 11:03:10 UTC
Awesome, but I am surprised to see this merged without an exp-run :D
Comment 5 Evgeniy Khramtsov 2021-10-01 11:04:13 UTC
(In reply to Evgeniy Khramtsov from comment #4)

> if defined(USE_LTO)

Ah, nevermind.