]> git.pld-linux.org Git - packages/crossavr-gcc.git/blob - 000-gcc-PR50293.patch
- updated to 4.7.3 (4.7.2 and older fail to compile with ICE)
[packages/crossavr-gcc.git] / 000-gcc-PR50293.patch
1 diff -Naurp gcc/gcc.c gcc/gcc.c
2 --- gcc/gcc.c   2012-08-06 20:04:27.000000000 +0530
3 +++ gcc/gcc.c   2013-03-21 12:13:51.000000000 +0530
4 @@ -267,6 +267,7 @@ static const char *compare_debug_dump_op
5  static const char *compare_debug_self_opt_spec_function (int, const char **);
6  static const char *compare_debug_auxbase_opt_spec_function (int, const char **);
7  static const char *pass_through_libs_spec_func (int, const char **);
8 +static char *convert_white_space (char *);
9  \f
10  /* The Specs Language
11  
12 @@ -6475,6 +6476,7 @@ main (int argc, char **argv)
13                                     X_OK, false);
14    if (lto_wrapper_file)
15      {
16 +      lto_wrapper_file = convert_white_space (lto_wrapper_file);
17        lto_wrapper_spec = lto_wrapper_file;
18        obstack_init (&collect_obstack);
19        obstack_grow (&collect_obstack, "COLLECT_LTO_WRAPPER=",
20 @@ -6876,12 +6878,13 @@ warranty; not even for MERCHANTABILITY o
21                               + strlen (fuse_linker_plugin), 0))
22  #endif
23             {
24 -             linker_plugin_file_spec = find_a_file (&exec_prefixes,
25 -                                                    LTOPLUGINSONAME, R_OK,
26 -                                                    false);
27 -             if (!linker_plugin_file_spec)
28 +             char *temp_spec = find_a_file (&exec_prefixes,
29 +                                            LTOPLUGINSONAME, R_OK,
30 +                                            false);
31 +             if (!temp_spec)
32                 fatal_error ("-fuse-linker-plugin, but %s not found",
33                              LTOPLUGINSONAME);
34 +             linker_plugin_file_spec = convert_white_space (temp_spec);
35             }
36  #endif
37           lto_gcc_spec = argv[0];
38 @@ -8318,3 +8321,51 @@ pass_through_libs_spec_func (int argc, c
39      }
40    return prepended;
41  }
42 +
43 +/* Insert backslash before spaces in ORIG (usually a file path), to 
44 +   avoid being broken by spec parser.
45 +
46 +   This function is needed as do_spec_1 treats white space (' ' and '\t')
47 +   as the end of an argument. But in case of -plugin /usr/gcc install/xxx.so,
48 +   the file name should be treated as a single argument rather than being
49 +   broken into multiple. Solution is to insert '\\' before the space in a 
50 +   file name.
51 +   
52 +   This function converts and only converts all occurrence of ' ' 
53 +   to '\\' + ' ' and '\t' to '\\' + '\t'.  For example:
54 +   "a b"  -> "a\\ b"
55 +   "a  b" -> "a\\ \\ b"
56 +   "a\tb" -> "a\\\tb"
57 +   "a\\ b" -> "a\\\\ b"
58 +
59 +   orig: input null-terminating string that was allocated by xalloc. The
60 +   memory it points to might be freed in this function. Behavior undefined
61 +   if ORIG wasn't xalloced or was freed already at entry.
62 +
63 +   Return: ORIG if no conversion needed. Otherwise a newly allocated string
64 +   that was converted from ORIG.  */
65 +
66 +static char *
67 +convert_white_space (char *orig)
68 +{
69 +  int len, number_of_space = 0;
70 +
71 +  for (len = 0; orig[len]; len++)
72 +    if (orig[len] == ' ' || orig[len] == '\t') number_of_space++;
73 +
74 +  if (number_of_space)
75 +    {
76 +      char *new_spec = (char *) xmalloc (len + number_of_space + 1);
77 +      int j, k;
78 +      for (j = 0, k = 0; j <= len; j++, k++)
79 +       {
80 +         if (orig[j] == ' ' || orig[j] == '\t')
81 +           new_spec[k++] = '\\';
82 +         new_spec[k] = orig[j];
83 +       }
84 +      free (orig);
85 +      return new_spec;
86 +  }
87 +  else
88 +    return orig;
89 +}
This page took 0.088707 seconds and 4 git commands to generate.