Index: gcc/gcc/gcc.c |
diff --git a/gcc/gcc/gcc.c b/gcc/gcc/gcc.c |
index 103a8a1fc2a8fe549a62c156d0b15b07b4583fe5..5ef245e4e891fe69ffd54f32970ee62750cf5f39 100644 |
--- a/gcc/gcc/gcc.c |
+++ b/gcc/gcc/gcc.c |
@@ -1136,6 +1136,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}, |
@@ -3255,6 +3256,9 @@ display_help (void) |
fputs (_(" -Xlinker <arg> Pass <arg> on to the linker\n"), stdout); |
fputs (_(" -combine Pass multiple source files to compiler at once\n"), stdout); |
fputs (_(" -save-temps 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); |
@@ -3347,6 +3351,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"); |
@@ -3442,6 +3448,27 @@ process_command (int argc, const char **argv) |
exit (status); |
} |
+ /* Convert new-style -- options to old-style. */ |
+ translate_options (&argc, (const char *const **) &argv); |
+ |
+ /* Do language-specific adjustment/addition of flags. */ |
+ lang_specific_driver (&argc, (const char *const **) &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]. */ |
@@ -3450,11 +3477,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)); |
} |
@@ -3465,9 +3493,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) |
@@ -3605,12 +3633,6 @@ process_command (int argc, const char **argv) |
} |
} |
- /* Convert new-style -- options to old-style. */ |
- translate_options (&argc, (const char *const **) &argv); |
- |
- /* Do language-specific adjustment/addition of flags. */ |
- lang_specific_driver (&argc, (const char *const **) &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). */ |
@@ -3794,6 +3816,9 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n" |
save_temps_flag = 1; |
n_switches++; |
} |
+ 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; |
@@ -4091,9 +4116,9 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n" |
``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; |
@@ -4135,6 +4160,8 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n" |
; |
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")) |