*** /dev/null Mon Nov 10 00:08:01 2003 --- gcl/h/netbsd.defs Mon Nov 3 14:23:51 2003 *************** *** 0 **** --- 1,62 ---- + # NetBSD + # + # Mar 21 2001 Keisuke YOSHIDA NetBSD 1.5S/sparc support + # Nov 3 2003 Keisuke YOSHIDA NetBSD 1.6ZE support + + # MACHINE + MACHINE_CMD=/usr/bin/machine + MACHINE=${MACHINE_CMD:sh} + + # LIBS = -lfpu # alternative math library works if you have it. + #ODIR_DEBUG= + #NULLFILE=../h/twelve_null + + # + OFLAG = -O2 -g + LIBS = -lm -lintl + + # tell linker to remember where it got the shared object... + # should have the same for TCL/TK if you used shared libs.. + X_LIBS=-Wl,-rpath,/usr/X11R6/lib -L/usr/X11R6/lib -lXmu -lXt -lXext -lXaw -lX11 + + # This CC string will be used for compilation of the system, + # and also in the compiler::*cc* variable for later compilation of + # lisp files. + CC = cc -fwritable-strings -fsigned-char -DVOL=volatile -DHAVE_ISNORMAL + LDCC = cc + + # + ifeq ($MACHINE, i386) + MPIOBJ = mpi-386.o + elifeq ($MACHINE, sparc) + MPIOBJ = mpi-sol-sparc.o + elifeq ($MACHINE, m68k) + MPIOBJ = mpi-bsd68k.o + else + MPIOBJ = mpi.o + endif + + MAINDIR = /usr/local/gcl + + # Use the mp.s file on 68k machine + MPFILES= ${MPDIR}/${MPIOBJ} ${MPDIR}/libmport.a + #GNULIB1 = /usr/lib/libgcc.a + + # Enable the fastloading mechanism which does not use ld -A + # requires c/rel_.. machine dependent code. + #RSYM = rsym + RSYM = + SFASL = ${ODIR}/sfasl.o + + # When using SFASL it is good to have (si::build-symbol-table) + #INITFORM=(si::build-symbol-table)(load "../lsp/setdoc.lsp") + INITFORM=(si::build-symbol-table)(setq si::*info-paths* (list "" "/usr/share/info/" "/usr/pkg/info/" "/usr/X11R6/info/" "/usr/local/info/"))(setq si::*default-info-files* (list "gcl-si.info" "gcl-tk.info")) + + # Use symbolic links + SYMB=-s + LIBFILES= + + # the make to use for saved_gcp the profiler. + GCP=gcp-bsd + + TK_BUILD_LIB_SPEC= Index: gcl/h/netbsd.h diff -c /dev/null gcl/h/netbsd.h:1.1 *** /dev/null Mon Nov 10 00:08:01 2003 --- gcl/h/netbsd.h Mon Nov 3 14:23:51 2003 *************** *** 0 **** --- 1,231 ---- + /* + * netbsd.h based on 386-bsd.h and solaris.h, etc. + * gcl-2.3.6 to NetBSD 1.5S/i386 + * gcl-2.5.3 to NetBSD 1.6ZE/i386 + */ + #include "bsd.h" + + #ifdef __alpha__ + #define ALPHA + #define CPU_FEATURE ADD_FEATURE("ALPHA") + #endif /* __alpha__ */ + + #ifdef __amd64__ + #define AMD64 + #define CPU_FEATURE ADD_FEATURE("AMD64") + #endif /* __amd64__ */ + + #ifdef __i386__ + #define I386 + #define CPU_FEATURE ADD_FEATURE("I386") + #endif /* __i386__ */ + + #ifdef __m68k__ + #define M68K + #define CPU_FEATURE ADD_FEATURE("M68K") + #endif /* __m68k__ */ + + #ifdef __sparc__ + #define SPARC + #define CPU_FEATURE ADD_FEATURE("SPARC") + #endif /* __sparc__ */ + + #ifdef __sparc64__ + #define SPARC64 + #define CPU_FEATURE ADD_FEATURE("SPARC64") + #endif /* __sparc64__ */ + + #define ADDITIONAL_FEATURES \ + CPU_FEATURE; \ + ADD_FEATURE("NetBSD"); + + #define HZ 100 + #define IEEEFLOAT + + #undef HAVE_XDR + #define USE_ATT_TIME + #define GETCWD + #define FCLOSE_SETBUF_OK + + #define HAVE_SIGPROCMASK + #define SIG_STACK_SIZE (SIGSTKSZ / sizeof(double)) + #define SETUP_SIG_STACK \ + { \ + stack_t estack; \ + if ((estack.ss_sp = malloc(SIGSTKSZ)) == NULL) \ + perror("malloc"); \ + estack.ss_size = SIGSTKSZ; \ + estack.ss_flags = 0; \ + if (sigaltstack(&estack, 0) < 0) \ + perror("sigaltstack"); \ + } + + #undef LISTEN_FOR_INPUT + #define LISTEN_FOR_INPUT(fp) \ + do { int c = 0; \ + if ((fp)->_r <=0 && (c=0, ioctl((fp)->_file, FIONREAD, &c), c <= 0)) \ + return FALSE; } while(0) + + #undef INSTALL_SEGMENTATION_CATCHER + #define INSTALL_SEGMENTATION_CATCHER \ + (void) gcl_signal(SIGSEGV, segmentation_catcher); \ + (void) gcl_signal(SIGBUS, segmentation_catcher) + + #ifdef USE_DLOPEN + #define SEPARATE_SFASL_FILE "fasldlsym.c" + #else + #ifdef HAVE_LIBBFD + #define SEPARATE_SFASL_FILE "sfaslbfd.c" + #else + #if !defined(__i386__) && !defined(__sparc__) + #error Can only do non-bfd relocs for i386 and sparc + #endif + #define SEPARATE_SFASL_FILE "sfaslelf.c" + #endif + #endif + + #ifdef __ELF__ + + #define HAVE_ELF + + #if defined(__alpha__) || defined(__amd64__) || defined(__sparc64__) + #define ELFSIZE 64 + #define ElfW(a) Elf64_ ## a + #else + #define ELFSIZE 32 + #define ElfW(a) Elf32_ ## a + #endif + + #define __ELF_NATIVE_CLASS ELFSIZE + + #include + + #define UNIXSAVE "unexelf.c" + + #ifdef HAVE_LIBBFD + #undef SPECIAL_RSYM + #else /* HAVE_LIBBFD */ + #define SPECIAL_RSYM "rsym_elf.c" + #endif /* HAVE_LIBBFD */ + + #ifndef SEPARATE_SFASL_FILE + #define SEPARATE_SFASL_FILE "sfaslelf.c" + #endif /* !SEPARATE_SFASL_FILE */ + + #define SEEK_TO_END_OFILE(fp)\ + do { \ + Elf_Off offset = 0, endofelf; int j; \ + Elf_Ehdr eheader; Elf_Shdr shdr; \ + fseek(fp, 0, SEEK_SET); \ + fread(&eheader, sizeof(eheader), 1, fp); \ + /* in case the headers themselves come AFTER the actual sections */ \ + endofelf=offset = eheader.e_shoff+ eheader.e_shentsize *eheader.e_shnum;\ + fseek(fp, eheader.e_shoff, SEEK_SET); \ + if (eheader.e_shentsize != sizeof(Elf_Shdr)) \ + { FEerror("Bad ELF section header size",0); } \ + for (j = 0; j < eheader.e_shnum; j++) \ + { fread(&shdr,eheader.e_shentsize,1,fp); \ + if ((shdr.sh_offset > offset) && (shdr.sh_type != SHT_NOBITS)) \ + { offset = shdr.sh_offset; endofelf = offset+shdr.sh_size; } \ + } \ + if ( fseek(fp, endofelf, SEEK_SET) ) \ + FEerror("Bad ELF file",0); \ + } while(0) + + #else /* __ELF__ */ + + #define DATA_BEGIN (char *)N_DATADDR(header); + #define A_TEXT_OFFSET(x) (sizeof (struct exec)) + #define A_TEXT_SEEK(hdr) (N_TXTOFF(hdr) + A_TEXT_OFFSET(hdr)) + #define start_of_data() &etext + #define start_of_text() ((char *)(sizeof(struct exec) + getpagesize())) + + #define UNIXSAVE "unexec.c" + #define RELOC_FILE "rel_sun3.c" + + #define HARDWARE_PAGESIZE (1L << PAGEWIDTH) + + #undef READ_HEADER + #define READ_HEADER \ + fread(&header, sizeof(header), 1, original); \ + data_begin = DATA_BEGIN; \ + { \ + long extra = ((long)sbrk(0) & (HARDWARE_PAGESIZE - 1)); \ + if(extra != 0) \ + sbrk(HARDWARE_PAGESIZE - extra); \ + } \ + data_end = sbrk(0); \ + original_data = header.a_data; \ + header.a_data = data_end - data_begin; \ + header.a_bss = 0; \ + fwrite(&header, sizeof(header), 1, save); \ + fflush(save); + + #endif /* __ELF__ */ + + /* + * MD part + */ + #ifdef __alpha__ + + #include + #include + + #undef DBEGIN + #define DBEGIN 0x0000000120000000L + + #define MUST_COPY_VA_LIST 1 + + #define INT_TO_ADDRESS(x) ((void *)(unsigned long) x) + + #define NULL_OR_ON_C_STACK(x) \ + (((unsigned long) x <= 0) || ((unsigned long) x >= (USRSTACK-MAXSSIZ))) + + #undef ROUND_UP_SBRK + #define ROUND_UP_SBRK(x) \ + do { unsigned long i; \ + if (i = ((unsigned long)x & (PAGESIZE - 1))) \ + x=sbrk(PAGESIZE - i); \ + } while(0); + + #define page(p) (((unsigned long)(((char *)(p))-DBEGIN)>>PAGEWIDTH)) + #define pagetochar(x) ((char *)(((x) << PAGEWIDTH) + DBEGIN)) + + #undef IF_ALLOCATE_ERR + #define IF_ALLOCATE_ERR \ + if (core_end != sbrk(0)) \ + { long ll; \ + if ((ll=(long)(sbrk(0) - core_end)) <= PAGESIZE) \ + { sbrk(PAGESIZE - ll); \ + type_map[page(core_end)] = t_other; \ + heap_end=core_end = sbrk(0); \ + } \ + else \ + error("Someone allocated my memory!"); \ + } \ + if (core_end != (sbrk(PAGESIZE*(n - m)))) + + #endif /* __alpha__ */ + + /* + * The next two defines are for SGC, + * one of which needs to go in cmpinclude.h. + */ + #undef SIGPROTV SIGBUS + + /* Begin for cmpinclude */ + #undef SGC /* can mprotect pages and so selective gc will work */ + + #ifdef IN_NUM_CO + #include + #include + static __inline__ int isnormal(double a) { + if (a == 0 || fabs(a) < DBL_MIN || isinf(a) || isnan(a)) + return 0; + return 1; + } + #endif + + #if defined(IN_UNIXTIME) + # include + #endif Index: gcl/o/sfaslelf.c diff -c gcl/o/sfaslelf.c:1.1.1.1 gcl/o/sfaslelf.c:1.2 *** gcl/o/sfaslelf.c:1.1.1.1 Sun Nov 2 14:34:05 2003 --- gcl/o/sfaslelf.c Mon Nov 3 14:24:39 2003 *************** *** 317,323 **** { int index_to_relocate = shp->sh_info; if (symtab_index != shp->sh_link) ! FEerror("unexpected symbol table used"); the_start = start_address + section[index_to_relocate].start; } /* else if (shp->sh_type == SHT_REL */ --- 317,323 ---- { int index_to_relocate = shp->sh_info; if (symtab_index != shp->sh_link) ! FEerror("unexpected symbol table used", 0); the_start = start_address + section[index_to_relocate].start; } /* else if (shp->sh_type == SHT_REL */ *************** *** 332,338 **** else if ( (shp->sh_type == SHT_REL) || (shp->sh_type == SHT_RELA) ) { if (get_section_number(".rel.stab") == j) continue; ! FEerror("unknown rel type"); } else continue; --- 332,338 ---- else if ( (shp->sh_type == SHT_REL) || (shp->sh_type == SHT_RELA) ) { if (get_section_number(".rel.stab") == j) continue; ! FEerror("unknown rel type", 0); } else continue; *************** *** 520,526 **** else if (sh_type == SHT_REL) a = 0; else { ! FEerror("relocate() error: unknown sh_type in ELF object"); a=0; } b = (unsigned int) the_start; --- 520,526 ---- else if (sh_type == SHT_REL) a = 0; else { ! FEerror("relocate() error: unknown sh_type in ELF object", 0); a=0; } b = (unsigned int) the_start; *************** *** 540,548 **** /* do_bfd_reloc(ELF32_R_TYPE(reloc_info->r_info),s+a,(unsigned int *)where); */ /* #else */ switch(ELF32_R_TYPE(reloc_info->r_info)){ ! #if (defined(__svr4__) || defined(__linux__)) && defined(__i386__) case R_386_NONE: ! FEerror("Unsupported ELF type R_386_NONE"); break; case R_386_32: --- 540,548 ---- /* do_bfd_reloc(ELF32_R_TYPE(reloc_info->r_info),s+a,(unsigned int *)where); */ /* #else */ switch(ELF32_R_TYPE(reloc_info->r_info)){ ! #if (defined(__svr4__) || defined(__linux__) || defined(__NetBSD__) && defined(__ELF__)) && defined(__i386__) case R_386_NONE: ! FEerror("Unsupported ELF type R_386_NONE", 0); break; case R_386_32: *************** *** 556,599 **** break; case R_386_GOT32: ! FEerror("Unsupported ELF type R_386_GOY32"); break; case R_386_PLT32: ! FEerror("Unsupported ELF type R_386_PLT32"); break; case R_386_COPY: ! FEerror("Unsupported ELF type R_386_COPY"); break; case R_386_GLOB_DAT: ! FEerror("Unsupported ELF type R_386_GLOB_DAT"); break; case R_386_JMP_SLOT: ! FEerror("Unsupported ELF type R_386_JMP_SLOT"); break; case R_386_RELATIVE: ! FEerror("Unsupported ELF type R_386_RELATIVE"); break; case R_386_GOTOFF: ! FEerror("Unsupported ELF type R_386_GOTOFF"); break; case R_386_GOTPC: ! FEerror("Unsupported ELF type R_386_GOTPC"); break; #ifdef R_386_NUM case R_386_NUM: ! FEerror("Unsupported ELF type R_386_NUM"); break; #endif ! #else /* (defined(__svr4__) || defined(__linux__)) && defined(__i386__) */ case R_SPARC_WDISP30: /* v-disp30*/ val=(s+a-p) >> 2; --- 556,599 ---- break; case R_386_GOT32: ! FEerror("Unsupported ELF type R_386_GOY32", 0); break; case R_386_PLT32: ! FEerror("Unsupported ELF type R_386_PLT32", 0); break; case R_386_COPY: ! FEerror("Unsupported ELF type R_386_COPY", 0); break; case R_386_GLOB_DAT: ! FEerror("Unsupported ELF type R_386_GLOB_DAT", 0); break; case R_386_JMP_SLOT: ! FEerror("Unsupported ELF type R_386_JMP_SLOT", 0); break; case R_386_RELATIVE: ! FEerror("Unsupported ELF type R_386_RELATIVE", 0); break; case R_386_GOTOFF: ! FEerror("Unsupported ELF type R_386_GOTOFF", 0); break; case R_386_GOTPC: ! FEerror("Unsupported ELF type R_386_GOTPC", 0); break; #ifdef R_386_NUM case R_386_NUM: ! FEerror("Unsupported ELF type R_386_NUM", 0); break; #endif ! #else /* (defined(__svr4__) || defined(__linux__) || defined(__NetBSD__) && defined(__ELF__)) && defined(__i386__) */ case R_SPARC_WDISP30: /* v-disp30*/ val=(s+a-p) >> 2; *************** *** 623,629 **** val = (s+a) & MASK(10); *(short *)(where +2) |= val; break; ! #endif /* (defined(__svr4__) || defined(__linux__)) && defined(__i386__) */ default: printf("(non supported relocation type %d)\n", ELF32_R_TYPE(reloc_info->r_info)); --- 623,629 ---- val = (s+a) & MASK(10); *(short *)(where +2) |= val; break; ! #endif /* (defined(__svr4__) || defined(__linux__) || defined(__NetBSD__) && defined(__ELF__)) && defined(__i386__) */ default: printf("(non supported relocation type %d)\n", ELF32_R_TYPE(reloc_info->r_info));