import insight-2000-02-04 snapshot (2nd try)
[external/binutils.git] / gas / config / tc-sh.c
index 6d8ca81..9f7a6c1 100644 (file)
@@ -1,5 +1,5 @@
 /* tc-sh.c -- Assemble code for the Hitachi Super-H
-   Copyright (C) 1993, 94, 95, 96, 97, 1998 Free Software Foundation.
+   Copyright (C) 1993, 94, 95, 96, 97, 98, 1999 Free Software Foundation.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -1066,9 +1066,16 @@ md_assemble (str)
     }
   else
     {
-      if (opcode->arg[0] != A_END)
+      if (opcode->arg[0] == A_END)
        {
-         get_operands (opcode, op_end, operand);
+         /* Ignore trailing whitespace.  If there is any, it has already
+            been compressed to a single space.  */
+         if (*op_end == ' ')
+           op_end++;
+       }
+      else
+       {
+         op_end = get_operands (opcode, op_end, operand);
        }
       opcode = get_specific (opcode, operand);
 
@@ -1083,6 +1090,9 @@ md_assemble (str)
          return;
        }
 
+      if (*op_end)
+       as_bad (_("excess operands: '%s'"), op_end);
+
       build_Mytes (opcode, operand);
     }
 
@@ -1450,7 +1460,8 @@ sh_frob_section (abfd, sec, ignore)
         We have already adjusted the value of sym to include the
         fragment address, so we undo that adjustment here.  */
       subseg_change (sec, 0);
-      fix_new (sym->sy_frag, S_GET_VALUE (sym) - sym->sy_frag->fr_address,
+      fix_new (symbol_get_frag (sym),
+              S_GET_VALUE (sym) - symbol_get_frag (sym)->fr_address,
               4, &abs_symbol, info.count, 0, BFD_RELOC_SH_COUNT);
     }
 }
@@ -2056,7 +2067,11 @@ md_apply_fix (fixP, val)
     case BFD_RELOC_VTABLE_INHERIT:
     case BFD_RELOC_VTABLE_ENTRY:
       fixP->fx_done = 0;
+#ifdef BFD_ASSEMBLER
+      return 0;
+#else
       return;
+#endif
 
     default:
       abort ();
@@ -2187,12 +2202,7 @@ sh_do_align (n, fill, len, max)
      int max;
 {
   if (fill == NULL
-#ifdef BFD_ASSEMBLER
-      && (now_seg->flags & SEC_CODE) != 0
-#else
-      && now_seg != data_section
-      && now_seg != bss_section
-#endif
+      && subseg_text_p (now_seg)
       && n > 1)
     {
       static const unsigned char big_nop_pattern[] = { 0x00, 0x09 };
@@ -2377,7 +2387,8 @@ tc_gen_reloc (section, fixp)
   bfd_reloc_code_real_type r_type;
 
   rel = (arelent *) xmalloc (sizeof (arelent));
-  rel->sym_ptr_ptr = &fixp->fx_addsy->bsym;
+  rel->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+  *rel->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
   rel->address = fixp->fx_frag->fr_address + fixp->fx_where;
 
   r_type = fixp->fx_r_type;