diff options
author | marxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-07-07 12:03:39 +0000 |
---|---|---|
committer | marxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-07-07 12:03:39 +0000 |
commit | eeb6872bfdfd1e71b27de6f62a5f5c08a2efb015 (patch) | |
tree | 9776d8d0e93b2015a8b4ebed34c65d2f6e684da5 /gcc/gcc-ar.c | |
parent | cd959806f7b4f39b299547df82b79e38139a3c3d (diff) | |
download | gcc-eeb6872bfdfd1e71b27de6f62a5f5c08a2efb015.tar.gz |
Prevent LTO wrappers to process a recursive execution
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@238089 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gcc-ar.c')
-rw-r--r-- | gcc/gcc-ar.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/gcc-ar.c b/gcc/gcc-ar.c index 45ba3617ff3..a02dccb8000 100644 --- a/gcc/gcc-ar.c +++ b/gcc/gcc-ar.c @@ -194,6 +194,14 @@ main (int ac, char **av) #ifdef CROSS_DIRECTORY_STRUCTURE real_exe_name = concat (target_machine, "-", PERSONALITY, NULL); #endif + /* Do not search original location in the same folder. */ + char *exe_folder = lrealpath (av[0]); + exe_folder[strlen (exe_folder) - strlen (lbasename (exe_folder))] = '\0'; + char *location = concat (exe_folder, PERSONALITY, NULL); + + if (access (location, X_OK) == 0) + remove_prefix (exe_folder, &path); + exe_name = find_a_file (&path, real_exe_name, X_OK); if (!exe_name) { |