gas: blackfin: fix DBG/DBGCMPLX insn encoding
[external/binutils.git] / gas / config / tc-z80.c
index 413e336..e2ea462 100644 (file)
@@ -1,12 +1,12 @@
 /* tc-z80.c -- Assemble code for the Zilog Z80 and ASCII R800
-   Copyright 2005 Free Software Foundation, Inc.
+   Copyright 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
    Contributed by Arnold Metselaar <arnold_m@operamail.com>
 
    This file is part of GAS, the GNU Assembler.
 
    GAS is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
+   the Free Software Foundation; either version 3, or (at your option)
    any later version.
 
    GAS is distributed in the hope that it will be useful,
    02110-1301, USA.  */
 
 #include "as.h"
-#include "listing.h"
-#include "bfd.h"
 #include "safe-ctype.h"
 #include "subsegs.h"
-#include "symbols.h"
-#include "libiberty.h"
 
 /* Exported constants.  */
 const char comment_chars[] = ";\0";
@@ -257,10 +253,8 @@ z80_start_line_hook (void)
     {
       char c, *rest, *line_start;
       int len;
-      symbolS * symbolP;
 
       line_start = input_line_pointer;
-      LISTING_NEWLINE ();
       if (ignore_input ())
        return 0;
 
@@ -279,20 +273,17 @@ z80_start_line_hook (void)
        len = 4;
       else
        len = 0;
-      if (len && (rest[len] == ' ' || rest[len] == '\t'))
+      if (len && (!ISALPHA(rest[len]) ) )
        {
          /* Handle assignment here.  */
-         input_line_pointer = rest + len;
          if (line_start[-1] == '\n')
-           bump_line_counters ();
-         /* Most Z80 assemblers require the first definition of a
-             label to use "EQU" and redefinitions to have "DEFL".  */
-         if (len == 3 && (symbolP = symbol_find (line_start)) != NULL) 
            {
-             if (S_IS_DEFINED (symbolP) || symbol_equated_p (symbolP))
-               as_bad (_("symbol `%s' is already defined"), line_start);
+             bump_line_counters ();
+             LISTING_NEWLINE ();
            }
-         equals (line_start, 1);
+         input_line_pointer = rest + len - 1;
+         /* Allow redefining with "DEFL" (len == 4), but not with "EQU".  */
+         equals (line_start, len == 4);
          return 1;
        }
       else
@@ -416,7 +407,7 @@ static char err_flag;
 static void
 error (const char * message)
 {
-  as_bad (message);
+  as_bad ("%s", message);
   err_flag = 1;
 }
 
@@ -691,7 +682,7 @@ emit_byte (expressionS * val, bfd_reloc_code_real_type r_type)
   *p = val->X_add_number;
   if ((r_type == BFD_RELOC_8_PCREL) && (val->X_op == O_constant))
     {
-      as_bad(_("cannot make a relative jump to an absolute location"));
+      as_bad (_("cannot make a relative jump to an absolute location"));
     }
   else if (val->X_op == O_constant)
     {
@@ -1475,7 +1466,7 @@ emit_ldreg (int dest, expressionS * src)
          && (src->X_add_number == REG_BC || src->X_add_number == REG_DE))
        {
          q = frag_more (1);
-         *q = 0x0A + ((dest & 1) << 4);
+         *q = 0x0A + ((src->X_add_number & 1) << 4);
          break;
        }
 
@@ -2032,4 +2023,3 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED , fixS *fixp)
 
   return reloc;
 }
-