MSP430: Fix relocation overflow when using #lo(EXP) macro

gas/ChangeLog:

2020-01-15  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

	* config/tc-msp430.c (CHECK_RELOC_MSP430): Always generate 430X
	relocations when the target is 430X, except when extracting part of an
	expression.
	(msp430_srcoperand): Adjust comment.
	Initialize the expp member of the msp430_operand_s struct as
	appropriate.
	(msp430_dstoperand): Likewise.
	* testsuite/gas/msp430/msp430.exp: Run new test.
	* testsuite/gas/msp430/reloc-lo-430x.d: New test.
	* testsuite/gas/msp430/reloc-lo-430x.s: New test.

include/ChangeLog:

2020-01-15  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

	* opcode/msp430.h (enum msp430_expp_e): New.
	(struct msp430_operand_s): Add expp member to struct.

ld/ChangeLog:

2020-01-15  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

	* testsuite/ld-msp430-elf/msp430-elf.exp: Run new test.
	* testsuite/ld-msp430-elf/reloc-lo-430x.s: New test.
This commit is contained in:
Jozef Lawrynowicz
2020-01-15 13:17:27 +00:00
parent c24d0e8d48
commit 131cb553d6
10 changed files with 114 additions and 11 deletions

View File

@ -21,6 +21,18 @@
#ifndef __MSP430_H_
#define __MSP430_H_
enum msp430_expp_e
{
MSP_EXPP_ALL = 0, /* Use full the value of the expression - default. */
MSP_EXPP_LO, /* Extract least significant word from expression. */
MSP_EXPP_HI, /* Extract 2nd word from expression. */
MSP_EXPP_LLO, /* Extract least significant word from an
immediate value. */
MSP_EXPP_LHI, /* Extract 2nd word from an immediate value. */
MSP_EXPP_HLO, /* Extract 3rd word from an immediate value. */
MSP_EXPP_HHI, /* Extract 4th word from an immediate value. */
};
struct msp430_operand_s
{
int ol; /* Operand length words. */
@ -28,6 +40,9 @@ struct msp430_operand_s
int reg; /* Register. */
int mode; /* Operand mode. */
int vshift; /* Number of bytes to shift operand down. */
enum msp430_expp_e expp; /* For when the operand is a constant
expression, the part of the expression to
extract. */
#define OP_REG 0
#define OP_EXP 1
#ifndef DASM_SECTION