boot2

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

arm64-svcul-no-truncate.after (627B)


      1 ST_FUNC void load(int r, SValue *sv)
      2 {
      3     int svtt = sv->type.t;
      4     int svr = sv->r & ~VT_LVAL_TYPE;
      5     int svrv = svr & VT_VALMASK;
      6     /* Stock tcc 0.9.26 truncates sv->c.i to uint32_t and then sign-
      7      * extends, which destroys the upper 32 bits of any pointer-sized
      8      * constant address.  This is fine for struct-field offsets but
      9      * silently miscompiles writes through `*(volatile T *)0x1xxxxxxxx`.
     10      * Keep the full 64-bit constant; signed offsets used by ldur/stur
     11      * already fit in 9 bits so the prior sign-extend was a no-op for
     12      * legitimate offsets. */
     13     uint64_t svcul = (uint64_t)sv->c.i;