On 04/25/2016 09:49 AM, Martin Liška wrote:
Hello.

To make LTO wrappers (gcc-nm, gcc-ar, gcc-ranlib) more smart, I would like to 
prevent execution
of the same binary by these wrapper. For LTO testing I symlink ar (nm, ranlib) 
to these wrappers instead
of hacking a build system to respect NM (AR, RANLIB) environment variables. The 
only problem with that solution
is that these wrappers recursively executes themselves as the first folder in 
PATH is set to the location with wrappers.

Following patch presents such recursion.

Patch can bootstrap&regtest on x86_64-linux-gnu.

Ready for trunk?
Thanks,
Martin


0001-Prevent-LTO-wrappers-to-process-a-recursive-executio.patch


From dfe0486ad7babe3d6de349001d4790684dc94bfb Mon Sep 17 00:00:00 2001
From: marxin <mli...@suse.cz>
Date: Fri, 22 Apr 2016 17:57:23 +0200
Subject: [PATCH] Prevent LTO wrappers to process a recursive execution

gcc/ChangeLog:

2016-04-22  Martin Liska  <mli...@suse.cz>

        * file-find.c (remove_prefix): New function.
        * file-find.h (remove_prefix): Declare the function.
        * gcc-ar.c (main): Skip a folder of the wrapper if
        a wrapped binary would point to the same file.
Is this still something you want to pursue? It looks pretty reasonable and one could make an argument that it's a good idea in and of itself.

jeff

Reply via email to