/* tc-m68hc11.c -- Assembler code for the Motorola 68HC11 & 68HC12.
- Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010,
- 2011, 2012
- Free Software Foundation, Inc.
+ Copyright (C) 1999-2015 Free Software Foundation, Inc.
Written by Stephane Carrez (stcarrez@nerim.fr)
XGATE and S12X added by James Murray (jsm@jsm-net.demon.co.uk)
/* Pseudo op to control the ELF flags. */
static void s_m68hc11_mode (int);
+/* Process directives specified via pseudo ops. */
+static void s_m68hc11_parse_pseudo_instruction (int);
+
/* Mark the symbols with STO_M68HC12_FAR to indicate the functions
are using 'rtc' for returning. It is necessary to use 'call'
to invoke them. This is also used by the debugger to correctly
/* .interrupt instruction. */
{"interrupt", s_m68hc11_mark_symbol, STO_M68HC12_INTERRUPT},
+ /* .nobankwarning instruction. */
+ {"nobankwarning", s_m68hc11_parse_pseudo_instruction, E_M68HC11_NO_BANK_WARNING},
+
{0, 0, 0}
};
\f
if (mode == M6811_OP_JUMP_REL)
{
- fixS *fixp;
-
- fixp = fix_new_exp (frag_now, f - frag_now->fr_literal, 1,
- oper, TRUE, BFD_RELOC_8_PCREL);
- fixp->fx_pcrel_adjust = 1;
+ fix_new_exp (frag_now, f - frag_now->fr_literal, 1,
+ oper, TRUE, BFD_RELOC_8_PCREL);
}
else
{
reloc == BFD_RELOC_16_PCREL,
reloc);
number_to_chars_bigendian (f, 0, 2);
- if (reloc == BFD_RELOC_16_PCREL)
- fixp->fx_pcrel_adjust = 2;
+
if (reloc == BFD_RELOC_M68HC11_LO16)
fixp->fx_no_overflow = 1;
}
{
if (mode == M68XG_OP_REL9)
{
- fixS *fixp;
-
/* Future improvement:
This fixup/reloc isn't adding on constants to symbols. */
- fixp = fix_new_exp (frag_now, f - frag_now->fr_literal -1, 2,
- oper, TRUE, BFD_RELOC_M68HC12_9_PCREL);
- fixp->fx_pcrel_adjust = 1;
+ fix_new_exp (frag_now, f - frag_now->fr_literal -1, 2,
+ oper, TRUE, BFD_RELOC_M68HC12_9_PCREL);
}
else if (mode == M68XG_OP_REL10)
{
- fixS *fixp;
-
/* Future improvement:
This fixup/reloc isn't adding on constants to symbols. */
- fixp = fix_new_exp (frag_now, f - frag_now->fr_literal -1, 2,
- oper, TRUE, BFD_RELOC_M68HC12_10_PCREL);
- fixp->fx_pcrel_adjust = 1;
+ fix_new_exp (frag_now, f - frag_now->fr_literal -1, 2,
+ oper, TRUE, BFD_RELOC_M68HC12_10_PCREL);
}
else
{
byte <<= 3;
byte |= 0xe2;
number_to_chars_bigendian (f, byte, 1);
+ f = frag_more (2);
fix_new (frag_now, f - frag_now->fr_literal, 2,
sym, off, 0, BFD_RELOC_M68HC12_16B);
- f = frag_more (2);
return 1;
}
else
md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, asection *sec ATTRIBUTE_UNUSED,
fragS *fragP)
{
- fixS *fixp;
long value;
long disp;
char *buffer_address = fragP->fr_literal;
/* Address in object code of the displacement. */
- register int object_address = fragP->fr_fix + fragP->fr_address;
+ int object_address = fragP->fr_fix + fragP->fr_address;
buffer_address += fragP->fr_fix;
fragP->fr_opcode[1] = fragP->fr_opcode[0];
fragP->fr_opcode[0] = M6811_OPCODE_PAGE2;
- fixp = fix_new (fragP, fragP->fr_fix, 2,
- fragP->fr_symbol, fragP->fr_offset, 1,
+ fix_new (fragP, fragP->fr_fix, 2,
+ fragP->fr_symbol, fragP->fr_offset, 1,
BFD_RELOC_16_PCREL);
- fixp->fx_pcrel_adjust = 2;
fragP->fr_fix += 2;
break;
&& fragP->fr_symbol != 0
&& S_GET_SEGMENT (fragP->fr_symbol) != absolute_section)
{
- fixp = fix_new (fragP, fragP->fr_fix, 2,
- fragP->fr_symbol, fragP->fr_offset,
- 1, BFD_RELOC_16_PCREL);
+ fix_new (fragP, fragP->fr_fix, 2,
+ fragP->fr_symbol, fragP->fr_offset,
+ 1, BFD_RELOC_16_PCREL);
}
else
{
if (value < 0)
value += 65536;
- where[1] = (value >> 8);
- where[2] = (value & 0xff);
+ where[0] = (value >> 8);
+ where[1] = (value & 0xff);
break;
case BFD_RELOC_M68HC11_RL_JUMP:
elf_elfheader (stdoutput)->e_flags &= ~EF_M68HC11_ABI;
elf_elfheader (stdoutput)->e_flags |= elf_flags;
}
+
+/* Process directives specified via pseudo ops */
+static void
+s_m68hc11_parse_pseudo_instruction (int pseudo_insn)
+{
+ switch (pseudo_insn)
+ {
+ case E_M68HC11_NO_BANK_WARNING:
+ elf_flags |= E_M68HC11_NO_BANK_WARNING;
+ break;
+ default:
+ as_bad (_("Invalid directive"));
+ }
+}