LTO and harden switches
Moderator: Forum Moderators
- revolting_peasant
- Posts: 229
- Joined: May 29th, 2012, 5:45 pm
LTO and harden switches
Three questions:
1. Is it useful to enable link-time optimizations (LTO) when building?
2. Is it _safe_ to enable LTO when building?
3. Why is executable "hardening" enabled when building? Why do I need "hardened" executables?
I'm building on a Devuan GNU/Linux Chimaera machine, GCC 10.2.1
1. Is it useful to enable link-time optimizations (LTO) when building?
2. Is it _safe_ to enable LTO when building?
3. Why is executable "hardening" enabled when building? Why do I need "hardened" executables?
I'm building on a Devuan GNU/Linux Chimaera machine, GCC 10.2.1
- Pentarctagon
- Project Manager
- Posts: 5599
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: LTO and harden switches
For (1): in theory it should give some degree of performance improvement, though nobody has measured what it ends up being for Wesnoth. It does also result in a smaller executable file. Linking with LTO does also take significantly longer.
For (2): Wesnoth has a CI job that builds with LTO enabled that is able to pass our automated tests, so it should be fine.
For (3): It enables additional flags to improve security generally. For example adding
For (2): Wesnoth has a CI job that builds with LTO enabled that is able to pass our automated tests, so it should be fine.
For (3): It enables additional flags to improve security generally. For example adding
-fPIE
(position independent executable) so it can work in ASLR.99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
take one down, patch it around
-2,147,483,648 little bugs in the code