glob_bss_write.c (852B)
1 /* glob: write to a ZERO-initialized file-scope global (lives in .bss). This is 2 * the canonical case for the .bss assembler gap: codegen emits `.bss` as 3 * SHT_NOBITS (no file contents, JIT allocates a fresh writable zero page), but 4 * `kit as` re-emits the section as SHT_PROGBITS. The round-tripped object's 5 * .bss therefore lands in the read-only image region, and the `str` against 6 * `g` faults (BUS on WRITE) under the JIT. L0/L1 pass (the .text bytes and 7 * relocs match; L1 does not compare .bss section type), L2 aborts. 8 * 9 * Currently SKIPPED (see glob_bss_write.skip). Counterpart glob_rw.c keeps the 10 * write path green by initializing its global nonzero so it lands in .data. 11 * Exit when the gap is fixed: g becomes 42. */ 12 int g = 0; 13 int test_main(void) { 14 volatile int v = 42; 15 g = v; /* adrp/str against g in .bss */ 16 return g; 17 }