From patchwork Wed Sep 11 08:51:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kai Tietz X-Patchwork-Id: 274200 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 668102C017E for ; Wed, 11 Sep 2013 18:51:43 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:content-type; q= dns; s=default; b=sGJXTLV41uSs2j7rbLI+s4oHaFCWl6PekGjkRAXERYFH7m 4faKx3QsQ/K/kOohP1OcPHexEpiNKvlPgoUXHcZKgp2xaE/wUFHPPoUGoFlqWwMA 8fpKBUdmiURycdT0g4Hl4KVM+69PyFwv9B+Epkf9u9idllyXEdJBL4vwWOEUo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:content-type; s= default; bh=vrWXvEI/fK0Sq9DB4kmObZLG01I=; b=VOrzVlWDx7574OmbsLSQ BdMuKbC/i3CMw8321CYPScrqkBdIsr+trLmW6TRKxa1SOlcwWDmkenmWir2ss5+c +iJrhdS85Vz89L2DrifFzA/kAIBA5qo4CqOdZe7Q1kGHQhto47LRVxpcTJZ5/X6w 9yKy1lM+/NxcbMQW3YKSCBs= Received: (qmail 14079 invoked by alias); 11 Sep 2013 08:51:37 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 14070 invoked by uid 89); 11 Sep 2013 08:51:37 -0000 Received: from mail-ie0-f180.google.com (HELO mail-ie0-f180.google.com) (209.85.223.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 11 Sep 2013 08:51:37 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, NO_RELAYS autolearn=no version=3.3.2 X-HELO: mail-ie0-f180.google.com Received: by mail-ie0-f180.google.com with SMTP id 10so14793097ied.25 for ; Wed, 11 Sep 2013 01:51:34 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.50.27.9 with SMTP id p9mr74226igg.53.1378889494618; Wed, 11 Sep 2013 01:51:34 -0700 (PDT) Received: by 10.64.133.138 with HTTP; Wed, 11 Sep 2013 01:51:34 -0700 (PDT) Date: Wed, 11 Sep 2013 10:51:34 +0200 Message-ID: Subject: [patch driver]: Fix relocatable toolchain path-replacement in driver From: Kai Tietz To: GCC Patches X-IsSubscribed: yes 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 * 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)