Commit ba0c638e by Simon Baldwin Committed by Simon Baldwin

gcc.c (option_map): New flag -no-canonical-prefixes.


	* gcc.c (option_map): New flag -no-canonical-prefixes.
	* (display_help): Print help text for new flag.
	* (process_command): Move options translation and language specifics
	and handle new flag early.  Use it to set a function pointer to a
	prefix builder.  Replace make_relative_prefix calls with calls to
	the function pointed to.  Ignore new flag in regular options handling.
	* doc/invoke.texi (Overall Options): Documented -no-canonical-prefixes.

From-SVN: r149702
parent 11af2d7b
2009-07-16 Simon Baldwin <simonb@google.com>
* gcc.c (option_map): New flag -no-canonical-prefixes.
* (display_help): Print help text for new flag.
* (process_command): Move options translation and language specifics
and handle new flag early. Use it to set a function pointer to a
prefix builder. Replace make_relative_prefix calls with calls to
the function pointed to. Ignore new flag in regular options handling.
* doc/invoke.texi (Overall Options): Documented -no-canonical-prefixes.
2009-07-15 DJ Delorie <dj@redhat.com>
* config/mep/mep.md (sibcall_internal): Change register to avoid
......
......@@ -161,7 +161,8 @@ in the following sections.
@table @emph
@item Overall Options
@xref{Overall Options,,Options Controlling the Kind of Output}.
@gccoptlist{-c -S -E -o @var{file} -combine -pipe -pass-exit-codes @gol
@gccoptlist{-c -S -E -o @var{file} -combine -no-canonical-prefixes @gol
-pipe -pass-exit-codes @gol
-x @var{language} -v -### --help@r{[}=@var{class}@r{[},@dots{}@r{]]} --target-help @gol
--version -wrapper@@@var{file} -fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg}}
......@@ -1305,6 +1306,12 @@ gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
diff /tmp/O2-opts /tmp/O3-opts | grep enabled
@end smallexample
@item -no-canonical-prefixes
@opindex no-canonical-prefixes
Do not expand any symbolic links, resolve references to @samp{/../}
or @samp{/./}, or make the path absolute when generating a relative
prefix.
@item --version
@opindex version
Display the version number and copyrights of the invoked GCC@.
......
......@@ -1180,6 +1180,7 @@ static const struct option_map option_map[] =
{"--library-directory", "-L", "a"},
{"--machine", "-m", "aj"},
{"--machine-", "-m", "*j"},
{"--no-canonical-prefixes", "-no-canonical-prefixes", 0},
{"--no-integrated-cpp", "-no-integrated-cpp", 0},
{"--no-line-commands", "-P", 0},
{"--no-precompiled-includes", "-noprecomp", 0},
......@@ -3370,6 +3371,9 @@ display_help (void)
fputs (_(" -combine Pass multiple source files to compiler at once\n"), stdout);
fputs (_(" -save-temps Do not delete intermediate files\n"), stdout);
fputs (_(" -save-temps=<arg> Do not delete intermediate files\n"), stdout);
fputs (_("\
-no-canonical-prefixes Do not canonicalize paths when building relative\n\
prefixes to other gcc components\n"), stdout);
fputs (_(" -pipe Use pipes rather than intermediate files\n"), stdout);
fputs (_(" -time Time the execution of each subprocess\n"), stdout);
fputs (_(" -specs=<file> Override built-in specs with the contents of <file>\n"), stdout);
......@@ -3462,6 +3466,8 @@ process_command (int argc, const char **argv)
unsigned int j;
#endif
const char *tooldir_prefix;
char *(*get_relative_prefix) (const char *, const char *,
const char *) = NULL;
GET_ENVIRONMENT (gcc_exec_prefix, "GCC_EXEC_PREFIX");
......@@ -3557,6 +3563,32 @@ process_command (int argc, const char **argv)
exit (status);
}
/* Convert new-style -- options to old-style. */
translate_options (&argc,
CONST_CAST2 (const char *const **, const char ***,
&argv));
/* Do language-specific adjustment/addition of flags. */
lang_specific_driver (&argc,
CONST_CAST2 (const char *const **, const char ***,
&argv),
&added_libraries);
/* Handle any -no-canonical-prefixes flag early, to assign the function
that builds relative prefixes. This function creates default search
paths that are needed later in normal option handling. */
for (i = 1; i < argc; i++)
{
if (! strcmp (argv[i], "-no-canonical-prefixes"))
{
get_relative_prefix = make_relative_prefix_ignore_links;
break;
}
}
if (! get_relative_prefix)
get_relative_prefix = make_relative_prefix;
/* Set up the default search paths. If there is no GCC_EXEC_PREFIX,
see if we can create it from the pathname specified in argv[0]. */
......@@ -3565,11 +3597,12 @@ process_command (int argc, const char **argv)
/* FIXME: make_relative_prefix doesn't yet work for VMS. */
if (!gcc_exec_prefix)
{
gcc_exec_prefix = make_relative_prefix (argv[0], standard_bindir_prefix,
standard_exec_prefix);
gcc_libexec_prefix = make_relative_prefix (argv[0],
standard_bindir_prefix,
standard_libexec_prefix);
gcc_exec_prefix = get_relative_prefix (argv[0],
standard_bindir_prefix,
standard_exec_prefix);
gcc_libexec_prefix = get_relative_prefix (argv[0],
standard_bindir_prefix,
standard_libexec_prefix);
if (gcc_exec_prefix)
xputenv (concat ("GCC_EXEC_PREFIX=", gcc_exec_prefix, NULL));
}
......@@ -3580,9 +3613,9 @@ process_command (int argc, const char **argv)
/ (which is ignored by make_relative_prefix), so append a
program name. */
char *tmp_prefix = concat (gcc_exec_prefix, "gcc", NULL);
gcc_libexec_prefix = make_relative_prefix (tmp_prefix,
standard_exec_prefix,
standard_libexec_prefix);
gcc_libexec_prefix = get_relative_prefix (tmp_prefix,
standard_exec_prefix,
standard_libexec_prefix);
/* The path is unrelocated, so fallback to the original setting. */
if (!gcc_libexec_prefix)
......@@ -3720,17 +3753,6 @@ process_command (int argc, const char **argv)
}
}
/* Convert new-style -- options to old-style. */
translate_options (&argc,
CONST_CAST2 (const char *const **, const char ***,
&argv));
/* Do language-specific adjustment/addition of flags. */
lang_specific_driver (&argc,
CONST_CAST2 (const char *const **, const char ***,
&argv),
&added_libraries);
/* Scan argv twice. Here, the first time, just count how many switches
there will be in their vector, and how many input files in theirs.
Here we also parse the switches that cc itself uses (e.g. -v). */
......@@ -3958,6 +3980,9 @@ process_command (int argc, const char **argv)
else
fatal ("'%s' is an unknown -save-temps option", argv[i]);
}
else if (strcmp (argv[i], "-no-canonical-prefixes") == 0)
/* Already handled as a special case, so ignored here. */
;
else if (strcmp (argv[i], "-combine") == 0)
{
combine_flag = 1;
......@@ -4305,9 +4330,9 @@ process_command (int argc, const char **argv)
``make_relative_prefix'' is not compiled for VMS, so don't call it. */
if (target_system_root && gcc_exec_prefix)
{
char *tmp_prefix = make_relative_prefix (argv[0],
standard_bindir_prefix,
target_system_root);
char *tmp_prefix = get_relative_prefix (argv[0],
standard_bindir_prefix,
target_system_root);
if (tmp_prefix && access_check (tmp_prefix, F_OK) == 0)
{
target_system_root = tmp_prefix;
......@@ -4349,6 +4374,8 @@ process_command (int argc, const char **argv)
;
else if (! strncmp (argv[i], "-Wp,", 4))
;
else if (! strcmp (argv[i], "-no-canonical-prefixes"))
;
else if (! strcmp (argv[i], "-pass-exit-codes"))
;
else if (! strcmp (argv[i], "-print-search-dirs"))
......
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