boot2

Playing with the boostrap
git clone https://git.ryansepassi.com/git/boot2.git
Log | Files | Refs | README

arm64-store-const-lvalue.after (1139B)


      1     if (svr == (VT_CONST | VT_LVAL | VT_SYM)) {
      2         arm64_sym(30, sv->sym, svcul); // use x30 for address
      3         if (IS_FREG(r))
      4             arm64_strv(arm64_type_size(svtt), fltr(r), 30, 0);
      5         else
      6             arm64_strx(arm64_type_size(svtt), intr(r), 30, 0);
      7         return;
      8     }
      9 
     10     if (svr == (VT_CONST | VT_LVAL)) {
     11         /* boot2: store via literal integer address (no VT_SYM).
     12          * Stock arm64-gen.c lacks this case; x86_64 routes through
     13          * gen_modrm and riscv64 has an explicit fr==VT_CONST branch.
     14          * Triggered by musl when storing through pointers tcc has
     15          * folded to constants (e.g. weak-hidden refs in
     16          * __libc_start_main, mallocng). Mirrors the |VT_SYM case
     17          * above but materializes the address with arm64_movimm
     18          * instead of arm64_sym. */
     19         arm64_movimm(30, svcul);
     20         if (IS_FREG(r))
     21             arm64_strv(arm64_type_size(svtt), fltr(r), 30, 0);
     22         else
     23             arm64_strx(arm64_type_size(svtt), intr(r), 30, 0);
     24         return;
     25     }
     26 
     27     printf("store(%x, (%x, %x, %llx))\n", r, svtt, sv->r, (long long)svcul);
     28     assert(0);