Commit a09f1a76 by Matthias Klose Committed by Matthias Klose

re PR driver/57651 (gcc-ar and gcc-nm don't find the lto plugin)

2013-06-19  Matthias Klose  <doko@ubuntu.com>

        PR driver/57651
        * file-find.h (find_a_file): Add a mode parameter.
        * file-find.c (find_a_file): Likewise.
        * gcc-ar.c (main): Call find_a_file with R_OK for the plugin,
        with X_OK for the executables.
        * collect2.c (main): Call find_a_file with X_OK.

From-SVN: r200219
parent 7d18b0ad
2013-06-19 Matthias Klose <doko@ubuntu.com>
PR driver/57651
* file-find.h (find_a_file): Add a mode parameter.
* file-find.c (find_a_file): Likewise.
* gcc-ar.c (main): Call find_a_file with R_OK for the plugin,
with X_OK for the executables.
* collect2.c (main): Call find_a_file with X_OK.
2013-06-19 Steve Ellcey <sellcey@mips.com> 2013-06-19 Steve Ellcey <sellcey@mips.com>
PR target/56942 PR target/56942
......
...@@ -1110,55 +1110,55 @@ main (int argc, char **argv) ...@@ -1110,55 +1110,55 @@ main (int argc, char **argv)
if (ld_file_name == 0) if (ld_file_name == 0)
#endif #endif
#ifdef REAL_LD_FILE_NAME #ifdef REAL_LD_FILE_NAME
ld_file_name = find_a_file (&path, REAL_LD_FILE_NAME); ld_file_name = find_a_file (&path, REAL_LD_FILE_NAME, X_OK);
if (ld_file_name == 0) if (ld_file_name == 0)
#endif #endif
/* Search the (target-specific) compiler dirs for ld'. */ /* Search the (target-specific) compiler dirs for ld'. */
ld_file_name = find_a_file (&cpath, real_ld_suffix); ld_file_name = find_a_file (&cpath, real_ld_suffix, X_OK);
/* Likewise for `collect-ld'. */ /* Likewise for `collect-ld'. */
if (ld_file_name == 0) if (ld_file_name == 0)
{ {
ld_file_name = find_a_file (&cpath, collect_ld_suffix); ld_file_name = find_a_file (&cpath, collect_ld_suffix, X_OK);
use_collect_ld = ld_file_name != 0; use_collect_ld = ld_file_name != 0;
} }
/* Search the compiler directories for `ld'. We have protection against /* Search the compiler directories for `ld'. We have protection against
recursive calls in find_a_file. */ recursive calls in find_a_file. */
if (ld_file_name == 0) if (ld_file_name == 0)
ld_file_name = find_a_file (&cpath, ld_suffixes[selected_linker]); ld_file_name = find_a_file (&cpath, ld_suffixes[selected_linker], X_OK);
/* Search the ordinary system bin directories /* Search the ordinary system bin directories
for `ld' (if native linking) or `TARGET-ld' (if cross). */ for `ld' (if native linking) or `TARGET-ld' (if cross). */
if (ld_file_name == 0) if (ld_file_name == 0)
ld_file_name = find_a_file (&path, full_ld_suffixes[selected_linker]); ld_file_name = find_a_file (&path, full_ld_suffixes[selected_linker], X_OK);
#ifdef REAL_NM_FILE_NAME #ifdef REAL_NM_FILE_NAME
nm_file_name = find_a_file (&path, REAL_NM_FILE_NAME); nm_file_name = find_a_file (&path, REAL_NM_FILE_NAME, X_OK);
if (nm_file_name == 0) if (nm_file_name == 0)
#endif #endif
nm_file_name = find_a_file (&cpath, gnm_suffix); nm_file_name = find_a_file (&cpath, gnm_suffix, X_OK);
if (nm_file_name == 0) if (nm_file_name == 0)
nm_file_name = find_a_file (&path, full_gnm_suffix); nm_file_name = find_a_file (&path, full_gnm_suffix, X_OK);
if (nm_file_name == 0) if (nm_file_name == 0)
nm_file_name = find_a_file (&cpath, nm_suffix); nm_file_name = find_a_file (&cpath, nm_suffix, X_OK);
if (nm_file_name == 0) if (nm_file_name == 0)
nm_file_name = find_a_file (&path, full_nm_suffix); nm_file_name = find_a_file (&path, full_nm_suffix, X_OK);
#ifdef LDD_SUFFIX #ifdef LDD_SUFFIX
ldd_file_name = find_a_file (&cpath, ldd_suffix); ldd_file_name = find_a_file (&cpath, ldd_suffix, X_OK);
if (ldd_file_name == 0) if (ldd_file_name == 0)
ldd_file_name = find_a_file (&path, full_ldd_suffix); ldd_file_name = find_a_file (&path, full_ldd_suffix, X_OK);
#endif #endif
#ifdef REAL_STRIP_FILE_NAME #ifdef REAL_STRIP_FILE_NAME
strip_file_name = find_a_file (&path, REAL_STRIP_FILE_NAME); strip_file_name = find_a_file (&path, REAL_STRIP_FILE_NAME, X_OK);
if (strip_file_name == 0) if (strip_file_name == 0)
#endif #endif
strip_file_name = find_a_file (&cpath, gstrip_suffix); strip_file_name = find_a_file (&cpath, gstrip_suffix, X_OK);
if (strip_file_name == 0) if (strip_file_name == 0)
strip_file_name = find_a_file (&path, full_gstrip_suffix); strip_file_name = find_a_file (&path, full_gstrip_suffix, X_OK);
if (strip_file_name == 0) if (strip_file_name == 0)
strip_file_name = find_a_file (&cpath, strip_suffix); strip_file_name = find_a_file (&cpath, strip_suffix, X_OK);
if (strip_file_name == 0) if (strip_file_name == 0)
strip_file_name = find_a_file (&path, full_strip_suffix); strip_file_name = find_a_file (&path, full_strip_suffix, X_OK);
/* Determine the full path name of the C compiler to use. */ /* Determine the full path name of the C compiler to use. */
c_file_name = getenv ("COLLECT_GCC"); c_file_name = getenv ("COLLECT_GCC");
...@@ -1171,12 +1171,12 @@ main (int argc, char **argv) ...@@ -1171,12 +1171,12 @@ main (int argc, char **argv)
#endif #endif
} }
p = find_a_file (&cpath, c_file_name); p = find_a_file (&cpath, c_file_name, X_OK);
/* Here it should be safe to use the system search path since we should have /* Here it should be safe to use the system search path since we should have
already qualified the name of the compiler when it is needed. */ already qualified the name of the compiler when it is needed. */
if (p == 0) if (p == 0)
p = find_a_file (&path, c_file_name); p = find_a_file (&path, c_file_name, X_OK);
if (p) if (p)
c_file_name = p; c_file_name = p;
......
...@@ -31,7 +31,7 @@ find_file_set_debug(bool debug_state) ...@@ -31,7 +31,7 @@ find_file_set_debug(bool debug_state)
} }
char * char *
find_a_file (struct path_prefix *pprefix, const char *name) find_a_file (struct path_prefix *pprefix, const char *name, int mode)
{ {
char *temp; char *temp;
struct prefix_list *pl; struct prefix_list *pl;
...@@ -50,7 +50,7 @@ find_a_file (struct path_prefix *pprefix, const char *name) ...@@ -50,7 +50,7 @@ find_a_file (struct path_prefix *pprefix, const char *name)
if (IS_ABSOLUTE_PATH (name)) if (IS_ABSOLUTE_PATH (name))
{ {
if (access (name, X_OK) == 0) if (access (name, mode) == 0)
{ {
strcpy (temp, name); strcpy (temp, name);
...@@ -66,7 +66,7 @@ find_a_file (struct path_prefix *pprefix, const char *name) ...@@ -66,7 +66,7 @@ find_a_file (struct path_prefix *pprefix, const char *name)
strcpy (temp, name); strcpy (temp, name);
strcat (temp, HOST_EXECUTABLE_SUFFIX); strcat (temp, HOST_EXECUTABLE_SUFFIX);
if (access (temp, X_OK) == 0) if (access (temp, mode) == 0)
return temp; return temp;
#endif #endif
...@@ -83,7 +83,7 @@ find_a_file (struct path_prefix *pprefix, const char *name) ...@@ -83,7 +83,7 @@ find_a_file (struct path_prefix *pprefix, const char *name)
if (stat (temp, &st) >= 0 if (stat (temp, &st) >= 0
&& ! S_ISDIR (st.st_mode) && ! S_ISDIR (st.st_mode)
&& access (temp, X_OK) == 0) && access (temp, mode) == 0)
return temp; return temp;
#ifdef HOST_EXECUTABLE_SUFFIX #ifdef HOST_EXECUTABLE_SUFFIX
...@@ -93,7 +93,7 @@ find_a_file (struct path_prefix *pprefix, const char *name) ...@@ -93,7 +93,7 @@ find_a_file (struct path_prefix *pprefix, const char *name)
if (stat (temp, &st) >= 0 if (stat (temp, &st) >= 0
&& ! S_ISDIR (st.st_mode) && ! S_ISDIR (st.st_mode)
&& access (temp, X_OK) == 0) && access (temp, mode) == 0)
return temp; return temp;
#endif #endif
} }
......
...@@ -38,7 +38,7 @@ struct path_prefix ...@@ -38,7 +38,7 @@ struct path_prefix
}; };
extern void find_file_set_debug (bool); extern void find_file_set_debug (bool);
extern char *find_a_file (struct path_prefix *, const char *); extern char *find_a_file (struct path_prefix *, const char *, int);
extern void add_prefix (struct path_prefix *, const char *); extern void add_prefix (struct path_prefix *, const char *);
extern void prefix_from_env (const char *, struct path_prefix *); extern void prefix_from_env (const char *, struct path_prefix *);
extern void prefix_from_string (const char *, struct path_prefix *); extern void prefix_from_string (const char *, struct path_prefix *);
......
...@@ -136,7 +136,7 @@ main(int ac, char **av) ...@@ -136,7 +136,7 @@ main(int ac, char **av)
setup_prefixes (av[0]); setup_prefixes (av[0]);
/* Find the GCC LTO plugin */ /* Find the GCC LTO plugin */
plugin = find_a_file (&target_path, LTOPLUGINSONAME); plugin = find_a_file (&target_path, LTOPLUGINSONAME, R_OK);
if (!plugin) if (!plugin)
{ {
fprintf (stderr, "%s: Cannot find plugin '%s'\n", av[0], LTOPLUGINSONAME); fprintf (stderr, "%s: Cannot find plugin '%s'\n", av[0], LTOPLUGINSONAME);
...@@ -144,14 +144,14 @@ main(int ac, char **av) ...@@ -144,14 +144,14 @@ main(int ac, char **av)
} }
/* Find the wrapped binutils program. */ /* Find the wrapped binutils program. */
exe_name = find_a_file (&target_path, PERSONALITY); exe_name = find_a_file (&target_path, PERSONALITY, X_OK);
if (!exe_name) if (!exe_name)
{ {
const char *real_exe_name = PERSONALITY; const char *real_exe_name = PERSONALITY;
#ifdef CROSS_DIRECTORY_STRUCTURE #ifdef CROSS_DIRECTORY_STRUCTURE
real_exe_name = concat (target_machine, "-", PERSONALITY, NULL); real_exe_name = concat (target_machine, "-", PERSONALITY, NULL);
#endif #endif
exe_name = find_a_file (&path, real_exe_name); exe_name = find_a_file (&path, real_exe_name, X_OK);
if (!exe_name) if (!exe_name)
{ {
fprintf (stderr, "%s: Cannot find binary '%s'\n", av[0], fprintf (stderr, "%s: Cannot find binary '%s'\n", av[0],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment