Spec M5.6 — fixes from the M5.5 review + creat (found during M6-macho)
reloc()only attaches to a raw word. The pending relocation is valid only until the next call togen_word(emit()or#opcode); any other instruction emitted while a relocation is pending is the errorreloc without an immediately following emit(inerr_node). Repro:reloc(BRANCH26,"_h"); i64 x = 5; emit(0x94000000);→ today the.ocomes out invalid; afterwards: a compile error.- Real 16-byte alignment:
__datacreated with align 4;#section's default ALIGN = 4. Repro:uptr names[] = {"abcdefg"};as the only global →otool -lshows__datawithaddra multiple of 16 andalign 2^4. MAXSECS/MAXPARAMSdefined once inmc.h; remove the copies inparse.c/gen_arm64.c.#opcodeparameter deliberately shadows a#define— just a comment indo_opcode.creatinstead of variadicopenfor writing files: libSystem'sopenis variadic, and on Apple's arm64 themodeargument goes on the stack — the language only passesx0..x7, so.mccode could never pass the mode. Rule "same I/O shape everywhere":stage0/arena.c'swrite_filenow usescreat(path, 0644)(fcntl.h).lib/sys.mcgainsextern i64 creat(uptr path, i64 mode);andlib/sys_svc.mcimplementscreatvia theopensyscall (5) with flags0x601(O_WRONLY|O_CREAT|O_TRUNC) and the mode in x2.src/arena.mc: replace theopen+fchmodpair withcreat(the only spot insrc/touched in this batch; nothing else insrc/).cmp_condvia a table ingen_arm64.c(optional, ≈ −5 lines). Do not touchtype_of_tokenor any other part ofparse.cbeyond item 3 (another agent is transliteratingparse.cright now).
Acceptance: make stage0 with no warnings, stage0-san, budget, test (mc0 and mc0-san),
check-lex; scripts/check-obj.sh BEFORE/AFTER: the .o files change only in __data's
alignment (verify that __text, symtab, and relocs are unchanged); repro of item 1 before/after;
otool -l for item 2; ls -l of a file written by src/m0.mc showing -rw-r--r--; new test
034-reloc-err.mc — no, errors do not go in the suite; add the case to the report instead.
Lines per file.