--- gforth/engine/main.c 2001/06/16 22:53:37 1.44 +++ gforth/engine/main.c 2001/09/12 14:45:10 1.45 @@ -126,14 +126,16 @@ int gforth_memcmp(const char * s1, const * If the word is 0: 0 is a null reference so don't adjust + if (token>=base) { + image[i]+=(Cell)start; + } } } } @@ -493,12 +499,12 @@ Address loader(FILE *imagefile, char* fi imp=image+preamblesize; if (clear_dictionary) memset(imp+header.image_size, 0, dictsize-header.image_size); - if(header.base==0) { + { Cell reloc_size=((header.image_size-1)/sizeof(Cell))/8+1; char reloc_bits[reloc_size]; fseek(imagefile, preamblesize+header.image_size, SEEK_SET); fread(reloc_bits, 1, reloc_size, imagefile); - relocate((Cell *)imp, reloc_bits, header.image_size, vm_prims); + relocate((Cell *)imp, reloc_bits, header.image_size, header.base, vm_prims); #if 0 { /* let's see what the relocator did */ FILE *snapshot=fopen("snapshot.fi","wb"); @@ -507,11 +513,6 @@ Address loader(FILE *imagefile, char* fi } #endif } - else if(header.base!=imp) { - fprintf(stderr,"%s: Cannot load nonrelocatable image (compiled for address $%lx) at address $%lx\n", - progname, (unsigned long)header.base, (unsigned long)imp); - exit(1); - } if (header.checksum==0) ((ImageHeader *)imp)->checksum=check_sum; else if (header.checksum != check_sum) {