diff options
Diffstat (limited to 'src/tools/genmap.c')
| -rw-r--r-- | src/tools/genmap.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/tools/genmap.c b/src/tools/genmap.c index 8a258e1..d063d36 100644 --- a/src/tools/genmap.c +++ b/src/tools/genmap.c @@ -609,9 +609,11 @@ static void expect_hex(const char *text, const char *where, const char *name, in static void check_sources(const Map *m) { char lfa_old[64]; + /* a memmap.h in the working directory is compared too, when there is one: the + default map's header is generated into build/core and never kept in the tree */ FILE *mf = fopen("memmap.h", "rb"); - const char *mm_path = mf ? (fclose(mf), "memmap.h") : "src/core/memmap.h"; - char *rt = slurp("src/runtime/rt.zc"), *cc = slurp("src/compiler/compiler.zc"), *mm = slurp(mm_path); + const char *mm_path = mf ? (fclose(mf), "memmap.h") : 0; + char *rt = slurp("src/runtime/rt.zc"), *cc = slurp("src/compiler/compiler.zc"), *mm = mm_path ? slurp(mm_path) : 0; char *rtb = between(rt, "// @map-rt", "// @end-map"); char *ccb = between(cc, "// @map-cc", "// @end-map"); static const char *rt_names[] = { @@ -644,7 +646,7 @@ static void check_sources(const Map *m) if (!strstr(rt, lfa_old)) die("src/runtime/rt.zc no longer has the default lfa immediate"); if (!strstr(cc, "ZFP - 16384")) die("src/compiler/compiler.zc lost its initial type-area formula"); for (i = 0; rt_names[i]; i++) expect_hex(rtb, "src/runtime/rt.zc", rt_names[i], rt_vals[i]); - for (i = 0; rt_names[i]; i++) { + for (i = 0; mm && rt_names[i]; i++) { if (!strcmp(rt_names[i], "MAGIC") || !strcmp(rt_names[i], "HEAP_GROW")) continue; expect_hex(mm, mm_path, !strcmp(rt_names[i], "MW") ? "PW" : rt_names[i], rt_vals[i]); } @@ -700,7 +702,7 @@ static void usage_status(int status) "--preset default has a growing heap above the stacks; fixed is the old 1,081,344-word map.\n" "--grow lets a map with a fixed size get bigger when its genome needs more room.\n" "--mode packs a compiler or a run-only image; spare words go to the data stack.\n" - "--check compares that layout to memmap.h and the checked-in const blocks.\n"); + "--check compares that layout to the checked-in const blocks (and to ./memmap.h if present).\n"); exit(status); } |
