]> git.draconx.ca Git - gentoo-draconx.git/blob - sys-devel/gcc/files/gcc-spec-env.patch
xorg-server: Add live ebuild.
[gentoo-draconx.git] / sys-devel / gcc / files / gcc-spec-env.patch
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.
3
4     Original patch by Rob Holland.  Extended to support multiple
5     entries separated by ':' by Kevin F. Quinn
6
7 --- gcc-4/gcc/gcc.c
8 +++ gcc-4/gcc/gcc.c
9 @@ -6482,6 +6482,32 @@
10
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));
28 +
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)
40      {
41        char *filename = find_a_file (&startfile_prefixes, uptr->filename,