In the relocation entries (.rela.text section in ELF file) we see a negative addend: rodata - 2. The symbol .rodata is located at 0x4000. Thus the relocation address results in 0x3FFE. Contrarily to this the code uses the correct address 0x400c. The relocation information seems to be wrong.
Using gcc_msp430_4.9.14r1_167 : msp430-elf-gcc -mmcu=msp430f1611 main.c
msp430-elf-objdump -sD:
00005560 <__do_global_ctors_aux>:
5560: 0a 12 push r10 ;
5562: 1c 42 0c 40 mov &0x400c,r12 ;0x400c
5566: 3c 93 cmp #-1, r12 ;r3 As==11
5568: 08 24 jz $+18 ;abs 0x557a
msp430-elf-readelf -a:
.rela.text Offset Info Type Sym.Value Sym. Name + Addend ... 00005564 00000203 R_MSP430_16 00004000 .rodata - 2 ...
#include <stdint.h>
int main (int argc, char *argv[])
{
uint8_t key[32];
uint8_t buf[16], i;
/* put a test vector */
for (i = 0; i < sizeof(buf);i++) buf[i] = i * 16 + i;
for (i = 0; i < sizeof(key);i++) key[i] = i;
return 0;
}