Allow symbols in MEMORY region specification
[deliverable/binutils-gdb.git] / gas / config / tc-m68hc11.c
index 391a5f52b52f52302d83aa24e11ae2a0669c7709..a12d106b1e30c67a8bd8b33eecf5e3a833fa46ca 100644 (file)
@@ -1,7 +1,5 @@
 /* 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)
 
@@ -225,6 +223,9 @@ static void s_m68hc11_relax (int);
 /* 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
@@ -314,6 +315,9 @@ const pseudo_typeS md_pseudo_table[] =
   /* .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
@@ -1597,11 +1601,8 @@ fixup8 (expressionS *oper, int mode, int opmode)
 
       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
        {
@@ -1670,8 +1671,7 @@ fixup16 (expressionS *oper, int mode, int opmode ATTRIBUTE_UNUSED)
                          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;
     }
@@ -1750,23 +1750,17 @@ fixup8_xg (expressionS *oper, int mode, int opmode)
     {
       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
         {
@@ -2223,9 +2217,9 @@ build_indexed_byte (operand *op, int format ATTRIBUTE_UNUSED, int move_insn)
                  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
@@ -3959,13 +3953,12 @@ void
 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;
 
@@ -4012,10 +4005,9 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, asection *sec ATTRIBUTE_UNUSED,
       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;
 
@@ -4054,9 +4046,9 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, asection *sec ATTRIBUTE_UNUSED,
           && 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
        {
@@ -4465,8 +4457,8 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
       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:
@@ -4491,3 +4483,17 @@ m68hc11_elf_final_processing (void)
   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"));
+    }
+}
This page took 0.025719 seconds and 4 git commands to generate.