H. J. Lu wrote:
It may be related to

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14435

Can you try

http://gcc.gnu.org/ml/gcc-patches/2006-01/msg01757.html
Tried that but no difference.

I had a look through gcc.c and noticed that standard_exec_prefix and standard_libexec_prefix are constants which refer to the configured install path. gcc_exec_prefix and gcc_libexec_prefix are the equivalent paths adjusted for the relocated toolchain but the unadjusted variables are used in several places. The attached patch switches them for the adjusted variables and is a partial fix for my problem but unfortunately isn't the whole story. The relocated compiler is still checking for includes in the configured location but all the directories reported from -print-search-dirs are now relocated.

Unfortunately I still don't quite understand how the include paths are determined so I haven't made much progress in tracking the problem there. Is there any reason why -print-search-dirs doesn't report include paths as well?

One caveat with this patch is that the make_relative_prefix calls are commented on VMS so this might utterly break the compiler on that platform.

Could someone check if this is the right approach and possibly point me in the right direction to adjust the include paths as well?

Dave
--- gcc-4.1.0/gcc/gcc.c Sat Jan 21 18:29:08 2006
+++ gcc-4.1.0-arm/gcc/gcc.c     Sat Apr 15 07:11:53 2006
@@ -3278,6 +3278,8 @@
       set_std_prefix (gcc_exec_prefix, len);
       add_prefix (&exec_prefixes, gcc_libexec_prefix, "GCC",
                  PREFIX_PRIORITY_LAST, 0, 0);
+      add_prefix (&exec_prefixes, gcc_exec_prefix, "GCC",
+                 PREFIX_PRIORITY_LAST, 0, 0);
       add_prefix (&startfile_prefixes, gcc_exec_prefix, "GCC",
                  PREFIX_PRIORITY_LAST, 0, 0);
     }
@@ -3812,11 +3814,11 @@
   /* Use 2 as fourth arg meaning try just the machine as a suffix,
      as well as trying the machine and the version.  */
 #ifndef OS2
-  add_prefix (&exec_prefixes, standard_libexec_prefix, "GCC",
+  add_prefix (&exec_prefixes, gcc_libexec_prefix, "GCC",
              PREFIX_PRIORITY_LAST, 1, 0);
-  add_prefix (&exec_prefixes, standard_libexec_prefix, "BINUTILS",
+  add_prefix (&exec_prefixes, gcc_libexec_prefix, "BINUTILS",
              PREFIX_PRIORITY_LAST, 2, 0);
-  add_prefix (&exec_prefixes, standard_exec_prefix, "BINUTILS",
+  add_prefix (&exec_prefixes, gcc_exec_prefix, "BINUTILS",
              PREFIX_PRIORITY_LAST, 2, 0);
   add_prefix (&exec_prefixes, standard_exec_prefix_1, "BINUTILS",
              PREFIX_PRIORITY_LAST, 2, 0);
@@ -3824,7 +3826,7 @@
              PREFIX_PRIORITY_LAST, 2, 0);
 #endif
 
-  add_prefix (&startfile_prefixes, standard_exec_prefix, "BINUTILS",
+  add_prefix (&startfile_prefixes, gcc_exec_prefix, "BINUTILS",
              PREFIX_PRIORITY_LAST, 1, 0);
   add_prefix (&startfile_prefixes, standard_exec_prefix_2, "BINUTILS",
              PREFIX_PRIORITY_LAST, 1, 0);
@@ -3857,7 +3859,7 @@
                      NULL, PREFIX_PRIORITY_LAST, 0, 1);
        }
 
-      tooldir_prefix = concat (standard_exec_prefix, spec_machine,
+      tooldir_prefix = concat (gcc_exec_prefix, spec_machine,
                               dir_separator_str, spec_version,
                               dir_separator_str, tooldir_prefix, NULL);
     }
@@ -6148,10 +6150,10 @@
 
   /* We need to check standard_exec_prefix/just_machine_suffix/specs
      for any override of as, ld and libraries.  */
-  specs_file = alloca (strlen (standard_exec_prefix)
+  specs_file = alloca (strlen (gcc_exec_prefix)
                       + strlen (just_machine_suffix) + sizeof ("specs"));
 
-  strcpy (specs_file, standard_exec_prefix);
+  strcpy (specs_file, gcc_exec_prefix);
   strcat (specs_file, just_machine_suffix);
   strcat (specs_file, "specs");
   if (access (specs_file, R_OK) == 0)
@@ -6254,7 +6256,7 @@
                                standard_startfile_prefix, NULL),
                        NULL, PREFIX_PRIORITY_LAST, 0, 1);
          add_prefix (&startfile_prefixes,
-                     concat (standard_exec_prefix,
+                     concat (gcc_exec_prefix,
                              machine_suffix,
                              standard_startfile_prefix, NULL),
                      NULL, PREFIX_PRIORITY_LAST, 0, 1);
@@ -6303,7 +6305,7 @@
 
   if (print_search_dirs)
     {
-      printf (_("install: %s%s\n"), standard_exec_prefix, machine_suffix);
+      printf (_("install: %s%s\n"), gcc_exec_prefix, machine_suffix);
       printf (_("programs: %s\n"), build_search_list (&exec_prefixes, "", 0));
       printf (_("libraries: %s\n"), build_search_list (&startfile_prefixes, 
"", 0));
       return (0);

Reply via email to