[cmucl-commit] [git] CMU Common Lisp branch master updated. 20f-43-gbcb2793

Raymond Toy rtoy at common-lisp.net
Thu Oct 16 02:19:50 UTC 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMU Common Lisp".

The branch, master has been updated
       via  bcb27939465ea192186d20aa8801db722dcb1bf4 (commit)
      from  b0cf84b5e4fa58f9a50c02e5163fea354829d132 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit bcb27939465ea192186d20aa8801db722dcb1bf4
Author: Raymond Toy <toy.raymond at gmail.com>
Date:   Wed Oct 15 19:19:37 2014 -0700

    Remove darwin-lispadjuster.c and ppc-darwin-dlshim.c
    
    Use of ppc-darwin-dlshim.c was removed, but I forgot to remove the
    file.
    
    Use of darwin-lispadjuster.c has been commented out for a while, so
    I'm getting rid of it. It seems at one point it was needed to resize
    the CMUCLRO section in the lisp executable, but there is CMUCLRO
    section anymore.
    
    darwin-lispadjuster.c:
     * Deleted
    
    ppc-darwin-dlshim.c:
    
    Config.ppc_darwin:
     * Remove Make rule for adjustlisp and friends.
     * Remove old commented out version of OS_SRC; we don't use
       ppc-darwin-dlshim.c anymore.

diff --git a/src/lisp/Config.ppc_darwin b/src/lisp/Config.ppc_darwin
index dffa756..f9d64ef 100644
--- a/src/lisp/Config.ppc_darwin
+++ b/src/lisp/Config.ppc_darwin
@@ -39,7 +39,6 @@ ASFLAGS = $(OSX_VERSION) -traditional -g -O3 -DDARWIN -Dppc $(LINKAGE) $(GENCGC)
 UNDEFSYMPATTERN = -Xlinker -u -Xlinker &
 ASSEM_SRC = ppc-assem.S linux-stubs.S
 ARCH_SRC = ppc-arch.c
-#OS_SRC = ppc-darwin-dlshim.c os-common.c Darwin-os.c
 OS_SRC = os-common.c Darwin-os.c
 
 
@@ -61,11 +60,3 @@ endif
 OS_LINK_FLAGS = $(OSX_VERSION) -static-libgcc
 OS_LIBS = -lSystem -lc -lm
 
