Index: helgrind/Makefile.am
===================================================================
--- helgrind/Makefile.am	(revision 11171)
+++ helgrind/Makefile.am	(working copy)
@@ -48,7 +48,7 @@
 helgrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS      = \
 	$(TOOL_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
 helgrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LINK = \
-	$(top_builddir)/coregrind/link_tool_exe \
+	$(top_builddir)/coregrind/link_tool_exe_@VGCONF_OS@ \
 	@VALT_LOAD_ADDRESS@ \
 	$(LINK) \
 	$(helgrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS) \
@@ -68,7 +68,7 @@
 helgrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS      = \
 	$(TOOL_LDFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
 helgrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LINK = \
-	$(top_builddir)/coregrind/link_tool_exe \
+	$(top_builddir)/coregrind/link_tool_exe_@VGCONF_OS@ \
 	@VALT_LOAD_ADDRESS@ \
 	$(LINK) \
 	$(helgrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS) \
Index: exp-ptrcheck/Makefile.am
===================================================================
--- exp-ptrcheck/Makefile.am	(revision 11171)
+++ exp-ptrcheck/Makefile.am	(working copy)
@@ -39,7 +39,7 @@
 exp_ptrcheck_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS      = \
 	$(TOOL_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
 exp_ptrcheck_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LINK = \
-	$(top_builddir)/coregrind/link_tool_exe \
+	$(top_builddir)/coregrind/link_tool_exe_@VGCONF_OS@ \
 	@VALT_LOAD_ADDRESS@ \
 	$(LINK) \
 	$(exp_ptrcheck_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS) \
@@ -59,7 +59,7 @@
 exp_ptrcheck_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS      = \
 	$(TOOL_LDFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
 exp_ptrcheck_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LINK = \
-	$(top_builddir)/coregrind/link_tool_exe \
+	$(top_builddir)/coregrind/link_tool_exe_@VGCONF_OS@ \
 	@VALT_LOAD_ADDRESS@ \
 	$(LINK) \
 	$(exp_ptrcheck_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS) \
Index: callgrind/Makefile.am
===================================================================
--- callgrind/Makefile.am	(revision 11171)
+++ callgrind/Makefile.am	(working copy)
@@ -66,7 +66,7 @@
 callgrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS      = \
 	$(TOOL_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
 callgrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LINK = \
-	$(top_builddir)/coregrind/link_tool_exe \
+	$(top_builddir)/coregrind/link_tool_exe_@VGCONF_OS@ \
 	@VALT_LOAD_ADDRESS@ \
 	$(LINK) \
 	$(callgrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS) \
@@ -86,7 +86,7 @@
 callgrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS      = \
 	$(TOOL_LDFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
 callgrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LINK = \
-	$(top_builddir)/coregrind/link_tool_exe \
+	$(top_builddir)/coregrind/link_tool_exe_@VGCONF_OS@ \
 	@VALT_LOAD_ADDRESS@ \
 	$(LINK) \
 	$(callgrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS) \
Index: exp-bbv/Makefile.am
===================================================================
--- exp-bbv/Makefile.am	(revision 11171)
+++ exp-bbv/Makefile.am	(working copy)
@@ -26,7 +26,7 @@
 exp_bbv_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS      = \
 	$(TOOL_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
 exp_bbv_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LINK = \
-	$(top_builddir)/coregrind/link_tool_exe \
+	$(top_builddir)/coregrind/link_tool_exe_@VGCONF_OS@ \
 	@VALT_LOAD_ADDRESS@ \
 	$(LINK) \
 	$(exp_bbv_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS) \
@@ -46,7 +46,7 @@
 exp_bbv_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS      = \
 	$(TOOL_LDFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
 exp_bbv_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LINK = \
-	$(top_builddir)/coregrind/link_tool_exe \
+	$(top_builddir)/coregrind/link_tool_exe_@VGCONF_OS@ \
 	@VALT_LOAD_ADDRESS@ \
 	$(LINK) \
 	$(exp_bbv_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS) \
Index: memcheck/Makefile.am
===================================================================
--- memcheck/Makefile.am	(revision 11171)
+++ memcheck/Makefile.am	(working copy)
@@ -44,7 +44,7 @@
 memcheck_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS      = \
 	$(TOOL_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
 memcheck_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LINK = \
-	$(top_builddir)/coregrind/link_tool_exe \
+	$(top_builddir)/coregrind/link_tool_exe_@VGCONF_OS@ \
 	@VALT_LOAD_ADDRESS@ \
 	$(LINK) \
 	$(memcheck_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS) \
@@ -64,7 +64,7 @@
 memcheck_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS      = \
 	$(TOOL_LDFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
 memcheck_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LINK = \
-	$(top_builddir)/coregrind/link_tool_exe \
+	$(top_builddir)/coregrind/link_tool_exe_@VGCONF_OS@ \
 	@VALT_LOAD_ADDRESS@ \
 	$(LINK) \
 	$(memcheck_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS) \
Index: massif/Makefile.am
===================================================================
--- massif/Makefile.am	(revision 11171)
+++ massif/Makefile.am	(working copy)
@@ -36,7 +36,7 @@
 massif_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS      = \
 	$(TOOL_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
 massif_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LINK = \
-	$(top_builddir)/coregrind/link_tool_exe \
+	$(top_builddir)/coregrind/link_tool_exe_@VGCONF_OS@ \
 	@VALT_LOAD_ADDRESS@ \
 	$(LINK) \
 	$(massif_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS) \
@@ -56,7 +56,7 @@
 massif_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS      = \
 	$(TOOL_LDFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
 massif_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LINK = \
-	$(top_builddir)/coregrind/link_tool_exe \
+	$(top_builddir)/coregrind/link_tool_exe_@VGCONF_OS@ \
 	@VALT_LOAD_ADDRESS@ \
 	$(LINK) \
 	$(massif_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS) \
Index: configure.in
===================================================================
--- configure.in	(revision 11171)
+++ configure.in	(working copy)
@@ -251,11 +251,6 @@
         VGCONF_OS="aix5"
         ;;       
 
-     *freebsd*)
-        AC_MSG_RESULT([ok (${host_os})])
-        VGCONF_OS="freebsd"
-        ;;
-
      *darwin*)
         AC_MSG_RESULT([ok (${host_os})])
         VGCONF_OS="darwin"
@@ -1278,9 +1273,12 @@
 CFLAGS=$safe_CFLAGS
 
 
-# does this compiler support -Wl,--build-id=none ?
+# does the linker support -Wl,--build-id=none ?  Note, it's
+# important that we test indirectly via whichever C compiler
+# is selected, rather than testing /usr/bin/ld or whatever
+# directly.
 
-AC_MSG_CHECKING([if gcc accepts -Wl,--build-id=none])
+AC_MSG_CHECKING([if the linker accepts -Wl,--build-id=none])
 
 safe_CFLAGS=$CFLAGS
 CFLAGS="-Wl,--build-id=none"
@@ -1864,6 +1862,12 @@
    exp-bbv/tests/ppc32-linux/Makefile
    exp-bbv/tests/arm-linux/Makefile
 ])
+AC_CONFIG_FILES([coregrind/link_tool_exe_linux],
+                [chmod +x coregrind/link_tool_exe_linux])
+AC_CONFIG_FILES([coregrind/link_tool_exe_darwin],
+                [chmod +x coregrind/link_tool_exe_darwin])
+AC_CONFIG_FILES([coregrind/link_tool_exe_aix5],
+                [chmod +x coregrind/link_tool_exe_aix5])
 AC_OUTPUT
 
 cat<<EOF
Index: cachegrind/Makefile.am
===================================================================
--- cachegrind/Makefile.am	(revision 11171)
+++ cachegrind/Makefile.am	(working copy)
@@ -56,7 +56,7 @@
 cachegrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS      = \
 	$(TOOL_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
 cachegrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LINK = \
-	$(top_builddir)/coregrind/link_tool_exe \
+	$(top_builddir)/coregrind/link_tool_exe_@VGCONF_OS@ \
 	@VALT_LOAD_ADDRESS@ \
 	$(LINK) \
 	$(cachegrind_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS) \
@@ -76,7 +76,7 @@
 cachegrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS      = \
 	$(TOOL_LDFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
 cachegrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LINK = \
-	$(top_builddir)/coregrind/link_tool_exe \
+	$(top_builddir)/coregrind/link_tool_exe_@VGCONF_OS@ \
 	@VALT_LOAD_ADDRESS@ \
 	$(LINK) \
 	$(cachegrind_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS) \
Index: none/Makefile.am
===================================================================
--- none/Makefile.am	(revision 11171)
+++ none/Makefile.am	(working copy)
@@ -26,7 +26,7 @@
 none_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS      = \
 	$(TOOL_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
 none_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LINK = \
-	$(top_builddir)/coregrind/link_tool_exe \
+	$(top_builddir)/coregrind/link_tool_exe_@VGCONF_OS@ \
 	@VALT_LOAD_ADDRESS@ \
 	$(LINK) \
 	$(none_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS) \
@@ -46,7 +46,7 @@
 none_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS      = \
 	$(TOOL_LDFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
 none_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LINK = \
-	$(top_builddir)/coregrind/link_tool_exe \
+	$(top_builddir)/coregrind/link_tool_exe_@VGCONF_OS@ \
 	@VALT_LOAD_ADDRESS@ \
 	$(LINK) \
 	$(none_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS) \
Index: lackey/Makefile.am
===================================================================
--- lackey/Makefile.am	(revision 11171)
+++ lackey/Makefile.am	(working copy)
@@ -26,7 +26,7 @@
 lackey_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS      = \
 	$(TOOL_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
 lackey_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LINK = \
-	$(top_builddir)/coregrind/link_tool_exe \
+	$(top_builddir)/coregrind/link_tool_exe_@VGCONF_OS@ \
 	@VALT_LOAD_ADDRESS@ \
 	$(LINK) \
 	$(lackey_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS) \
@@ -46,7 +46,7 @@
 lackey_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS      = \
 	$(TOOL_LDFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
 lackey_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LINK = \
-	$(top_builddir)/coregrind/link_tool_exe \
+	$(top_builddir)/coregrind/link_tool_exe_@VGCONF_OS@ \
 	@VALT_LOAD_ADDRESS@ \
 	$(LINK) \
 	$(lackey_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS) \
Index: drd/Makefile.am
===================================================================
--- drd/Makefile.am	(revision 11171)
+++ drd/Makefile.am	(working copy)
@@ -80,7 +80,7 @@
 drd_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS      = \
 	$(TOOL_LDFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
 drd_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LINK = \
-	$(top_builddir)/coregrind/link_tool_exe \
+	$(top_builddir)/coregrind/link_tool_exe_@VGCONF_OS@ \
 	@VALT_LOAD_ADDRESS@ \
 	$(LINK) \
 	$(drd_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS) \
@@ -100,7 +100,7 @@
 drd_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS      = \
 	$(TOOL_LDFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
 drd_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LINK = \
-	$(top_builddir)/coregrind/link_tool_exe \
+	$(top_builddir)/coregrind/link_tool_exe_@VGCONF_OS@ \
 	@VALT_LOAD_ADDRESS@ \
 	$(LINK) \
 	$(drd_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS) \
Index: coregrind/link_tool_exe_aix5.in
===================================================================
--- coregrind/link_tool_exe_aix5.in	(revision 0)
+++ coregrind/link_tool_exe_aix5.in	(revision 0)
@@ -0,0 +1,6 @@
+#! @PERL@
+
+use warnings;
+use strict;
+
+die "link_tool_exe_@VGCONF_OS@ requires implementation";
Index: coregrind/link_tool_exe_darwin.in
===================================================================
--- coregrind/link_tool_exe_darwin.in	(revision 0)
+++ coregrind/link_tool_exe_darwin.in	(revision 0)
@@ -0,0 +1,6 @@
+#! @PERL@
+
+use warnings;
+use strict;
+
+die "link_tool_exe_@VGCONF_OS@ requires implementation";
Index: coregrind/link_tool_exe_linux.in
===================================================================
--- coregrind/link_tool_exe_linux.in	(revision 0)
+++ coregrind/link_tool_exe_linux.in	(revision 0)
@@ -0,0 +1,89 @@
+#! @PERL@
+
+# This script handles linking the tool executables on Linux,
+# statically and at an alternative load address.
+#
+# Linking statically sidesteps all sorts of complications to do with
+# having two copies of the dynamic linker (valgrind's and the
+# client's) coexisting in the same process.  The alternative load
+# address is needed because Valgrind itself will load the client at
+# whatever address it specifies, which is almost invariably the
+# default load address.  Hence we can't allow Valgrind itself (viz,
+# the tool executable) to be loaded at that address.
+#
+# Unfortunately there's no standard way to do 'static link at
+# alternative address', so this program handles the per-platform
+# hoop-jumping.
+#
+#
+# What we get passed here is:
+#   first arg
+#      the alternative load address
+#   all the rest of the args
+#      the gcc invokation to do the final link, that
+#      the build system would have done, left to itself
+#
+# We just let assertions fail rather than do proper error reporting.
+# We don't expect the users to run this directly.  It is only run
+# from as part of the build process, with carefully constrained
+# inputs.
+#
+# Linux specific complications:
+#
+# - need to support both old GNU ld and gold: use -Ttext= to
+#   set the text segment address.
+#
+# - need to pass --build-id=none (that is, -Wl,--build-id=none to
+#   gcc) if it accepts it, to ensure the linker doesn't add a
+#   notes section which ends up at the default load address and
+#   so defeats our attempts to keep that address clear for the
+#   client.  However, older linkers don't support this flag, so it
+#   is tested for by configure.in and is shipped to us as part of
+#   argv[2 ..].
+#
+#
+# So: what we actually do:
+# 
+#   pass the specified command to the linker as-is, except, add
+#   "-static" and "-Ttext=<argv[1]>" to it.
+#
+
+use warnings;
+use strict;
+
+# expect at least: alt-load-address gcc -o foo bar.o
+die "Not enougn arguments"
+    if (($#ARGV + 1) < 5);
+
+my $ala = $ARGV[0];
+
+# check for plausible-ish alt load address
+die "Bogus alt-load address"
+    if (length($ala) < 3 || index($ala, "0x") != 0);
+
+# The cc invokation to do the final link
+my $cc = $ARGV[1];
+
+# and the 'restargs' are argv[2 ..]
+
+# so, build up the complete command here:
+# 'cc' -static -Ttext='ala' 'restargs'
+
+my $cmd="$cc -static -Wl,-Ttext=$ala";
+
+# Add the rest of the parameters
+foreach my $n (2 .. $#ARGV) {
+   $cmd = "$cmd $ARGV[$n]";
+}
+
+print "link_tool_exe_linux: $cmd\n";
+
+
+# Execute the command:
+my $r = system("$cmd");
+
+if ($r == 0) {
+    exit 0;
+} else {
+    exit 1;
+}
Index: coregrind/Makefile.am
===================================================================
--- coregrind/Makefile.am	(revision 11171)
+++ coregrind/Makefile.am	(working copy)
@@ -422,27 +422,6 @@
 endif
 
 #----------------------------------------------------------------------------
-# link_tool_exe, the wrapper for the system linker
-#----------------------------------------------------------------------------
-
-noinst_PROGRAMS += link_tool_exe
-
-link_tool_exe_SOURCES   = link_tool_exe.c
-link_tool_exe_CPPFLAGS  = $(AM_CPPFLAGS_PRI)
-link_tool_exe_CFLAGS    = $(AM_CFLAGS_PRI)
-link_tool_exe_CCASFLAGS = $(AM_CCASFLAGS_PRI)
-link_tool_exe_LDFLAGS   = $(AM_CFLAGS_PRI)
-
-# force link_tool_exe to be built before libcoregrind.a is, and hence
-# before any of the tool executables are linked, since they in turn
-# are dependent on libcoregrind.a.  Unfortunately this doesn't give a
-# dependence on link_tool_exe.c: ideally if link_tool_exe.c is
-# changed, then 'make' rebuilds link_tool_exe, but the tool
-# executables themselves are not relinked.  I can't figure out how
-# to get that to happen.
-BUILT_SOURCES += link_tool_exe
-
-#----------------------------------------------------------------------------
 # General stuff
 #----------------------------------------------------------------------------
 
Index: coregrind/link_tool_exe.c
===================================================================
--- coregrind/link_tool_exe.c	(revision 11171)
+++ coregrind/link_tool_exe.c	(working copy)
@@ -1,171 +0,0 @@
-
-/* This program handles linking the tool executables, statically and
-   at an alternative load address.  Linking them statically sidesteps
-   all sorts of complications to do with having two copies of the
-   dynamic linker (valgrind's and the client's) coexisting in the same
-   process.  The alternative load address is needed because Valgrind
-   itself will load the client at whatever address it specifies, which
-   is almost invariably the default load address.  Hence we can't
-   allow Valgrind itself (viz, the tool executable) to be loaded at
-   that address.
-
-   Unfortunately there's no standard way to do 'static link at
-   alternative address', so this program handles the per-platform
-   hoop-jumping.
-*/
-
-/* What we get passed here is:
-   first arg
-      the alternative load address
-   all the rest of the args
-      the gcc invokation to do the final link, that
-      the build system would have done, left to itself
-
-   We just let assertions fail rather than do proper error reporting.
-   We don't expect the users to run this directly.  It is only run
-   from as part of the build process, with carefully constrained
-   inputs.
-*/
-
-/* ------------------------- LINUX ------------------------- */
-
-#if defined(VGO_linux)
-
-/* Scheme is simple: pass the specified command to the linker as-is,
-   except, add "-static" and "-Ttext=<argv[1]>" to it.
-*/
-
-// Don't NDEBUG this; the asserts are necesary for
-// safety checks.
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/wait.h>  /* WEXITSTATUS */
-
-int main ( int argc, char** argv )
-{
-   int         i;
-   int/*bool*/ failed = 0;
-   size_t      reqd = 0;
-
-   // expect at least: alt-load-address gcc -o foo bar.o
-   assert(argc > 5);
-
-   // check for plausible-ish alt load address
-   char* ala = argv[1];
-   assert(ala[0] == '0');
-   assert(ala[1] == 'x');
-
-   // We'll need to invoke this to do the linking
-   char* gcc = argv[2];
-
-   // and the 'restargs' are argv[3 ..]
-
-   // so, build up the complete command here:
-   // 'gcc' -static -Ttext='ala' 'restargs'
-
-   // first, do length safety checks
-   reqd += 1+ strlen(gcc);
-   reqd += 1+ 100/*let's say*/ + strlen(ala);
-   for (i = 3; i < argc; i++)
-      reqd += 1+ strlen(argv[i]);
-
-   reqd += 1;
-   char* cmd = calloc(reqd,1);
-   assert(cmd);
-
-   char ttext[100];
-   assert(strlen(ala) < 30);
-   memset(ttext, 0, sizeof(ttext));
-   sprintf(ttext, " -static -Wl,-Ttext=%s", ala);
-
-   strcpy(cmd, gcc);
-   strcat(cmd, ttext);
-   for (i = 3; i < argc; i++) {
-     strcat(cmd, " ");
-     strcat(cmd, argv[i]);
-   }
-
-   assert(cmd[reqd-1] == 0);
-
-   if (0) printf("\n");
-   printf("link_tool_exe: %s\n", cmd);
-   if (0) printf("\n");
-
-   int r = system(cmd);
-   if (r == -1 || WEXITSTATUS(r) != 0)
-      failed = 1;
-
-   free(cmd);
-
-   // return the result of system.
-   return failed ? 1 : 0;
-}
-
-/* ------------------------- DARWIN ------------------------ */
-
-#elif defined(VGO_darwin)
-
-/* Run the specified command as-is; ignore the specified load address
-   (argv[1]). */
-
-// Don't NDEBUG this; the asserts are necesary for
-// safety checks.
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-int main ( int argc, char** argv )
-{
-   int         i;
-   int/*bool*/ failed = 0;
-   size_t      reqd = 0;
-
-   // expect at least: alt-load-address gcc -o foo bar.o
-   assert(argc > 5);
-
-   // check for plausible-ish alt load address
-   char* ala = argv[1];
-   assert(ala[0] == '0');
-   assert(ala[1] == 'x');
-
-   // command to run is argv[2 ..]
-
-   // so, build up the complete command here:
-   // argv[2 ..]
-
-   // first, do length safety checks
-   for (i = 2; i < argc; i++)
-      reqd += 1+ strlen(argv[i]);
-
-   reqd += 1;
-   char* cmd = calloc(reqd,1);
-   assert(cmd);
-
-   for (i = 2; i < argc; i++) {
-     strcat(cmd, " ");
-     strcat(cmd, argv[i]);
-   }
-
-   assert(cmd[reqd-1] == 0);
-
-   if (0) printf("\n");
-   printf("link_tool_exe: %s\n", cmd);
-   if (0) printf("\n");
-
-   int r = system(cmd);
-   if (r == -1 || WEXITSTATUS(r) != 0)
-      failed = 1;
-
-   free(cmd);
-
-   // return the result of system.
-   return failed ? 1 : 0;
-}
-
-
-#else
-#  error "Unsupported OS"
-#endif
