From ebdda997920695c82672016c940addea025327a4 Mon Sep 17 00:00:00 2001
From: rtoy <rtoy>
Date: Mon, 2 Aug 2010 21:45:36 +0000
Subject: [PATCH] Let the linker remove the object files we created for the
 Lisp spaces.

lisp/elf.c:
lisp/mach-o.c:
o Remove obj_cleanup function.

lisp/save.c:
o Don't call obj_cleanup anymore (because it doesn't exist.)

toosl/linker-x86.sh:
o Remove CORRO.o CORSTA.o CORDYN.o on exit.
---
 lisp/elf.c          | 16 +---------------
 lisp/mach-o.c       | 19 +------------------
 lisp/save.c         |  5 +----
 tools/linker-x86.sh |  4 ++--
 4 files changed, 5 insertions(+), 39 deletions(-)

diff --git a/lisp/elf.c b/lisp/elf.c
index 550c058d2..9a208028b 100644
--- a/lisp/elf.c
+++ b/lisp/elf.c
@@ -8,7 +8,7 @@
 
  Above changes put into main CVS branch. 05-Jul-2007.
 
- $Id: elf.c,v 1.27 2010/08/02 06:03:49 rtoy Exp $
+ $Id: elf.c,v 1.28 2010/08/02 21:45:36 rtoy Exp $
 */
 
 #include <stdio.h>
@@ -313,20 +313,6 @@ write_space_object(const char *dir, int id, os_vm_address_t start, os_vm_address
     return ret;
 }
 
-void
-obj_cleanup(const char *dirname)
-{
-    char filename[FILENAME_MAX + 1];
-    int i;
-
-    /* Get rid of lisp space files. */
-    for(i = 0; i < 3; i++) {
-	/* Delete core space .o files. */
-	sprintf(filename, "%s/%s.o", dirname, section_names[i]);
-	unlink(filename);
-    }
-}
-
 int
 obj_run_linker(long init_func_address, char *file)
 {
diff --git a/lisp/mach-o.c b/lisp/mach-o.c
index 759320af9..3932069d1 100644
--- a/lisp/mach-o.c
+++ b/lisp/mach-o.c
@@ -1,5 +1,5 @@
 /*
- * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/mach-o.c,v 1.5 2010/08/01 15:23:28 rtoy Exp $
+ * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/mach-o.c,v 1.6 2010/08/02 21:45:36 rtoy Exp $
  *
  * This code was written by Raymond Toy as part of CMU Common Lisp and
  * has been placed in the public domain.
@@ -280,23 +280,6 @@ write_space_object(const char *dir, int id, os_vm_address_t start, os_vm_address
     return ret;
 }
 
-/*
- * Remove the 3 space files that we created.
- */
-void
-obj_cleanup(const char *dirname)
-{
-    char filename[FILENAME_MAX + 1];
-    int i;
-
-    /* Get rid of lisp space files. */
-    for(i = 0; i < 3; i++) {
-	/* Delete core space .o files. */
-	sprintf(filename, "%s/%s.o", dirname, section_names[i]);
-	unlink(filename);
-    }
-}
-
 /*
  * Link everything together to create the executable.
  */
diff --git a/lisp/save.c b/lisp/save.c
index 51618e749..93245961a 100644
--- a/lisp/save.c
+++ b/lisp/save.c
@@ -1,6 +1,6 @@
 /*
 
- $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/save.c,v 1.27 2010/07/31 00:03:23 rtoy Exp $
+ $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/save.c,v 1.28 2010/08/02 21:45:36 rtoy Exp $
 
  This code was written as part of the CMU Common Lisp project at
  Carnegie Mellon University, and has been placed in the public domain.
@@ -358,9 +358,6 @@ save_executable(char *filename, lispobj init_function)
     printf("Linking executable...\n");
     fflush(stdout);
     obj_run_linker(init_function, filename);
-#if 0
-    obj_cleanup(dir_name);
-#endif
     printf("done.\n");
     exit(0);
 }
diff --git a/tools/linker-x86.sh b/tools/linker-x86.sh
index 37abb3409..21543728b 100644
--- a/tools/linker-x86.sh
+++ b/tools/linker-x86.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-# $Id: linker-x86.sh,v 1.8 2010/08/02 14:21:59 rtoy Exp $
+# $Id: linker-x86.sh,v 1.9 2010/08/02 21:45:36 rtoy Exp $
 
 # This file written by Raymond Toy as part of CMU Common Lisp and is
 # placed in the public domain.
@@ -114,7 +114,7 @@ case `uname` in
 esac
 
 # Remove the C file when we're done.
-trap 'rm -f $OUTDIR/$OPT_IFADDR' 0
+trap 'rm -f $OUTDIR/$OPT_IFADDR $OUTDIR/CORRO.o $OUTDIR/CORSTA.o $OUTDIR/CORDYN.o' 0
 
 (cd $OUTDIR
 echo "long initial_function_addr = $IFADDR;" > $OPT_IFADDR
-- 
GitLab