* [PATCH] drop MAXPATHLEN dependency from gcc/tlink.c
@ 2007-07-24 21:19 Samuel Thibault
2007-08-01 1:39 ` Ian Lance Taylor
0 siblings, 1 reply; 8+ messages in thread
From: Samuel Thibault @ 2007-07-24 21:19 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 153 bytes --]
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
[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 1162 bytes --]
2007-07-24 Samuel Thibault <samuel.thibault@ens-lyon.org>
* 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;
\f
/* 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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] drop MAXPATHLEN dependency from gcc/tlink.c
2007-07-24 21:19 [PATCH] drop MAXPATHLEN dependency from gcc/tlink.c Samuel Thibault
@ 2007-08-01 1:39 ` Ian Lance Taylor
2007-08-01 21:03 ` Samuel Thibault
0 siblings, 1 reply; 8+ messages in thread
From: Ian Lance Taylor @ 2007-08-01 1:39 UTC (permalink / raw)
To: Samuel Thibault; +Cc: gcc-patches
Samuel Thibault <samuel.thibault@ens-lyon.org> writes:
> 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
>
> 2007-07-24 Samuel Thibault <samuel.thibault@ens-lyon.org>
>
> * gcc/tlink.c (initial_cwd): Change type into char*.
> (tlink_init): Add loop to dynamically allocate initial_cwd as needed.
Just call getpwd instead.
Thanks.
Ian
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] drop MAXPATHLEN dependency from gcc/tlink.c
2007-08-01 1:39 ` Ian Lance Taylor
@ 2007-08-01 21:03 ` Samuel Thibault
2007-08-04 21:20 ` Samuel Thibault
2007-08-08 14:01 ` Ian Lance Taylor
0 siblings, 2 replies; 8+ messages in thread
From: Samuel Thibault @ 2007-08-01 21:03 UTC (permalink / raw)
To: Ian Lance Taylor; +Cc: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 469 bytes --]
Ian Lance Taylor, le Tue 31 Jul 2007 18:38:24 -0700, a écrit :
> Samuel Thibault <samuel.thibault@ens-lyon.org> writes:
> > 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.
> >
> > (tlink_init): Add loop to dynamically allocate initial_cwd as needed.
>
> Just call getpwd instead.
Oh right, I didn't notice that non-standard function. Here is an
updated patch
Samuel
[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 903 bytes --]
2007-08-01 Samuel Thibault <samuel.thibault@ens-lyon.org>
* gcc/tlink.c: Include "libiberty.h"
(initial_cwd): Change type into char*.
(tlink_init): Call getpwd() instead of getcwd().
Index: gcc/tlink.c
===================================================================
--- gcc/tlink.c (r�vision 127116)
+++ gcc/tlink.c (copie de travail)
@@ -30,6 +30,7 @@
#include "hashtab.h"
#include "demangle.h"
#include "collect2.h"
+#include "libiberty.h"
#define MAX_ITERATIONS 17
@@ -38,7 +39,7 @@
static int tlink_verbose;
-static char initial_cwd[MAXPATHLEN + 1];
+static char *initial_cwd;
\f
/* Hash table boilerplate for working with htab_t. We have hash tables
for symbol names, file names, and demangled symbols. */
@@ -274,7 +275,7 @@
tlink_verbose = 3;
}
- getcwd (initial_cwd, sizeof (initial_cwd));
+ initial_cwd = getpwd();
}
static int
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] drop MAXPATHLEN dependency from gcc/tlink.c
2007-08-01 21:03 ` Samuel Thibault
@ 2007-08-04 21:20 ` Samuel Thibault
2007-08-08 14:01 ` Ian Lance Taylor
1 sibling, 0 replies; 8+ messages in thread
From: Samuel Thibault @ 2007-08-04 21:20 UTC (permalink / raw)
To: Ian Lance Taylor; +Cc: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 579 bytes --]
Samuel Thibault, le Wed 01 Aug 2007 23:03:10 +0200, a écrit :
> Ian Lance Taylor, le Tue 31 Jul 2007 18:38:24 -0700, a écrit :
> > Samuel Thibault <samuel.thibault@ens-lyon.org> writes:
> > > 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.
> > >
> > > (tlink_init): Add loop to dynamically allocate initial_cwd as needed.
> >
> > Just call getpwd instead.
>
> Oh right, I didn't notice that non-standard function. Here is an
> updated patch
Could someone apply it?
Samuel
[-- Attachment #2: patch-gcc-tlink --]
[-- Type: text/plain, Size: 904 bytes --]
2007-08-01 Samuel Thibault <samuel.thibault@ens-lyon.org>
* gcc/tlink.c: Include "libiberty.h"
(initial_cwd): Change type into char*.
(tlink_init): Call getpwd() instead of getcwd().
Index: gcc/tlink.c
===================================================================
--- gcc/tlink.c (r�vision 127116)
+++ gcc/tlink.c (copie de travail)
@@ -30,6 +30,7 @@
#include "hashtab.h"
#include "demangle.h"
#include "collect2.h"
+#include "libiberty.h"
#define MAX_ITERATIONS 17
@@ -38,7 +39,7 @@
static int tlink_verbose;
-static char initial_cwd[MAXPATHLEN + 1];
+static char *initial_cwd;
\f
/* Hash table boilerplate for working with htab_t. We have hash tables
for symbol names, file names, and demangled symbols. */
@@ -274,7 +275,7 @@
tlink_verbose = 3;
}
- getcwd (initial_cwd, sizeof (initial_cwd));
+ initial_cwd = getpwd ();
}
static int
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] drop MAXPATHLEN dependency from gcc/tlink.c
2007-08-01 21:03 ` Samuel Thibault
2007-08-04 21:20 ` Samuel Thibault
@ 2007-08-08 14:01 ` Ian Lance Taylor
2007-08-08 14:13 ` Samuel Thibault
1 sibling, 1 reply; 8+ messages in thread
From: Ian Lance Taylor @ 2007-08-08 14:01 UTC (permalink / raw)
To: Samuel Thibault; +Cc: gcc-patches
Samuel Thibault <samuel.thibault@ens-lyon.org> writes:
> 2007-08-01 Samuel Thibault <samuel.thibault@ens-lyon.org>
>
> * gcc/tlink.c: Include "libiberty.h"
> (initial_cwd): Change type into char*.
> (tlink_init): Call getpwd() instead of getcwd().
Omit parentheses after function names in ChangeLog entry.
> - getcwd (initial_cwd, sizeof (initial_cwd));
> + initial_cwd = getpwd();
Space before left parenthesis.
OK with those changes.
Thanks.
Ian
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] drop MAXPATHLEN dependency from gcc/tlink.c
2007-08-08 14:01 ` Ian Lance Taylor
@ 2007-08-08 14:13 ` Samuel Thibault
2007-08-08 14:25 ` Ian Lance Taylor
0 siblings, 1 reply; 8+ messages in thread
From: Samuel Thibault @ 2007-08-08 14:13 UTC (permalink / raw)
To: Ian Lance Taylor; +Cc: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 274 bytes --]
Ian Lance Taylor, le Wed 08 Aug 2007 07:00:16 -0700, a écrit :
> > - getcwd (initial_cwd, sizeof (initial_cwd));
> > + initial_cwd = getpwd();
>
> Space before left parenthesis.
Yes I had already fixed that in my latest post. Here is a
changelog-fixed version.
Samuel
[-- Attachment #2: patch-gcc-tlink --]
[-- Type: text/plain, Size: 895 bytes --]
2007-08-01 Samuel Thibault <samuel.thibault@ens-lyon.org>
* gcc/tlink.c: Include "libiberty.h"
(initial_cwd): Change type into char*.
(tlink_init): Call getpwd instead of getcwd.
Index: gcc/tlink.c
===================================================================
--- gcc/tlink.c (revision 127116)
+++ gcc/tlink.c (copie de travail)
@@ -30,6 +30,7 @@
#include "hashtab.h"
#include "demangle.h"
#include "collect2.h"
+#include "libiberty.h"
#define MAX_ITERATIONS 17
@@ -38,7 +39,7 @@
static int tlink_verbose;
-static char initial_cwd[MAXPATHLEN + 1];
+static char *initial_cwd;
\f
/* Hash table boilerplate for working with htab_t. We have hash tables
for symbol names, file names, and demangled symbols. */
@@ -274,7 +275,7 @@
tlink_verbose = 3;
}
- getcwd (initial_cwd, sizeof (initial_cwd));
+ initial_cwd = getpwd ();
}
static int
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] drop MAXPATHLEN dependency from gcc/tlink.c
2007-08-08 14:13 ` Samuel Thibault
@ 2007-08-08 14:25 ` Ian Lance Taylor
2007-08-13 20:57 ` Samuel Thibault
0 siblings, 1 reply; 8+ messages in thread
From: Ian Lance Taylor @ 2007-08-08 14:25 UTC (permalink / raw)
To: Samuel Thibault; +Cc: gcc-patches
Samuel Thibault <samuel.thibault@ens-lyon.org> writes:
> 2007-08-01 Samuel Thibault <samuel.thibault@ens-lyon.org>
>
> * gcc/tlink.c: Include "libiberty.h"
> (initial_cwd): Change type into char*.
> (tlink_init): Call getpwd instead of getcwd.
This is OK.
Thanks.
Ian
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] drop MAXPATHLEN dependency from gcc/tlink.c
2007-08-08 14:25 ` Ian Lance Taylor
@ 2007-08-13 20:57 ` Samuel Thibault
0 siblings, 0 replies; 8+ messages in thread
From: Samuel Thibault @ 2007-08-13 20:57 UTC (permalink / raw)
To: Ian Lance Taylor; +Cc: gcc-patches
Ian Lance Taylor, le Wed 08 Aug 2007 07:24:19 -0700, a écrit :
> Samuel Thibault <samuel.thibault@ens-lyon.org> writes:
>
> > 2007-08-01 Samuel Thibault <samuel.thibault@ens-lyon.org>
> >
> > * gcc/tlink.c: Include "libiberty.h"
> > (initial_cwd): Change type into char*.
> > (tlink_init): Call getpwd instead of getcwd.
>
> This is OK.
Could someone commit it please?
Samuel
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-08-13 20:57 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-24 21:19 [PATCH] drop MAXPATHLEN dependency from gcc/tlink.c Samuel Thibault
2007-08-01 1:39 ` Ian Lance Taylor
2007-08-01 21:03 ` Samuel Thibault
2007-08-04 21:20 ` Samuel Thibault
2007-08-08 14:01 ` Ian Lance Taylor
2007-08-08 14:13 ` Samuel Thibault
2007-08-08 14:25 ` Ian Lance Taylor
2007-08-13 20:57 ` Samuel Thibault
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).