tm.texi (DRIVER_SELF_SPECS): Document.

* doc/tm.texi (DRIVER_SELF_SPECS): Document.
	* gcc.c (driver_self_specs): New variable.
	(do_self_spec): New function.
	(main): Use it to process driver_self_specs.

From-SVN: r58109
This commit is contained in:
Richard Sandiford 2002-10-14 07:15:39 +00:00 committed by Richard Sandiford
parent 11e5489b1e
commit db36994b97
3 changed files with 76 additions and 0 deletions

View File

@ -1,3 +1,10 @@
2002-10-14 Richard Sandiford <rsandifo@redhat.com>
* doc/tm.texi (DRIVER_SELF_SPECS): Document.
* gcc.c (driver_self_specs): New variable.
(do_self_spec): New function.
(main): Use it to process driver_self_specs.
2002-10-13 Richard Henderson <rth@redhat.com>
* rtl.c (shallow_copy_rtx): Use memcpy for the entire node.

View File

@ -163,6 +163,23 @@ multilibs. Example nonsensical definition, where @code{-malt-abi},
@{ "-compat", "-EB -malign=4 -mspoo" @}
@end smallexample
@findex DRIVER_SELF_SPECS
@item DRIVER_SELF_SPECS
A list of specs for the driver itself. It should be a suitable
initializer for an array of strings, with no surrounding braces.
The driver applies these specs to its own command line before choosing
the multilib directory or running any subcommands. It applies them in
the order given, so each spec can depend on the options added by
earlier ones. It is also possible to remove options using
@samp{%<@var{option}} in the usual way.
This macro can be useful when a port has several interdependent target
options. It provides a way of standardizing the command line so
that the other specs are easier to write.
Do not define this macro if it does not need to do anything.
@findex CPP_SPEC
@item CPP_SPEC
A C string constant that tells the GCC driver program options to

View File

@ -296,6 +296,7 @@ static char *save_string PARAMS ((const char *, int));
static void set_collect_gcc_options PARAMS ((void));
static int do_spec_1 PARAMS ((const char *, int, const char *));
static int do_spec_2 PARAMS ((const char *));
static void do_self_spec PARAMS ((const char *));
static const char *find_file PARAMS ((const char *));
static int is_directory PARAMS ((const char *, const char *, int));
static void validate_switches PARAMS ((const char *));
@ -738,6 +739,12 @@ static const char *multilib_exclusions;
static const char *const multilib_defaults_raw[] = MULTILIB_DEFAULTS;
#ifndef DRIVER_SELF_SPECS
#define DRIVER_SELF_SPECS ""
#endif
static const char *const driver_self_specs[] = { DRIVER_SELF_SPECS };
struct user_specs
{
struct user_specs *next;
@ -4268,6 +4275,45 @@ do_spec_2 (spec)
return do_spec_1 (spec, 0, NULL);
}
/* Process the given spec string and add any new options to the end
of the switches/n_switches array. */
static void
do_self_spec (spec)
const char *spec;
{
do_spec_2 (spec);
do_spec_1 (" ", 0, NULL);
if (argbuf_index > 0)
{
int i, first;
first = n_switches;
n_switches += argbuf_index;
switches = xrealloc (switches,
sizeof (struct switchstr) * (n_switches + 1));
switches[n_switches] = switches[first];
for (i = 0; i < argbuf_index; i++)
{
struct switchstr *sw;
/* Each switch should start with '-'. */
if (argbuf[i][0] != '-')
abort ();
sw = &switches[i + first];
sw->part1 = &argbuf[i][1];
sw->args = 0;
sw->live_cond = SWITCH_OK;
sw->validated = 0;
sw->ordering = 0;
}
}
}
/* Process the sub-spec SPEC as a portion of a larger spec.
This is like processing a whole spec except that we do
not initialize at the beginning and we do not supply a
@ -5917,6 +5963,12 @@ main (argc, argv)
process_command (argc, argv);
/* Process DRIVER_SELF_SPECS, adding any new options to the end
of the command line. */
for (i = 0; i < ARRAY_SIZE (driver_self_specs); i++)
do_self_spec (driver_self_specs[i]);
/* Initialize the vector of specs to just the default.
This means one element containing 0s, as a terminator. */