diff --git a/src/jit/nvm_x86_64.c b/src/jit/nvm_x86_64.c index 2944cfe5..cfd6361c 100644 --- a/src/jit/nvm_x86_64.c +++ b/src/jit/nvm_x86_64.c @@ -528,7 +528,7 @@ static void onJIT(Body* body, u8* binEx, u64 sz) { #if USE_PERF if (!perf_map) { B s = m_c8vec_0("/tmp/perf-"); AFMT("%l.map", getpid()); - perf_map = file_open(s, "open", "wa"); + perf_map = file_open(s, "open", "wab"); printsB(s); printf(": map\n"); dec(s); } @@ -609,7 +609,7 @@ Nvm_res m_nvm(Body* body) { u32* origBC = body->bc; u32 bodyOff = origBC - (u32*)body->bl->bc; #if STORE_JIT_MAP - if (!jit_map) jit_map = fopen("cbqn-jit.bqn", "wa"); + if (!jit_map) jit_map = fopen("cbqn-jit.bqn", "wab"); fprintf(jit_map, "{\n"); print_jit_line(body, NULL, body->bl->map[bodyOff]); #endif diff --git a/src/utils/file.c b/src/utils/file.c index 2602f34b..b4b6f8f6 100644 --- a/src/utils/file.c +++ b/src/utils/file.c @@ -61,7 +61,7 @@ I8Arr* stream_bytes(FILE* f) { } I8Arr* path_bytes(B path) { // consumes - FILE* f = file_open(path, "read", "r"); + FILE* f = file_open(path, "read", "rb"); int seekRes = fseek(f, 0, SEEK_END); I8Arr* src; if (seekRes==-1) { @@ -217,7 +217,7 @@ void free_chars(CharBuf b) { } void path_wChars(B path, B x) { // consumes path - FILE* f = file_open(path, "write to", "w"); + FILE* f = file_open(path, "write to", "wb"); u64 len = utf8lenB(x); TALLOC(char, val, len); @@ -241,7 +241,7 @@ void file_wBytes(FILE* f, B name, B x) { free_chars(buf); } void path_wBytes(B path, B x) { // consumes path - FILE* f = file_open(path, "write to", "w"); + FILE* f = file_open(path, "write to", "wb"); file_wBytes(f, path, x); fclose(f); dec(path); @@ -433,7 +433,7 @@ static u8 types_val[] = { void cbqn_heapDump(char* name0) { char* name = name0==NULL? "CBQNHeapDump" : name0; - FILE* f = fopen(name, "w"); + FILE* f = fopen(name, "wb"); if (f==NULL) { fprintf(stderr, "Failed to dump heap - could not open file for writing\n"); return;