From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2691 invoked by alias); 24 Jul 2007 20:39:55 -0000 Received: (qmail 2675 invoked by uid 22791); 24 Jul 2007 20:39:55 -0000 X-Spam-Check-By: sourceware.org Received: from iona.labri.fr (HELO iona.labri.fr) (147.210.8.143) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 24 Jul 2007 20:39:52 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by iona.labri.fr (Postfix) with ESMTP id D4F399005F for ; Tue, 24 Jul 2007 22:39:21 +0200 (CEST) Received: from iona.labri.fr ([127.0.0.1]) by localhost (iona.labri.fr [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Evz4DiU9YIGw for ; Tue, 24 Jul 2007 22:39:19 +0200 (CEST) Received: from interface.famille.thibault.fr (d80-170-42-62.cust.tele2.fr [80.170.42.62]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by iona.labri.fr (Postfix) with ESMTP id C014090056 for ; Tue, 24 Jul 2007 22:39:19 +0200 (CEST) Received: from samy by interface.famille.thibault.fr with local (Exim 4.67) (envelope-from ) id 1IDRAV-0003Uw-5T for gcc-patches@gcc.gnu.org; Tue, 24 Jul 2007 22:39:43 +0200 Date: Tue, 24 Jul 2007 21:19:00 -0000 From: Samuel Thibault To: gcc-patches@gcc.gnu.org Subject: [PATCH] drop MAXPATHLEN dependency from gcc/tlink.c Message-ID: <20070724203941.GE3700@interface.famille.thibault.fr> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="zhXaljGHf11kAtnf" Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.5.12-2006-07-14 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2007-07/txt/msg01772.txt.bz2 --zhXaljGHf11kAtnf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 153 Hi, Some systems don't define MAXPATHLEN because they don't have such hard limit. Here is a patch against gcc/tlink.c to take benefit of this. Samuel --zhXaljGHf11kAtnf Content-Type: text/plain; charset=latin1 Content-Disposition: attachment; filename=patch Content-Transfer-Encoding: 8bit Content-length: 1161 2007-07-24 Samuel Thibault * gcc/tlink.c (initial_cwd): Change type into char*. (tlink_init): Add loop to dynamically allocate initial_cwd as needed. Index: gcc/tlink.c =================================================================== --- gcc/tlink.c (révision 126889) +++ gcc/tlink.c (copie de travail) @@ -31,6 +31,7 @@ #include "hashtab.h" #include "demangle.h" #include "collect2.h" +#include "libiberty.h" #define MAX_ITERATIONS 17 @@ -39,7 +40,7 @@ static int tlink_verbose; -static char initial_cwd[MAXPATHLEN + 1]; +static char *initial_cwd; /* Hash table boilerplate for working with htab_t. We have hash tables for symbol names, file names, and demangled symbols. */ @@ -252,6 +253,7 @@ tlink_init (void) { const char *p; + size_t size = 128; symbol_table = htab_create (500, hash_string_hash, hash_string_eq, NULL); @@ -275,7 +277,12 @@ tlink_verbose = 3; } - getcwd (initial_cwd, sizeof (initial_cwd)); + while (1) { + initial_cwd = xrealloc (initial_cwd, size); + if (getcwd (initial_cwd, size)) + break; + size *= 2; + } } static int --zhXaljGHf11kAtnf--