-#all: adjustlisp
-#adjustlisp: lisp darwin-lispadjuster
-#	./darwin-lispadjuster lisp
-#adjustlisp: lisp darwin-lispadjuster
-#	true
-
-#darwin-lispadjuster: darwin-lispadjuster.c
-
diff --git a/src/lisp/darwin-lispadjuster.c b/src/lisp/darwin-lispadjuster.c
deleted file mode 100644
index a18768a..0000000
--- a/src/lisp/darwin-lispadjuster.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/* Modify the final lisp binary to enlarge the generated CMUCLRO segment */
-#include <stdlib.h>
-#include <string.h>
-#include <mach-o/loader.h>
-#include <sys/types.h>
-#include <sys/uio.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include "validate.h"
-
-#ifdef DEBUG
-#define dprintf printf
-#else
-#define dprintf(...)
-#endif
-
-int
-main(int argc, char **argv)
-{
-    char *filename;
-    int fd;
-    int i, result;
-    off_t curpos;
-    struct mach_header theheader;
-    struct segment_command thesegment;
-    char segname[17];
-
-    if (argc != 2)
-	return 1;
-    filename = argv[1];
-
-    fd = open(filename, O_RDWR, 0755);
-    read(fd, &theheader, sizeof(theheader));
-
-    if ((theheader.magic != MH_MAGIC) || (theheader.filetype != MH_EXECUTE))
-	return 2;
-
-    dprintf("Reading %d commands:\n", theheader.ncmds);
-
-    for (i = 0; i < theheader.ncmds; i++) {
-	curpos = lseek(fd, 0, SEEK_CUR);
-	dprintf("Reading command %d (%d bytes):\n", i,
-
-		sizeof(struct load_command));
-	read(fd, &thesegment, sizeof(struct load_command));
-
-	dprintf("Command is %d, length %d\n", thesegment.cmd,
-		thesegment.cmdsize);
-	if (thesegment.cmd != LC_SEGMENT) {
-	    dprintf("Skipping remainder of command...\n");
-	    lseek(fd, thesegment.cmdsize - sizeof(struct load_command),
-
-		  SEEK_CUR);
-	    continue;
-	}
-
-	dprintf("Reading remainder of Segment command (%d bytes)",
-		sizeof(thesegment) - sizeof(struct load_command));
-	read(fd, &thesegment.segname,
-
-	     sizeof(thesegment) - sizeof(struct load_command));
-	memset(segname, 0, 17);
-	memcpy(segname, thesegment.segname, 16);
-	dprintf("Segname: %s\n", segname);
-	if (0 == strncmp(thesegment.segname, "CMUCLRO", 7)) {
-	    dprintf("Frobbing the segment, setting vmsize from %8X to %8X\n",
-		    thesegment.vmsize, READ_ONLY_SPACE_SIZE);
-	    thesegment.vmsize = READ_ONLY_SPACE_SIZE;
-	    dprintf("Skipping back to %lld.\n", curpos);
-	    lseek(fd, curpos, SEEK_SET);
-	    dprintf("Writing %d bytes.\n", sizeof(thesegment));
-	    result = write(fd, &thesegment, sizeof(thesegment));
-	    if (result == -1)
-		perror("Error:");
-	    close(fd);
-	    return 0;
-	} else {
-	    dprintf("Cmdsize = %d, Already read = %d, Now seeking %d\n",
-		    thesegment.cmdsize, sizeof(thesegment),
-		    thesegment.cmdsize - sizeof(thesegment));
-	    lseek(fd, thesegment.cmdsize - sizeof(thesegment), SEEK_CUR);
-	}
-    }
-    close(fd);
-    return 3;
-}
diff --git a/src/lisp/ppc-darwin-dlshim.c b/src/lisp/ppc-darwin-dlshim.c
deleted file mode 100644
index e6865cd..0000000
--- a/src/lisp/ppc-darwin-dlshim.c
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * These functions emulate a small subset of the dlopen / dlsym
- * functionality under Darwin's Mach-O dyld system.
- *
- * This file was graciously taken from the SBCL OS X/Darwin port, for
- * which it was originally written by Brian Mastenbrook:
- */
-
-/*
- * This software is part of the SBCL system. See the README file for
- * more information.
- *
- * This software is derived from the CMU CL system, which was
- * written at Carnegie Mellon University and released into the
- * public domain. The software is in the public domain and is
- * provided with absolutely no warranty. See the COPYING and CREDITS
- * files for more information.
- */
-
-
-#include <mach-o/dyld.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-/* Darwin does not define the standard ELF
- * dlopen/dlclose/dlsym/dlerror interface to shared libraries, so this
- * is an attempt at a minimal wrapper to allow SBCL to work without
- * external dependency on pogma's dlcompat library.
- */
-
-/* For now, there is no RTLD_GLOBAL emulation either. */
-
-static char dl_self;		/* I'm going to abuse this */
-
-#define RTLD_LAZY 1
-#define RTLD_NOW 2
-#define RTLD_GLOBAL 0x100
-
-static int callback_count;
-static struct mach_header *last_header;
-
-void
-dlshim_image_callback(struct mach_header *ptr, unsigned long phooey)
-{
-    callback_count++;
-    last_header = ptr;
-}
-
-int
-lib_path_count(void)
-{
-    char *libpath;
-    int i;
-    int count;
-
-    libpath = getenv("DYLD_LIBRARY_PATH");
-    count = 1;
-    if (libpath) {
-	for (i = 0; libpath[i] != '\0'; i++) {
-	    if (libpath[i] == ':')
-		count++;
-	}
-    }
-    return count;
-}
-
-const char *
-lib_path_prefixify(int index, const char *filename)
-{
-    static char *retbuf = NULL;
-    int fi, li, i, count;
-    char *libpath;
-
-    if (!retbuf) {
-	retbuf = (char *) malloc(1024 * sizeof(char));
-    }
-    count = 0;
-    fi = 0;
-    li = -1;
-    libpath = getenv("DYLD_LIBRARY_PATH");
-    if (libpath) {
-	i = 0;
-	while (count != index && libpath[i] != '\0') {
-	    if (libpath[i] == ':')
-		count++;
-	    i++;
-	}
-	fi = i;
-	while (libpath[i] != '\0' && libpath[i] != ':') {
-	    i++;
-	}
-	li = i - 1;
-    }
-    if (li - fi > 0) {
-	if (li - fi + 1 > 1022 - strlen(filename)) {
-	    retbuf =
-		(char *) realloc(retbuf,
-
-				 (li - fi + 3 +
-				  strlen(filename)) * sizeof(char));
-	}
-	memcpy(retbuf, libpath + fi, (li - fi + 1) * sizeof(char));
-
-	retbuf[li - fi + 1] = '/';
-	memcpy(retbuf + li - fi + 2, filename, strlen(filename) + 1);
-	return retbuf;
-    } else {
-	return filename;
-    }
-}
-
-void *
-dlopen(const char *filename, int flags)
-{
-    static char has_callback = 0;
-
-    if (!has_callback) {
-	_dyld_register_func_for_add_image(dlshim_image_callback);
-    }
-    if (!filename) {
-	return &dl_self;
-    } else {
-	struct mach_header *img = NULL;
-
-	if (!img)
-	    img = NSAddImage(filename, NSADDIMAGE_OPTION_RETURN_ON_ERROR);
-	if (!img)
-	    img =
-		NSAddImage(filename,
-			   NSADDIMAGE_OPTION_RETURN_ON_ERROR |
-			   NSADDIMAGE_OPTION_WITH_SEARCHING);
-	if (!img) {
-	    NSObjectFileImage fileImage;
-
-	    callback_count = 0;
-	    last_header = NULL;
-	    if (NSCreateObjectFileImageFromFile(filename, &fileImage) ==
-		NSObjectFileImageSuccess) {
-		NSLinkModule(fileImage, filename,
-			     NSLINKMODULE_OPTION_BINDNOW |
-			     ((flags & RTLD_GLOBAL) ?
-			      NSLINKMODULE_OPTION_PRIVATE : 0) |
-			     NSLINKMODULE_OPTION_RETURN_ON_ERROR);
-		if (callback_count && last_header)
-		    img = last_header;
-	    }
-	}
-	if (!img) {
-	    NSObjectFileImage fileImage;
-	    int i, maxi;
-	    char *prefixfilename;
-
-	    maxi = lib_path_count();
-	    for (i = 0; i < maxi && !img; i++) {
-		prefixfilename = lib_path_prefixify(i, filename);
-		callback_count = 0;
-		last_header = NULL;
-		if (NSCreateObjectFileImageFromFile(prefixfilename, &fileImage)
-		    == NSObjectFileImageSuccess) {
-		    NSLinkModule(fileImage, filename,
-				 NSLINKMODULE_OPTION_BINDNOW |
-				 ((flags & RTLD_GLOBAL) ?
-				  NSLINKMODULE_OPTION_PRIVATE : 0) |
-				 NSLINKMODULE_OPTION_RETURN_ON_ERROR);
-		    if (callback_count && last_header)
-			img = last_header;
-		}
-	    }
-	}
-	if (img) {
-	    if (flags & RTLD_NOW) {
-		NSLookupSymbolInImage(img, "",
-				      NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_FULLY |
-				      NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR);
-	    }
-	    if (NSIsSymbolNameDefinedInImage(img, "__init")) {
-		NSSymbol *initsymbol;
-		void (*initfunc) (void);
-
-		initsymbol = NSLookupSymbolInImage(img, "__init", 0);
-		initfunc = NSAddressOfSymbol(initsymbol);
-		initfunc();
-	    }
-	}
-	return img;
-    }
-}
-
-const char *
-dlerror(void)
-{
-    static char *errbuf = NULL;
-    NSLinkEditErrors a;
-    int b;
-    char *c, *d;
-
-    NSLinkEditError(&a, &b, &c, &d);
-    if (!errbuf) {
-	errbuf = (char *) malloc(256 * sizeof(char));
-    }
-    snprintf(errbuf, 255, "%s in %s: %d %d", c, d, a, b);
-    return errbuf;
-}
-
-void *
-dlsym(void *handle, char *symbol)
-{
-    if (handle == &dl_self) {
-	if (NSIsSymbolNameDefined(symbol)) {
-	    NSSymbol *retsym;
-
-	    retsym = NSLookupAndBindSymbol(symbol);
-	    return NSAddressOfSymbol(retsym);
-	} else {
-	    return NULL;
-	}
-    } else {
-	if (NSIsSymbolNameDefinedInImage(handle, symbol)) {
-	    NSSymbol *retsym;
-
-	    retsym = NSLookupSymbolInImage(handle, symbol, 0);
-	    return NSAddressOfSymbol(retsym);
-	} else {
-	    return NULL;
-	}
-    }
-}
-
-int
-dlclose(void *handle)
-{
-    /* dlclose is not implemented, and never will be for dylibs.
-     * return -1 to signal an error; it's not used by SBCL anyhow */
-    return -1;
-}

-----------------------------------------------------------------------

Summary of changes:
 src/lisp/Config.ppc_darwin     |    9 --
 src/lisp/darwin-lispadjuster.c |   87 ---------------
 src/lisp/ppc-darwin-dlshim.c   |  236 ----------------------------------------
 3 files changed, 332 deletions(-)
 delete mode 100644 src/lisp/darwin-lispadjuster.c
 delete mode 100644 src/lisp/ppc-darwin-dlshim.c


hooks/post-receive
-- 
CMU Common Lisp


More information about the cmucl-commit mailing list