2001-06-18 Philip Blundell <philb@gnu.org>
[external/binutils.git] / gas / config / tc-arm.c
index 69d3d4f..99aff8e 100644 (file)
@@ -1279,12 +1279,23 @@ add_to_lit_pool ()
              == inst.reloc.exp.X_add_number)
          && literals[lit_count].exp.X_unsigned == inst.reloc.exp.X_unsigned)
        break;
+
+      if (literals[lit_count].exp.X_op == inst.reloc.exp.X_op
+          && inst.reloc.exp.X_op == O_symbol
+          && (literals[lit_count].exp.X_add_number
+             == inst.reloc.exp.X_add_number)
+          && (literals[lit_count].exp.X_add_symbol
+             == inst.reloc.exp.X_add_symbol)
+          && (literals[lit_count].exp.X_op_symbol
+             == inst.reloc.exp.X_op_symbol))
+        break;
+
       lit_count++;
     }
 
   if (lit_count == next_literal_pool_place) /* New entry.  */
     {
-      if (next_literal_pool_place > MAX_LITERAL_POOL_SIZE)
+      if (next_literal_pool_place >= MAX_LITERAL_POOL_SIZE)
        {
          inst.error = _("Literal Pool Overflow");
          return FAIL;
@@ -2278,12 +2289,17 @@ do_msr (str, flags)
       return;
     }
 
+#if 0  /* The first edition of the ARM architecture manual stated that
+         writing anything other than the flags with an immediate operation
+         had UNPREDICTABLE effects.  This constraint was removed in the
+         second edition of the specification.  */
   if ((cpu_variant & ARM_EXT_V5) != ARM_EXT_V5
       && inst.instruction & ((PSR_c | PSR_x | PSR_s) << PSR_SHIFT))
     {
       inst.error = _("immediate value cannot be used to set this field");
       return;
     }
+#endif
 
   flags |= INST_IMMEDIATE;
 
@@ -6014,7 +6030,7 @@ do_t_arit (str)
 
       if (Rs != Rd)
        {
-         inst.error = _("dest and source1 one must be the same register");
+         inst.error = _("dest and source1 must be the same register");
          return;
        }
       Rs = Rn;
@@ -8785,8 +8801,8 @@ s_arm_elf_cons (nbytes)
    of an rs_align_code fragment.  */
 
 void
-arm_handle_align (fragp)
-     fragS *fragp;
+arm_handle_align (fragP)
+     fragS *fragP;
 {
   static char const arm_noop[4] = { 0x00, 0x00, 0xa0, 0xe1 };
   static char const thumb_noop[2] = { 0xc0, 0x46 };
@@ -8797,14 +8813,17 @@ arm_handle_align (fragp)
   char * p;
   const char * noop;
   
-  if (fragp->fr_type != rs_align_code)
+  if (fragP->fr_type != rs_align_code)
     return;
 
-  bytes = fragp->fr_next->fr_address - fragp->fr_address - fragp->fr_fix;
-  p = fragp->fr_literal + fragp->fr_fix;
+  bytes = fragP->fr_next->fr_address - fragP->fr_address - fragP->fr_fix;
+  p = fragP->fr_literal + fragP->fr_fix;
   fix = 0;
   
-  if (fragp->tc_frag_data)
+  if (bytes > MAX_MEM_FOR_RS_ALIGN_CODE)
+    bytes &= MAX_MEM_FOR_RS_ALIGN_CODE;
+  
+  if (fragP->tc_frag_data)
     {
       if (target_big_endian)
        noop = thumb_bigend_noop;
@@ -8837,8 +8856,8 @@ arm_handle_align (fragp)
       fix += noop_size;
     }
   
-  fragp->fr_fix += fix;
-  fragp->fr_var = noop_size;
+  fragP->fr_fix += fix;
+  fragP->fr_var = noop_size;
 }
 
 /* Called from md_do_align.  Used to create an alignment
@@ -8853,11 +8872,11 @@ arm_frag_align_code (n, max)
 
   /* We assume that there will never be a requirment
      to support alignments greater than 32 bytes.  */
-  if (max > 31)
+  if (max > MAX_MEM_FOR_RS_ALIGN_CODE)
     as_fatal (_("alignments greater than 32 bytes not supported in .text sections."));
   
   p = frag_var (rs_align_code,
-               31,
+               MAX_MEM_FOR_RS_ALIGN_CODE,
                1,
                (relax_substateT) max,
                (symbolS *) NULL,
@@ -8870,9 +8889,9 @@ arm_frag_align_code (n, max)
 /* Perform target specific initialisation of a frag.  */
 
 void
-arm_init_frag (fragp)
-     fragS *fragp;
+arm_init_frag (fragP)
+     fragS *fragP;
 {
   /* Record whether this frag is in an ARM or a THUMB area.  */
-  fragp->tc_frag_data = thumb_mode;
+  fragP->tc_frag_data = thumb_mode;
 }