# LTO disabled by default



## jbo (Dec 1, 2021)

Hey guys,

Browsing through some ports, I noticed that most (at least all of the ports I checked) have LTO disabled by default.
I would like to understand the reasoning behind LTO being disabled by default for building ports.

Would it be as simple as keeping linking times down or are we trying to avoid certain nasty LTO bugs that plagued certain compilers in the past?

Other than that - are you guys building with LTO enabled?


----------



## angry_vincent (Dec 1, 2021)

LTO being disabled by default is very sane approach, because now only dedicated number of software would build with this optimization enabled. In other words, build system of many many packages would need certain fixes to make it work. There are  some generic patterns in failures you may encounter, please, follow here:


			KubilayKocak/Ports/LinkTimeOptimization - FreeBSD Wiki


----------



## Geezer (Dec 1, 2021)

Firefox and thunderbird have LTO as default. It seems to add at least 50% on to the build time, with no perceptible improvement in performance.


----------



## Alain De Vos (Dec 2, 2021)

There are 3 things which don't work good in freebsd, so i disabled them.
1. #Stackgap
kern.elf64.aslr.stack_gap=0    # ntp,firefox
2. #WX
kern.elf64.allow_wx=1 # Compilers
3. lto.
Make.conf

```
OPTIONS_UNSET+=GOLD
OPTIONS_UNSET+=LTO
```
I also don't think loading libraries with lto produces spectacular speed increase.


----------

