This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch driver]: Fix relocatable toolchain path-replacement in driver
- From: Kai Tietz <ktietz70 at googlemail dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 11 Sep 2013 10:51:34 +0200
- Subject: [patch driver]: Fix relocatable toolchain path-replacement in driver
- Authentication-results: sourceware.org; auth=none
Hi,
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.
ChangeLog
2013-09-11 Kai Tietz <ktietz@redhat.com>
* 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?
Regards,
Kai
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)