public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: nick clifton <nickc@redhat.com>
To: Pedro Alves <pedro@codesourcery.com>,
	       Pierre Muller <pierre.muller@ics-cnrs.unistra.fr>,
	       alan modra <amodra@gmail.com>
Cc: binutils@sourceware.org
Subject: Re: [RFC] 2.22 release: Compilation failure for mingw32 target with --enable-targets=all
Date: Tue, 29 Nov 2011 12:43:00 -0000	[thread overview]
Message-ID: <4ED4D31D.5010803@redhat.com> (raw)
In-Reply-To: <201111251702.16713.pedro@codesourcery.com>

[-- Attachment #1: Type: text/plain, Size: 770 bytes --]

Hi Pedro, Hi Pierre, Hi Alan,

> The best is not to use execvp in host independent code at all, but to
> use libiberty's pex routines.  Windows doesn't really support exec;
> I'm surprised execvp is actually declared in mingw32's headers.  Or
> maybe you're building for msys, rather than mingw32?
>
> 2009-04-09  Thilo Fischer<thilo.fischer@uni-muenster.de>
>
>          * emultempl/spuelf.em (embedded_spu_file): Use pex_one in place
>          of fork/execvp.
>
> this same file has already been corrected once in another function,
> but for some reason, spu_elf_relink wasn't.

How about the attached patch ... any objections ?

Cheers
   Nick

2011-11-29  Nick Clifton  <nickc@redhat.com>

	* emultempl/spuelf.em (spu_elf_relink): Use pex_one instead of
	execvp.



[-- Attachment #2: spuelf.em.patch --]
[-- Type: text/plain, Size: 1135 bytes --]

Index: ld/emultempl/spuelf.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/spuelf.em,v
retrieving revision 1.43
diff -u -3 -p -r1.43 spuelf.em
--- ld/emultempl/spuelf.em	13 Jan 2011 13:06:22 -0000	1.43
+++ ld/emultempl/spuelf.em	29 Nov 2011 12:36:02 -0000
@@ -384,9 +384,13 @@ spu_elf_open_overlay_script (void)
   return script;
 }
 
+#include <errno.h>
+
 static void
 spu_elf_relink (void)
 {
+  const char *pex_return;
+  int status;
   char **argv = xmalloc ((my_argc + 4) * sizeof (*argv));
 
   memcpy (argv, my_argv, my_argc * sizeof (*argv));
@@ -397,9 +401,16 @@ spu_elf_relink (void)
   argv[my_argc++] = "-T";
   argv[my_argc++] = auto_overlay_file;
   argv[my_argc] = 0;
-  execvp (argv[0], (char *const *) argv);
-  perror (argv[0]);
-  _exit (127);
+
+  pex_return = pex_one (PEX_SEARCH | PEX_LAST, (const char *) argv[0],
+			(char * const *) argv, (const char *) argv[0],
+			NULL, NULL, & status, & errno);
+  if (pex_return != NULL)
+    {
+      perror (pex_return);
+      _exit (127);
+    }
+  exit (status);
 }
 
 /* Final emulation specific call.  */

  reply	other threads:[~2011-11-29 12:43 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <48683.3413750448$1288971470@news.gmane.org>
2010-11-05 17:21 ` [OBV/RFA] Fix compilation of ld/emultempl/spuelf.em on systems where HAVE_MKSTEMP is not defined Richard Sandiford
2010-12-09 11:11   ` Not in 2.21 sources... " Pierre Muller
2010-12-09 11:20     ` Tristan Gingold
2010-12-09 12:26       ` Pierre Muller
2010-12-10 10:45         ` Tristan Gingold
2011-11-22 15:26         ` [RFC] 2.22 release: Compilation failure for mingw32 target with --enable-targets=all Pierre Muller
2011-11-25 16:40           ` nick clifton
2011-11-25 17:02             ` Pedro Alves
2011-11-29 12:43               ` nick clifton [this message]
2011-11-29 12:53                 ` Alan Modra
2011-11-29 16:27                   ` nick clifton
2011-11-30 11:52                     ` Alan Modra
2011-12-01 11:39                       ` nick clifton
2011-11-26 11:18             ` JonY

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4ED4D31D.5010803@redhat.com \
    --to=nickc@redhat.com \
    --cc=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=pedro@codesourcery.com \
    --cc=pierre.muller@ics-cnrs.unistra.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).