@@ -46,7 +46,9 @@ enum gcc_base_api_version
{
GCC_FE_VERSION_0 = 0,
- /* Parameter verbose has been moved from compile to set_arguments. */
+ /* Parameter verbose has been moved from compile to set_arguments.
+ Parameter triplet_regexp of set_arguments can be also gcc driver
+ executable. */
GCC_FE_VERSION_1 = 1,
};
@@ -104,7 +106,8 @@ struct gcc_base_vtable
/* Set the compiler's command-line options for the next compilation.
TRIPLET_REGEXP is a regular expression that is used to match the
- configury triplet prefix to the compiler.
+ configury triplet prefix to the compiler; TRIPLET_REGEXP can be
+ also absolute filename to the computer.
The arguments are copied by GCC. ARGV need not be
NULL-terminated. The arguments must be set separately for each
compilation; that is, after a compile is requested, the
@@ -322,38 +322,48 @@ libcc1_set_arguments (struct gcc_base_context *s,
self->verbose = verbose != 0;
- std::string rx = make_regexp (triplet_regexp, COMPILER_NAME);
- // Simulate fnotice by fprintf.
- if (self->verbose)
- fprintf (stderr, _("searching for compiler matching regex %s\n"),
- rx.c_str());
- code = regcomp (&triplet, rx.c_str (), REG_EXTENDED | REG_NOSUB);
- if (code != 0)
+ std::string compiler;
+ if (access (triplet_regexp, X_OK) == 0)
{
- size_t len = regerror (code, &triplet, NULL, 0);
- char err[len];
+ compiler = triplet_regexp;
+ // Simulate fnotice by fprintf.
+ if (self->verbose)
+ fprintf (stderr, _("using explicit compiler filename %s\n"),
+ compiler.c_str());
+ }
+ else
+ {
+ std::string rx = make_regexp (triplet_regexp, COMPILER_NAME);
+ if (self->verbose)
+ fprintf (stderr, _("searching for compiler matching regex %s\n"),
+ rx.c_str());
+ code = regcomp (&triplet, rx.c_str (), REG_EXTENDED | REG_NOSUB);
+ if (code != 0)
+ {
+ size_t len = regerror (code, &triplet, NULL, 0);
+ char err[len];
- regerror (code, &triplet, err, len);
+ regerror (code, &triplet, err, len);
- return concat ("Could not compile regexp \"",
- rx.c_str (),
- "\": ",
- err,
- (char *) NULL);
- }
+ return concat ("Could not compile regexp \"",
+ rx.c_str (),
+ "\": ",
+ err,
+ (char *) NULL);
+ }
- std::string compiler;
- if (!find_compiler (triplet, &compiler))
- {
+ if (!find_compiler (triplet, &compiler))
+ {
+ regfree (&triplet);
+ return concat ("Could not find a compiler matching \"",
+ rx.c_str (),
+ "\"",
+ (char *) NULL);
+ }
regfree (&triplet);
- return concat ("Could not find a compiler matching \"",
- rx.c_str (),
- "\"",
- (char *) NULL);
+ if (self->verbose)
+ fprintf (stderr, _("found compiler %s\n"), compiler.c_str());
}
- regfree (&triplet);
- if (self->verbose)
- fprintf (stderr, _("found compiler %s\n"), compiler.c_str());
self->args.push_back (compiler);