Commit a1d9074c by Tom Tromey Committed by Tom Tromey

* gcc.c (do_spec_1): Support text between `%u' and `%O'.

From-SVN: r30478
parent 6c9821b7
Wed Nov 10 10:52:42 1999 Tom Tromey <tromey@cygnus.com>
* gcc.c (do_spec_1): Support text between `%u' and `%O'.
Wed Nov 10 12:43:21 1999 Philippe De Muyter <phdm@macqel.be> Wed Nov 10 12:43:21 1999 Philippe De Muyter <phdm@macqel.be>
Kaveh R. Ghazi <ghazi@caip.rutgers.edu> Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
......
...@@ -283,11 +283,11 @@ or with constant text in a single argument. ...@@ -283,11 +283,11 @@ or with constant text in a single argument.
chosen in a way that is hard to predict even when previously chosen in a way that is hard to predict even when previously
chosen file names are known. For example, `%g.s ... %g.o ... %g.s' chosen file names are known. For example, `%g.s ... %g.o ... %g.s'
might turn into `ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s'. SUFFIX matches might turn into `ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s'. SUFFIX matches
the regexp "[.A-Za-z]*" or the special string "%O", which is the regexp "[.A-Za-z]*%O"; "%O" is treated exactly as if it
treated exactly as if %O had been pre-processed. Previously, %g had been pre-processed. Previously, %g was simply substituted
was simply substituted with a file name chosen once per compilation, with a file name chosen once per compilation, without regard
without regard to any appended suffix (which was therefore treated to any appended suffix (which was therefore treated just like
just like ordinary text), making such attacks more likely to succeed. ordinary text), making such attacks more likely to succeed.
%uSUFFIX %uSUFFIX
like %g, but generates a new temporary file name even if %uSUFFIX like %g, but generates a new temporary file name even if %uSUFFIX
was already seen. was already seen.
...@@ -317,12 +317,13 @@ or with constant text in a single argument. ...@@ -317,12 +317,13 @@ or with constant text in a single argument.
at all, but they are included among the output files, so they will at all, but they are included among the output files, so they will
be linked. be linked.
%O substitutes the suffix for object files. Note that this is %O substitutes the suffix for object files. Note that this is
handled specially when it immediately follows %g, %u, or %U, handled specially when it immediately follows %g, %u, or %U
because of the need for those to form complete file names. The (with or without a suffix argument) because of the need for
handling is such that %O is treated exactly as if it had already those to form complete file names. The handling is such that
been substituted, except that %g, %u, and %U do not currently %O is treated exactly as if it had already been substituted,
support additional SUFFIX characters following %O as they would except that %g, %u, and %U do not currently support additional
following, for example, `.o'. SUFFIX characters following %O as they would following, for
example, `.o'.
%p substitutes the standard macro predefinitions for the %p substitutes the standard macro predefinitions for the
current target machine. Use this when running cpp. current target machine. Use this when running cpp.
%P like %p, but puts `__' before and after the name of each macro. %P like %p, but puts `__' before and after the name of each macro.
...@@ -3980,21 +3981,29 @@ do_spec_1 (spec, inswitch, soft_matched_part) ...@@ -3980,21 +3981,29 @@ do_spec_1 (spec, inswitch, soft_matched_part)
struct temp_name *t; struct temp_name *t;
int suffix_length; int suffix_length;
const char *suffix = p; const char *suffix = p;
char *saved_suffix = NULL;
while (*p == '.' || ISALPHA ((unsigned char)*p))
p++;
suffix_length = p - suffix;
if (p[0] == '%' && p[1] == 'O') if (p[0] == '%' && p[1] == 'O')
{ {
p += 2; p += 2;
/* We don't support extra suffix characters after %O. */ /* We don't support extra suffix characters after %O. */
if (*p == '.' || ISALPHA ((unsigned char)*p)) if (*p == '.' || ISALPHA ((unsigned char)*p))
abort (); abort ();
suffix = OBJECT_SUFFIX; if (suffix_length == 0)
suffix_length = strlen (OBJECT_SUFFIX); suffix = OBJECT_SUFFIX;
} else
else {
{ saved_suffix
while (*p == '.' || ISALPHA ((unsigned char)*p)) = (char *) xmalloc (suffix_length
p++; + strlen (OBJECT_SUFFIX));
suffix_length = p - suffix; strncpy (saved_suffix, suffix, suffix_length);
strcpy (saved_suffix + suffix_length,
OBJECT_SUFFIX);
}
suffix_length += strlen (OBJECT_SUFFIX);
} }
/* See if we already have an association of %g/%u/%U and /* See if we already have an association of %g/%u/%U and
...@@ -4023,6 +4032,9 @@ do_spec_1 (spec, inswitch, soft_matched_part) ...@@ -4023,6 +4032,9 @@ do_spec_1 (spec, inswitch, soft_matched_part)
t->filename_length = temp_filename_length; t->filename_length = temp_filename_length;
} }
if (saved_suffix)
free (saved_suffix);
obstack_grow (&obstack, t->filename, t->filename_length); obstack_grow (&obstack, t->filename, t->filename_length);
delete_this_arg = 1; delete_this_arg = 1;
#else #else
......
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