pub struct Lto {
pub requested: bool,
pub jobs: LtoJobs,
pub partition: Partition,
pub compression: Option<u8>,
}Expand description
What the -flto family asked for, which is a whole optimization this compiler does not do yet.
Link time optimization is the optimizer run once over the whole program instead of once per
translation unit, which is the only way an inliner ever sees across a file boundary and is
where most of what is left on the table after -O2 is. spec/09-optimizer.md says how it will
work here: the IR goes into a section of the object, the driver finds those sections at link
time, merges them into one module and generates code with everything visible.
None of that exists, so the whole family is read, checked and recorded rather than acted on.
That is a different answer from the one -gsplit-dwarf gets in the same specification, and the
difference is what ignoring each of them does. Ignoring -gsplit-dwarf means a file a build
asked for never appears. Ignoring this means a program that is correct and slower than it could
have been, which is what section 4.1 means by a hint about speed, and which is also what every
compilation at -O0 already is.
The other half of the argument is about the object. gcc’s -flto object holds the bytecode and
no machine code at all, so it is only useful to a link that knows about it; the objects here
always hold the code, which is what -ffat-lto-objects asks gcc for. So a build that passes
-flto to this compiler gets objects that are strictly more usable than the ones it would have
got, rather than different ones.
Fields§
§requested: boolWhether the last of -flto and -fno-lto on the command line was the first of the two.
jobs: LtoJobsHow many processes to spread the link time work over.
partition: PartitionHow the program is cut up before the work is spread.
compression: Option<u8>How hard to compress the IR on its way into the object, from -flto-compression-level=,
where None means whatever the compressor does when nobody says. Between 0 and 19, which
is zstd’s range and is the range gcc checks against.