Index: COFF/Chunks.cpp =================================================================== --- COFF/Chunks.cpp +++ COFF/Chunks.cpp @@ -114,6 +114,8 @@ uint32_t S = V < 0 ? 1 : 0; uint32_t J1 = ((~V >> 23) & 1) ^ S; uint32_t J2 = ((~V >> 22) & 1) ^ S; + if (!isInt<25>(V)) + fatal("relocation out of range"); or16(Off, (S << 10) | ((V >> 12) & 0x3ff)); // The J1 and J2 bits are set in the opcode already, so mask them out // before or'ing in the new bits.