This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch driver]: Fix relocatable toolchain path-replacement in driver


This change fixes a quirk happening for relocated toolchains.  Driver
remembers original-build directory
in std_prefix variable for being able later to modify path.  Sadly
this std_prefix variable gets modified
later on, and so update_path can't work any longer as desired.  This
patch fixes that by introducing an
constant variable holding the initial path without being later on modified.


2013-09-11  Kai Tietz  <>

    * prefix.c (org_prefix): New static variable.
    (update_path): Use org_prefix instead of std_prefix.

Tested for i686-w64-mingw32, for x86_64-w64-mingw32, and for
x86_64-unknown-linux-gnu.  Ok for apply?


Index: prefix.c
--- prefix.c    (Revision 202491)
+++ prefix.c    (Arbeitskopie)
@@ -73,6 +73,9 @@ License along with GCC; see the file COPYING3.  If
 #include "common/common-target.h"

 static const char *std_prefix = PREFIX;
+/* Original prefix used on intial build.  This might be different
+   to std_prefix for relocatable-configure.  */
+static const char *org_prefix = PREFIX;

 static const char *get_key_value (char *);
 static char *translate_name (char *);
@@ -247,9 +250,9 @@ char *
 update_path (const char *path, const char *key)
   char *result, *p;
-  const int len = strlen (std_prefix);
+  const int len = strlen (org_prefix);

-  if (! filename_ncmp (path, std_prefix, len)
+  if (! filename_ncmp (path, org_prefix, len)
       && (IS_DIR_SEPARATOR(path[len])
           || path[len] == '\0')
       && key != 0)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]