/* tc-sh.c -- Assemble code for the Renesas / SuperH SH
- Copyright (C) 1993-2018 Free Software Foundation, Inc.
+ Copyright (C) 1993-2020 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
#define DEFINE_TABLE
#include "opcodes/sh-opc.h"
#include "safe-ctype.h"
-#include "struc-symbol.h"
#ifdef OBJ_ELF
#include "elf/sh.h"
{
static int count = 0;
char name[11];
+ expressionS *symval;
/* If the last loop insn is a two-byte-insn, it is in danger of being
swapped with the insn after it. To prevent this, create a new
SF_SET_LOCAL (end_sym);
#endif /* OBJ_COFF */
symbol_table_insert (end_sym);
- end_sym->sy_value = operand[1].immediate;
- end_sym->sy_value.X_add_number += 2;
+ symval = symbol_get_value_expression (end_sym);
+ *symval = operand[1].immediate;
+ symval->X_add_number += 2;
fix_new (frag_now, frag_now_fix (), 2, end_sym, 0, 1, BFD_RELOC_SH_LABEL);
}
case IMM0_8BY2:
insert (output + low_byte, BFD_RELOC_SH_IMM8BY2, 0, operand);
break;
- case IMM0_8:
+ case IMM0_8U:
+ case IMM0_8S:
insert (output + low_byte, BFD_RELOC_SH_IMM8, 0, operand);
break;
case IMM1_8BY4:
char *name = initial_str;
int name_length = 0;
const sh_opcode_info *op;
- int found = 0;
+ bfd_boolean found = FALSE;
- /* identify opcode in string */
+ /* Identify opcode in string. */
while (ISSPACE (*name))
- {
- name++;
- }
- while (!ISSPACE (name[name_length]))
- {
- name_length++;
- }
+ name++;
+
+ while (name[name_length] != '\0' && !ISSPACE (name[name_length]))
+ name_length++;
- /* search for opcode in full list */
+ /* Search for opcode in full list. */
for (op = sh_table; op->name; op++)
{
if (strncasecmp (op->name, name, name_length) == 0
&& op->name[name_length] == '\0')
{
- found = 1;
+ found = TRUE;
break;
}
}
- if ( found )
- {
- as_bad (_("opcode not valid for this cpu variant"));
- }
+ if (found)
+ as_bad (_("opcode not valid for this cpu variant"));
else
- {
- as_bad (_("unknown opcode"));
- }
+ as_bad (_("unknown opcode"));
+
return;
}
if (seginfo == NULL)
return;
- for (fix = seginfo->fix_root; fix != NULL; fix = fix->fx_next)
- {
- symbolS *sym;
-
- sym = fix->fx_addsy;
- /* Check for a local_symbol. */
- if (sym && sym->bsym == NULL)
- {
- struct local_symbol *ls = (struct local_symbol *)sym;
- /* See if it's been converted. If so, canonicalize. */
- if (local_symbol_converted_p (ls))
- fix->fx_addsy = local_symbol_get_real_symbol (ls);
- }
- }
-
for (fix = seginfo->fix_root; fix != NULL; fix = fix->fx_next)
{
symbolS *sym;
differently from ones without delay slots. */
{
unsigned char *buffer =
- (unsigned char *) (fragP->fr_fix + fragP->fr_literal);
+ (unsigned char *) (fragP->fr_fix + &fragP->fr_literal[0]);
int highbyte = target_big_endian ? 0 : 1;
int lowbyte = target_big_endian ? 1 : 0;
int delay = fragP->fr_subtype == C (COND_JUMP_DELAY, COND12);
#ifdef OBJ_ELF
return size;
#else /* ! OBJ_ELF */
- return ((size + (1 << bfd_get_section_alignment (stdoutput, seg)) - 1)
- & -(1 << bfd_get_section_alignment (stdoutput, seg)));
+ return ((size + (1 << bfd_section_alignment (seg)) - 1)
+ & -(1 << bfd_section_alignment (seg)));
#endif /* ! OBJ_ELF */
}