32-bit constants loaded by two const16 opcodes that involve relocation
(e.g. calculated as a sum of a symbol and a constant) may overflow,
resulting in linking error with the following message:
dangerous relocation: const16: cannot encode: (_start+0x70000000)
They should wrap around instead. Limit const16 opcode immediate field to
16 least significant bits to implement this wrap around.
bfd/
2018-12-11 Max Filippov <jcmvbkbc@gmail.com>
* elf32-xtensa.c (elf_xtensa_do_reloc): Limit const16 opcode
immediate field to 16 least significant bits.
+2018-12-11 Max Filippov <jcmvbkbc@gmail.com>
+
+ * elf32-xtensa.c (elf_xtensa_do_reloc): Limit const16 opcode
+ immediate field to 16 least significant bits.
+
2018-12-11 H.J. Lu <hongjiu.lu@intel.com>
* elf32-xc16x.c (elf32_xc16x_rtype_to_howto): New function.
}
else if (opcode == get_const16_opcode ())
{
- /* ALT used for high 16 bits. */
- newval = relocation >> 16;
+ /* ALT used for high 16 bits.
+ Ignore 32-bit overflow. */
+ newval = (relocation >> 16) & 0xffff;
opnd = 1;
}
else