This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Re: How to disable toplevel fixincludes?
- From: "Aaron W. LaFramboise" <aaronavay62 at aaronwl dot com>
- To: Paolo Bonzini <bonzini at gnu dot org>
- Cc: gcc-patches at gcc dot gnu dot org, gcc at gcc dot gnu dot org
- Date: Mon, 13 Sep 2004 21:57:27 -0500
- Subject: Re: [PATCH] Re: How to disable toplevel fixincludes?
- References: <41413986.90408@aaronwl.com> <414158CA.3080500@gnu.org>
Paolo Bonzini wrote:
>>With the recent fixincludes reorganization, bootstrap now attempts to
>>build fixincludes on i686-pc-mingw32. Like collect2, fixincludes
>>contains some fairly unrepetant Unixisms, and can not be trivially
>>changed to build on Windows.
>
> Is this true for two-process fixincludes too? (Can you try "make
> twoprocess" from the fixincludes directory?)
I have attached a patch that fixes some obvious portability problems
with fixincludes. However, both the normal build and the two-process
build of fixincludes seem to require fork(), something that Windows just
doesn't have. Someone (?) is working on adding process chaining of some
sort to libiberty to be used by collect2, and I would guess that is also
the proper thing to use here.
Aaron W. LaFramboise
2004-09-12 Aaron W. LaFramboise <aaronavay62@aaronwl.com>
* fixincludes/fixincl.c (initialize): Check for SIGQUIT
and SIGALRM.
(create_file): Fix mkdir() for Win32.
* fixincludes/procopen.c (internal_fix): Fallback to dup2()
if F_DUPFD not defined.
* fixincludes/server.c (close_server): Check for SIGKILL.
(server_setup): Check for SIGPIPE and SIGALRM.
Index: gcc/fixincludes/fixincl.c
===================================================================
RCS file: /cvsroot/gcc/gcc/fixincludes/fixincl.c,v
retrieving revision 1.1
diff -c -3 -p -r1.1 fixincl.c
*** gcc/fixincludes/fixincl.c 31 Aug 2004 09:26:05 -0000 1.1
--- gcc/fixincludes/fixincl.c 11 Sep 2004 23:47:30 -0000
*************** ENV_TABLE
*** 313,326 ****
--- 313,330 ----
pz_temp_file = tempnam( NULL, "fxinc" );
# endif
+ #ifdef SIGQUIT
signal (SIGQUIT, SIG_IGN);
+ #endif
#ifdef SIGIOT
signal (SIGIOT, SIG_IGN);
#endif
#ifdef SIGPIPE
signal (SIGPIPE, SIG_IGN);
#endif
+ #ifdef SIGALRM
signal (SIGALRM, SIG_IGN);
+ #endif
signal (SIGTERM, SIG_IGN);
}
*************** create_file (void)
*** 575,581 ****
--- 579,589 ----
*pz_dir = NUL;
if (stat (fname, &stbf) < 0)
{
+ #ifdef _WIN32
+ mkdir (fname);
+ #else
mkdir (fname, S_IFDIR | S_DIRALL);
+ #endif
}
*pz_dir = '/';
*************** internal_fix (int read_fd, tFixDesc* p_f
*** 858,865 ****
--- 866,878 ----
* Make the fd passed in the stdin, and the write end of
* the new pipe become the stdout.
*/
+ #ifdef F_DUPFD
fcntl (fd[1], F_DUPFD, STDOUT_FILENO);
fcntl (read_fd, F_DUPFD, STDIN_FILENO);
+ #else
+ dup2 (fd[1], STDOUT_FILENO);
+ dup2 (read_fd, STDIN_FILENO);
+ #endif
apply_fix (p_fixd, pz_curr_file);
exit (0);
Index: gcc/fixincludes/procopen.c
===================================================================
RCS file: /cvsroot/gcc/gcc/fixincludes/procopen.c,v
retrieving revision 1.1
diff -c -3 -p -r1.1 procopen.c
*** gcc/fixincludes/procopen.c 31 Aug 2004 09:26:05 -0000 1.1
--- gcc/fixincludes/procopen.c 11 Sep 2004 23:47:30 -0000
*************** chain_open (int stdin_fd, tCC** pp_args,
*** 155,162 ****
--- 155,167 ----
* Make the fd passed in the stdin, and the write end of
* the new pipe become the stdout.
*/
+ #ifdef F_DUPFD
fcntl (stdout_pair.write_fd, F_DUPFD, STDOUT_FILENO);
fcntl (stdin_fd, F_DUPFD, STDIN_FILENO);
+ #else
+ dup2 (stdout_pair.write_fd, STDOUT_FILENO);
+ dup2 (stdin_fd, STDIN_FILENO);
+ #endif
if (*pp_args == (char *) NULL)
*pp_args = pz_cmd;
Index: gcc/fixincludes/server.c
===================================================================
RCS file: /cvsroot/gcc/gcc/fixincludes/server.c,v
retrieving revision 1.1
diff -c -3 -p -r1.1 server.c
*** gcc/fixincludes/server.c 31 Aug 2004 09:26:05 -0000 1.1
--- gcc/fixincludes/server.c 11 Sep 2004 23:47:31 -0000
*************** close_server (void)
*** 140,146 ****
--- 140,150 ----
if ( (server_id != NULLPROCESS)
&& (server_master_pid == getpid ()))
{
+ #ifdef SIGKILL
kill ((pid_t) server_id, SIGKILL);
+ #else
+ kill ((pid_t) server_id, SIGTERM);
+ #endif
server_id = NULLPROCESS;
server_master_pid = NOPROCESS;
fclose (server_pair.pf_read);
*************** server_setup (void)
*** 187,194 ****
--- 191,202 ----
server_master_pid = getpid ();
+ #ifdef SIGPIPE
signal (SIGPIPE, sig_handler);
+ #endif
+ #ifdef SIGALRM
signal (SIGALRM, sig_handler);
+ #endif
fputs ("trap : 1\n", server_pair.pf_write);
fflush (server_pair.pf_write);