Sanitize support for the ESA sparc simulator.
[deliverable/binutils-gdb.git] / gas / config / tc-m68k.c
index d9694e09be21839a7668c3fe1c8b72f8ac34109f..cd70be1207d2784772dfb3335761e60977009330 100644 (file)
@@ -28,7 +28,7 @@
 
 /* This array holds the chars that always start a comment.  If the
    pre-processor is disabled, these aren't very useful */
-#if (defined (OBJ_ELF) && ! defined (TE_PSOS)) || defined (TE_DELTA)
+#if (defined (OBJ_ELF) && ! defined (TE_PSOS) && ! defined (TE_LINUX)) || defined (TE_DELTA)
 const char comment_chars[] = "|#";
 #else
 const char comment_chars[] = "|";
@@ -1743,6 +1743,9 @@ m68k_ip (instring)
                           && cpu_of_arch (current_architecture) >= m68020)
                          || opP->disp.size == SIZE_LONG)))
                {
+                 if (cpu_of_arch (current_architecture) < m68020)
+                   opP->error =
+                     "displacement too large for this architecture; needs 68020 or higher";
                  if (opP->reg == PC)
                    tmpreg = 0x3B;      /* 7.3 */
                  else
@@ -4159,13 +4162,27 @@ md_estimate_size_before_relax (fragP, segment)
     {
     case TAB (BCC68000, BYTE):
     case TAB (ABRANCH, BYTE):
-      /* We can't do a short jump to the next instruction,
-          so we force word mode.  */
-      if (fragP->fr_symbol && S_GET_VALUE (fragP->fr_symbol) == 0 &&
-         fragP->fr_symbol->sy_frag == fragP->fr_next)
+      /* We can't do a short jump to the next instruction, so in that
+        case we force word mode.  At this point S_GET_VALUE should
+        return the offset of the symbol within its frag.  If the
+        symbol is at the start of a frag, and it is the next frag
+        with any data in it (usually this is just the next frag, but
+        assembler listings may introduce empty frags), we must use
+        word mode.  */
+      if (fragP->fr_symbol && S_GET_VALUE (fragP->fr_symbol) == 0)
        {
-         fragP->fr_subtype = TAB (TABTYPE (fragP->fr_subtype), SHORT);
-         fragP->fr_var += 2;
+         fragS *l;
+
+         for (l = fragP->fr_next;
+              l != fragP->fr_symbol->sy_frag;
+              l = l->fr_next)
+           if (l->fr_fix + l->fr_var != 0)
+             break;
+         if (l == fragP->fr_symbol->sy_frag)
+           {
+             fragP->fr_subtype = TAB (TABTYPE (fragP->fr_subtype), SHORT);
+             fragP->fr_var += 2;
+           }
        }
       break;
     default:
This page took 0.024538 seconds and 4 git commands to generate.