https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125187

--- Comment #10 from Oliver Schönrock <oschonrock at gmail dot com> ---
(In reply to Sam James from comment #9)
> (No, because when linking the executable, it knows nothing more is to come,
> as opposed to when it's just an object and it has all the (lack of)
> constraints that come with that.)

OK.

Slightly off topic:

1. Does that also apply when invoking the driver for "compile and link" in a
single invocation? ie without `-c`  

2. Does this mean that if we don't pass -flto=[n] for a single TU that
optimisation opportunities are left on the table? Or, as seems more likely to
me, it will actual force the compiler to do the same optimisation work, that it
already did to produce the object, for a second time:

-flto[=n]
...
"When the object files are linked together, all the function bodies are read
from these ELF sections and instantiated as if they had been part of the same
translation unit. "

It's already done that for a single TU? => LTO is redundant in this case?

Reply via email to