Date: Monday, August 2, 2010 @ 17:59:43
Author: rtoy
Path: /project/cmucl/cvsroot/src/lisp
Modified: elf.c mach-o.c
More comment cleanups.
----------+
elf.c | 47 ++++++++++++++++++++++++-----------------------
mach-o.c | 12 +++++++++---
2 files changed, 33 insertions(+), 26 deletions(-)
Index: src/lisp/elf.c
diff -u src/lisp/elf.c:1.28 src/lisp/elf.c:1.29
--- src/lisp/elf.c:1.28 Mon Aug 2 17:45:36 2010
+++ src/lisp/elf.c Mon Aug 2 17:59:43 2010
@@ -8,7 +8,7 @@
Above changes put into main CVS branch. 05-Jul-2007.
- $Id: elf.c,v 1.28 2010-08-02 21:45:36 rtoy Exp $
+ $Id: elf.c,v 1.29 2010-08-02 21:59:43 rtoy Exp $
*/
#include <stdio.h>
@@ -466,17 +466,18 @@
if (!strncmp(nambuf, section_names[j], 6)) {
os_vm_address_t addr;
/*
- * On Solaris, the section header sets the addr
- * field to 0 because the linker script says the
- * sections are NOTE sections. Hence, we need to
- * look up the section addresses ourselves.
+ * Found a core section. Map it!
*
- * For other systems, we don't care what the
- * address is. We infer the address from the
- * segment name.
+ * Although the segment may contain the correct
+ * address for the start of the segment, we don't
+ * care. We infer the address from the segment
+ * name. (The names better be unique!!!!) This
+ * approach allows for a possibly simpler linking
+ * operation because we don't have to figure out
+ * how to get the linker to give segments the
+ * correct address.
*/
addr = section_addr[j];
- /* Found a core section. Map it! */
if ((os_vm_address_t) os_map(exec_fd, sh.sh_offset,
addr, sh.sh_size)
== (os_vm_address_t) -1) {
@@ -484,20 +485,20 @@
exit(-1);
}
switch(j) {
- case 0: /* Dynamic space. */
- /* Dynamic space variables are set in lisp.c. */
- image_dynamic_space_size = sh.sh_size;
- break;
- case 1: /* Static space. */
- image_static_space_size = sh.sh_size;
- break;
- case 2: /* Read-only space. */
- image_read_only_space_size = sh.sh_size;
- break;
- default:
- /* Should never get here. */
- abort();
- break;
+ case 0: /* Dynamic space. */
+ /* Dynamic space variables are set in lisp.c. */
+ image_dynamic_space_size = sh.sh_size;
+ break;
+ case 1: /* Static space. */
+ image_static_space_size = sh.sh_size;
+ break;
+ case 2: /* Read-only space. */
+ image_read_only_space_size = sh.sh_size;
+ break;
+ default:
+ /* Should never get here. */
+ abort();
+ break;
}
sections_remaining--;
Index: src/lisp/mach-o.c
diff -u src/lisp/mach-o.c:1.6 src/lisp/mach-o.c:1.7
--- src/lisp/mach-o.c:1.6 Mon Aug 2 17:45:36 2010
+++ src/lisp/mach-o.c Mon Aug 2 17:59:43 2010
@@ -1,5 +1,5 @@
/*
- * $Header: /project/cmucl/cvsroot/src/lisp/mach-o.c,v 1.6 2010-08-02 21:45:36 rtoy Exp $
+ * $Header: /project/cmucl/cvsroot/src/lisp/mach-o.c,v 1.7 2010-08-02 21:59:43 rtoy Exp $
*
* This code was written by Raymond Toy as part of CMU Common Lisp and
* has been placed in the public domain.
@@ -413,11 +413,17 @@
#endif
if (lc.cmd == LC_SEGMENT) {
- /* Read the rest of the command, which is a segment command. */
+ /*
+ * Got a segment command, so read the rest of the command so
+ * we can see if it's the segment for one of our Lisp
+ * spaces.
+ */
#ifdef DEBUG_MACH_O
fprintf(stderr, "Reading next %ld bytes for SEGMENT\n", sizeof(sc) - sizeof(lc));
#endif
+
eread(exec_fd, &sc.segname, sizeof(sc) - sizeof(lc), __func__);
+
#ifdef DEBUG_MACH_O
fprintf(stderr, "LC_SEGMENT: name = %s\n", sc.segname);
#endif
@@ -475,7 +481,7 @@
#endif
elseek(exec_fd, lc.cmdsize - sizeof(sc), SEEK_CUR, __func__);
} else {
- /* Seek to the next command */
+ /* Not a segment command, so seek to the next command */
#ifdef DEBUG_MACH_O
fprintf(stderr, "Seeking by %ld bytes\n", lc.cmdsize - sizeof(lc));
#endif