SLAA534A June 2013 – June 2020
MSP430 instructions allow only a 16-bit field. MSP430 instruction relocations are not typically not checked for overflow. MSP430 instructions can also be used on MSP430X, but the assembler uses different relocations so that overflow can be checked.
R_MSP430_ABS16 and R_MSP430_PCR16 are used for MSP430 instructions. With one exception (R_MSP430_ABS16 for $LO16), neither is used for instructions on MSP430X . The use of R_MSP430_ABS16 for $LO16 for MSP430X is a special case intended to be half of a 32-bit immediate load; the other half is $HI16 (R_MSP430_ABS_HI16). See the description of R_MSP430_ABS_HI16 in Section 11.6.1.5.
R_MSP430_ABS16 is used for Absolute, Indexed, and Immediate addressing modes, but only on MSP430:
ADD.W #X, R5 ; R_MSP430_ABS16
ADD.W &X, R5 ; R_MSP430_ABS16
ADD.W R5, &X ; R_MSP430_ABS16
ADD.W K(R4), R5 ; R_MSP430_ABS16
R_MSP430_PCR16 is used for Symbolic addressing mode, but only on MSP430. The address of the relocation container matches the effective PC, so the addend does not need to be adjusted.
MOV.W X, R5 ; R_MSP430_PCR16
MOV.W R5, X ; R_MSP430_PCR16
MOV.W X, Y ; R_MSP430_PCR16(X) and R_MSP430_PCR16(Y)
CALL X ; R_MSP430_PCR16
R_MSP430X_ABS16 and R_MSP430X_PCR16 (both MSP430X only) are used for MSP430 instructions assembled for MSP430X. For instructions where MSP430 would use R_MSP430_ABS16, MSP430X uses R_MSP430X_ABS16 instead. R_MSP430_ABS16 is identical to R_MSP430X_ABS16 except that that the latter checks for overflow. R_MSP430_PCR16 and R_MSP430X_PCR16 are similar.
R_MSP430X_ABS16 is used for Absolute, Indexed, and Immediate addressing modes, but only on MSP430X:
ADD.W #X, R5 ; R_MSP430X_ABS16
ADD.W &X, R5 ; R_MSP430X_ABS16
ADD.W R5, &X ; R_MSP430X_ABS16
ADD.W K(R4), R5 ; R_MSP430X_ABS16
R_MSP430X_PCR16 is used for Symbolic addressing mode, but only on MSP430X:
MOV.W X, R5 ; R_MSP430X_PCR16
MOV.W R5, X ; R_MSP430X_PCR16
MOV.W X, Y ; R_MSP430X_PCR16(X) and R_MSP430X_PCR16(Y)
CALL X ; R_MSP430X_PCR16
R_MSP430X_ABS16 and R_MSP430X_PCR16 are also used for most of the MSP430X-only "address instructions" (MOVA, ADDA, SUBA, and CMPA, but not CALLA), because these instructions only allow a 16-bit immediate in "Indexed" addressing mode. (There are other instructions that allow a larger immediate in Indexed addressing mode.)
MOVA K(R4), R5 ; R_MSP430X_ABS16 (MSP430X only)
MOVA X, R5 ; R_MSP430X_PCR16