System: Elk version 3.0 Patch #: 2 Priority: high Acknowledgements: I would like to thank Albert L. Ting, Helmut Dipper, Brian Denheyer, Mark Diekhans, Mike Wray, and Craig McPheeters for pointing out the bugs fixed by this patch. Description: README: COPYRGIGHT: Updated my e-mail address config/hp9k700-hpux9.0-cc: config/hp9k700-hpux10.0-cc: C doubles must be aligned at 8-byte boundaries on these platforms doc/cprog/cprog.ms: Fixed an error in the example for linkscheme lib/misc/bitstring.c: Fixed two GC-related bugs lib/unix/process.c: Removed a hack for Ultrix 4.2 that does no longer work with modern C compilers src/stab-bsd.c: Removed an #ifdef to allow for dlopen-based dynamic loading on systems using the BSD-style a.out format src/dump.c: Fixed a bug in the `dump' primitive src/heap-sc.c: src/heap-gen.c: When I rewrote the C/C++ Programmer's Manual for Elk 3.0, I forgot to mention that the first `Object' component of each Scheme type must be initialized after allocation (as was mentioned in the previous version of the manual). Alloc_Object() now takes care of this. src/print.c: Fixed a bug in the `format' primitive config/powerpc-solaris2.5-cc: New configuration file for the IBM PowerPC running Solaris Fix: From rn, say "| patch -p -N -d DIR", where DIR is the top of your Elk source directory tree. Outside of rn, say "cd DIR; patch -p -N --- 190,193 ---- serves and to be fully understood with acceptable effort. ! Oliver Laumann *** 1.9 1995/08/15 11:25:59 --- COPYRIGHT 1996/04/05 13:10:14 *************** *** 25,28 **** Berlin, June 20, 1995 ! Oliver Laumann --- 25,28 ---- Berlin, June 20, 1995 ! Oliver Laumann *** 1.1 1995/08/15 11:26:37 --- config/hp9k700-hpux10.0-cc 1996/04/04 12:43:27 *************** *** 279,285 **** # to be aligned at 8-byte boundaries? If not, 4-byte alignment will # be assumed. ! align_8byte=no # The C compiler used to compile the source code. --- 279,285 ---- # to be aligned at 8-byte boundaries? If not, 4-byte alignment will # be assumed. ! align_8byte=yes # The C compiler used to compile the source code. *** 1.3 1995/08/15 11:26:37 --- config/hp9k700-hpux9.0-cc 1996/04/04 12:43:33 *************** *** 279,285 **** # to be aligned at 8-byte boundaries? If not, 4-byte alignment will # be assumed. ! align_8byte=no # The C compiler used to compile the source code. --- 279,285 ---- # to be aligned at 8-byte boundaries? If not, 4-byte alignment will # be assumed. ! align_8byte=yes # The C compiler used to compile the source code. *** 1.24 1995/08/15 11:27:57 --- doc/cprog/cprog.ms 1996/04/04 12:24:52 *************** *** 696,703 **** assuming you have installed the software under ``/usr/elk''): .Es \f6%\fP cd /usr/elk ! \f6%\fP lib/linkscheme x11scheme runtime/obj/xlib.o runtime/obj/xt.o \e ! runtime/obj/xaw/*.o \-lXaw \-lXmu \-lXt \-lSM \-lICE \-lX11 \-lXext .Ee .PP The exact form of the libraries depends on your platform and X11 --- 696,703 ---- assuming you have installed the software under ``/usr/elk''): .Es \f6%\fP cd /usr/elk ! \f6%\fP lib/linkscheme x11scheme runtime/obj/xt.o runtime/obj/xaw/*.o \e ! \-lXaw \-lXmu \-lXt \-lSM \-lICE \-lX11 \-lXext .Ee .PP The exact form of the libraries depends on your platform and X11 *** 1.5 1995/08/15 11:33:07 --- lib/misc/bitstring.c 1996/04/05 13:16:20 *************** *** 50,62 **** --- 50,65 ---- static Bitstring_Print(x, port, raw, depth, length) Object x, port; { int i, rem; struct S_Bitstring *b = BITSTRING(x); + GC_Node2; + GC_Link2(x, port); Printf(port, "#*"); i = bits_to_bytes(b->len) - 1; if (rem = b->len % 8) Printf(port, Digits(b->data[i--], rem)); for ( ; i >= 0; i--) Printf(port, Digits(b->data[i], 8)); + GC_Unlink; } static Object Make_Bitstring(len) unsigned len; { *************** *** 65,70 **** --- 68,74 ---- b = Alloc_Object(sizeof(struct S_Bitstring) + nbytes-1, T_Bitstring, 0); bzero((char *)BITSTRING(b)->data, nbytes); + BITSTRING(b)->tag = Null; BITSTRING(b)->len = len; return b; } *** 1.15 1995/09/19 16:35:46 --- lib/unix/process.c 1996/04/05 13:18:16 *************** *** 3,11 **** #include /* "extern" in front of the next declaration causes the Ultrix 4.2 linker ! * to fail when dynamically loading unix.o: */ ! char **environ; static Object P_Environ() { Object ret, cell, str; --- 3,12 ---- #include /* "extern" in front of the next declaration causes the Ultrix 4.2 linker ! * to fail when dynamically loading unix.o (but omitting it does no longer ! * work with modern C compilers): */ ! extern char **environ; static Object P_Environ() { Object ret, cell, str; *** 1.2 1993/08/02 11:15:58 --- src/stab-bsd.c 1996/04/04 12:47:02 *************** *** 56,62 **** return tab; } - #ifdef INIT_OBJECTS SYMTAB *Open_File_And_Snarf_Symbols (name) char *name; { struct exec hdr; int fd; --- 56,61 ---- *************** *** 79,82 **** (void)fclose (fp); return tab; } - #endif /* INIT_OBJECTS */ --- 78,80 ---- *** 1.26 1995/08/02 10:22:40 --- src/dump.c 1996/04/04 12:48:31 *************** *** 16,21 **** --- 16,22 ---- Object Dump_Control_Point; Init_Dump () { + Dump_Control_Point = Null; Global_GC_Link (Dump_Control_Point); } *** 1.3 1995/08/03 10:27:58 --- src/heap-sc.c 1996/04/04 12:55:43 *************** *** 46,51 **** --- 46,52 ---- Uncatchable_Error ("Out of heap space"); } Hp = p + size; + *(Object *)p = Null; SET(ret, type, p); if (konst) SETCONST(ret); *** 1.16 1995/08/15 11:41:49 --- src/heap-gen.c 1996/04/04 13:12:39 *************** *** 868,873 **** --- 868,874 ---- MAKE_HEADER (*current_freep, s, type); current_freep++; + *current_freep = Null; SET (obj, type, current_freep); if (big) current_freep = (Object*)0, current_free = 0; *** 1.54 1995/08/15 11:41:49 --- src/print.c 1996/04/04 13:25:04 *************** *** 549,557 **** return stringret ? P_Get_Output_String (port) : Void; } ! Format (port, p, len, argc, argv) Object port; const char *p; int len; Object *argv; { register const char *s, *ep; register c; char buf[256]; extern sys_nerr; --- 549,558 ---- return stringret ? P_Get_Output_String (port) : Void; } ! Format (port, fmt, len, argc, argv) Object port; const char *fmt; int len; Object *argv; { register const char *s, *ep; + char *p; register c; char buf[256]; extern sys_nerr; *************** *** 559,566 **** --- 560,570 ---- extern char *sys_errlist[]; #endif GC_Node; + Alloca_Begin; GC_Link (port); + Alloca (p, char*, len); + bcopy (fmt, p, len); for (ep = p + len; p < ep; p++) { if (*p == '~') { if (++p == ep) break; *************** *** 595,599 **** --- 599,604 ---- Print_Char (port, *p); } } + Alloca_End; GC_Unlink; } *** /dev/null Fri Apr 5 15:21:58 1996 --- config/powerpc-solaris2.5-cc Wed Dec 6 09:47:23 1995 *************** *** 0 **** --- 1,367 ---- + # This is a shell script. It is sourced by the build scripts in the + # various subdirectories to gather system-, compiler-, and OS-specific + # information required for building the Makefiles. + # + # Most variables in this script are interpreted as boolean variables and + # indicate presence or absence of one specific feature. The value "yes" + # is regarded as "true", all other values (including no value or even + # non-existence of the variable) are interpreted as "false". + # + # Do not forget to quote values that contain shell meta syntax. + # + # ----------------------------------------------------------------------- + + + # $system should contain the name of this file. It may be used by some + # of the build scripts to do things that are specific to one single + # type of system. + + system=powerpc-solaris2.5-cc + + + # Does the system support the vprintf library function? If not, + # availability of the (non-portable) _doprnt function is assumed. + + vprintf=yes + + + # Does the directory(3) library follow the POSIX conventions (i.e. + # requires the include file and uses "struct dirent")? + # If not, the (obsolete) BSD-style interface with and + # "struct direct" is assumed. + + dirent=yes + + + # Does the system have the random/srandom library functions? If not, + # rand/srand will be used instead. + + random=yes + + + # Does the system have the index library function? If not, strchr + # will be used. + + index=no + + + # Does the system have the bcopy, bzero, and bcmp library functions? + # If not, memcpy/memset/memcmp will be used. + + bstring=no + + + # Does using the access system call require to be included? + # (Look into the manual page for access if in doubt.) + + include_unistd_h=yes + + + # If the FIONREAD ioctl command is defined, which file must be included? + + fionread_include='' + + + # What is the name of the a.out include file? + + aout_h='' + + + # The following variables control how certain system limits are obtained + # during runtime. + # + # If getdtablesize() is available to determine the maximum number of open + # files per process, set getdtablesize=yes. + # Alternatively, if POSIX-style sysconf() can be called with _SC_OPEN_MAX, + # set sysconf_open_max=yes. + # If neither is set to "yes", an educated guess will be made. + + getdtablesize=yes + sysconf_open_max=yes + + # If POSIX-style pathconf() can be invoked with _PC_PATH_MAX to determine + # the maximum pathname length, set pathconf_path_max=yes. + + pathconf_path_max=yes + + # If the system page size can be determined by calling getpagesize() + # set getpagesize=yes. + # Alternatively, if sysconf() can be invoked with _SC_PAGESIZE, set + # sysconf_pagesize=yes. + # These two variables are only required if the generational garbage + # collector is used. + + getpagesize=yes + sysconf_pagesize=yes + + + # Set reliable_signals=bsd if your system supports BSD-style reliable + # signals (has sigblock and related functions); set reliable_signals=posix + # for POSIX-style signals (sigprocmask, sigsets); otherwise old V7/SysV + # signal semantics are assumed. + + reliable_signals=posix + + + # To support dynamic loading of object files and "dump", the system's + # a.out format has to be known. Choose one of the following: + # + # coff ecoff xcoff elf macho hp9k convex + # + # Other values of "aout_format" are interpreted as BSD-style a.out format. + + aout_format=elf + + + # Which mechanism should be used to dynamically load object files? + # Possible values currently are: + # + # ld BSD-style incremental loading based on ld -A + # rld NeXT-style rld_load() + # shl HP-UX shl_load() + # dl SysVR4/SunOS5 dlopen() + # + # Leave load_obj empty if dynamic loading is not supported. + + load_obj=dl + + + # The following variables are only relevant if load_obj is set. + + # Linker options to produce a shared object from a .o file. + # Only used if load_obj=dl. + + ldflags_shared="-G -z text" + + # The libraries against which dynamically loaded files are resolved + # at the time they are loaded. + + load_libraries= + + # Additional flags to be passed to the linker for an incremental + # linker run (ld -A). Ignored unless load_obj=ld. + + incremental_ldflags= + + # Systems with "aout_format=ecoff" may require a call to the cacheflush + # system call after an object file has been loaded. Which include file + # has to be included in this case? + + cachectl_h=unused + + # Is the ANSI-C atexit function supported to register an exit handler? + # If not, the exit library function will be redefined and will end in + # a call to _exit. + + atexit=yes + + + # Do the names of external functions in the symbol table always begin + # with a special character (such as underline)? If so, syms_begin_with + # should hold this character, otherwise leave it empty. + + syms_begin_with= + + + # The symbol prefixes of extension initialization and finalization + # functions (without the initial $syms_begin_with). Do not change + # these unless the compiler or linker restricts the length of symbols! + + init_prefix=elk_init_ + finit_prefix=elk_finit_ + + + # Is the "dump" function supported? + + can_dump=yes + + + # The following variables are only relevant if "can_dump=yes". + + # Is the fchmod system call broken or unavailable? + + fchmod_broken=no + + # These four variables are only relevant if the system has the BSD-style + # a.out format. + # segment_size is the segment size of the system's memory management + # unit, i.e. the number to a multiple of which the size of an a.out + # segment (e.g. .text) is rounded up. + # file_text_start is the file offset at which the text segment starts + # in an a.out file. + # mem_text_start is the starting address of the text segment in memory. + # text_length_adj must be set to "sizeof (struct exec)" if the length of + # the text segment stored in the a.out header includes the a.out header + # itself. + + segment_size=SEGSIZ + file_text_start='sizeof(struct exec)' + mem_text_start='(PAGSIZ+sizeof(struct exec))' + text_length_adj='sizeof(struct exec)' + + # Only relevant if "aout_format=coff": the system's pagesize. + + coff_pagesize= + + # Only relevant if "aout_format=hp9k" and "load_obj=shl" + + hp_shared_libraries=yes + + # Print debug messages when dumping + + debug_dump=yes + + + # Is the "termio" terminal interface supported by the system? If not, + # BSD-style tty handling will be used. + + termio=yes + + + # flush_stdio and flush_tty indicate how clear-input/output-port can + # flush (purge) a FILE pointer and a TTY file descriptor. + # Possible values of flush_stdio: + # bsd assume old BSD-style FILE* (with _cnt, _ptr, _base) + # fpurge use 4.4BSD-style fpurge stdio library function + # Possible values of flush_tty: + # tiocflush use TIOCFLUSH ioctl from + # tcflsh use TCFLSH ioctl from + # Leave the variable(s) empty if flushing is not supported. + + flush_stdio=bsd + flush_tty=tcflsh + + + # The interpreter uses the getrlimit function to determine the maximum + # stack size of the running program. If this function is not supported, + # set max_stack_size to a (fixed) maximum stack size (in bytes). + + max_stack_size= + + + # Is the mprotect system call supported? The generational garbage collector + # requires mprotect to implement incremental GC. $mprotect is ignored if + # generational_gc is set to "no" in the site file. Set mprotect=mmap if + # mprotect is supported, but only for mmap()ed memory. + + mprotect=yes + + + # How can a SIGSEGV or SIGBUS signal handler find out the address of + # the faulting memory reference? This variable is only used if + # $mprotect is "yes" or "mmap". Possible values are: + # + # siginfo handler is called with siginfo_t structure (enabled + # by a call to sigaction) + # sigcontext address is in the sigcontext structure (3rd arg, sc_badvaddr) + # arg4 address is delivered to handler as argument #4 + # aix use an AIX-specific hack to get hold of the bad address + # hpux use a HP-UX-specific hack + + sigsegv_addr=siginfo + + + # Does the system support the alloca library function, and does this + # function actually extend the stack? If in doubt, extract alloca.o + # from the C library and check if it contains the symbols malloc and free. + # If this is the case, forget it. + + use_alloca=yes + + + # Must be included to use alloca? Is "#pragma alloca" required? + + include_alloca_h=yes + pragma_alloca=no + + + # Does the system (or compiler) require certain objects (e.g. doubles) + # to be aligned at 8-byte boundaries? If not, 4-byte alignment will + # be assumed. + + align_8byte=yes + + + # The C compiler used to compile the source code. + + cc=/opt/SUNWspro/bin/cc + + + # The name of the linker. This is usually just "ld", or /usr/ccs/bin/ld + # in SVR4-based systems. + + ld=/usr/ccs/bin/ld + + + # The C compiler flags used for all files. + + cflags='-O' + + + # Are extra C compiler flags (such as -D_NO_PROTO) required to compile + # Motif applications? + + motif_cflags= + + + # Are extra C compiler flags (such as -G 0) required to compile + # dynamically loadable files? + + obj_cflags='-K PIC' + + + # Are extra linker flags (such as -G 0) required to link several object + # files together to one dynamically loadable file? + + obj_ldflags= + + + # The linker flags used to link the interpreter. + + ldflags='-lm -lelf -ldl' + + + # The lint flags. + + lintflags='-abxh' + + + # Are function prototypes in the header files required? If prototypes=yes, + # prototypes are used unconditionally; if prototypes=no, prototypes are + # not used; otherwise prototypes are only used if the source code is + # compiled with an ANSI-C- or C++-compiler. + + prototypes=yes + + + # Does your C preprocessor support the ANSI-C ## operator, although + # __STDC__ is not defined? + + ansi_cpp=yes + + + # The UNIX extension likes to know which of the following system calls, + # library functions, and include files are supported by the system. + + gettimeofday=yes + ftime=yes + vfork=yes + gethostname=no + uname=yes + mktemp=yes + tmpnam=yes + tempnam=yes + getcwd=yes + getwd=yes + rename=yes + waitpid=yes + wait3=yes + wait4=yes + utime_h=yes + regcomp=yes + + + # Element type of the gidset argument of getgroups(); typically int + # or gid_t. Only needed by the UNIX extension. + + getgroups_type=gid_t