[PATCH] D23053: [COFF][ARM] Clear the J1 and J2 bits when applying relocations to 24 bit branches

Saleem Abdulrasool via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 4 17:30:19 PDT 2016


compnerd accepted this revision.
This revision is now accepted and ready to land.

================
Comment at: COFF/Chunks.cpp:107
@@ +106,3 @@
+  // The J1 and J2 bits are set in the opcode already, so mask them out
+  // before or'ing in the new bits.
+  write16le(Off + 2, (read16le(Off + 2) & 0xd000) | (J1 << 13) | (J2 << 11) | ((V >> 1) & 0x7ff));
----------------
Yeah, the bits need to be cleared out as the value may be altered by the new computation.

There is no guarantee that the bits are set IIRC, so I find the comment misleading.  You can add a comment along the lines of `clear out the J1 and J2 bits which may be set`, though, Im not sure if it really adds much value.


https://reviews.llvm.org/D23053





More information about the llvm-commits mailing list