http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46749
--- Comment #35 from Mike Stump <mikestump at comcast dot net> 2010-12-05 21:13:30 UTC --- Surely this design isn't complete as it doesn't cover the changes or the requirements for lto. Without those, I can't review the design to see if it is sufficient to actually fix the problem at hand. The problem is there are temporary files removed by subpasses during the subpass. The above doesn't lengthen the lifetime of those temporary files, so can't fix the problem. Compare and contrast another potential design: Add an environment variable that identifies a file in which additions can be made of temporary object files to remove once the link is done. If any subpart of the compilation process wants to create to create intermediate .o files, they can instead write into that named file, the names of the temporary files to delete, then the top level driver (one with no environment variable set, can delete them, at the very end. This even works for linker plugin files and cover just about every type of tech or architecture for the compilation process save distribution, caching and compilation server. I'd propose we handle those later, as necessary. The advantages of this over the last one is, it is complete, it would always work, regardless of nesting complexities, doesn't require any changes to `ld', and works, even when collect2 isn't used.