summaryrefslogtreecommitdiff
path: root/gcc/gcc.c
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2002-10-14 07:15:39 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2002-10-14 07:15:39 +0000
commit73023f498316b10629006910e7f687a88ea5375b (patch)
tree0cc93a95de2023f1fadaefdc7bf5081a6ac353b1 /gcc/gcc.c
parent35aae09b1082d2c1c3ba86fc6cc149948a89c9dc (diff)
downloadgcc-73023f498316b10629006910e7f687a88ea5375b.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@58109 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gcc.c')
-rw-r--r--gcc/gcc.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 1018513f5c7..291712dcfa1 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -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. */