new gcc snapshot
[dottout.git] / net-im / emesene / files / sys-devel / gcc / files / gcc-spec-env.patch
blob9d5e666a5441d44414231eba97b5b487670f5fc6
1 Add support for external spec file via the GCC_SPECS env var. This
2 allows us to easily control pie/ssp defaults with gcc-config profiles.
4 Original patch by Rob Holland. Extended to support multiple
5 entries separated by ':' by Kevin F. Quinn
7 --- gcc-4/gcc/gcc.c
8 +++ gcc-4/gcc/gcc.c
9 @@ -6482,6 +6482,32 @@
11 /* Process any user specified specs in the order given on the command
12 line. */
13 +#if !(defined (__MSDOS__) || defined (OS2) || defined (VMS) || defined (WIN32))
14 + /* Add specs listed in GCC_SPECS. Note; in the process of separating
15 + * each spec listed, the string is overwritten at token boundaries
16 + * (':') with '\0', an effect of strtok_r().
17 + */
18 + GET_ENVIRONMENT (specs_file, "GCC_SPECS");
19 + if (specs_file && (strlen(specs_file) > 0))
20 + {
21 + char *spec, *saveptr;
22 + for (spec=strtok_r(specs_file,":",&saveptr);
23 + spec!=NULL;
24 + spec=strtok_r(NULL,":",&saveptr))
25 + {
26 + struct user_specs *user = (struct user_specs *)
27 + xmalloc (sizeof (struct user_specs));
29 + user->next = (struct user_specs *) 0;
30 + user->filename = spec;
31 + if (user_specs_tail)
32 + user_specs_tail->next = user;
33 + else
34 + user_specs_head = user;
35 + user_specs_tail = user;
36 + }
37 + }
38 +#endif
39 for (uptr = user_specs_head; uptr; uptr = uptr->next)
41 char *filename = find_a_file (&startfile_prefixes, uptr->filename,