4 ms·
I don't completely understand how LTO works - is LTO 100% done in compiler plugins? Or is some of it done in ld/gold/lld which mold doesn't have implemented yet
by jcranberry 4y ago
I don't completely understand how LTO works - is LTO 100% done in compiler plugins? Or is some of it done in ld/gold/lld which mold doesn't have implemented yet?
- nybble41 4y agoWith LTO when you "compile" a source file it really only processes it into an intermediate language (IL) format and stores that in the object (.o) files. When you invoke the linker on those object files it runs the compiler again with all the IL from the inputs and generates a temporary object file with the actual executable object code, which is then linked into the final executable binary. I would guess that mold doesn't have the necessary support for the second step, running the compiler again on the IL during linking.
- jcranberry 4y agoThank you for the info. It does have support for linker plugins now (I was following the github issue somewhat), I just wasn't sure whether I shouldn't bother testing it to see if I can use it without performance regressions because I didn't understand how it works. Might give it a shot one of these days.