This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [lto][patch] Patch to close unneeded fd's in lto-wrapper
Joseph S. Myers wrote:
On Mon, 16 Mar 2009, Simon Baldwin wrote:
This patch adds code to lto-wrapper to close file descriptors inherited from
ld and the linker plugin.
lto1 does not use these file descriptors, so closing them here relieves
possible pressure on unlimit -n in lto1 and later executables.
Why is it appropriate to fix this here rather than in ld and the linker
plugin? I'd say that it's for the program execing a subprocess to set
close-on-exec on file descriptors it doesn't intend to pass to the
subprocess, not for the subprocess to close them itself.
According to Rafael, leaving these fd's open for the plugin is a part of
the API, so it's intentional. We discussed an extra linker/plugin flag
to request that it close these fds before executing the wrapper, but
that seemed a longish way around the problem.
I'll leave it to Rafael to explain why it's better that these file
generally remain open for the plugins, since he understands this much
better than I.
--
Google UK Limited | Registered Office: Belgrave House, 76 Buckingham
Palace Road, London SW1W 9TQ | Registered in England Number: 3977902